diff options
Diffstat (limited to 'arch/arm64/include/asm/smp.h')
-rw-r--r-- | arch/arm64/include/asm/smp.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index 2013a4dc5124..1d3ff7e4a6c2 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h | |||
@@ -16,6 +16,19 @@ | |||
16 | #ifndef __ASM_SMP_H | 16 | #ifndef __ASM_SMP_H |
17 | #define __ASM_SMP_H | 17 | #define __ASM_SMP_H |
18 | 18 | ||
19 | /* Values for secondary_data.status */ | ||
20 | |||
21 | #define CPU_MMU_OFF (-1) | ||
22 | #define CPU_BOOT_SUCCESS (0) | ||
23 | /* The cpu invoked ops->cpu_die, synchronise it with cpu_kill */ | ||
24 | #define CPU_KILL_ME (1) | ||
25 | /* The cpu couldn't die gracefully and is looping in the kernel */ | ||
26 | #define CPU_STUCK_IN_KERNEL (2) | ||
27 | /* Fatal system error detected by secondary CPU, crash the system */ | ||
28 | #define CPU_PANIC_KERNEL (3) | ||
29 | |||
30 | #ifndef __ASSEMBLY__ | ||
31 | |||
19 | #include <linux/threads.h> | 32 | #include <linux/threads.h> |
20 | #include <linux/cpumask.h> | 33 | #include <linux/cpumask.h> |
21 | #include <linux/thread_info.h> | 34 | #include <linux/thread_info.h> |
@@ -54,11 +67,17 @@ asmlinkage void secondary_start_kernel(void); | |||
54 | 67 | ||
55 | /* | 68 | /* |
56 | * Initial data for bringing up a secondary CPU. | 69 | * Initial data for bringing up a secondary CPU. |
70 | * @stack - sp for the secondary CPU | ||
71 | * @status - Result passed back from the secondary CPU to | ||
72 | * indicate failure. | ||
57 | */ | 73 | */ |
58 | struct secondary_data { | 74 | struct secondary_data { |
59 | void *stack; | 75 | void *stack; |
76 | long status; | ||
60 | }; | 77 | }; |
78 | |||
61 | extern struct secondary_data secondary_data; | 79 | extern struct secondary_data secondary_data; |
80 | extern long __early_cpu_boot_status; | ||
62 | extern void secondary_entry(void); | 81 | extern void secondary_entry(void); |
63 | 82 | ||
64 | extern void arch_send_call_function_single_ipi(int cpu); | 83 | extern void arch_send_call_function_single_ipi(int cpu); |
@@ -77,5 +96,38 @@ extern int __cpu_disable(void); | |||
77 | 96 | ||
78 | extern void __cpu_die(unsigned int cpu); | 97 | extern void __cpu_die(unsigned int cpu); |
79 | extern void cpu_die(void); | 98 | extern void cpu_die(void); |
99 | extern void cpu_die_early(void); | ||
100 | |||
101 | static inline void cpu_park_loop(void) | ||
102 | { | ||
103 | for (;;) { | ||
104 | wfe(); | ||
105 | wfi(); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | static inline void update_cpu_boot_status(int val) | ||
110 | { | ||
111 | WRITE_ONCE(secondary_data.status, val); | ||
112 | /* Ensure the visibility of the status update */ | ||
113 | dsb(ishst); | ||
114 | } | ||
115 | |||
116 | /* | ||
117 | * If a secondary CPU enters the kernel but fails to come online, | ||
118 | * (e.g. due to mismatched features), and cannot exit the kernel, | ||
119 | * we increment cpus_stuck_in_kernel and leave the CPU in a | ||
120 | * quiesecent loop within the kernel text. The memory containing | ||
121 | * this loop must not be re-used for anything else as the 'stuck' | ||
122 | * core is executing it. | ||
123 | * | ||
124 | * This function is used to inhibit features like kexec and hibernate. | ||
125 | */ | ||
126 | bool cpus_are_stuck_in_kernel(void); | ||
127 | |||
128 | extern void smp_send_crash_stop(void); | ||
129 | extern bool smp_crash_stop_failed(void); | ||
130 | |||
131 | #endif /* ifndef __ASSEMBLY__ */ | ||
80 | 132 | ||
81 | #endif /* ifndef __ASM_SMP_H */ | 133 | #endif /* ifndef __ASM_SMP_H */ |