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

TOMOYO Linux Cross Reference
Linux/arch/arm/kernel/psci_smp.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/arm/kernel/psci_smp.c (Architecture m68k) and /arch/i386/kernel/psci_smp.c (Architecture i386)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  *                                                
  4  * Copyright (C) 2012 ARM Limited                 
  5  *                                                
  6  * Author: Will Deacon <will.deacon@arm.com>      
  7  */                                               
  8                                                   
  9 #include <linux/init.h>                           
 10 #include <linux/smp.h>                            
 11 #include <linux/of.h>                             
 12 #include <linux/delay.h>                          
 13 #include <linux/psci.h>                           
 14                                                   
 15 #include <uapi/linux/psci.h>                      
 16                                                   
 17 #include <asm/psci.h>                             
 18 #include <asm/smp_plat.h>                         
 19                                                   
 20 /*                                                
 21  * psci_smp assumes that the following is true    
 22  *                                                
 23  * cpu_suspend   Suspend the execution on a CP    
 24  * @state        we don't currently describe a    
 25  * @entry_point  the first instruction to be e    
 26  * returns 0  success, < 0 on failure             
 27  *                                                
 28  * cpu_off       Power down a CPU                 
 29  * @state        we don't currently describe a    
 30  * no return on successful call                   
 31  *                                                
 32  * cpu_on        Power up a CPU                   
 33  * @cpuid        cpuid of target CPU, as from     
 34  * @entry_point  the first instruction to be e    
 35  * returns 0  success, < 0 on failure             
 36  *                                                
 37  * migrate       Migrate the context to a diff    
 38  * @cpuid        cpuid of target CPU, as from     
 39  * returns 0  success, < 0 on failure             
 40  *                                                
 41  */                                               
 42                                                   
 43 extern void secondary_startup(void);              
 44                                                   
 45 static int psci_boot_secondary(unsigned int cp    
 46 {                                                 
 47         if (psci_ops.cpu_on)                      
 48                 return psci_ops.cpu_on(cpu_log    
 49                                         virt_t    
 50         return -ENODEV;                           
 51 }                                                 
 52                                                   
 53 #ifdef CONFIG_HOTPLUG_CPU                         
 54 static int psci_cpu_disable(unsigned int cpu)     
 55 {                                                 
 56         /* Fail early if we don't have CPU_OFF    
 57         if (!psci_ops.cpu_off)                    
 58                 return -EOPNOTSUPP;               
 59                                                   
 60         /* Trusted OS will deny CPU_OFF */        
 61         if (psci_tos_resident_on(cpu))            
 62                 return -EPERM;                    
 63                                                   
 64         return 0;                                 
 65 }                                                 
 66                                                   
 67 static void psci_cpu_die(unsigned int cpu)        
 68 {                                                 
 69         u32 state = PSCI_POWER_STATE_TYPE_POWE    
 70                     PSCI_0_2_POWER_STATE_TYPE_    
 71                                                   
 72         if (psci_ops.cpu_off)                     
 73                 psci_ops.cpu_off(state);          
 74                                                   
 75         /* We should never return */              
 76         panic("psci: cpu %d failed to shutdown    
 77 }                                                 
 78                                                   
 79 static int psci_cpu_kill(unsigned int cpu)        
 80 {                                                 
 81         int err, i;                               
 82                                                   
 83         if (!psci_ops.affinity_info)              
 84                 return 1;                         
 85         /*                                        
 86          * cpu_kill could race with cpu_die an    
 87          * potentially end up declaring this c    
 88          * while it is dying. So, try again a     
 89          */                                       
 90                                                   
 91         for (i = 0; i < 10; i++) {                
 92                 err = psci_ops.affinity_info(c    
 93                 if (err == PSCI_0_2_AFFINITY_L    
 94                         pr_info("CPU%d killed.    
 95                         return 1;                 
 96                 }                                 
 97                                                   
 98                 msleep(10);                       
 99                 pr_info("Retrying again to che    
100         }                                         
101                                                   
102         pr_warn("CPU%d may not have shut down     
103                         cpu, err);                
104         /* Make platform_cpu_kill() fail. */      
105         return 0;                                 
106 }                                                 
107                                                   
108 #endif                                            
109                                                   
110 bool __init psci_smp_available(void)              
111 {                                                 
112         /* is cpu_on available at least? */       
113         return (psci_ops.cpu_on != NULL);         
114 }                                                 
115                                                   
116 const struct smp_operations psci_smp_ops __ini    
117         .smp_boot_secondary     = psci_boot_se    
118 #ifdef CONFIG_HOTPLUG_CPU                         
119         .cpu_disable            = psci_cpu_dis    
120         .cpu_die                = psci_cpu_die    
121         .cpu_kill               = psci_cpu_kil    
122 #endif                                            
123 };                                                
124                                                   

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