Skip to contentSkip to conversation

irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured to fire FIQ

PATCH Applied Nick Chan 2 participants 2 messages Jan 18, 2025 – Jan 27, 2025

Subsystems (3)
lore
Share & tools
lore

Nick Chan

author
#0 lore raw

PATCH v2 1/1 irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured to fire FIQ

The CPU PMU in Apple SoCs can be configured to fire its interrupt in one of several ways, and since Apple A11 one of the method is FIQ. Only handle the PMC interrupt as a FIQ when the CPU PMU has been configured to fire FIQs.

Fixes c7708816c944 ("irqchip/apple-aic: Wire PMU interrupts")

---

Changes in v2:
Fix the conditional to have the intented behavior of evaluating to true only when both PMCR0_IMODE is PMCR0_IMODE_FIQ and PMCR0_IACT is set by reverting the conditional to how it is before c7708816c944.

Link to v1: https://lore.kernel.org/asahi/[email protected]/T

- Nick Chan

 drivers/irqchip/irq-apple-aic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-apple-aic.c +2 -1
index da5250f0155c..2b1684c60e3c 100644
@@ -577,7 +577,8 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs)
 						  AIC_FIQ_HWIRQ(AIC_TMR_EL02_VIRT));
 	}
 
-	if (read_sysreg_s(SYS_IMP_APL_PMCR0_EL1) & PMCR0_IACT) {
+	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))

base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37

Signature · 1 line
2.48.1
merge bot Applied
#1 lore raw

[tip: irq/urgent] irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured so

The following commit has been merged into the irq/urgent branch of tip:

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     698244bbb3bfd32ddf9a0b70a12b1c7d69056497
Gitweb:        https://git.kernel.org/tip/698244bbb3bfd32ddf9a0b70a12b1c7d69056497
Author:        Nick Chan <[email protected]>
AuthorDate:    Sun, 19 Jan 2025 00:31:42 +08:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Mon, 27 Jan 2025 18:39:15 +01:00

irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured so

The CPU PMU in Apple SoCs can be configured to fire its interrupt in one of several ways, and since Apple A11 one of the methods is FIQ, but the check of the configuration register fails to test explicitely for FIQ mode. It tests whether the IMODE bitfield is zero or not and the PMCRO_IACT bit is set. That results in false positives when the IMODE bitfield is not zero, but does not have the mode PMCR0_IMODE_FIQ.

Only handle the PMC interrupt as a FIQ when the CPU PMU has been configured to fire FIQs, i.e. the IMODE bitfield value is PMCR0_IMODE_FIQ and PMCR0_IACT is set.

Fixes c7708816c944 ("irqchip/apple-aic: Wire PMU interrupts")
---
 drivers/irqchip/irq-apple-aic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-apple-aic.c +2 -1
index da5250f..2b1684c 100644
@@ -577,7 +577,8 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs)
 						  AIC_FIQ_HWIRQ(AIC_TMR_EL02_VIRT));
 	}
 
-	if (read_sysreg_s(SYS_IMP_APL_PMCR0_EL1) & PMCR0_IACT) {
+	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))