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

TOMOYO Linux Cross Reference
Linux/arch/arm/mm/cache-v4wb.S

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/arm/mm/cache-v4wb.S (Version linux-6.12-rc7) and /arch/sparc64/mm/cache-v4wb.S (Version linux-4.16.18)


  1 /* SPDX-License-Identifier: GPL-2.0-only */       
  2 /*                                                
  3  *  linux/arch/arm/mm/cache-v4wb.S                
  4  *                                                
  5  *  Copyright (C) 1997-2002 Russell king          
  6  */                                               
  7 #include <linux/linkage.h>                        
  8 #include <linux/init.h>                           
  9 #include <linux/cfi_types.h>                      
 10 #include <asm/assembler.h>                        
 11 #include <asm/page.h>                             
 12 #include "proc-macros.S"                          
 13                                                   
 14 /*                                                
 15  * The size of one data cache line.               
 16  */                                               
 17 #define CACHE_DLINESIZE 32                        
 18                                                   
 19 /*                                                
 20  * The total size of the data cache.              
 21  */                                               
 22 #if defined(CONFIG_CPU_SA110)                     
 23 # define CACHE_DSIZE    16384                     
 24 #elif defined(CONFIG_CPU_SA1100)                  
 25 # define CACHE_DSIZE    8192                      
 26 #else                                             
 27 # error Unknown cache size                        
 28 #endif                                            
 29                                                   
 30 /*                                                
 31  * This is the size at which it becomes more e    
 32  * clean the whole cache, rather than using th    
 33  * cache line maintenance instructions.           
 34  *                                                
 35  *  Size  Clean (ticks) Dirty (ticks)             
 36  *   4096   21  20  21    53  55  54              
 37  *   8192   40  41  40   106 100 102              
 38  *  16384   77  77  76   140 140 138              
 39  *  32768  150 149 150   214 216 212 <---         
 40  *  65536  296 297 296   351 358 361              
 41  * 131072  591 591 591   656 657 651              
 42  *  Whole  132 136 132   221 217 207 <---         
 43  */                                               
 44 #define CACHE_DLIMIT    (CACHE_DSIZE * 4)         
 45                                                   
 46         .data                                     
 47         .align  2                                 
 48 flush_base:                                       
 49         .long   FLUSH_BASE                        
 50         .text                                     
 51                                                   
 52 /*                                                
 53  *      flush_icache_all()                        
 54  *                                                
 55  *      Unconditionally clean and invalidate t    
 56  */                                               
 57 SYM_TYPED_FUNC_START(v4wb_flush_icache_all)       
 58         mov     r0, #0                            
 59         mcr     p15, 0, r0, c7, c5, 0             
 60         ret     lr                                
 61 SYM_FUNC_END(v4wb_flush_icache_all)               
 62                                                   
 63 /*                                                
 64  *      flush_user_cache_all()                    
 65  *                                                
 66  *      Clean and invalidate all cache entries    
 67  *      space.                                    
 68  */                                               
 69 SYM_FUNC_ALIAS(v4wb_flush_user_cache_all, v4wb    
 70                                                   
 71 /*                                                
 72  *      flush_kern_cache_all()                    
 73  *                                                
 74  *      Clean and invalidate the entire cache.    
 75  */                                               
 76 SYM_TYPED_FUNC_START(v4wb_flush_kern_cache_all    
 77         mov     ip, #0                            
 78         mcr     p15, 0, ip, c7, c5, 0             
 79 __flush_whole_cache:                              
 80         ldr     r3, =flush_base                   
 81         ldr     r1, [r3, #0]                      
 82         eor     r1, r1, #CACHE_DSIZE              
 83         str     r1, [r3, #0]                      
 84         add     r2, r1, #CACHE_DSIZE              
 85 1:      ldr     r3, [r1], #32                     
 86         cmp     r1, r2                            
 87         blo     1b                                
 88 #ifdef FLUSH_BASE_MINICACHE                       
 89         add     r2, r2, #FLUSH_BASE_MINICACHE     
 90         sub     r1, r2, #512                      
 91 1:      ldr     r3, [r1], #32                     
 92         cmp     r1, r2                            
 93         blo     1b                                
 94 #endif                                            
 95         mcr     p15, 0, ip, c7, c10, 4            
 96         ret     lr                                
 97 SYM_FUNC_END(v4wb_flush_kern_cache_all)           
 98                                                   
 99 /*                                                
100  *      flush_user_cache_range(start, end, fla    
101  *                                                
102  *      Invalidate a range of cache entries in    
103  *      address space.                            
104  *                                                
105  *      - start - start address (inclusive, pa    
106  *      - end   - end address (exclusive, page    
107  *      - flags - vma_area_struct flags descri    
108  */                                               
109 SYM_TYPED_FUNC_START(v4wb_flush_user_cache_ran    
110         mov     ip, #0                            
111         sub     r3, r1, r0                        
112         tst     r2, #VM_EXEC                      
113         mcrne   p15, 0, ip, c7, c5, 0             
114                                                   
115         cmp     r3, #CACHE_DLIMIT                 
116         bhs     __flush_whole_cache               
117                                                   
118 1:      mcr     p15, 0, r0, c7, c10, 1            
119         mcr     p15, 0, r0, c7, c6, 1             
120         add     r0, r0, #CACHE_DLINESIZE          
121         cmp     r0, r1                            
122         blo     1b                                
123         tst     r2, #VM_EXEC                      
124         mcrne   p15, 0, ip, c7, c10, 4            
125         ret     lr                                
126 SYM_FUNC_END(v4wb_flush_user_cache_range)         
127                                                   
128 /*                                                
129  *      flush_kern_dcache_area(void *addr, siz    
130  *                                                
131  *      Ensure no D cache aliasing occurs, eit    
132  *      the I cache                               
133  *                                                
134  *      - addr  - kernel address                  
135  *      - size  - region size                     
136  */                                               
137 SYM_TYPED_FUNC_START(v4wb_flush_kern_dcache_ar    
138         add     r1, r0, r1                        
139 #ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI    
140         b       v4wb_coherent_user_range          
141 #endif                                            
142 SYM_FUNC_END(v4wb_flush_kern_dcache_area)         
143                                                   
144 /*                                                
145  *      coherent_kern_range(start, end)           
146  *                                                
147  *      Ensure coherency between the Icache an    
148  *      region described by start.  If you hav    
149  *      Harvard caches, you need to implement     
150  *                                                
151  *      - start  - virtual start address          
152  *      - end    - virtual end address            
153  */                                               
154 SYM_TYPED_FUNC_START(v4wb_coherent_kern_range)    
155 #ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI    
156         b       v4wb_coherent_user_range          
157 #endif                                            
158 SYM_FUNC_END(v4wb_coherent_kern_range)            
159                                                   
160 /*                                                
161  *      coherent_user_range(start, end)           
162  *                                                
163  *      Ensure coherency between the Icache an    
164  *      region described by start.  If you hav    
165  *      Harvard caches, you need to implement     
166  *                                                
167  *      - start  - virtual start address          
168  *      - end    - virtual end address            
169  */                                               
170 SYM_TYPED_FUNC_START(v4wb_coherent_user_range)    
171         bic     r0, r0, #CACHE_DLINESIZE - 1      
172 1:      mcr     p15, 0, r0, c7, c10, 1            
173         mcr     p15, 0, r0, c7, c6, 1             
174         add     r0, r0, #CACHE_DLINESIZE          
175         cmp     r0, r1                            
176         blo     1b                                
177         mov     r0, #0                            
178         mcr     p15, 0, r0, c7, c5, 0             
179         mcr     p15, 0, r0, c7, c10, 4            
180         ret     lr                                
181 SYM_FUNC_END(v4wb_coherent_user_range)            
182                                                   
183 /*                                                
184  *      dma_inv_range(start, end)                 
185  *                                                
186  *      Invalidate (discard) the specified vir    
187  *      May not write back any entries.  If 's    
188  *      are not cache line aligned, those line    
189  *      back.                                     
190  *                                                
191  *      - start  - virtual start address          
192  *      - end    - virtual end address            
193  */                                               
194 v4wb_dma_inv_range:                               
195         tst     r0, #CACHE_DLINESIZE - 1          
196         bic     r0, r0, #CACHE_DLINESIZE - 1      
197         mcrne   p15, 0, r0, c7, c10, 1            
198         tst     r1, #CACHE_DLINESIZE - 1          
199         mcrne   p15, 0, r1, c7, c10, 1            
200 1:      mcr     p15, 0, r0, c7, c6, 1             
201         add     r0, r0, #CACHE_DLINESIZE          
202         cmp     r0, r1                            
203         blo     1b                                
204         mcr     p15, 0, r0, c7, c10, 4            
205         ret     lr                                
206                                                   
207 /*                                                
208  *      dma_clean_range(start, end)               
209  *                                                
210  *      Clean (write back) the specified virtu    
211  *                                                
212  *      - start  - virtual start address          
213  *      - end    - virtual end address            
214  */                                               
215 v4wb_dma_clean_range:                             
216         bic     r0, r0, #CACHE_DLINESIZE - 1      
217 1:      mcr     p15, 0, r0, c7, c10, 1            
218         add     r0, r0, #CACHE_DLINESIZE          
219         cmp     r0, r1                            
220         blo     1b                                
221         mcr     p15, 0, r0, c7, c10, 4            
222         ret     lr                                
223                                                   
224 /*                                                
225  *      dma_flush_range(start, end)               
226  *                                                
227  *      Clean and invalidate the specified vir    
228  *                                                
229  *      - start  - virtual start address          
230  *      - end    - virtual end address            
231  *                                                
232  *      This is actually the same as v4wb_cohe    
233  */                                               
234         .globl  v4wb_dma_flush_range              
235         .set    v4wb_dma_flush_range, v4wb_coh    
236                                                   
237 /*                                                
238  *      dma_map_area(start, size, dir)            
239  *      - start - kernel virtual start address    
240  *      - size  - size of region                  
241  *      - dir   - DMA direction                   
242  */                                               
243 SYM_TYPED_FUNC_START(v4wb_dma_map_area)           
244         add     r1, r1, r0                        
245         cmp     r2, #DMA_TO_DEVICE                
246         beq     v4wb_dma_clean_range              
247         bcs     v4wb_dma_inv_range                
248         b       v4wb_dma_flush_range              
249 SYM_FUNC_END(v4wb_dma_map_area)                   
250                                                   
251 /*                                                
252  *      dma_unmap_area(start, size, dir)          
253  *      - start - kernel virtual start address    
254  *      - size  - size of region                  
255  *      - dir   - DMA direction                   
256  */                                               
257 SYM_TYPED_FUNC_START(v4wb_dma_unmap_area)         
258         ret     lr                                
259 SYM_FUNC_END(v4wb_dma_unmap_area)                 
                                                      

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