Skip to content

Commit 1b57d91

Browse files
Valentin SchneiderMarc Zyngier
authored andcommitted
irqchip/gic-v2, v3: Prevent SW resends entirely
The GIC irqchips can now use a HW resend when a retrigger is invoked by check_irq_resend(). However, should the HW resend fail, check_irq_resend() will still attempt to trigger a SW resend, which is still a bad idea for the GICs. Prevent this from happening by setting IRQD_HANDLE_ENFORCE_IRQCTX on all GIC IRQs. Technically per-cpu IRQs do not need this, as their flow handlers never set IRQS_PENDING, but this aligns all IRQs wrt context enforcement: this also forces all GIC IRQ handling to happen in IRQ context (as defined by in_irq()). Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20200730170321.31228-3-valentin.schneider@arm.com
1 parent 5f774f5 commit 1b57d91

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎drivers/irqchip/irq-gic-v3.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,7 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
12791279
irq_hw_number_t hw)
12801280
{
12811281
struct irq_chip *chip = &gic_chip;
1282+
struct irq_data *irqd = irq_desc_get_irq_data(irq_to_desc(irq));
12821283

12831284
if (static_branch_likely(&supports_deactivate_key))
12841285
chip = &gic_eoimode1_chip;
@@ -1296,7 +1297,7 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
12961297
irq_domain_set_info(d, irq, hw, chip, d->host_data,
12971298
handle_fasteoi_irq, NULL, NULL);
12981299
irq_set_probe(irq);
1299-
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
1300+
irqd_set_single_target(irqd);
13001301
break;
13011302

13021303
case LPI_RANGE:
@@ -1310,6 +1311,8 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
13101311
return -EPERM;
13111312
}
13121313

1314+
/* Prevents SW retriggers which mess up the ACK/EOI ordering */
1315+
irqd_set_handle_enforce_irqctx(irqd);
13131316
return 0;
13141317
}
13151318

‎drivers/irqchip/irq-gic.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
975975
irq_hw_number_t hw)
976976
{
977977
struct gic_chip_data *gic = d->host_data;
978+
struct irq_data *irqd = irq_desc_get_irq_data(irq_to_desc(irq));
978979

979980
if (hw < 32) {
980981
irq_set_percpu_devid(irq);
@@ -984,8 +985,11 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
984985
irq_domain_set_info(d, irq, hw, &gic->chip, d->host_data,
985986
handle_fasteoi_irq, NULL, NULL);
986987
irq_set_probe(irq);
987-
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
988+
irqd_set_single_target(irqd);
988989
}
990+
991+
/* Prevents SW retriggers which mess up the ACK/EOI ordering */
992+
irqd_set_handle_enforce_irqctx(irqd);
989993
return 0;
990994
}
991995

0 commit comments

Comments
 (0)