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


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

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