linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] irqchip/sifive-plic: Respect mask state when setting affinity
@ 2025-08-11  0:26 Inochi Amaoto
  2025-08-21  6:37 ` Chen Wang
  2025-08-24  0:40 ` Chen Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Inochi Amaoto @ 2025-08-11  0:26 UTC (permalink / raw)
  To: Thomas Gleixner, Paul Walmsley, Samuel Holland
  Cc: Inochi Amaoto, linux-kernel, linux-riscv, Yixun Lan, Longbin Li,
	Nam Cao

The plic_set_affinity always call plic_irq_enable(), which clears up
the priority setting even the irq is only masked. This make the irq
unmasked unexpectly.

Replace the plic_irq_enable/disable() with plic_irq_toggle() to
avoid changing priority setting.

Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Tested-by: Nam Cao <namcao@linutronix.de> # VisionFive 2
---
Change from v1:
1. apply Nam's tag
2. remove unnecessary off-topic change in plic_irq_disable()
---
 drivers/irqchip/irq-sifive-plic.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index bf69a4802b71..866e38612b94 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -179,12 +179,14 @@ static int plic_set_affinity(struct irq_data *d,
 	if (cpu >= nr_cpu_ids)
 		return -EINVAL;

-	plic_irq_disable(d);
+	/* Invalidate the original routing entry */
+	plic_irq_toggle(irq_data_get_effective_affinity_mask(d), d, 0);

 	irq_data_update_effective_affinity(d, cpumask_of(cpu));

+	/* Setting the new routing entry if irq is enabled */
 	if (!irqd_irq_disabled(d))
-		plic_irq_enable(d);
+		plic_irq_toggle(irq_data_get_effective_affinity_mask(d), d, 1);

 	return IRQ_SET_MASK_OK_DONE;
 }
--
2.50.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-24  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-11  0:26 [PATCH v2] irqchip/sifive-plic: Respect mask state when setting affinity Inochi Amaoto
2025-08-21  6:37 ` Chen Wang
2025-08-24  0:40 ` Chen Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).