irqchip/sifive-plic: Respect mask state when setting affinity
Subsystems (3)
PATCH v2 1/1 irqchip/sifive-plic: Respect mask state when setting affinity
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.
---
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(-)
drivers/irqchip/irq-sifive-plic.c +4 -2
@@ -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
Quoted 11 lines · Inochi Amaoto
The
plic_set_affinityalways callplic_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 <[email protected]>Signed-off-by Inochi Amaoto <[email protected]>Reviewed-by Nam Cao <[email protected]>
It is recommended to add the following email link about the relevant discussion in the commit message for quich reference when there is a revision or merge:
https://lore.kernel.org/lkml/[email protected]/
Quoted 37 lines
---
Change from v1:
1. apply Nam's tag
2. remove unnecessary off-topic change inplic_irq_disable()--- drivers/irqchip/irq-sifive-plic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/irqchip/irq-sifive-plic.c +4
-3@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Hi, Thomas, will you merge this? I see you have picked another related patchset [1].
Thanks,
Chen
Quoted 48 lines · Inochi Amaoto
The
plic_set_affinityalways callplic_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 <[email protected]>Signed-off-by Inochi Amaoto <[email protected]>Reviewed-by Nam Cao <[email protected]>---
Change from v1:
1. apply Nam's tag
2. remove unnecessary off-topic change inplic_irq_disable()--- drivers/irqchip/irq-sifive-plic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/irqchip/irq-sifive-plic.c +4
-3@@ -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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
The following commit has been merged into the irq/drivers branch of tip:
The following commit has been merged into the irq/drivers branch of tip:
Commit-ID: adecf78df945f4c7a1d29111b0002827f487df51 Gitweb: https://git.kernel.org/tip/adecf78df945f4c7a1d29111b0002827f487df51 Author: Inochi Amaoto <[email protected]> AuthorDate: Mon, 11 Aug 2025 08:26:32 +08:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Sun, 24 Aug 2025 12:20:18 +02:00
irqchip/sifive-plic: Respect mask state when setting affinity
plic_set_affinity() always calls plic_irq_enable(), which clears up the priority setting even the interrupt is only masked. This unmasks the interrupt unexpectly.
Replace the plic_irq_enable/disable() with plic_irq_toggle() to avoid changing the priority setting.
--- drivers/irqchip/irq-sifive-plic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +4 -2
@@ -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 ; }