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/sysctl.h> 171da177e4SLinus Torvalds 181da177e4SLinus Torvalds #include <asm/mman.h> 191da177e4SLinus Torvalds #include <asm/pgalloc.h> 201da177e4SLinus Torvalds #include <asm/tlb.h> 211da177e4SLinus Torvalds #include <asm/tlbflush.h> 221da177e4SLinus Torvalds #include <asm/cacheflush.h> 231da177e4SLinus Torvalds 24a5516438SAndi Kleen pte_t *huge_pte_alloc(struct mm_struct *mm, 25a5516438SAndi Kleen unsigned long addr, unsigned long sz) 261da177e4SLinus Torvalds { 271da177e4SLinus Torvalds pgd_t *pgd; 283f787fe2SPaul Mundt pud_t *pud; 291da177e4SLinus Torvalds pmd_t *pmd; 301da177e4SLinus Torvalds pte_t *pte = NULL; 311da177e4SLinus Torvalds 321da177e4SLinus Torvalds pgd = pgd_offset(mm, addr); 331da177e4SLinus Torvalds if (pgd) { 343f787fe2SPaul Mundt pud = pud_alloc(mm, pgd, addr); 353f787fe2SPaul Mundt if (pud) { 363f787fe2SPaul Mundt pmd = pmd_alloc(mm, pud, addr); 371da177e4SLinus Torvalds if (pmd) 383ed3a4f0SKirill A. Shutemov pte = pte_alloc_map(mm, pmd, addr); 391da177e4SLinus Torvalds } 403f787fe2SPaul Mundt } 413f787fe2SPaul Mundt 421da177e4SLinus Torvalds return pte; 431da177e4SLinus Torvalds } 441da177e4SLinus Torvalds 45*7868a208SPunit Agrawal pte_t *huge_pte_offset(struct mm_struct *mm, 46*7868a208SPunit Agrawal unsigned long addr, unsigned long sz) 471da177e4SLinus Torvalds { 481da177e4SLinus Torvalds pgd_t *pgd; 493f787fe2SPaul 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) { 553f787fe2SPaul Mundt pud = pud_offset(pgd, addr); 563f787fe2SPaul Mundt if (pud) { 573f787fe2SPaul Mundt pmd = pmd_offset(pud, addr); 581da177e4SLinus Torvalds if (pmd) 591da177e4SLinus Torvalds pte = pte_offset_map(pmd, addr); 601da177e4SLinus Torvalds } 613f787fe2SPaul Mundt } 623f787fe2SPaul Mundt 631da177e4SLinus Torvalds return pte; 641da177e4SLinus Torvalds } 651da177e4SLinus Torvalds 661da177e4SLinus Torvalds int pmd_huge(pmd_t pmd) 671da177e4SLinus Torvalds { 681da177e4SLinus Torvalds return 0; 691da177e4SLinus Torvalds } 701da177e4SLinus Torvalds 71ceb86879SAndi Kleen int pud_huge(pud_t pud) 72ceb86879SAndi Kleen { 73ceb86879SAndi Kleen return 0; 74ceb86879SAndi Kleen } 75