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

TOMOYO Linux Cross Reference
Linux/arch/m68k/include/asm/mcf_pgalloc.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ 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 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef M68K_MCF_PGALLOC_H
  3 #define M68K_MCF_PGALLOC_H
  4 
  5 #include <asm/tlb.h>
  6 #include <asm/tlbflush.h>
  7 
  8 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
  9 {
 10         pagetable_free(virt_to_ptdesc(pte));
 11 }
 12 
 13 extern const char bad_pmd_string[];
 14 
 15 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
 16 {
 17         struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_ZERO) &
 18                         ~__GFP_HIGHMEM, 0);
 19 
 20         if (!ptdesc)
 21                 return NULL;
 22 
 23         return ptdesc_address(ptdesc);
 24 }
 25 
 26 extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
 27 {
 28         return (pmd_t *) pgd;
 29 }
 30 
 31 #define pmd_populate(mm, pmd, pte) (pmd_val(*pmd) = (unsigned long)(pte))
 32 
 33 #define pmd_populate_kernel pmd_populate
 34 
 35 static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pgtable,
 36                                   unsigned long address)
 37 {
 38         struct ptdesc *ptdesc = virt_to_ptdesc(pgtable);
 39 
 40         pagetable_pte_dtor(ptdesc);
 41         pagetable_free(ptdesc);
 42 }
 43 
 44 static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
 45 {
 46         struct ptdesc *ptdesc = pagetable_alloc(GFP_DMA | __GFP_ZERO, 0);
 47         pte_t *pte;
 48 
 49         if (!ptdesc)
 50                 return NULL;
 51         if (!pagetable_pte_ctor(ptdesc)) {
 52                 pagetable_free(ptdesc);
 53                 return NULL;
 54         }
 55 
 56         pte = ptdesc_address(ptdesc);
 57         return pte;
 58 }
 59 
 60 static inline void pte_free(struct mm_struct *mm, pgtable_t pgtable)
 61 {
 62         struct ptdesc *ptdesc = virt_to_ptdesc(pgtable);
 63 
 64         pagetable_pte_dtor(ptdesc);
 65         pagetable_free(ptdesc);
 66 }
 67 
 68 /*
 69  * In our implementation, each pgd entry contains 1 pmd that is never allocated
 70  * or freed.  pgd_present is always 1, so this should never be called. -NL
 71  */
 72 #define pmd_free(mm, pmd) BUG()
 73 
 74 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
 75 {
 76         pagetable_free(virt_to_ptdesc(pgd));
 77 }
 78 
 79 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 80 {
 81         pgd_t *new_pgd;
 82         struct ptdesc *ptdesc = pagetable_alloc((GFP_DMA | __GFP_NOWARN) &
 83                         ~__GFP_HIGHMEM, 0);
 84 
 85         if (!ptdesc)
 86                 return NULL;
 87         new_pgd = ptdesc_address(ptdesc);
 88 
 89         memcpy(new_pgd, swapper_pg_dir, PTRS_PER_PGD * sizeof(pgd_t));
 90         memset(new_pgd, 0, PAGE_OFFSET >> PGDIR_SHIFT);
 91         return new_pgd;
 92 }
 93 
 94 #endif /* M68K_MCF_PGALLOC_H */
 95 

~ [ 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.

sflogo.php