xref: /openbmc/linux/arch/sh/mm/hugetlbpage.c (revision c9b5e85a)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * arch/sh/mm/hugetlbpage.c
4  *
5  * SuperH HugeTLB page support.
6  *
7  * Cloned from sparc64 by Paul Mundt.
8  *
9  * Copyright (C) 2002, 2003 David S. Miller (davem@redhat.com)
10  */
11 
12 #include <linux/init.h>
13 #include <linux/fs.h>
14 #include <linux/mm.h>
15 #include <linux/hugetlb.h>
16 #include <linux/pagemap.h>
17 #include <linux/sysctl.h>
18 
19 #include <asm/mman.h>
20 #include <asm/pgalloc.h>
21 #include <asm/tlb.h>
22 #include <asm/tlbflush.h>
23 #include <asm/cacheflush.h>
24 
25 pte_t *huge_pte_alloc(struct mm_struct *mm,
26 			unsigned long addr, unsigned long sz)
27 {
28 	pgd_t *pgd;
29 	p4d_t *p4d;
30 	pud_t *pud;
31 	pmd_t *pmd;
32 	pte_t *pte = NULL;
33 
34 	pgd = pgd_offset(mm, addr);
35 	if (pgd) {
36 		p4d = p4d_alloc(mm, pgd, addr);
37 		if (p4d) {
38 			pud = pud_alloc(mm, p4d, addr);
39 			if (pud) {
40 				pmd = pmd_alloc(mm, pud, addr);
41 				if (pmd)
42 					pte = pte_alloc_map(mm, pmd, addr);
43 			}
44 		}
45 	}
46 
47 	return pte;
48 }
49 
50 pte_t *huge_pte_offset(struct mm_struct *mm,
51 		       unsigned long addr, unsigned long sz)
52 {
53 	pgd_t *pgd;
54 	p4d_t *p4d;
55 	pud_t *pud;
56 	pmd_t *pmd;
57 	pte_t *pte = NULL;
58 
59 	pgd = pgd_offset(mm, addr);
60 	if (pgd) {
61 		p4d = p4d_offset(pgd, addr);
62 		if (p4d) {
63 			pud = pud_offset(p4d, addr);
64 			if (pud) {
65 				pmd = pmd_offset(pud, addr);
66 				if (pmd)
67 					pte = pte_offset_map(pmd, addr);
68 			}
69 		}
70 	}
71 
72 	return pte;
73 }
74 
75 int pmd_huge(pmd_t pmd)
76 {
77 	return 0;
78 }
79 
80 int pud_huge(pud_t pud)
81 {
82 	return 0;
83 }
84