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

TOMOYO Linux Cross Reference
Linux/arch/arm64/kernel/sleep.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/arm64/kernel/sleep.S (Version linux-6.12-rc7) and /arch/i386/kernel/sleep.S (Version linux-5.4.285)


  1 /* SPDX-License-Identifier: GPL-2.0 */            
  2 #include <linux/errno.h>                          
  3 #include <linux/linkage.h>                        
  4 #include <asm/asm-offsets.h>                      
  5 #include <asm/assembler.h>                        
  6 #include <asm/smp.h>                              
  7                                                   
  8         .text                                     
  9 /*                                                
 10  * Implementation of MPIDR_EL1 hash algorithm     
 11  * and OR'ing.                                    
 12  *                                                
 13  * @dst: register containing hash result          
 14  * @rs0: register containing affinity level 0     
 15  * @rs1: register containing affinity level 1     
 16  * @rs2: register containing affinity level 2     
 17  * @rs3: register containing affinity level 3     
 18  * @mpidr: register containing MPIDR_EL1 value    
 19  * @mask: register containing MPIDR mask          
 20  *                                                
 21  * Pseudo C-code:                                 
 22  *                                                
 23  *u32 dst;                                        
 24  *                                                
 25  *compute_mpidr_hash(u32 rs0, u32 rs1, u32 rs2    
 26  *      u32 aff0, aff1, aff2, aff3;               
 27  *      u64 mpidr_masked = mpidr & mask;          
 28  *      aff0 = mpidr_masked & 0xff;               
 29  *      aff1 = mpidr_masked & 0xff00;             
 30  *      aff2 = mpidr_masked & 0xff0000;           
 31  *      aff3 = mpidr_masked & 0xff00000000;       
 32  *      dst = (aff0 >> rs0 | aff1 >> rs1 | aff    
 33  *}                                               
 34  * Input registers: rs0, rs1, rs2, rs3, mpidr,    
 35  * Output register: dst                           
 36  * Note: input and output registers must be di    
 37          (eg: a macro instance with mpidr = x1    
 38  */                                               
 39         .macro compute_mpidr_hash dst, rs0, rs    
 40         and     \mpidr, \mpidr, \mask             
 41         and     \dst, \mpidr, #0xff               
 42         lsr     \dst ,\dst, \rs0                  
 43         and     \mask, \mpidr, #0xff00            
 44         lsr     \mask ,\mask, \rs1                
 45         orr     \dst, \dst, \mask                 
 46         and     \mask, \mpidr, #0xff0000          
 47         lsr     \mask ,\mask, \rs2                
 48         orr     \dst, \dst, \mask                 
 49         and     \mask, \mpidr, #0xff00000000      
 50         lsr     \mask ,\mask, \rs3                
 51         orr     \dst, \dst, \mask                 
 52         .endm                                     
 53 /*                                                
 54  * Save CPU state in the provided sleep_stack_    
 55  * location for cpu_resume()'s use in sleep_sa    
 56  *                                                
 57  * cpu_resume() will restore this saved state,    
 58  * link-register is saved and restored, it wil    
 59  * function. So that the caller can tell the s    
 60  * __cpu_suspend_enter() will always return a     
 61  * path through cpu_resume() will return 0.       
 62  *                                                
 63  *  x0 = struct sleep_stack_data area             
 64  */                                               
 65 SYM_FUNC_START(__cpu_suspend_enter)               
 66         stp     x29, lr, [x0, #SLEEP_STACK_DAT    
 67         stp     x19, x20, [x0,#SLEEP_STACK_DAT    
 68         stp     x21, x22, [x0,#SLEEP_STACK_DAT    
 69         stp     x23, x24, [x0,#SLEEP_STACK_DAT    
 70         stp     x25, x26, [x0,#SLEEP_STACK_DAT    
 71         stp     x27, x28, [x0,#SLEEP_STACK_DAT    
 72                                                   
 73         /* save the sp in cpu_suspend_ctx */      
 74         mov     x2, sp                            
 75         str     x2, [x0, #SLEEP_STACK_DATA_SYS    
 76                                                   
 77         /* find the mpidr_hash */                 
 78         ldr_l   x1, sleep_save_stash              
 79         mrs     x7, mpidr_el1                     
 80         adr_l   x9, mpidr_hash                    
 81         ldr     x10, [x9, #MPIDR_HASH_MASK]       
 82         /*                                        
 83          * Following code relies on the struct    
 84          * members size.                          
 85          */                                       
 86         ldp     w3, w4, [x9, #MPIDR_HASH_SHIFT    
 87         ldp     w5, w6, [x9, #(MPIDR_HASH_SHIF    
 88         compute_mpidr_hash x8, x3, x4, x5, x6,    
 89         add     x1, x1, x8, lsl #3                
 90                                                   
 91         str     x0, [x1]                          
 92         add     x0, x0, #SLEEP_STACK_DATA_SYST    
 93         stp     x29, lr, [sp, #-16]!              
 94         bl      cpu_do_suspend                    
 95         ldp     x29, lr, [sp], #16                
 96         mov     x0, #1                            
 97         ret                                       
 98 SYM_FUNC_END(__cpu_suspend_enter)                 
 99                                                   
100         .pushsection ".idmap.text", "a"           
101 SYM_CODE_START(cpu_resume)                        
102         mov     x0, xzr                           
103         bl      init_kernel_el                    
104         mov     x19, x0                 // pre    
105         bl      __cpu_setup                       
106         /* enable the MMU early - so we can ac    
107         adrp    x1, swapper_pg_dir                
108         adrp    x2, idmap_pg_dir                  
109         bl      __enable_mmu                      
110         ldr     x8, =_cpu_resume                  
111         br      x8                                
112 SYM_CODE_END(cpu_resume)                          
113         .ltorg                                    
114         .popsection                               
115                                                   
116 SYM_FUNC_START(_cpu_resume)                       
117         mov     x0, x19                           
118         bl      finalise_el2                      
119                                                   
120         mrs     x1, mpidr_el1                     
121         adr_l   x8, mpidr_hash          // x8     
122                                                   
123         /* retrieve mpidr_hash members to comp    
124         ldr     x2, [x8, #MPIDR_HASH_MASK]        
125         ldp     w3, w4, [x8, #MPIDR_HASH_SHIFT    
126         ldp     w5, w6, [x8, #(MPIDR_HASH_SHIF    
127         compute_mpidr_hash x7, x3, x4, x5, x6,    
128                                                   
129         /* x7 contains hash index, let's use i    
130         ldr_l   x0, sleep_save_stash              
131         ldr     x0, [x0, x7, lsl #3]              
132         add     x29, x0, #SLEEP_STACK_DATA_CAL    
133         add     x0, x0, #SLEEP_STACK_DATA_SYST    
134         /* load sp from context */                
135         ldr     x2, [x0, #CPU_CTX_SP]             
136         mov     sp, x2                            
137         /*                                        
138          * cpu_do_resume expects x0 to contain    
139          */                                       
140         bl      cpu_do_resume                     
141                                                   
142 #if defined(CONFIG_KASAN) && defined(CONFIG_KA    
143         mov     x0, sp                            
144         bl      kasan_unpoison_task_stack_belo    
145 #endif                                            
146                                                   
147         ldp     x19, x20, [x29, #16]              
148         ldp     x21, x22, [x29, #32]              
149         ldp     x23, x24, [x29, #48]              
150         ldp     x25, x26, [x29, #64]              
151         ldp     x27, x28, [x29, #80]              
152         ldp     x29, lr, [x29]                    
153         mov     x0, #0                            
154         ret                                       
155 SYM_FUNC_END(_cpu_resume)                         
                                                      

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