~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/mm/hugetlbpage.c

Version: ~ [ linux-6.6-rc4 ] ~ [ linux-6.5.5 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.55 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.133 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.197 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.257 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.295 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.326 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * MIPS Huge TLB Page Support for Kernel.
  3  *
  4  * This file is subject to the terms and conditions of the GNU General Public
  5  * License.  See the file "COPYING" in the main directory of this archive
  6  * for more details.
  7  *
  8  * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
  9  * Copyright 2005, Embedded Alley Solutions, Inc.
 10  * Matt Porter <mporter@embeddedalley.com>
 11  * Copyright (C) 2008, 2009 Cavium Networks, Inc.
 12  */
 13 
 14 #include <linux/init.h>
 15 #include <linux/fs.h>
 16 #include <linux/mm.h>
 17 #include <linux/hugetlb.h>
 18 #include <linux/pagemap.h>
 19 #include <linux/slab.h>
 20 #include <linux/err.h>
 21 #include <linux/sysctl.h>
 22 #include <asm/mman.h>
 23 #include <asm/tlb.h>
 24 #include <asm/tlbflush.h>
 25 
 26 pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr,
 27                       unsigned long sz)
 28 {
 29         pgd_t *pgd;
 30         pud_t *pud;
 31         pte_t *pte = NULL;
 32 
 33         pgd = pgd_offset(mm, addr);
 34         pud = pud_alloc(mm, pgd, addr);
 35         if (pud)
 36                 pte = (pte_t *)pmd_alloc(mm, pud, addr);
 37 
 38         return pte;
 39 }
 40 
 41 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 42 {
 43         pgd_t *pgd;
 44         pud_t *pud;
 45         pmd_t *pmd = NULL;
 46 
 47         pgd = pgd_offset(mm, addr);
 48         if (pgd_present(*pgd)) {
 49                 pud = pud_offset(pgd, addr);
 50                 if (pud_present(*pud))
 51                         pmd = pmd_offset(pud, addr);
 52         }
 53         return (pte_t *) pmd;
 54 }
 55 
 56 int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
 57 {
 58         return 0;
 59 }
 60 
 61 /*
 62  * This function checks for proper alignment of input addr and len parameters.
 63  */
 64 int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
 65 {
 66         if (len & ~HPAGE_MASK)
 67                 return -EINVAL;
 68         if (addr & ~HPAGE_MASK)
 69                 return -EINVAL;
 70         return 0;
 71 }
 72 
 73 struct page *
 74 follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
 75 {
 76         return ERR_PTR(-EINVAL);
 77 }
 78 
 79 int pmd_huge(pmd_t pmd)
 80 {
 81         return (pmd_val(pmd) & _PAGE_HUGE) != 0;
 82 }
 83 
 84 int pud_huge(pud_t pud)
 85 {
 86         return (pud_val(pud) & _PAGE_HUGE) != 0;
 87 }
 88 
 89 struct page *
 90 follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 91                 pmd_t *pmd, int write)
 92 {
 93         struct page *page;
 94 
 95         page = pte_page(*(pte_t *)pmd);
 96         if (page)
 97                 page += ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
 98         return page;
 99 }
100 
101 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp