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

TOMOYO Linux Cross Reference
Linux/arch/arm/common/vlock.S

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/arm/common/vlock.S (Version linux-6.11.5) and /arch/sparc64/common/vlock.S (Version linux-5.13.19)


  1 /* SPDX-License-Identifier: GPL-2.0-only */       
  2 /*                                                
  3  * vlock.S - simple voting lock implementation    
  4  *                                                
  5  * Created by:  Dave Martin, 2012-08-16           
  6  * Copyright:   (C) 2012-2013  Linaro Limited     
  7  *                                                
  8  * This algorithm is described in more detail     
  9  * Documentation/arch/arm/vlocks.rst.             
 10  */                                               
 11                                                   
 12 #include <linux/linkage.h>                        
 13 #include "vlock.h"                                
 14                                                   
 15 .arch armv7-a                                     
 16                                                   
 17 /* Select different code if voting flags  can     
 18 #if VLOCK_VOTING_SIZE > 4                         
 19 #define FEW(x...)                                 
 20 #define MANY(x...) x                              
 21 #else                                             
 22 #define FEW(x...) x                               
 23 #define MANY(x...)                                
 24 #endif                                            
 25                                                   
 26 @ voting lock for first-man coordination          
 27                                                   
 28 .macro voting_begin rbase:req, rcpu:req, rscra    
 29         mov     \rscratch, #1                     
 30         strb    \rscratch, [\rbase, \rcpu]        
 31         dmb                                       
 32 .endm                                             
 33                                                   
 34 .macro voting_end rbase:req, rcpu:req, rscratc    
 35         dmb                                       
 36         mov     \rscratch, #0                     
 37         strb    \rscratch, [\rbase, \rcpu]        
 38         dsb     st                                
 39         sev                                       
 40 .endm                                             
 41                                                   
 42 /*                                                
 43  * The vlock structure must reside in Strongly    
 44  * This implementation deliberately eliminates    
 45  * would be required for other memory types, a    
 46  * writes to neighbouring locations within a c    
 47  * with one another.                              
 48  */                                               
 49                                                   
 50 @ r0: lock structure base                         
 51 @ r1: CPU ID (0-based index within cluster)       
 52 ENTRY(vlock_trylock)                              
 53         add     r1, r1, #VLOCK_VOTING_OFFSET      
 54                                                   
 55         voting_begin    r0, r1, r2                
 56                                                   
 57         ldrb    r2, [r0, #VLOCK_OWNER_OFFSET]     
 58         cmp     r2, #VLOCK_OWNER_NONE             
 59         bne     trylock_fail                      
 60                                                   
 61         @ Control dependency implies strb not     
 62                                                   
 63         strb    r1, [r0, #VLOCK_OWNER_OFFSET]     
 64                                                   
 65         voting_end      r0, r1, r2                
 66                                                   
 67         @ Wait for the current round of voting    
 68                                                   
 69  MANY(  mov     r3, #VLOCK_VOTING_OFFSET          
 70 0:                                                
 71  MANY(  ldr     r2, [r0, r3]                      
 72  FEW(   ldr     r2, [r0, #VLOCK_VOTING_OFFSET]    
 73         cmp     r2, #0                            
 74         wfene                                     
 75         bne     0b                                
 76  MANY(  add     r3, r3, #4                        
 77  MANY(  cmp     r3, #VLOCK_VOTING_OFFSET + VLO    
 78  MANY(  bne     0b                                
 79                                                   
 80         @ Check who won:                          
 81                                                   
 82         dmb                                       
 83         ldrb    r2, [r0, #VLOCK_OWNER_OFFSET]     
 84         eor     r0, r1, r2                        
 85         bx      lr                                
 86                                                   
 87 trylock_fail:                                     
 88         voting_end      r0, r1, r2                
 89         mov     r0, #1                            
 90         bx      lr                                
 91 ENDPROC(vlock_trylock)                            
 92                                                   
 93 @ r0: lock structure base                         
 94 ENTRY(vlock_unlock)                               
 95         dmb                                       
 96         mov     r1, #VLOCK_OWNER_NONE             
 97         strb    r1, [r0, #VLOCK_OWNER_OFFSET]     
 98         dsb     st                                
 99         sev                                       
100         bx      lr                                
101 ENDPROC(vlock_unlock)                             
                                                      

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