* [PATCH] irqchip/sifive-plic: fix call to __plic_toggle in M-Mode code path
@ 2025-11-03 16:18 Charles Mirabile
2025-11-03 22:16 ` [tip: irq/core] irqchip/sifive-plic: Fix call to __plic_toggle() " tip-bot2 for Charles Mirabile
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Charles Mirabile @ 2025-11-03 16:18 UTC (permalink / raw)
To: linux-kernel
Cc: Charles Mirabile, linux-riscv, Lucas Zampieri, Samuel Holland,
Paul Walmsley, Thomas Gleixner, kernel test robot
The code path for M-Mode linux that disables interrupts for other contexts
was missed when refactoring __plic_toggle.
Since the new version caches updates to the state for the primary context,
its use in this codepath is no longer desireable even if it could be made
correct.
Replace the calls to __plic_toggle with a loop that simply disables all of
the interrupts in groups of 32 with a direct mmio write.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202510271316.AQM7gCCy-lkp@intel.com/
Fixes: 14ff9e54dd14 ("irqchip/sifive-plic: Cache the interrupt enable state")
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
---
drivers/irqchip/irq-sifive-plic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index cbd7697bc148..0de3003981f1 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -592,12 +592,12 @@ static int plic_probe(struct fwnode_handle *fwnode)
if (parent_hwirq != RV_IRQ_EXT) {
/* Disable S-mode enable bits if running in M-mode. */
if (IS_ENABLED(CONFIG_RISCV_M_MODE)) {
- void __iomem *enable_base = priv->regs +
+ u32 __iomem *enable_base = priv->regs +
CONTEXT_ENABLE_BASE +
i * CONTEXT_ENABLE_SIZE;
- for (hwirq = 1; hwirq <= nr_irqs; hwirq++)
- __plic_toggle(enable_base, hwirq, 0);
+ for (int j = 0; j <= nr_irqs / 32; j++)
+ writel(0, enable_base + j);
}
continue;
}
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: irq/core] irqchip/sifive-plic: Fix call to __plic_toggle() in M-Mode code path
2025-11-03 16:18 [PATCH] irqchip/sifive-plic: fix call to __plic_toggle in M-Mode code path Charles Mirabile
@ 2025-11-03 22:16 ` tip-bot2 for Charles Mirabile
2025-11-11 21:17 ` [tip: irq/drivers] " tip-bot2 for Charles Mirabile
2025-12-19 8:10 ` [PATCH] irqchip/sifive-plic: fix call to __plic_toggle " patchwork-bot+linux-riscv
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Charles Mirabile @ 2025-11-03 22:16 UTC (permalink / raw)
To: linux-tip-commits
Cc: kernel test robot, Charles Mirabile, Thomas Gleixner, x86,
linux-kernel, maz
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 3d02464f7b12d3244f2fbc210afcdd0cdb7da4f7
Gitweb: https://git.kernel.org/tip/3d02464f7b12d3244f2fbc210afcdd0cdb7da4f7
Author: Charles Mirabile <cmirabil@redhat.com>
AuthorDate: Mon, 03 Nov 2025 11:18:13 -05:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Mon, 03 Nov 2025 23:15:04 +01:00
irqchip/sifive-plic: Fix call to __plic_toggle() in M-Mode code path
The code path for M-Mode linux that disables interrupts for other contexts
was missed when refactoring __plic_toggle().
Since the new version caches updates to the state for the primary context,
its use in this codepath is no longer desireable even if it could be made
correct.
Replace the calls to __plic_toggle() with a loop that simply disables all
of the interrupts in groups of 32 with a direct mmio write.
Fixes: 14ff9e54dd14 ("irqchip/sifive-plic: Cache the interrupt enable state")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251103161813.2437427-1-cmirabil@redhat.com
Closes: https://lore.kernel.org/oe-kbuild-all/202510271316.AQM7gCCy-lkp@intel.com/
---
drivers/irqchip/irq-sifive-plic.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index cbd7697..39ea044 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -592,12 +592,11 @@ static int plic_probe(struct fwnode_handle *fwnode)
if (parent_hwirq != RV_IRQ_EXT) {
/* Disable S-mode enable bits if running in M-mode. */
if (IS_ENABLED(CONFIG_RISCV_M_MODE)) {
- void __iomem *enable_base = priv->regs +
- CONTEXT_ENABLE_BASE +
- i * CONTEXT_ENABLE_SIZE;
+ u32 __iomem *enable_base = priv->regs + CONTEXT_ENABLE_BASE +
+ i * CONTEXT_ENABLE_SIZE;
- for (hwirq = 1; hwirq <= nr_irqs; hwirq++)
- __plic_toggle(enable_base, hwirq, 0);
+ for (int j = 0; j <= nr_irqs / 32; j++)
+ writel(0, enable_base + j);
}
continue;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: irq/drivers] irqchip/sifive-plic: Fix call to __plic_toggle() in M-Mode code path
2025-11-03 16:18 [PATCH] irqchip/sifive-plic: fix call to __plic_toggle in M-Mode code path Charles Mirabile
2025-11-03 22:16 ` [tip: irq/core] irqchip/sifive-plic: Fix call to __plic_toggle() " tip-bot2 for Charles Mirabile
@ 2025-11-11 21:17 ` tip-bot2 for Charles Mirabile
2025-12-19 8:10 ` [PATCH] irqchip/sifive-plic: fix call to __plic_toggle " patchwork-bot+linux-riscv
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Charles Mirabile @ 2025-11-11 21:17 UTC (permalink / raw)
To: linux-tip-commits
Cc: kernel test robot, Charles Mirabile, Thomas Gleixner, x86, linux-kernel
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: a045359e72455c4fd178fbedbf398f8df7da97e7
Gitweb: https://git.kernel.org/tip/a045359e72455c4fd178fbedbf398f8df7da97e7
Author: Charles Mirabile <cmirabil@redhat.com>
AuthorDate: Mon, 03 Nov 2025 11:18:13 -05:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Tue, 11 Nov 2025 22:11:16 +01:00
irqchip/sifive-plic: Fix call to __plic_toggle() in M-Mode code path
The code path for M-Mode linux that disables interrupts for other contexts
was missed when refactoring __plic_toggle().
Since the new version caches updates to the state for the primary context,
its use in this codepath is no longer desireable even if it could be made
correct.
Replace the calls to __plic_toggle() with a loop that simply disables all
of the interrupts in groups of 32 with a direct mmio write.
Fixes: 14ff9e54dd14 ("irqchip/sifive-plic: Cache the interrupt enable state")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251103161813.2437427-1-cmirabil@redhat.com
Closes: https://lore.kernel.org/oe-kbuild-all/202510271316.AQM7gCCy-lkp@intel.com/
---
drivers/irqchip/irq-sifive-plic.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index c03340e..c5db7d6 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -679,12 +679,11 @@ static int plic_probe(struct fwnode_handle *fwnode)
if (parent_hwirq != RV_IRQ_EXT) {
/* Disable S-mode enable bits if running in M-mode. */
if (IS_ENABLED(CONFIG_RISCV_M_MODE)) {
- void __iomem *enable_base = priv->regs +
- CONTEXT_ENABLE_BASE +
- i * CONTEXT_ENABLE_SIZE;
+ u32 __iomem *enable_base = priv->regs + CONTEXT_ENABLE_BASE +
+ i * CONTEXT_ENABLE_SIZE;
- for (hwirq = 1; hwirq <= nr_irqs; hwirq++)
- __plic_toggle(enable_base, hwirq, 0);
+ for (int j = 0; j <= nr_irqs / 32; j++)
+ writel(0, enable_base + j);
}
continue;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] irqchip/sifive-plic: fix call to __plic_toggle in M-Mode code path
2025-11-03 16:18 [PATCH] irqchip/sifive-plic: fix call to __plic_toggle in M-Mode code path Charles Mirabile
2025-11-03 22:16 ` [tip: irq/core] irqchip/sifive-plic: Fix call to __plic_toggle() " tip-bot2 for Charles Mirabile
2025-11-11 21:17 ` [tip: irq/drivers] " tip-bot2 for Charles Mirabile
@ 2025-12-19 8:10 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-12-19 8:10 UTC (permalink / raw)
To: Charles Mirabile
Cc: linux-riscv, linux-kernel, lzampier, samuel.holland, pjw, tglx, lkp
Hello:
This patch was applied to riscv/linux.git (fixes)
by Thomas Gleixner <tglx@linutronix.de>:
On Mon, 3 Nov 2025 11:18:13 -0500 you wrote:
> The code path for M-Mode linux that disables interrupts for other contexts
> was missed when refactoring __plic_toggle.
>
> Since the new version caches updates to the state for the primary context,
> its use in this codepath is no longer desireable even if it could be made
> correct.
>
> [...]
Here is the summary with links:
- irqchip/sifive-plic: fix call to __plic_toggle in M-Mode code path
https://git.kernel.org/riscv/c/a045359e7245
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-19 8:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-03 16:18 [PATCH] irqchip/sifive-plic: fix call to __plic_toggle in M-Mode code path Charles Mirabile
2025-11-03 22:16 ` [tip: irq/core] irqchip/sifive-plic: Fix call to __plic_toggle() " tip-bot2 for Charles Mirabile
2025-11-11 21:17 ` [tip: irq/drivers] " tip-bot2 for Charles Mirabile
2025-12-19 8:10 ` [PATCH] irqchip/sifive-plic: fix call to __plic_toggle " patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome