Skip to content

Commit c7cad38

Browse files
ffainelliKAGA-KOKO
authored andcommitted
irqchip/irq-brcmstb-l2: Avoid saving mask on shutdown
The interrupt controller shutdown path does not need to save the mask of enabled interrupts because the next state the system is going to be in is akin to a cold boot, or a kexec'd kernel. Saving the mask only makes sense if the software state needs to preserve the hardware state across a system suspend/resume cycle. As an optimization, and given that there are systems with dozens of such interrupt controller, save a "slow" memory mapped I/O read in the shutdown path where no saving/restoring is required. Reported-by: Tim Ross <tim.ross@broadcom.com> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240424175732.1526531-1-florian.fainelli@broadcom.com
1 parent 6678ae1 commit c7cad38

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

drivers/irqchip/irq-brcmstb-l2.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static void brcmstb_l2_intc_irq_handle(struct irq_desc *desc)
118118
chained_irq_exit(chip, desc);
119119
}
120120

121-
static void brcmstb_l2_intc_suspend(struct irq_data *d)
121+
static void __brcmstb_l2_intc_suspend(struct irq_data *d, bool save)
122122
{
123123
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
124124
struct irq_chip_type *ct = irq_data_get_chip_type(d);
@@ -127,7 +127,8 @@ static void brcmstb_l2_intc_suspend(struct irq_data *d)
127127

128128
irq_gc_lock_irqsave(gc, flags);
129129
/* Save the current mask */
130-
b->saved_mask = irq_reg_readl(gc, ct->regs.mask);
130+
if (save)
131+
b->saved_mask = irq_reg_readl(gc, ct->regs.mask);
131132

132133
if (b->can_wake) {
133134
/* Program the wakeup mask */
@@ -137,6 +138,16 @@ static void brcmstb_l2_intc_suspend(struct irq_data *d)
137138
irq_gc_unlock_irqrestore(gc, flags);
138139
}
139140

141+
static void brcmstb_l2_intc_shutdown(struct irq_data *d)
142+
{
143+
__brcmstb_l2_intc_suspend(d, false);
144+
}
145+
146+
static void brcmstb_l2_intc_suspend(struct irq_data *d)
147+
{
148+
__brcmstb_l2_intc_suspend(d, true);
149+
}
150+
140151
static void brcmstb_l2_intc_resume(struct irq_data *d)
141152
{
142153
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
@@ -252,7 +263,7 @@ static int __init brcmstb_l2_intc_of_init(struct device_node *np,
252263

253264
ct->chip.irq_suspend = brcmstb_l2_intc_suspend;
254265
ct->chip.irq_resume = brcmstb_l2_intc_resume;
255-
ct->chip.irq_pm_shutdown = brcmstb_l2_intc_suspend;
266+
ct->chip.irq_pm_shutdown = brcmstb_l2_intc_shutdown;
256267

257268
if (data->can_wake) {
258269
/* This IRQ chip can wake the system, set all child interrupts

0 commit comments

Comments
 (0)