xref: /linux/arch/sh/mm/hugetlbpage.c (revision 3f787fe2e077ecfe43ad9ad56f12a8e21cffafc3)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  * arch/sh/mm/hugetlbpage.c
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  * SuperH HugeTLB page support.
51da177e4SLinus Torvalds  *
61da177e4SLinus Torvalds  * Cloned from sparc64 by Paul Mundt.
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  * Copyright (C) 2002, 2003 David S. Miller (davem@redhat.com)
91da177e4SLinus Torvalds  */
101da177e4SLinus Torvalds 
111da177e4SLinus Torvalds #include <linux/init.h>
121da177e4SLinus Torvalds #include <linux/fs.h>
131da177e4SLinus Torvalds #include <linux/mm.h>
141da177e4SLinus Torvalds #include <linux/hugetlb.h>
151da177e4SLinus Torvalds #include <linux/pagemap.h>
161da177e4SLinus Torvalds #include <linux/smp_lock.h>
171da177e4SLinus Torvalds #include <linux/slab.h>
181da177e4SLinus Torvalds #include <linux/sysctl.h>
191da177e4SLinus Torvalds 
201da177e4SLinus Torvalds #include <asm/mman.h>
211da177e4SLinus Torvalds #include <asm/pgalloc.h>
221da177e4SLinus Torvalds #include <asm/tlb.h>
231da177e4SLinus Torvalds #include <asm/tlbflush.h>
241da177e4SLinus Torvalds #include <asm/cacheflush.h>
251da177e4SLinus Torvalds 
2663551ae0SDavid Gibson pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
271da177e4SLinus Torvalds {
281da177e4SLinus Torvalds 	pgd_t *pgd;
29*3f787fe2SPaul 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) {
35*3f787fe2SPaul Mundt 		pud = pud_alloc(mm, pgd, addr);
36*3f787fe2SPaul Mundt 		if (pud) {
37*3f787fe2SPaul Mundt 			pmd = pmd_alloc(mm, pud, addr);
381da177e4SLinus Torvalds 			if (pmd)
391da177e4SLinus Torvalds 				pte = pte_alloc_map(mm, pmd, addr);
401da177e4SLinus Torvalds 		}
41*3f787fe2SPaul Mundt 	}
42*3f787fe2SPaul Mundt 
431da177e4SLinus Torvalds 	return pte;
441da177e4SLinus Torvalds }
451da177e4SLinus Torvalds 
4663551ae0SDavid Gibson pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
471da177e4SLinus Torvalds {
481da177e4SLinus Torvalds 	pgd_t *pgd;
49*3f787fe2SPaul Mundt 	pud_t *pud;
501da177e4SLinus Torvalds 	pmd_t *pmd;
511da177e4SLinus Torvalds 	pte_t *pte = NULL;
521da177e4SLinus Torvalds 
531da177e4SLinus Torvalds 	pgd = pgd_offset(mm, addr);
541da177e4SLinus Torvalds 	if (pgd) {
55*3f787fe2SPaul Mundt 		pud = pud_offset(pgd, addr);
56*3f787fe2SPaul Mundt 		if (pud) {
57*3f787fe2SPaul Mundt 			pmd = pmd_offset(pud, addr);
581da177e4SLinus Torvalds 			if (pmd)
591da177e4SLinus Torvalds 				pte = pte_offset_map(pmd, addr);
601da177e4SLinus Torvalds 		}
61*3f787fe2SPaul Mundt 	}
62*3f787fe2SPaul Mundt 
631da177e4SLinus Torvalds 	return pte;
641da177e4SLinus Torvalds }
651da177e4SLinus Torvalds 
661da177e4SLinus Torvalds struct page *follow_huge_addr(struct mm_struct *mm,
671da177e4SLinus Torvalds 			      unsigned long address, int write)
681da177e4SLinus Torvalds {
691da177e4SLinus Torvalds 	return ERR_PTR(-EINVAL);
701da177e4SLinus Torvalds }
711da177e4SLinus Torvalds 
721da177e4SLinus Torvalds int pmd_huge(pmd_t pmd)
731da177e4SLinus Torvalds {
741da177e4SLinus Torvalds 	return 0;
751da177e4SLinus Torvalds }
761da177e4SLinus Torvalds 
771da177e4SLinus Torvalds struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address,
781da177e4SLinus Torvalds 			     pmd_t *pmd, int write)
791da177e4SLinus Torvalds {
801da177e4SLinus Torvalds 	return NULL;
811da177e4SLinus Torvalds }
82