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

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

Version: ~ [ linux-5.15-rc5 ] ~ [ linux-5.14.11 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.72 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.152 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.210 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.250 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.286 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.288 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _PARISC_CACHEFLUSH_H
  2 #define _PARISC_CACHEFLUSH_H
  3 
  4 #include <linux/config.h>
  5 #include <linux/mm.h>
  6 
  7 /* The usual comment is "Caches aren't brain-dead on the <architecture>".
  8  * Unfortunately, that doesn't apply to PA-RISC. */
  9 
 10 /* Cache flush operations */
 11 
 12 #ifdef CONFIG_SMP
 13 #define flush_cache_mm(mm) flush_cache_all()
 14 #else
 15 #define flush_cache_mm(mm) flush_cache_all_local()
 16 #endif
 17 
 18 #define flush_kernel_dcache_range(start,size) \
 19         flush_kernel_dcache_range_asm((start), (start)+(size));
 20 
 21 extern void flush_cache_all_local(void);
 22 
 23 static inline void cacheflush_h_tmp_function(void *dummy)
 24 {
 25         flush_cache_all_local();
 26 }
 27 
 28 static inline void flush_cache_all(void)
 29 {
 30         on_each_cpu(cacheflush_h_tmp_function, NULL, 1, 1);
 31 }
 32 
 33 #define flush_cache_vmap(start, end)            flush_cache_all()
 34 #define flush_cache_vunmap(start, end)          flush_cache_all()
 35 
 36 /* The following value needs to be tuned and probably scaled with the
 37  * cache size.
 38  */
 39 
 40 #define FLUSH_THRESHOLD 0x80000
 41 
 42 static inline void
 43 flush_user_dcache_range(unsigned long start, unsigned long end)
 44 {
 45 #ifdef CONFIG_SMP
 46         flush_user_dcache_range_asm(start,end);
 47 #else
 48         if ((end - start) < FLUSH_THRESHOLD)
 49                 flush_user_dcache_range_asm(start,end);
 50         else
 51                 flush_data_cache();
 52 #endif
 53 }
 54 
 55 static inline void
 56 flush_user_icache_range(unsigned long start, unsigned long end)
 57 {
 58 #ifdef CONFIG_SMP
 59         flush_user_icache_range_asm(start,end);
 60 #else
 61         if ((end - start) < FLUSH_THRESHOLD)
 62                 flush_user_icache_range_asm(start,end);
 63         else
 64                 flush_instruction_cache();
 65 #endif
 66 }
 67 
 68 extern void __flush_dcache_page(struct page *page);
 69 
 70 static inline void flush_dcache_page(struct page *page)
 71 {
 72         if (page->mapping && list_empty(&page->mapping->i_mmap) &&
 73                         list_empty(&page->mapping->i_mmap_shared)) {
 74                 set_bit(PG_dcache_dirty, &page->flags);
 75         } else {
 76                 __flush_dcache_page(page);
 77         }
 78 }
 79 
 80 #define flush_icache_page(vma,page)     do { flush_kernel_dcache_page(page_address(page)); flush_kernel_icache_page(page_address(page)); } while (0)
 81 
 82 #define flush_icache_range(s,e)         do { flush_kernel_dcache_range_asm(s,e); flush_kernel_icache_range_asm(s,e); } while (0)
 83 
 84 #define flush_icache_user_range(vma, page, addr, len) do { \
 85         flush_user_dcache_range(addr, addr + len); \
 86         flush_user_icache_range(addr, addr + len); } while (0)
 87 
 88 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 89 do { memcpy(dst, src, len); \
 90      flush_icache_user_range(vma, page, vaddr, len); \
 91 } while (0)
 92 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
 93         memcpy(dst, src, len)
 94 
 95 static inline void flush_cache_range(struct vm_area_struct *vma,
 96                 unsigned long start, unsigned long end)
 97 {
 98         int sr3;
 99 
100         if (!vma->vm_mm->context) {
101                 BUG();
102                 return;
103         }
104 
105         sr3 = mfsp(3);
106         if (vma->vm_mm->context == sr3) {
107                 flush_user_dcache_range(start,end);
108                 flush_user_icache_range(start,end);
109         } else {
110                 flush_cache_all();
111         }
112 }
113 
114 static inline void
115 flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
116 {
117         int sr3;
118 
119         if (!vma->vm_mm->context) {
120                 BUG();
121                 return;
122         }
123 
124         sr3 = mfsp(3);
125         if (vma->vm_mm->context == sr3) {
126                 flush_user_dcache_range(vmaddr,vmaddr + PAGE_SIZE);
127                 if (vma->vm_flags & VM_EXEC)
128                         flush_user_icache_range(vmaddr,vmaddr + PAGE_SIZE);
129         } else {
130                 if (vma->vm_flags & VM_EXEC)
131                         flush_cache_all();
132                 else
133                         flush_data_cache();
134         }
135 }
136 #endif
137 
138 

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