Skip to content

Commit 244e9a8

Browse files
Sticklyman1936timothy-hayes
authored andcommitted
irqchip/gic-v5: Skip deactivate for forwarded PPI interrupts
If a PPI interrupt is forwarded to a guest, skip the deactivate and only EOI. Rely on the guest deactivating both the virtual and physical interrupts (due to ICH_LRx_EL2.HW being set) later on as part of handling the injected interrupt. This mimics the behaviour seen on native GICv3. This is part of adding support for the GICv3 compatibility mode on a GICv5 host. Reviewed-by: Lorenzo Pieralisi <[email protected]> Co-authored-by: Timothy Hayes <[email protected]> Signed-off-by: Timothy Hayes <[email protected]> Signed-off-by: Sascha Bischoff <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 53bb952 commit 244e9a8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/irqchip/irq-gic-v5.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,12 @@ static void gicv5_hwirq_eoi(u32 hwirq_id, u8 hwirq_type)
222222

223223
static void gicv5_ppi_irq_eoi(struct irq_data *d)
224224
{
225+
/* Skip deactivate for forwarded PPI interrupts */
226+
if (irqd_is_forwarded_to_vcpu(d)) {
227+
gic_insn(0, CDEOI);
228+
return;
229+
}
230+
225231
gicv5_hwirq_eoi(d->hwirq, GICV5_HWIRQ_TYPE_PPI);
226232
}
227233

@@ -503,13 +509,24 @@ static bool gicv5_ppi_irq_is_level(irq_hw_number_t hwirq)
503509
return !!(read_ppi_sysreg_s(hwirq, PPI_HM) & bit);
504510
}
505511

512+
static int gicv5_ppi_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu)
513+
{
514+
if (vcpu)
515+
irqd_set_forwarded_to_vcpu(d);
516+
else
517+
irqd_clr_forwarded_to_vcpu(d);
518+
519+
return 0;
520+
}
521+
506522
static const struct irq_chip gicv5_ppi_irq_chip = {
507523
.name = "GICv5-PPI",
508524
.irq_mask = gicv5_ppi_irq_mask,
509525
.irq_unmask = gicv5_ppi_irq_unmask,
510526
.irq_eoi = gicv5_ppi_irq_eoi,
511527
.irq_get_irqchip_state = gicv5_ppi_irq_get_irqchip_state,
512528
.irq_set_irqchip_state = gicv5_ppi_irq_set_irqchip_state,
529+
.irq_set_vcpu_affinity = gicv5_ppi_irq_set_vcpu_affinity,
513530
.flags = IRQCHIP_SKIP_SET_WAKE |
514531
IRQCHIP_MASK_ON_SUSPEND,
515532
};

0 commit comments

Comments
 (0)