Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc: Add smp_generic_cpu_bootable

Cell and PSeries both implemented their own versions of a
cpu_bootable smp_op which do the same thing (well, the PSeries
one has support for more than 2 threads). Copy the PSeries one
to generic code, and rename it smp_generic_cpu_bootable.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Andy Fleming and committed by
Benjamin Herrenschmidt
3cd85250 3b04c300

+24
+2
arch/powerpc/include/asm/smp.h
··· 186 186 extern int smp_mpic_probe(void); 187 187 extern void smp_mpic_setup_cpu(int cpu); 188 188 extern int smp_generic_kick_cpu(int nr); 189 + extern int smp_generic_cpu_bootable(unsigned int nr); 190 + 189 191 190 192 extern void smp_generic_give_timebase(void); 191 193 extern void smp_generic_take_timebase(void);
+22
arch/powerpc/kernel/smp.c
··· 81 81 82 82 static void (*crash_ipi_function_ptr)(struct pt_regs *) = NULL; 83 83 84 + /* 85 + * Returns 1 if the specified cpu should be brought up during boot. 86 + * Used to inhibit booting threads if they've been disabled or 87 + * limited on the command line 88 + */ 89 + int smp_generic_cpu_bootable(unsigned int nr) 90 + { 91 + /* Special case - we inhibit secondary thread startup 92 + * during boot if the user requests it. 93 + */ 94 + if (system_state == SYSTEM_BOOTING && cpu_has_feature(CPU_FTR_SMT)) { 95 + if (!smt_enabled_at_boot && cpu_thread_in_core(nr) != 0) 96 + return 0; 97 + if (smt_enabled_at_boot 98 + && cpu_thread_in_core(nr) >= smt_enabled_at_boot) 99 + return 0; 100 + } 101 + 102 + return 1; 103 + } 104 + 105 + 84 106 #ifdef CONFIG_PPC64 85 107 int smp_generic_kick_cpu(int nr) 86 108 {