@@ -63,4 +63,6 @@ extern int cpu_read_ops(struct device_node *dn, int cpu,
const struct cpu_operations **cpu_ops);
extern void __init cpu_read_bootcpu_ops(void);
+void smp_spin_table_set_die(void (*fn)(unsigned int));
+
#endif /* ifndef __ASM_CPU_OPS_H */
@@ -153,7 +153,7 @@ static void smp_spin_table_cpu_die(unsigned int cpu)
cpu_relax();
}
-const struct cpu_operations smp_spin_table_ops = {
+struct cpu_operations smp_spin_table_ops = {
.name = "spin-table",
.cpu_init = smp_spin_table_cpu_init,
.cpu_prepare = smp_spin_table_cpu_prepare,
@@ -162,3 +162,9 @@ const struct cpu_operations smp_spin_table_ops = {
.cpu_disable = smp_spin_table_cpu_disable,
.cpu_die = smp_spin_table_cpu_die,
};
+
+void smp_spin_table_set_die(void (*fn)(unsigned int))
+{
+ BUG_ON(!fn);
+ smp_spin_table_ops.cpu_die = fn;
+}
Remove the const attribute from the smp_spin_table_ops instance in smp_spin_table.c and add the new routine smp_spin_table_set_die() which allows a custom cpu die method to be set in the smp_spin_table_ops instance. The ability to set a custom cpu die routine is needed by kexec to allow it to manage any secondary CPUs that need to be shut down as described in booting.txt. Signed-off-by: Geoff Levand <geoff@infradead.org> --- arch/arm64/include/asm/cpu_ops.h | 2 ++ arch/arm64/kernel/smp_spin_table.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-)