From 1a81530166e3e452ce1996243d818adee83cfae1 Mon Sep 17 00:00:00 2001 From: Kazuhide Takahashi Date: Sat, 21 Nov 2026 04:56:09 +0000 Subject: [PATCH] irqchip/apple-aic: treat T8132 VM_TMR_FIQ_ENA_EL2 as read-only without a CTXR window On a J715 (Mac16,13) booted through a stage 1 that arms no CTXR exec window, the kernel dies before the console in aic_init_cpu(): Internal error: Oops - Undefined instruction ... pc : aic_init_cpu+0x8c (msr s3_5_c15_c1_3, x9 -- VM_TMR_FIQ_ENA_EL2) T8142 already avoids this write through vm_timer_fiq_readonly (EL02 timer masks), which is cleared when the loader publishes aurora,ctxr-exec-window. Apply the same policy to T8132, so an aura-booted T8132 is unchanged, and say in the two comments that the policy now covers T8132 as well. Tested on J715 with OS firmware 26.5 and 26.6.2 (no CTXR window): boots with all 10 CPUs. The vGIC maintenance write (ICH_HCR_EL2) does not trap there and is left as is. Signed-off-by: Kazuhide Takahashi --- drivers/irqchip/irq-apple-aic.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-aic.c index 0a9aeced27721..bc1fb7b3c3ab1 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -366,6 +366,7 @@ static const struct aic_info aic3_t8132_info __initconst = { .irq_cfg = AIC3_IRQ_CFG, .fast_ipi = true, .local_fast_ipi = true, + .vm_timer_fiq_readonly = true, .fw_suspend = true, }; @@ -665,8 +666,9 @@ static unsigned long aic_fiq_get_idx(struct irq_data *d) } /* - * T8142 traps writes to VM_TMR_FIQ_ENA_EL2. Mask the guest timers through - * their architectural EL02 controls instead, leaving the older SoCs alone. + * T8132 and T8142 trap writes to VM_TMR_FIQ_ENA_EL2 outside a CTXR execute + * window. Mask the guest timers through their architectural EL02 controls + * instead, leaving the older SoCs alone. */ static void aic_vm_timer_mask(u64 timers, bool mask) { @@ -1324,12 +1326,13 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p irqc->info = *(struct aic_info *)match->data; /* - * The VM_TMR_FIQ_ENA_EL2 write that traps on T8142 was seen under - * SPTM. A loader that runs the OS at EL2 in a CTXR execute window - * starts no SPTM and says so with this property, and there the - * register takes writes. Masking through the EL02 controls instead - * sets IMASK in the guest's own timer, which KVM then keeps as - * guest state: the guest gets no timer interrupt again. + * The VM_TMR_FIQ_ENA_EL2 write traps on T8142 under SPTM, and on T8132 + * booted by a stage 1 that arms no CTXR execute window. A loader that + * runs the OS at EL2 in a CTXR execute window starts no SPTM and says + * so with this property, and there the register takes writes. + * Masking through the EL02 controls instead sets IMASK in the guest's + * own timer, which KVM then keeps as guest state: the guest gets no + * timer interrupt again. */ if (irqc->info.vm_timer_fiq_readonly && is_kernel_in_hyp_mode() && of_property_present(of_chosen, "aurora,ctxr-exec-window"))