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

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

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/csky/mm/cachev1.c (Version linux-6.12-rc7) and /arch/ppc/mm/cachev1.c (Version linux-2.4.37.11)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 // Copyright (C) 2018 Hangzhou C-SKY Microsyst    
  3                                                   
  4 #include <linux/spinlock.h>                       
  5 #include <asm/cache.h>                            
  6 #include <abi/reg_ops.h>                          
  7                                                   
  8 /* for L1-cache */                                
  9 #define INS_CACHE               (1 << 0)          
 10 #define DATA_CACHE              (1 << 1)          
 11 #define CACHE_INV               (1 << 4)          
 12 #define CACHE_CLR               (1 << 5)          
 13 #define CACHE_OMS               (1 << 6)          
 14 #define CACHE_ITS               (1 << 7)          
 15 #define CACHE_LICF              (1 << 31)         
 16                                                   
 17 /* for L2-cache */                                
 18 #define CR22_LEVEL_SHIFT        (1)               
 19 #define CR22_SET_SHIFT          (7)               
 20 #define CR22_WAY_SHIFT          (30)              
 21 #define CR22_WAY_SHIFT_L2       (29)              
 22                                                   
 23 static DEFINE_SPINLOCK(cache_lock);               
 24                                                   
 25 static inline void cache_op_line(unsigned long    
 26 {                                                 
 27         mtcr("cr22", i);                          
 28         mtcr("cr17", val);                        
 29 }                                                 
 30                                                   
 31 #define CCR2_L2E (1 << 3)                         
 32 static void cache_op_all(unsigned int value, u    
 33 {                                                 
 34         mtcr("cr17", value | CACHE_CLR);          
 35         mb();                                     
 36                                                   
 37         if (l2 && (mfcr_ccr2() & CCR2_L2E)) {     
 38                 mtcr("cr24", value | CACHE_CLR    
 39                 mb();                             
 40         }                                         
 41 }                                                 
 42                                                   
 43 static void cache_op_range(                       
 44         unsigned int start,                       
 45         unsigned int end,                         
 46         unsigned int value,                       
 47         unsigned int l2)                          
 48 {                                                 
 49         unsigned long i, flags;                   
 50         unsigned int val = value | CACHE_CLR |    
 51         bool l2_sync;                             
 52                                                   
 53         if (unlikely((end - start) >= PAGE_SIZ    
 54             unlikely(start < PAGE_OFFSET) ||      
 55             unlikely(start >= PAGE_OFFSET + LO    
 56                 cache_op_all(value, l2);          
 57                 return;                           
 58         }                                         
 59                                                   
 60         if ((mfcr_ccr2() & CCR2_L2E) && l2)       
 61                 l2_sync = 1;                      
 62         else                                      
 63                 l2_sync = 0;                      
 64                                                   
 65         spin_lock_irqsave(&cache_lock, flags);    
 66                                                   
 67         i = start & ~(L1_CACHE_BYTES - 1);        
 68         for (; i < end; i += L1_CACHE_BYTES) {    
 69                 cache_op_line(i, val);            
 70                 if (l2_sync) {                    
 71                         mb();                     
 72                         mtcr("cr24", val);        
 73                 }                                 
 74         }                                         
 75         spin_unlock_irqrestore(&cache_lock, fl    
 76                                                   
 77         mb();                                     
 78 }                                                 
 79                                                   
 80 void dcache_wb_line(unsigned long start)          
 81 {                                                 
 82         asm volatile("idly4\n":::"memory");       
 83         cache_op_line(start, DATA_CACHE|CACHE_    
 84         mb();                                     
 85 }                                                 
 86                                                   
 87 void icache_inv_range(unsigned long start, uns    
 88 {                                                 
 89         cache_op_range(start, end, INS_CACHE|C    
 90 }                                                 
 91                                                   
 92 void icache_inv_all(void)                         
 93 {                                                 
 94         cache_op_all(INS_CACHE|CACHE_INV, 0);     
 95 }                                                 
 96                                                   
 97 void local_icache_inv_all(void *priv)             
 98 {                                                 
 99         cache_op_all(INS_CACHE|CACHE_INV, 0);     
100 }                                                 
101                                                   
102 void dcache_wb_range(unsigned long start, unsi    
103 {                                                 
104         cache_op_range(start, end, DATA_CACHE|    
105 }                                                 
106                                                   
107 void dcache_wbinv_all(void)                       
108 {                                                 
109         cache_op_all(DATA_CACHE|CACHE_CLR|CACH    
110 }                                                 
111                                                   
112 void cache_wbinv_range(unsigned long start, un    
113 {                                                 
114         cache_op_range(start, end, INS_CACHE|D    
115 }                                                 
116 EXPORT_SYMBOL(cache_wbinv_range);                 
117                                                   
118 void cache_wbinv_all(void)                        
119 {                                                 
120         cache_op_all(INS_CACHE|DATA_CACHE|CACH    
121 }                                                 
122                                                   
123 void dma_wbinv_range(unsigned long start, unsi    
124 {                                                 
125         cache_op_range(start, end, DATA_CACHE|    
126 }                                                 
127                                                   
128 void dma_inv_range(unsigned long start, unsign    
129 {                                                 
130         cache_op_range(start, end, DATA_CACHE|    
131 }                                                 
132                                                   
133 void dma_wb_range(unsigned long start, unsigne    
134 {                                                 
135         cache_op_range(start, end, DATA_CACHE|    
136 }                                                 
137                                                   

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