From: Guo Ren <guoren@kernel.org>
To: guoren@kernel.org
Cc: alex@ghiti.fr, aou@eecs.berkeley.edu, bigeasy@linutronix.de,
chenhuacai@loongson.cn, jelonek.jonas@gmail.com,
jiayuan.chen@linux.dev, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org, palmer@dabbelt.com,
pjw@kernel.org, rostedt@goodmis.org, samuel.holland@sifive.com,
stable@vger.kernel.org, tglx@kernel.org,
tsbogend@alpha.franken.de
Subject: [PATCH] riscv: smp: Invoke cpu_ops->cpu_stop() in ipi_stop() for hotplug
Date: Wed, 1 Jul 2026 03:13:22 +0000 [thread overview]
Message-ID: <20260701031322.1018667-1-guoren@kernel.org> (raw)
From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>
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.
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
---
arch/riscv/kernel/smp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c
index fa66f9c97d74..95aa11a0e590 100644
--- a/arch/riscv/kernel/smp.c
+++ b/arch/riscv/kernel/smp.c
@@ -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();
}
--
2.43.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
reply other threads:[~2026-07-01 3:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701031322.1018667-1-guoren@kernel.org \
--to=guoren@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=bigeasy@linutronix.de \
--cc=chenhuacai@loongson.cn \
--cc=jelonek.jonas@gmail.com \
--cc=jiayuan.chen@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=rostedt@goodmis.org \
--cc=samuel.holland@sifive.com \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox