Skip to content

Commit 21bbbc5

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
irqchip/gic-v3: Switch high priority PPIs over to handle_percpu_devid_irq()
It so appears that handle_percpu_devid_irq() is extremely similar to handle_percpu_devid_fasteoi_nmi(), and that the differences do no justify the horrid machinery in the GICv3 driver to handle the flow handler switch. Stick with the standard flow handler, even for NMIs. Suggested-by: Will Deacon <will@kernel.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Will Deacon <will@kernel.org> Link: https://patch.msgid.link/20251020122944.3074811-11-maz@kernel.org
1 parent f6c8ace commit 21bbbc5

1 file changed

Lines changed: 2 additions & 52 deletions

File tree

drivers/irqchip/irq-gic-v3.c

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,6 @@ static void __init gic_prio_init(void)
230230
!cpus_have_group0);
231231
}
232232

233-
/* rdist_nmi_refs[n] == number of cpus having the rdist interrupt n set as NMI */
234-
static refcount_t *rdist_nmi_refs;
235-
236233
static struct gic_kvm_info gic_v3_kvm_info __initdata;
237234
static DEFINE_PER_CPU(bool, has_rss);
238235

@@ -608,24 +605,6 @@ static u32 __gic_get_ppi_index(irq_hw_number_t hwirq)
608605
}
609606
}
610607

611-
static u32 __gic_get_rdist_index(irq_hw_number_t hwirq)
612-
{
613-
switch (__get_intid_range(hwirq)) {
614-
case SGI_RANGE:
615-
case PPI_RANGE:
616-
return hwirq;
617-
case EPPI_RANGE:
618-
return hwirq - EPPI_BASE_INTID + 32;
619-
default:
620-
unreachable();
621-
}
622-
}
623-
624-
static u32 gic_get_rdist_index(struct irq_data *d)
625-
{
626-
return __gic_get_rdist_index(d->hwirq);
627-
}
628-
629608
static int gic_irq_nmi_setup(struct irq_data *d)
630609
{
631610
struct irq_desc *desc = irq_to_desc(d->irq);
@@ -646,20 +625,8 @@ static int gic_irq_nmi_setup(struct irq_data *d)
646625
return -EINVAL;
647626

648627
/* desc lock should already be held */
649-
if (gic_irq_in_rdist(d)) {
650-
u32 idx = gic_get_rdist_index(d);
651-
652-
/*
653-
* Setting up a percpu interrupt as NMI, only switch handler
654-
* for first NMI
655-
*/
656-
if (!refcount_inc_not_zero(&rdist_nmi_refs[idx])) {
657-
refcount_set(&rdist_nmi_refs[idx], 1);
658-
desc->handle_irq = handle_percpu_devid_fasteoi_nmi;
659-
}
660-
} else {
628+
if (!gic_irq_in_rdist(d))
661629
desc->handle_irq = handle_fasteoi_nmi;
662-
}
663630

664631
gic_irq_set_prio(d, dist_prio_nmi);
665632

@@ -686,15 +653,8 @@ static void gic_irq_nmi_teardown(struct irq_data *d)
686653
return;
687654

688655
/* desc lock should already be held */
689-
if (gic_irq_in_rdist(d)) {
690-
u32 idx = gic_get_rdist_index(d);
691-
692-
/* Tearing down NMI, only switch handler for last NMI */
693-
if (refcount_dec_and_test(&rdist_nmi_refs[idx]))
694-
desc->handle_irq = handle_percpu_devid_irq;
695-
} else {
656+
if (!gic_irq_in_rdist(d))
696657
desc->handle_irq = handle_fasteoi_irq;
697-
}
698658

699659
gic_irq_set_prio(d, dist_prio_irq);
700660
}
@@ -2080,19 +2040,9 @@ static const struct gic_quirk gic_quirks[] = {
20802040

20812041
static void gic_enable_nmi_support(void)
20822042
{
2083-
int i;
2084-
20852043
if (!gic_prio_masking_enabled() || nmi_support_forbidden)
20862044
return;
20872045

2088-
rdist_nmi_refs = kcalloc(gic_data.ppi_nr + SGI_NR,
2089-
sizeof(*rdist_nmi_refs), GFP_KERNEL);
2090-
if (!rdist_nmi_refs)
2091-
return;
2092-
2093-
for (i = 0; i < gic_data.ppi_nr + SGI_NR; i++)
2094-
refcount_set(&rdist_nmi_refs[i], 0);
2095-
20962046
pr_info("Pseudo-NMIs enabled using %s ICC_PMR_EL1 synchronisation\n",
20972047
gic_has_relaxed_pmr_sync() ? "relaxed" : "forced");
20982048

0 commit comments

Comments
 (0)