Skip to contentSkip to conversation

powerpc: Fixes to allow pseries to build for HOTPLUG_CPU=n

RFC PATCH New Paul E. McKenney 1 participant 1 message Feb 28, 2010 PowerPC

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 powerpc: Fixes to allow pseries to build for HOTPLUG_CPU=n

Building for a pseries machine with HOTPLUG_CPU=n on 2.6.33 gives the following build errors:

arch/powerpc/platforms/built-in.o: In function `.smp_xics_setup_cpu':
smp.c:(.devinit.text+0x8c): undefined reference to .set_cpu_current_state' smp.c:(.devinit.text+0x98): undefined reference to .set_default_offline_state' arch/powerpc/platforms/built-in.o: In function `.smp_pSeries_kick_cpu':
smp.c:(.devinit.text+0x13c): undefined reference to .get_cpu_current_state' smp.c:(.devinit.text+0x1c4): undefined reference to .set_preferred_offline_state' smp.c:(.devinit.text+0x1d0): undefined reference to `.get_cpu_current_state'

This patch fixes this by providing empty (or nearly empty) functions for the HOTPLUG_CPU=n case. Passes moderate rcutorture testing.

---

 offline_states.h |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/powerpc/platforms/pseries/offline_states.h +30 -0
index 22574e0..195f9c7 100644
@@ -9,10 +9,40 @@ enum cpu_state_vals {
 	CPU_MAX_OFFLINE_STATES
 };
 
+#ifdef CONFIG_HOTPLUG_CPU
+
 extern enum cpu_state_vals get_cpu_current_state(int cpu);
 extern void set_cpu_current_state(int cpu, enum cpu_state_vals state);
 extern enum cpu_state_vals get_preferred_offline_state(int cpu);
 extern void set_preferred_offline_state(int cpu, enum cpu_state_vals state);
 extern void set_default_offline_state(int cpu);
+
+#else /* #ifdef CONFIG_HOTPLUG_CPU */
+
+static inline enum cpu_state_vals get_cpu_current_state(int cpu)
+{
+	return cpu_online(cpu) ? CPU_STATE_ONLINE : CPU_STATE_OFFLINE;
+}
+
+static inline void set_cpu_current_state(int cpu, enum cpu_state_vals state)
+{
+}
+
+static inline enum cpu_state_vals get_preferred_offline_state(int cpu)
+{
+	return CPU_STATE_OFFLINE;
+}
+
+static inline void set_preferred_offline_state(int cpu,
+					       enum cpu_state_vals state)
+{
+}
+
+static inline void set_default_offline_state(int cpu)
+{
+}
+
+#endif /* #else #ifdef CONFIG_HOTPLUG_CPU */
+
 extern int start_secondary(void);
 #endif