All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip/sifive-plic: Respect mask state when setting affinity
@ 2025-08-07 11:18 ` Inochi Amaoto
  0 siblings, 0 replies; 12+ messages in thread
From: Inochi Amaoto @ 2025-08-07 11:18 UTC (permalink / raw)
  To: Thomas Gleixner, Paul Walmsley, Samuel Holland
  Cc: Inochi Amaoto, linux-kernel, linux-riscv, Yixun Lan, Longbin Li

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>
---
 drivers/irqchip/irq-sifive-plic.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index bf69a4802b71..5bf5050996da 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -148,6 +148,7 @@ static void plic_irq_enable(struct irq_data *d)
 
 static void plic_irq_disable(struct irq_data *d)
 {
+	plic_irq_mask(d);
 	plic_irq_toggle(irq_data_get_effective_affinity_mask(d), d, 0);
 }
 
@@ -179,12 +180,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] 12+ messages in thread

end of thread, other threads:[~2025-08-08  8:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 11:18 [PATCH] irqchip/sifive-plic: Respect mask state when setting affinity Inochi Amaoto
2025-08-07 11:18 ` Inochi Amaoto
2025-08-07 12:39 ` Nam Cao
2025-08-07 12:39   ` Nam Cao
2025-08-07 22:01   ` Inochi Amaoto
2025-08-07 22:01     ` Inochi Amaoto
2025-08-08  0:08     ` Inochi Amaoto
2025-08-08  0:08       ` Inochi Amaoto
2025-08-08  4:52       ` Nam Cao
2025-08-08  4:52         ` Nam Cao
2025-08-08  8:29         ` Inochi Amaoto
2025-08-08  8:29           ` Inochi Amaoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.