Patch "irqchip/sifive-plic: Cache the interrupt enable state" has been added to the 6.12-stable tree
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi All—
Quoted 8 lines · Sasha Levin
This is a note to let you know that I've just added the patch titled
irqchip/sifive-plic: Cache the interrupt enable state
to the 6.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
Quoted 6 lines
The filename of the patch is:
irqchip-sifive-plic-cache-the-interrupt-enable-state.patch
and it can be found in the queue-6.12 subdirectory.If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Same concern as 6.18 stable—this patch makes quite substantial changes to the driver. I don't think it makes sense for stable.
Quoted 23 lines
commit
93c071c13839d60f69c7dbd6b1857d3b8d13c433Author: Charles Mirabile <[email protected]> Date: Fri Oct 24 09:36:42 2025 +0100irqchip/sifive-plic: Cache the interrupt enable state
[ Upstream commit
14ff9e54dd14339776afff78e2d29e0edb3a4402]Optimize the PLIC driver by maintaining the interrupt enable state in the handler's
enable_savearray during normal operation rather than only during suspend/resume. This eliminates the need to read enable registers during suspend and makes the enable state immediately available for other purposes.Let
__plic_toggle()update both the hardware registers and the cachedenable_savestate atomically within the existingenable_lockprotection.That allows to remove the suspend-time enable register reading since
handler::enable_savenow always reflects the current state.
Quoted 7 lines
[ tglx: Massaged change log ]
Signed-off-by Charles Mirabile <[email protected]>Signed-off-by Lucas Zampieri <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>Stable-dep-of:
0f214e5bbee5("irqchip/sifive-plic: Avoid signed shift in interrupt enable mask")
Consider this altnernative version of 0f214e5bbee5 ("irqchip/sifive-plic: Avoid signed shift in interrupt enable mask") which applies on v6.12.118
(quoted diff) +0 -0
b/drivers/irqchip/irq-sifive-plic.c
index d57e9b25d0b4d..b061062f47c58 100644
drivers/irqchip/irq-sifive-plic.c +0 -0
@@ -97,7 +97,7 @@ static int plic_irq_set_type(struct irq_data *d,
unsigned int type);
static void __plic_toggle(void __iomem *enable_base, int hwirq, int enable) {
u32 __iomem *reg = enable_base + (hwirq / 32) * sizeof(u32);
- u32 hwirq_mask = 1 << (hwirq % 32);
+ u32 hwirq_mask = BIT(hwirq % 32);
if (enable) writel(readl(reg) | hwirq_mask, reg);
Again, forgive me that it is not a proper patch for git am, it is a one line diff.
Quoted 68 lines
Signed-off-by Sasha Levin <[email protected]>drivers/irqchip/irq-sifive-plic.c +13
-16@@ -94,15 +94,22 @@ static DEFINE_PER_CPU(struct plic_handler, plic_handlers);static int plic_irq_set_type (struct irq_data *d,unsigned int type); -static void __plic_toggle (void __iomem *enable_base,int hwirq,int enable) +static void __plic_toggle (struct plic_handler *handler,int hwirq,int enable) { -u32 __iomem *reg = enable_base + (hwirq /32 ) *sizeof (u32); +u32 __iomem *base = handler->enable_base;u32 hwirq_mask =1 << (hwirq %32 ); +int group = hwirq /32 ; +u32 value; + + value =readl (base + group);if (enable) -writel (readl (reg) | hwirq_mask, reg); + value |= hwirq_mask;else -writel (readl (reg) & ~hwirq_mask, reg); + value &= ~hwirq_mask; + + handler->enable_save[group] = value; +writel (value, base + group); }static void plic_toggle (struct plic_handler *handler,int hwirq,int enable)@@ -110,7 +117,7 @@ static void plic_toggle(struct plic_handler *handler, int hwirq, int enable)unsigned long flags;raw_spin_lock_irqsave (&handler->enable_lock, flags); -__plic_toggle (handler->enable_base, hwirq, enable); +__plic_toggle (handler, hwirq, enable);raw_spin_unlock_irqrestore (&handler->enable_lock, flags); }@@ -252,33 +259,16 @@ static int plic_irq_set_type(struct irq_data *d, unsigned int type)static int plic_irq_suspend (void *data) { -unsigned int i, cpu; -unsigned long flags; -u32 __iomem *reg;struct plic_priv *priv; priv =per_cpu_ptr (&plic_handlers,smp_processor_id ())->priv;/* irq ID 0 is reserved */ -for (i =1 ; i < priv->nr_irqs; i++) { +for (unsigned int i =1 ; i < priv->nr_irqs; i++) {__assign_bit (i, priv->prio_save,readl (priv->regs +PRIORITY_BASE + i *PRIORITY_PER_ID )); } -for_each_present_cpu (cpu) { -struct plic_handler *handler =per_cpu_ptr (&plic_handlers, cpu); - -if (!handler->present) -continue ; - -raw_spin_lock_irqsave (&handler->enable_lock, flags);
drivers/irqchip/irq-sifive-plic.c static int plic_irq_set_type(struct irq_data *d, unsigned int type) · line 274
Quoted 10 lines
drivers/irqchip/irq-sifive-plic.c +0
-7-for (i =0 ; i <DIV_ROUND_UP (priv->nr_irqs,32 ); i++) { - reg = handler->enable_base + i *sizeof (u32); - handler->enable_save[i] =readl (reg); - } -raw_spin_unlock_irqrestore (&handler->enable_lock, flags); - } -return 0 ; }
Best—Charlie