xref: /linux/arch/sh/mm/hugetlbpage.c (revision b7b7ef6b448513e41796a160efab320755b835c2)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  * arch/sh/mm/hugetlbpage.c
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  * SuperH HugeTLB page support.
61da177e4SLinus Torvalds  *
71da177e4SLinus Torvalds  * Cloned from sparc64 by Paul Mundt.
81da177e4SLinus Torvalds  *
91da177e4SLinus Torvalds  * Copyright (C) 2002, 2003 David S. Miller (davem@redhat.com)
101da177e4SLinus Torvalds  */
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds #include <linux/init.h>
131da177e4SLinus Torvalds #include <linux/fs.h>
141da177e4SLinus Torvalds #include <linux/mm.h>
151da177e4SLinus Torvalds #include <linux/hugetlb.h>
161da177e4SLinus Torvalds #include <linux/pagemap.h>
171da177e4SLinus Torvalds #include <linux/sysctl.h>
181da177e4SLinus Torvalds 
191da177e4SLinus Torvalds #include <asm/mman.h>
201da177e4SLinus Torvalds #include <asm/tlb.h>
211da177e4SLinus Torvalds #include <asm/tlbflush.h>
221da177e4SLinus Torvalds #include <asm/cacheflush.h>
231da177e4SLinus Torvalds 
24aec44e0fSPeter Xu pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma,
25a5516438SAndi Kleen 			unsigned long addr, unsigned long sz)
261da177e4SLinus Torvalds {
271da177e4SLinus Torvalds 	pgd_t *pgd;
28874e2cc1SMike Rapoport 	p4d_t *p4d;
293f787fe2SPaul Mundt 	pud_t *pud;
301da177e4SLinus Torvalds 	pmd_t *pmd;
311da177e4SLinus Torvalds 	pte_t *pte = NULL;
321da177e4SLinus Torvalds 
331da177e4SLinus Torvalds 	pgd = pgd_offset(mm, addr);
341da177e4SLinus Torvalds 	if (pgd) {
35874e2cc1SMike Rapoport 		p4d = p4d_alloc(mm, pgd, addr);
36874e2cc1SMike Rapoport 		if (p4d) {
37874e2cc1SMike Rapoport 			pud = pud_alloc(mm, p4d, addr);
383f787fe2SPaul Mundt 			if (pud) {
393f787fe2SPaul Mundt 				pmd = pmd_alloc(mm, pud, addr);
401da177e4SLinus Torvalds 				if (pmd)
41*b7b7ef6bSHugh Dickins 					pte = pte_alloc_huge(mm, pmd, addr);
421da177e4SLinus Torvalds 			}
433f787fe2SPaul Mundt 		}
44874e2cc1SMike Rapoport 	}
453f787fe2SPaul Mundt 
461da177e4SLinus Torvalds 	return pte;
471da177e4SLinus Torvalds }
481da177e4SLinus Torvalds 
497868a208SPunit Agrawal pte_t *huge_pte_offset(struct mm_struct *mm,
507868a208SPunit Agrawal 		       unsigned long addr, unsigned long sz)
511da177e4SLinus Torvalds {
521da177e4SLinus Torvalds 	pgd_t *pgd;
53874e2cc1SMike Rapoport 	p4d_t *p4d;
543f787fe2SPaul Mundt 	pud_t *pud;
551da177e4SLinus Torvalds 	pmd_t *pmd;
561da177e4SLinus Torvalds 	pte_t *pte = NULL;
571da177e4SLinus Torvalds 
581da177e4SLinus Torvalds 	pgd = pgd_offset(mm, addr);
591da177e4SLinus Torvalds 	if (pgd) {
60874e2cc1SMike Rapoport 		p4d = p4d_offset(pgd, addr);
61874e2cc1SMike Rapoport 		if (p4d) {
62874e2cc1SMike Rapoport 			pud = pud_offset(p4d, addr);
633f787fe2SPaul Mundt 			if (pud) {
643f787fe2SPaul Mundt 				pmd = pmd_offset(pud, addr);
651da177e4SLinus Torvalds 				if (pmd)
66*b7b7ef6bSHugh Dickins 					pte = pte_offset_huge(pmd, addr);
671da177e4SLinus Torvalds 			}
683f787fe2SPaul Mundt 		}
69874e2cc1SMike Rapoport 	}
703f787fe2SPaul Mundt 
711da177e4SLinus Torvalds 	return pte;
721da177e4SLinus Torvalds }
731da177e4SLinus Torvalds 
741da177e4SLinus Torvalds int pmd_huge(pmd_t pmd)
751da177e4SLinus Torvalds {
761da177e4SLinus Torvalds 	return 0;
771da177e4SLinus Torvalds }
781da177e4SLinus Torvalds 
79ceb86879SAndi Kleen int pud_huge(pud_t pud)
80ceb86879SAndi Kleen {
81ceb86879SAndi Kleen 	return 0;
82ceb86879SAndi Kleen }
83