Skip to content

Commit 826da77

Browse files
committed
genirq: Provide IRQCHIP_AFFINITY_PRE_STARTUP
X86 IO/APIC and MSI interrupts (when used without interrupts remapping) require that the affinity setup on startup is done before the interrupt is enabled for the first time as the non-remapped operation mode cannot safely migrate enabled interrupts from arbitrary contexts. Provide a new irq chip flag which allows affected hardware to request this. This has to be opt-in because there have been reports in the past that some interrupt chips cannot handle affinity setting before startup. Fixes: 1840475 ("genirq: Expose default irq affinity mask (take 3)") Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Marc Zyngier <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 77e89af commit 826da77

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

include/linux/irq.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ struct irq_chip {
569569
* IRQCHIP_SUPPORTS_NMI: Chip can deliver NMIs, only for root irqchips
570570
* IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND: Invokes __enable_irq()/__disable_irq() for wake irqs
571571
* in the suspend path if they are in disabled state
572+
* IRQCHIP_AFFINITY_PRE_STARTUP: Default affinity update before startup
572573
*/
573574
enum {
574575
IRQCHIP_SET_TYPE_MASKED = (1 << 0),
@@ -581,6 +582,7 @@ enum {
581582
IRQCHIP_SUPPORTS_LEVEL_MSI = (1 << 7),
582583
IRQCHIP_SUPPORTS_NMI = (1 << 8),
583584
IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = (1 << 9),
585+
IRQCHIP_AFFINITY_PRE_STARTUP = (1 << 10),
584586
};
585587

586588
#include <linux/irqdesc.h>

kernel/irq/chip.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,11 @@ int irq_startup(struct irq_desc *desc, bool resend, bool force)
265265
} else {
266266
switch (__irq_startup_managed(desc, aff, force)) {
267267
case IRQ_STARTUP_NORMAL:
268+
if (d->chip->flags & IRQCHIP_AFFINITY_PRE_STARTUP)
269+
irq_setup_affinity(desc);
268270
ret = __irq_startup(desc);
269-
irq_setup_affinity(desc);
271+
if (!(d->chip->flags & IRQCHIP_AFFINITY_PRE_STARTUP))
272+
irq_setup_affinity(desc);
270273
break;
271274
case IRQ_STARTUP_MANAGED:
272275
irq_do_set_affinity(d, aff, false);

0 commit comments

Comments
 (0)