Skip to contentSkip to conversation

riscv: smp: Invoke cpu_ops->cpu_stop() in ipi_stop() for hotplug

PATCH New Guo Ren 1 participant 1 message Jul 1

Subsystems (2)
lore
Share & tools
lore

Guo Ren

author
#0 lore raw

PATCH 1/1 riscv: smp: Invoke cpu_ops->cpu_stop() in ipi_stop() for hotplug

From: "Guo Ren (Alibaba DAMO Academy)" <[email protected]>

When a CPU receives an IPI stop during hotplug teardown, the platform-specific cpu_stop() callback should be called before spinning in wait_for_interrupt(), so that firmware (e.g. SBI HSM) is notified that the hart has stopped.

This aligns ipi_stop() with the existing behavior of ipi_cpu_crash_stop(), which already calls cpu_ops[cpu]->cpu_stop() under CONFIG_HOTPLUG_CPU.

---
 arch/riscv/kernel/smp.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/riscv/kernel/smp.c +6 -0
index fa66f9c97d74..95aa11a0e590 100644
@@ -82,6 +82,12 @@ int riscv_hartid_to_cpuid(unsigned long hartid)
 static void ipi_stop(void)
 {
 	set_cpu_online(smp_processor_id(), false);
+
+#ifdef CONFIG_HOTPLUG_CPU
+	if (cpu_has_hotplug(cpu))
+		cpu_ops->cpu_stop();
+#endif
+
 	while (1)
 		wait_for_interrupt();
 }
Signature · 1 line
2.43.0