Skip to contentSkip to conversation

MIPS: SMP-CPS: fix build error when HOTPLUG_CPU not set

RFC PATCH Superseded Randy Dunlap 2 participants 2 messages Feb 17, 2023 MIPS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 MIPS: SMP-CPS: fix build error when HOTPLUG_CPU not set

When MIPS_CPS=y, MIPS_CPS_PM is not set, HOTPLUG_CPU is not set, and KEXEC=y, cps_shutdown_this_cpu() attempts to call cps_pm_enter_state(), which is not built when MIPS_CPS_PM is not set. Conditionally execute the else branch based on CONFIG_HOTPLUG_CPU to remove the build error.
This build failure is from a randconfig file.

mips-linux-ld: arch/mips/kernel/smp-cps.o: in function `$L162':
smp-cps.c:(.text.cps_kexec_nonboot_cpu+0x31c): undefined reference to `cps_pm_enter_state'

Fixes 1447864bee4c ("MIPS: kexec: CPS systems to halt nonboot CPUs")
Cc Dengcheng Zhu <[email protected]>
Cc Paul Burton <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
---
 arch/mips/kernel/smp-cps.c |    2 ++
 1 file changed, 2 insertions(+)
arch/mips/kernel/smp-cps.c +2 -0
diff -- a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c
@@ -424,9 +424,11 @@ static void cps_shutdown_this_cpu(enum c
 			wmb();
 		}
 	} else {
+#ifdef CONFIG_HOTPLUG_CPU
 		pr_debug("Gating power to core %d\n", core);
 		/* Power down the core */
 		cps_pm_enter_state(CPS_PM_POWER_GATED);
+#endif /* CONFIG_HOTPLUG_CPU */
 	}
 }
 
#1 lore raw
Quoted 24 lines · Randy Dunlap

When MIPS_CPS=y, MIPS_CPS_PM is not set, HOTPLUG_CPU is not set, and KEXEC=y, cps_shutdown_this_cpu() attempts to call cps_pm_enter_state(), which is not built when MIPS_CPS_PM is not set. Conditionally execute the else branch based on CONFIG_HOTPLUG_CPU to remove the build error.
This build failure is from a randconfig file.

mips-linux-ld: arch/mips/kernel/smp-cps.o: in function `$L162':
smp-cps.c:(.text.cps_kexec_nonboot_cpu+0x31c): undefined reference to `cps_pm_enter_state'

Fixes 1447864bee4c ("MIPS: kexec: CPS systems to halt nonboot CPUs")
Cc Dengcheng Zhu <[email protected]>
Cc Paul Burton <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
---
 arch/mips/kernel/smp-cps.c |    2 ++
 1 file changed, 2 insertions(+)

diff -- a/arch/mips/kernel/smp-cps.c b/arch/mips/kernel/smp-cps.c

arch/mips/kernel/smp-cps.c static void cps_shutdown_this_cpu(enum c · line 427

Quoted 4 lines
arch/mips/kernel/smp-cps.c +1 -0
@@ -424,9 +424,11 @@ static void cps_shutdown_this_cpu(enum c
 			wmb();
 		}
 	} else {
+#ifdef CONFIG_HOTPLUG_CPU

Perhaps, instead of #ifdef'ery, ude the following:

	} else if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) {

arch/mips/kernel/smp-cps.c static void cps_shutdown_this_cpu(enum c · line 434

Quoted 7 lines
arch/mips/kernel/smp-cps.c +1 -0
 		pr_debug("Gating power to core %d\n", core);
 		/* Power down the core */
 		cps_pm_enter_state(CPS_PM_POWER_GATED);
+#endif /* CONFIG_HOTPLUG_CPU */
 	}
 }
 

MBR, Sergey