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

TOMOYO Linux Cross Reference
Linux/arch/parisc/include/asm/cacheflush.h

Version: ~ [ linux-6.0 ] ~ [ linux-5.19.12 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.71 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.146 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.215 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.260 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.295 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.330 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ 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 _PARISC_CACHEFLUSH_H
  3 #define _PARISC_CACHEFLUSH_H
  4 
  5 #include <linux/mm.h>
  6 #include <linux/uaccess.h>
  7 #include <asm/tlbflush.h>
  8 
  9 /* The usual comment is "Caches aren't brain-dead on the <architecture>".
 10  * Unfortunately, that doesn't apply to PA-RISC. */
 11 
 12 /* Internal implementation */
 13 void flush_data_cache_local(void *);  /* flushes local data-cache only */
 14 void flush_instruction_cache_local(void *); /* flushes local code-cache only */
 15 #ifdef CONFIG_SMP
 16 void flush_data_cache(void); /* flushes data-cache only (all processors) */
 17 void flush_instruction_cache(void); /* flushes i-cache only (all processors) */
 18 #else
 19 #define flush_data_cache() flush_data_cache_local(NULL)
 20 #define flush_instruction_cache() flush_instruction_cache_local(NULL)
 21 #endif
 22 
 23 #define flush_cache_dup_mm(mm) flush_cache_mm(mm)
 24 
 25 void flush_user_icache_range_asm(unsigned long, unsigned long);
 26 void flush_kernel_icache_range_asm(unsigned long, unsigned long);
 27 void flush_user_dcache_range_asm(unsigned long, unsigned long);
 28 void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
 29 void purge_kernel_dcache_range_asm(unsigned long, unsigned long);
 30 void flush_kernel_dcache_page_asm(void *);
 31 void flush_kernel_icache_page(void *);
 32 
 33 /* Cache flush operations */
 34 
 35 void flush_cache_all_local(void);
 36 void flush_cache_all(void);
 37 void flush_cache_mm(struct mm_struct *mm);
 38 
 39 #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
 40 void flush_kernel_dcache_page_addr(void *addr);
 41 static inline void flush_kernel_dcache_page(struct page *page)
 42 {
 43         flush_kernel_dcache_page_addr(page_address(page));
 44 }
 45 
 46 #define flush_kernel_dcache_range(start,size) \
 47         flush_kernel_dcache_range_asm((start), (start)+(size));
 48 
 49 void flush_kernel_vmap_range(void *vaddr, int size);
 50 void invalidate_kernel_vmap_range(void *vaddr, int size);
 51 
 52 #define flush_cache_vmap(start, end)            flush_cache_all()
 53 #define flush_cache_vunmap(start, end)          flush_cache_all()
 54 
 55 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
 56 extern void flush_dcache_page(struct page *page);
 57 
 58 #define flush_dcache_mmap_lock(mapping)         xa_lock_irq(&mapping->i_pages)
 59 #define flush_dcache_mmap_unlock(mapping)       xa_unlock_irq(&mapping->i_pages)
 60 
 61 #define flush_icache_page(vma,page)     do {            \
 62         flush_kernel_dcache_page(page);                 \
 63         flush_kernel_icache_page(page_address(page));   \
 64 } while (0)
 65 
 66 #define flush_icache_range(s,e)         do {            \
 67         flush_kernel_dcache_range_asm(s,e);             \
 68         flush_kernel_icache_range_asm(s,e);             \
 69 } while (0)
 70 
 71 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 72 do { \
 73         flush_cache_page(vma, vaddr, page_to_pfn(page)); \
 74         memcpy(dst, src, len); \
 75         flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \
 76 } while (0)
 77 
 78 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
 79 do { \
 80         flush_cache_page(vma, vaddr, page_to_pfn(page)); \
 81         memcpy(dst, src, len); \
 82 } while (0)
 83 
 84 void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn);
 85 void flush_cache_range(struct vm_area_struct *vma,
 86                 unsigned long start, unsigned long end);
 87 
 88 /* defined in pacache.S exported in cache.c used by flush_anon_page */
 89 void flush_dcache_page_asm(unsigned long phys_addr, unsigned long vaddr);
 90 
 91 #define ARCH_HAS_FLUSH_ANON_PAGE
 92 static inline void
 93 flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
 94 {
 95         if (PageAnon(page)) {
 96                 flush_tlb_page(vma, vmaddr);
 97                 preempt_disable();
 98                 flush_dcache_page_asm(page_to_phys(page), vmaddr);
 99                 preempt_enable();
100         }
101 }
102 
103 #include <asm/kmap_types.h>
104 
105 #define ARCH_HAS_KMAP
106 
107 static inline void *kmap(struct page *page)
108 {
109         might_sleep();
110         return page_address(page);
111 }
112 
113 static inline void kunmap(struct page *page)
114 {
115         flush_kernel_dcache_page_addr(page_address(page));
116 }
117 
118 static inline void *kmap_atomic(struct page *page)
119 {
120         preempt_disable();
121         pagefault_disable();
122         return page_address(page);
123 }
124 
125 static inline void __kunmap_atomic(void *addr)
126 {
127         flush_kernel_dcache_page_addr(addr);
128         pagefault_enable();
129         preempt_enable();
130 }
131 
132 #define kmap_atomic_prot(page, prot)    kmap_atomic(page)
133 #define kmap_atomic_pfn(pfn)    kmap_atomic(pfn_to_page(pfn))
134 
135 #endif /* _PARISC_CACHEFLUSH_H */
136 
137 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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