xref: /linux/arch/sh/mm/hugetlbpage.c (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg 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/pgalloc.h>
211da177e4SLinus Torvalds #include <asm/tlb.h>
221da177e4SLinus Torvalds #include <asm/tlbflush.h>
231da177e4SLinus Torvalds #include <asm/cacheflush.h>
241da177e4SLinus Torvalds 
25a5516438SAndi Kleen pte_t *huge_pte_alloc(struct mm_struct *mm,
26a5516438SAndi Kleen 			unsigned long addr, unsigned long sz)
271da177e4SLinus Torvalds {
281da177e4SLinus Torvalds 	pgd_t *pgd;
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) {
353f787fe2SPaul Mundt 		pud = pud_alloc(mm, pgd, addr);
363f787fe2SPaul Mundt 		if (pud) {
373f787fe2SPaul Mundt 			pmd = pmd_alloc(mm, pud, addr);
381da177e4SLinus Torvalds 			if (pmd)
393ed3a4f0SKirill A. Shutemov 				pte = pte_alloc_map(mm, pmd, addr);
401da177e4SLinus Torvalds 		}
413f787fe2SPaul Mundt 	}
423f787fe2SPaul Mundt 
431da177e4SLinus Torvalds 	return pte;
441da177e4SLinus Torvalds }
451da177e4SLinus Torvalds 
467868a208SPunit Agrawal pte_t *huge_pte_offset(struct mm_struct *mm,
477868a208SPunit Agrawal 		       unsigned long addr, unsigned long sz)
481da177e4SLinus Torvalds {
491da177e4SLinus Torvalds 	pgd_t *pgd;
503f787fe2SPaul Mundt 	pud_t *pud;
511da177e4SLinus Torvalds 	pmd_t *pmd;
521da177e4SLinus Torvalds 	pte_t *pte = NULL;
531da177e4SLinus Torvalds 
541da177e4SLinus Torvalds 	pgd = pgd_offset(mm, addr);
551da177e4SLinus Torvalds 	if (pgd) {
563f787fe2SPaul Mundt 		pud = pud_offset(pgd, addr);
573f787fe2SPaul Mundt 		if (pud) {
583f787fe2SPaul Mundt 			pmd = pmd_offset(pud, addr);
591da177e4SLinus Torvalds 			if (pmd)
601da177e4SLinus Torvalds 				pte = pte_offset_map(pmd, addr);
611da177e4SLinus Torvalds 		}
623f787fe2SPaul Mundt 	}
633f787fe2SPaul Mundt 
641da177e4SLinus Torvalds 	return pte;
651da177e4SLinus Torvalds }
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds int pmd_huge(pmd_t pmd)
681da177e4SLinus Torvalds {
691da177e4SLinus Torvalds 	return 0;
701da177e4SLinus Torvalds }
711da177e4SLinus Torvalds 
72ceb86879SAndi Kleen int pud_huge(pud_t pud)
73ceb86879SAndi Kleen {
74ceb86879SAndi Kleen 	return 0;
75ceb86879SAndi Kleen }
76