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

TOMOYO Linux Cross Reference
Linux/arch/csky/mm/highmem.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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 ] ~

Diff markup

Differences between /arch/csky/mm/highmem.c (Version linux-6.11.5) and /arch/sparc/mm/highmem.c (Version linux-5.9.16)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 // Copyright (C) 2018 Hangzhou C-SKY Microsyst !!   2 /*
  3                                                !!   3  *  highmem.c: virtual kernel memory mappings for high memory
  4 #include <linux/module.h>                      !!   4  *
                                                   >>   5  *  Provides kernel-static versions of atomic kmap functions originally
                                                   >>   6  *  found as inlines in include/asm-sparc/highmem.h.  These became
                                                   >>   7  *  needed as kmap_atomic() and kunmap_atomic() started getting
                                                   >>   8  *  called from within modules.
                                                   >>   9  *  -- Tomas Szepe <szepe@pinerecords.com>, September 2002
                                                   >>  10  *
                                                   >>  11  *  But kmap_atomic() and kunmap_atomic() cannot be inlined in
                                                   >>  12  *  modules because they are loaded with btfixup-ped functions.
                                                   >>  13  */
                                                   >>  14 
                                                   >>  15 /*
                                                   >>  16  * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
                                                   >>  17  * gives a more generic (and caching) interface. But kmap_atomic can
                                                   >>  18  * be used in IRQ contexts, so in some (very limited) cases we need it.
                                                   >>  19  *
                                                   >>  20  * XXX This is an old text. Actually, it's good to use atomic kmaps,
                                                   >>  21  * provided you remember that they are atomic and not try to sleep
                                                   >>  22  * with a kmap taken, much like a spinlock. Non-atomic kmaps are
                                                   >>  23  * shared by CPUs, and so precious, and establishing them requires IPI.
                                                   >>  24  * Atomic kmaps are lightweight and we may have NCPUS more of them.
                                                   >>  25  */
  5 #include <linux/highmem.h>                         26 #include <linux/highmem.h>
  6 #include <linux/smp.h>                         !!  27 #include <linux/export.h>
  7 #include <linux/memblock.h>                    !!  28 #include <linux/mm.h>
  8 #include <asm/fixmap.h>                        !!  29 
  9 #include <asm/tlbflush.h>                      << 
 10 #include <asm/cacheflush.h>                        30 #include <asm/cacheflush.h>
                                                   >>  31 #include <asm/tlbflush.h>
                                                   >>  32 #include <asm/vaddrs.h>
 11                                                    33 
 12 unsigned long highstart_pfn, highend_pfn;      !!  34 static pte_t *kmap_pte;
 13                                                    35 
 14 void kmap_flush_tlb(unsigned long addr)        !!  36 void __init kmap_init(void)
 15 {                                                  37 {
 16         flush_tlb_one(addr);                   !!  38         unsigned long address = __fix_to_virt(FIX_KMAP_BEGIN);
                                                   >>  39 
                                                   >>  40         /* cache the first kmap pte */
                                                   >>  41         kmap_pte = virt_to_kpte(address);
 17 }                                                  42 }
 18 EXPORT_SYMBOL(kmap_flush_tlb);                 << 
 19                                                    43 
 20 void __init kmap_init(void)                    !!  44 void *kmap_atomic_high_prot(struct page *page, pgprot_t prot)
 21 {                                                  45 {
 22         unsigned long vaddr;                       46         unsigned long vaddr;
 23         pgd_t *pgd;                            !!  47         long idx, type;
 24         pmd_t *pmd;                            !!  48 
 25         pud_t *pud;                            !!  49         type = kmap_atomic_idx_push();
 26         pte_t *pte;                            !!  50         idx = type + KM_TYPE_NR*smp_processor_id();
 27                                                !!  51         vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
 28         vaddr = PKMAP_BASE;                    !!  52 
 29         fixrange_init(vaddr, vaddr + PAGE_SIZE !!  53 /* XXX Fix - Anton */
 30                                                !!  54 #if 0
 31         pgd = swapper_pg_dir + pgd_index(vaddr !!  55         __flush_cache_one(vaddr);
 32         pud = (pud_t *)pgd;                    !!  56 #else
 33         pmd = pmd_offset(pud, vaddr);          !!  57         flush_cache_all();
 34         pte = pte_offset_kernel(pmd, vaddr);   !!  58 #endif
 35         pkmap_page_table = pte;                !!  59 
                                                   >>  60 #ifdef CONFIG_DEBUG_HIGHMEM
                                                   >>  61         BUG_ON(!pte_none(*(kmap_pte-idx)));
                                                   >>  62 #endif
                                                   >>  63         set_pte(kmap_pte-idx, mk_pte(page, prot));
                                                   >>  64 /* XXX Fix - Anton */
                                                   >>  65 #if 0
                                                   >>  66         __flush_tlb_one(vaddr);
                                                   >>  67 #else
                                                   >>  68         flush_tlb_all();
                                                   >>  69 #endif
                                                   >>  70 
                                                   >>  71         return (void*) vaddr;
                                                   >>  72 }
                                                   >>  73 EXPORT_SYMBOL(kmap_atomic_high_prot);
                                                   >>  74 
                                                   >>  75 void kunmap_atomic_high(void *kvaddr)
                                                   >>  76 {
                                                   >>  77         unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK;
                                                   >>  78         int type;
                                                   >>  79 
                                                   >>  80         if (vaddr < FIXADDR_START)
                                                   >>  81                 return;
                                                   >>  82 
                                                   >>  83         type = kmap_atomic_idx();
                                                   >>  84 
                                                   >>  85 #ifdef CONFIG_DEBUG_HIGHMEM
                                                   >>  86         {
                                                   >>  87                 unsigned long idx;
                                                   >>  88 
                                                   >>  89                 idx = type + KM_TYPE_NR * smp_processor_id();
                                                   >>  90                 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx));
                                                   >>  91 
                                                   >>  92                 /* XXX Fix - Anton */
                                                   >>  93 #if 0
                                                   >>  94                 __flush_cache_one(vaddr);
                                                   >>  95 #else
                                                   >>  96                 flush_cache_all();
                                                   >>  97 #endif
                                                   >>  98 
                                                   >>  99                 /*
                                                   >> 100                  * force other mappings to Oops if they'll try to access
                                                   >> 101                  * this pte without first remap it
                                                   >> 102                  */
                                                   >> 103                 pte_clear(&init_mm, vaddr, kmap_pte-idx);
                                                   >> 104                 /* XXX Fix - Anton */
                                                   >> 105 #if 0
                                                   >> 106                 __flush_tlb_one(vaddr);
                                                   >> 107 #else
                                                   >> 108                 flush_tlb_all();
                                                   >> 109 #endif
                                                   >> 110         }
                                                   >> 111 #endif
                                                   >> 112 
                                                   >> 113         kmap_atomic_idx_pop();
 36 }                                                 114 }
                                                   >> 115 EXPORT_SYMBOL(kunmap_atomic_high);
 37                                                   116 

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