[PATCH v3 22/26] irqchip/apple-aic: Drop support for custom PMU irq partitions

Marc Zyngier posted 26 patches 1 week, 2 days ago
[PATCH v3 22/26] irqchip/apple-aic: Drop support for custom PMU irq partitions
Posted by Marc Zyngier 1 week, 2 days ago
Similarly to what has been done for GICv3, drop the irq partitioning
support from the AIC driver, effectively merging the two per-cpu
interrupts for the PMU.

Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 drivers/irqchip/irq-apple-aic.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c
index cb8b6f40ce8d3..6305d25b9e77b 100644
--- a/drivers/irqchip/irq-apple-aic.c
+++ b/drivers/irqchip/irq-apple-aic.c
@@ -578,16 +578,9 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs)
 	}
 
 	if ((read_sysreg_s(SYS_IMP_APL_PMCR0_EL1) & (PMCR0_IMODE | PMCR0_IACT)) ==
-			(FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_FIQ) | PMCR0_IACT)) {
-		int irq;
-		if (cpumask_test_cpu(smp_processor_id(),
-				     &aic_irqc->fiq_aff[AIC_CPU_PMU_P]->aff))
-			irq = AIC_CPU_PMU_P;
-		else
-			irq = AIC_CPU_PMU_E;
+			(FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_FIQ) | PMCR0_IACT))
 		generic_handle_domain_irq(aic_irqc->hw_domain,
-					  AIC_FIQ_HWIRQ(irq));
-	}
+					  AIC_FIQ_HWIRQ(AIC_CPU_PMU_P));
 
 	if (static_branch_likely(&use_fast_ipi) &&
 	    (FIELD_GET(UPMCR0_IMODE, read_sysreg_s(SYS_IMP_APL_UPMCR0_EL1)) == UPMCR0_IMODE_FIQ) &&
@@ -632,18 +625,7 @@ static int aic_irq_domain_map(struct irq_domain *id, unsigned int irq,
 				    handle_fasteoi_irq, NULL, NULL);
 		irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq)));
 	} else {
-		int fiq = FIELD_GET(AIC_EVENT_NUM, hw);
-
-		switch (fiq) {
-		case AIC_CPU_PMU_P:
-		case AIC_CPU_PMU_E:
-			irq_set_percpu_devid_partition(irq, &ic->fiq_aff[fiq]->aff);
-			break;
-		default:
-			irq_set_percpu_devid(irq);
-			break;
-		}
-
+		irq_set_percpu_devid(irq);
 		irq_domain_set_info(id, irq, hw, &fiq_chip, id->host_data,
 				    handle_percpu_devid_irq, NULL, NULL);
 	}
@@ -732,6 +714,10 @@ static int aic_irq_domain_translate(struct irq_domain *id,
 				break;
 			}
 		}
+
+		/* Merge the two PMUs on a single interrupt */
+		if (*hwirq == AIC_CPU_PMU_E)
+			*hwirq = AIC_CPU_PMU_P;
 		break;
 	default:
 		return -EINVAL;
-- 
2.47.3
Re: [PATCH v3 22/26] irqchip/apple-aic: Drop support for custom PMU irq partitions
Posted by Sven Peter 1 week, 2 days ago
On 22.09.25 10:28, Marc Zyngier wrote:
> Similarly to what has been done for GICv3, drop the irq partitioning
> support from the AIC driver, effectively merging the two per-cpu
> interrupts for the PMU.
> 
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---

Reviewed-by: Sven Peter <sven@kernel.org>


>   drivers/irqchip/irq-apple-aic.c | 28 +++++++---------------------
>   1 file changed, 7 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c
> index cb8b6f40ce8d3..6305d25b9e77b 100644
> --- a/drivers/irqchip/irq-apple-aic.c
> +++ b/drivers/irqchip/irq-apple-aic.c
> @@ -578,16 +578,9 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs)
>   	}
>   
>   	if ((read_sysreg_s(SYS_IMP_APL_PMCR0_EL1) & (PMCR0_IMODE | PMCR0_IACT)) ==
> -			(FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_FIQ) | PMCR0_IACT)) {
> -		int irq;
> -		if (cpumask_test_cpu(smp_processor_id(),
> -				     &aic_irqc->fiq_aff[AIC_CPU_PMU_P]->aff))
> -			irq = AIC_CPU_PMU_P;
> -		else
> -			irq = AIC_CPU_PMU_E;
> +			(FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_FIQ) | PMCR0_IACT))
>   		generic_handle_domain_irq(aic_irqc->hw_domain,
> -					  AIC_FIQ_HWIRQ(irq));
> -	}
> +					  AIC_FIQ_HWIRQ(AIC_CPU_PMU_P));

Probably one of the most confusing diffs for a change that's actually 
fairly simple that the diff algorithm generated! I was only able to tell 
what's going on by looking at the file after applying this.





Sven
Re: [PATCH v3 22/26] irqchip/apple-aic: Drop support for custom PMU irq partitions
Posted by Marc Zyngier 1 week, 2 days ago
On Mon, 22 Sep 2025 19:43:40 +0100,
Sven Peter <sven@kernel.org> wrote:
> 
> On 22.09.25 10:28, Marc Zyngier wrote:
> > Similarly to what has been done for GICv3, drop the irq partitioning
> > support from the AIC driver, effectively merging the two per-cpu
> > interrupts for the PMU.
> > 
> > Signed-off-by: Marc Zyngier <maz@kernel.org>
> > ---
> 
> Reviewed-by: Sven Peter <sven@kernel.org>
> 
> 
> >   drivers/irqchip/irq-apple-aic.c | 28 +++++++---------------------
> >   1 file changed, 7 insertions(+), 21 deletions(-)
> > 
> > diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c
> > index cb8b6f40ce8d3..6305d25b9e77b 100644
> > --- a/drivers/irqchip/irq-apple-aic.c
> > +++ b/drivers/irqchip/irq-apple-aic.c
> > @@ -578,16 +578,9 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs)
> >   	}
> >     	if ((read_sysreg_s(SYS_IMP_APL_PMCR0_EL1) & (PMCR0_IMODE |
> > PMCR0_IACT)) ==
> > -			(FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_FIQ) | PMCR0_IACT)) {
> > -		int irq;
> > -		if (cpumask_test_cpu(smp_processor_id(),
> > -				     &aic_irqc->fiq_aff[AIC_CPU_PMU_P]->aff))
> > -			irq = AIC_CPU_PMU_P;
> > -		else
> > -			irq = AIC_CPU_PMU_E;
> > +			(FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_FIQ) | PMCR0_IACT))
> >   		generic_handle_domain_irq(aic_irqc->hw_domain,
> > -					  AIC_FIQ_HWIRQ(irq));
> > -	}
> > +					  AIC_FIQ_HWIRQ(AIC_CPU_PMU_P));
> 
> Probably one of the most confusing diffs for a change that's actually
> fairly simple that the diff algorithm generated! I was only able to
> tell what's going on by looking at the file after applying this.

It appears that all 4 algorithms (myers, minimal, patience and
histogram) give the exact same resolution for these two hunks.

It would have been easier to read if I had rewritten the 'if'
statement to be on a single line (and moved the whole field business
to a helper), but I went for the smallest possible change. My bad,

Thanks for the review!

	M.

-- 
Jazz isn't dead. It just smells funny.