summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Hu <nick.hu@sifive.com>2025-02-19 19:41:35 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-05-29 11:02:14 +0200
commit7790a9449cf4391b664775d444657deb2fa06b48 (patch)
tree1602eced16cf30cc28c5e37467825b1b2dec8e29
parent39ff1903246aa5f47c5cf741c705d649623a7103 (diff)
clocksource/drivers/timer-riscv: Stop stimecmp when cpu hotplug
[ Upstream commit 70c93b026ed07078e933583591aa9ca6701cd9da ] Stop the timer when the cpu is going to be offline otherwise the timer interrupt may be pending while performing power-down. Suggested-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/lkml/20240829033904.477200-3-nick.hu@sifive.com/T/#u Signed-off-by: Nick Hu <nick.hu@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20250219114135.27764-3-nick.hu@sifive.com Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/clocksource/timer-riscv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c
index 48ce50c5f5e6..4d7cf338824a 100644
--- a/drivers/clocksource/timer-riscv.c
+++ b/drivers/clocksource/timer-riscv.c
@@ -126,7 +126,13 @@ static int riscv_timer_starting_cpu(unsigned int cpu)
static int riscv_timer_dying_cpu(unsigned int cpu)
{
+ /*
+ * Stop the timer when the cpu is going to be offline otherwise
+ * the timer interrupt may be pending while performing power-down.
+ */
+ riscv_clock_event_stop();
disable_percpu_irq(riscv_clock_event_irq);
+
return 0;
}