Skip to content

irqchip/apple-aic: treat T8132 VM_TMR_FIQ_ENA_EL2 as read-only without a CTXR window - #2666

Merged
DjDeveloperr merged 1 commit into
aurora-silicon:mainfrom
kazuhidet:j715/aic-t8132-vm-timer-readonly
Nov 26, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-silicon:mainfrom
kazuhidet:j715/aic-t8132-vm-timer-readonly

Conversation

@kazuhidet

@kazuhidet kazuhidet commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What: on a T8132 booted without a CTXR exec window, the VM_TMR_FIQ_ENA_EL2 write in aic_init_cpu() is an undefined instruction and the kernel dies before the console. Treat it as read-only there, as T8142 already does.
Tested: J715 M4 Air (no CTXR window) with the code of 6c49ab136eb7, which is the same as at 1a815301 (that commit changes only comments): boots to the desktop with all 10 CPUs.
Risk: two-way · M4 (T8132) Macs; unchanged where aura publishes aurora,ctxr-exec-window
Not yet: an aura-booted T8132 with aurora,ctxr-exec-window present (J713, J604 or J773g); KVM guest timers.

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.

Reduced to one line after the J715 test in the comment below: the ICH_HCR_EL2 write does not trap. 1a81530166e3 changes only the two comments; the code is the same as 6c49ab136eb7. Built and tested on integration/aurora 0abc2f3; the change applies unchanged to the current tip. J715 report: #2663.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the clear report. Making T8132 follow the T8142 policy for VM_TMR_FIQ_ENA_EL2 is the right fix: the property decides, not the board. On an aura-booted T8132, aurora,ctxr-exec-window is present (checked on an M4 Air J713 on 27.2), so both flags are cleared at init and nothing changes there. Only loader chains without the window, like yours, take the new path.

One request: the ICH_HCR_EL2 skip is described as a precaution that "was not separately shown to trap". The write only clears En. If the boot loader left En set, skipping it leaves vGIC maintenance interrupts enabled with nothing handling them, so skipping is not free in the other direction either. Could you check on the J715 whether the write traps (for example, boot once with only the timer write skipped)? Then keep the second flag only if it does. If it isn't needed, the PR becomes a one-line .vm_timer_fiq_readonly = true.

Assisted-by: LLM (Claude:Opus 5.5)

@kazuhidet

Copy link
Copy Markdown
Contributor Author

I tested it on the J715. The ICH_HCR_EL2 write does not trap, so the second flag isn't needed.

Build: this PR with .el2_ich_write_locked left unset, so only the timer write is skipped and ICH_HCR_EL2 is written as before.

Result:

  • The kernel booted with all 10 CPUs online (0-9).
  • No Undefined instruction or oops.
  • The graphical session came up (SDDM, Hyprland).
  • AIC: Initialized with 2048/4096 IRQs * 1/2 die(s), 7 FIQs, 32 vIPIs
  • KVM: VHE mode initialized successfully, vgic interrupt IRQ33
  • IRQ 33 (AIC-FIQ 6 vgic) shows 0 on every CPU, so no stray maintenance interrupts.
  • The only kernel errors were unrelated: avd probe -2, and the two external DCPs that are not handed over.

So only the timer write traps here. I'll reduce this PR to the one line .vm_timer_fiq_readonly = true.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 6c49ab1: No blockers.

  1. ICH_HCR_EL2 skip: resolved. The PR is now the single .vm_timer_fiq_readonly = true in aic3_t8132_info (drivers/irqchip/irq-apple-aic.c:369), and the J715 boot with only the timer write skipped shows the ICH_HCR_EL2 write does not trap and the vGIC maintenance IRQ stays at 0. With aurora,ctxr-exec-window present the flag is still cleared at init (irq-apple-aic.c:1335-1337), so aura-booted T8132 machines keep the register write and the read of the live enable bits at :777-779.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review at 6c49ab136eb76d7350b9b6240cefc723995a5262: 0 code/policy/attribution blockers (CI host-tests: pass; mergeable/clean). Holding only for missing §5 hardware verification rows.

Checklist audit (§1–§6)

  • Code (drivers/irqchip/irq-apple-aic.c:369): Sound. Adding .vm_timer_fiq_readonly = true to aic3_t8132_info matches aic3_t8142_info. At init (irq-apple-aic.c:1335-1337), aurora,ctxr-exec-window in /chosen clears vm_timer_fiq_readonly back to false at EL2, leaving Aura-booted T8132 machines unchanged. Without a CTXR window, aic_vm_timer_mask() masks via SYS_CNTP_CTL_EL02 / SYS_CNTV_CTL_EL02 instead of trapping on SYS_IMP_APL_VM_TMR_FIQ_ENA_EL2, while ICH_HCR_EL2 remains written as before (proven not to trap on J715 with IRQ 33 at 0).
  • §1 No model gating: Pass. Driven by the /chosen aurora,ctxr-exec-window property, not board/model/firmware checks.
  • §2 Production-ready: Pass. No new cmdline flags, knobs, or hacks.
  • §3 Safety: Pass. Prevents early undefined-instruction oops without weakening vGIC maintenance masking.
  • §4 Clean-room & attribution: Pass. Single commit 6c49ab13 carries human author/committer (Kazuhide Takahashi <[email protected]>) and Signed-off-by: with no agent trailers; clean-room diff.
  • §6 Naming: Pass (mention of m1n1 stage 1 accurately describes the third-party stage 1 chain lacking a CTXR window, distinct from aura).
  • Non-blocking nit: Comments at irq-apple-aic.c:669 and :1328 still mention T8142 only (now applies to both T8132 and T8142).

Remaining §5 HW rows required before merge

  1. J715 (T8132, no CTXR window) at 6c49ab13 on the default kernel command line (without extra earlycon=efifb,dt keep_bootcon): include the §5 regression counts (0 SELinux denials, 0 failed systemd units, 0 new kernel errors).
  2. Aura-booted T8132 (e.g. M4 Air J713 or M4 Mac mini J773g, with aurora,ctxr-exec-window present) at 6c49ab13: boot and regression run confirming the CTXR-window path clears vm_timer_fiq_readonly and boots with 0 SELinux denials, 0 failed units, and 0 new kernel errors.

@DjDeveloperr DjDeveloperr left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 review at verified live head 6c49ab136eb76d7350b9b6240cefc723995a5262 (live integration/aurora 0f111a0dc307, not superseded; live CI host-tests 1/1 green, run 44868471966).

Checklist Summary

  • §1 No model gating, §2 Production-ready, §3 Safety, §4 Attribution, §6 Naming: PASS (0 code/policy/attribution/naming/CI blockers).
    • Adding .vm_timer_fiq_readonly = true to aic3_t8132_info (drivers/irqchip/irq-apple-aic.c:369) matches aic3_t8142_info. In aic_of_ic_init() (:1352-1354), /chosen's aurora,ctxr-exec-window clears vm_timer_fiq_readonly back to false at EL2, leaving Aura-booted T8132 machines unchanged while avoiding the undef-instruction oops on chains without a CTXR window. ICH_HCR_EL2 handling is left intact (proven not to trap on J715 with IRQ 33 at 0).
    • Commit 6c49ab136eb7 carries human author/committer (Kazuhide Takahashi) and human Signed-off-by: only.

Blockers (§5 Evidence)

  1. J715 (no-CTXR path) exact-head default-cmdline regression row missing: The earlier J715 boot ran on older base 0abc2f385e with extra debug parameters (earlycon=efifb,dt keep_bootcon) and omitted §5 regression counts. Please re-run on exact live head 6c49ab136eb7 using the default kernel command line (no extra bootcon flags) and report 0 SELinux denials, 0 failed units, and 0 new kernel errors.
  2. Aura-booted T8132 (aurora,ctxr-exec-window present) exact-head regression row missing: Please post a default-cmdline boot at 6c49ab136eb7 on an Aura-booted T8132 Mac (e.g. M4 Air J713 or M4 Mac mini J773g) confirming vm_timer_fiq_readonly is cleared cleanly with 0 SELinux denials, 0 failed units, and 0 new kernel errors.

Non-blocking nit

  • Comments at drivers/irqchip/irq-apple-aic.c:659 and :1345 still mention T8142 only (now applies to both T8132 and T8142).

…t 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 <[email protected]>
@kazuhidet
kazuhidet force-pushed the j715/aic-t8132-vm-timer-readonly branch from 6c49ab1 to 1a81530 Compare November 24, 2026 00:16
@kazuhidet

Copy link
Copy Markdown
Contributor Author

Thanks. I've pushed 1a81530166e3. It changes only the comments: they now name T8132 next to T8142, at aic_vm_timer_mask() and above the aurora,ctxr-exec-window check. The code is unchanged from 6c49ab136eb7. The commit message no longer names m1n1.

1. J715, no CTXR window: row with the change lines of 6c49ab136eb7

This boot was made for the #2665 tip row (#2665 (comment)). It contains this PR's change, with the same lines as 6c49ab136eb7.

  • Machine: J715 (MacBook Air 15-inch, M4, Mac16,13), OS firmware 26.6.2. Stage 1 → aura; this stage 1 arms no CTXR window.

  • Kernel: integration/aurora b10280c04c2d, plus three commits:

    Release 7.3.0-j715-aurora-tip+, built with the J715's own config.

  • Command line: the J715's everyday line, with no earlycon and no keep_bootcon. For this boot only, it also had modprobe.blacklist=/module_blacklist= for the three internal speaker drivers, because the tip doesn't carry this machine's speaker-safety arrangement. Those two parameters don't touch the AIC.

  • Result: boots to the desktop (sddm and the Hyprland session), with GPU READY and Bluetooth working. The test ran over two days with four complete check records. No oops in aic_init_cpu().

  • Regression counts:

    • SELinux: N/A (not enabled on this install).
    • Failed units: 2, both local services of this install (j713-owner-assets, m4-j715-backlight). They fail the same way on the everyday kernel.
    • New kernel errors from this change: 0. The known avd -2 and hid-generic … no listeners lines appear, and the two dcpext DCPs print no IOMMU domain; not handing the firmware untranslated DMA addresses, a message from drivers/gpu/drm/apple/dcp.c on the tip.
  • Not recorded in this boot: the online CPU count. The earlier J715 rows recorded all 10 CPUs (0-9).

2. Aura-booted T8132 with aurora,ctxr-exec-window

I can't produce this boot: this J715's stage 1 is the one that arms no window. I'll ask for that row in a separate comment.

@kazuhidet

Copy link
Copy Markdown
Contributor Author

Request for one more row. I can't produce it here. Could someone with an aura-booted T8132 Mac boot 1a81530166e3? Any of these would do: M4 Air J713 or J715, M4 Mac mini J773g, or J604.

  • What it needs: a T8132 Mac where aura publishes aurora,ctxr-exec-window in /chosen. You can check with ls /proc/device-tree/chosen/ | grep ctxr.
  • What to report:
    • a default-command-line boot;
    • whether /proc/device-tree/chosen/aurora,ctxr-exec-window is present;
    • that all CPUs come online;
    • that KVM guests still get timer interrupts, if you run any (vm_timer_fiq_readonly is cleared on this path, so the old VM_TMR_FIQ_ENA_EL2 masking is used);
    • the regression counts (SELinux denials, failed units, new kernel errors).
  • What it shows: on that path the change does nothing. aic_of_ic_init() clears vm_timer_fiq_readonly again when the property is present, so the boot should match the same tree without this commit.

@RyanTheTide, @erikwb, you've posted J713 rows before. Would one of you be able to?

@github-actions github-actions Bot added changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH at 1a81530166e3

Blockers:

  • Exact-head CI (Host tests, run 45295786722) at 1a81530166e3 is action_required (fork PR awaiting maintainer approval and a green run).
  • §5 hardware verification: missing an exact-head (1a81530166e3) default-cmdline boot and regression row on an aura-booted T8132 Mac with /chosen/aurora,ctxr-exec-window present (e.g. J713, J773g, J604, or aura-booted J715) confirming vm_timer_fiq_readonly is cleared cleanly with 0 SELinux denials, 0 failed units, and 0 new kernel errors (already requested by the author).

Checked: Code, EL2/hyp register paths, and comments at 1a81530166e3 (drivers/irqchip/irq-apple-aic.c:369, :669-671, :1329-1339) are clean and mergeable against main (1b1304ff2a67); §1 no model gating, §2 production-readiness, §3 safety, §4 human-only commit attribution, and §6 commit naming all pass. No further code changes needed from the author (optional nit: sync the PR description wording with the updated commit message).

Evidence
  • Head / base: 1a81530166e3e452ce1996243d818adee83cfae1 (fork kazuhidet/linux:j715/aic-t8132-vm-timer-readonly) against main (1b1304ff2a67128b726bed27c36a7244f71c7014); mergeable: true.
  • Code & EL2/hyp paths (drivers/irqchip/irq-apple-aic.c): Adding .vm_timer_fiq_readonly = true to aic3_t8132_info (:369) matches aic3_t8142_info (:378). In aic_of_ic_init() (:1337-1339), /chosen/aurora,ctxr-exec-window at EL2 clears vm_timer_fiq_readonly back to false before aic_irqc is published and before aic_init_cpu() runs, leaving aura-booted T8132 machines unchanged. Without a CTXR window, aic_vm_timer_mask() masks via SYS_CNTP_CTL_EL02/SYS_CNTV_CTL_EL02 instead of trapping on SYS_IMP_APL_VM_TMR_FIQ_ENA_EL2, while ICH_HCR_EL2 (:1071) remains untouched. Both comments (:669-671, :1329-1335) were updated to include T8132 alongside T8142; functional code is unchanged from 6c49ab136eb7.
  • §1–§4 & §6: Property-gated (/chosen/aurora,ctxr-exec-window), no new cmdline/module knobs, no safety regressions. Single commit 1a81530166e3 has human author/committer (Kazuhide Takahashi <[email protected]>) and human Signed-off-by:, with zero AI attribution in commit, PR title, or PR body. Commit message removed the legacy loader name; PR body still references the third-party stage 1 chain.
  • §5 CI & hardware evidence:
    • CI: Host tests run 45295786722 at 1a81530166e3 is action_required (fork PR, not yet approved/run).
    • J715 (T8132, no CTXR window): tested with the identical functional change on tip integration/aurora b10280c04c2d (+ #2665, #2672) without earlycon/keep_bootcon (desktop up, 0 new kernel errors, 2 pre-existing local failed units, SELinux N/A; earlier boot also confirmed 10/10 CPUs online and IRQ 33 = 0).
    • Aura-booted T8132 (aurora,ctxr-exec-window present): pending maintainer/tester run at 1a81530166e3.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 1a815301: ready to merge

Check Detail
CI at head ok no CI for this change (the hardware row is the gate)
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at 1a815301
Conflicts ok none
PR text ok Risk: two-way · M4 (T8132) Macs; unchanged where aura publishes aurora,ctxr-exec-window

Areas: none matched in CODEOWNERS
Merge: gh pr merge 2666 --merge (Owners and Core through the bypass: add --admin).

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-template PR body lacks Tested or Risk (bot) labels Nov 25, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 1a81530166e3: the code is ready; it needs only a row at this head.

Blockers: none in the code. Missing row: your J715 row covers the no-CTXR path. Still needed, as you asked: one aura-booted T8132 with aurora,ctxr-exec-window in /chosen (a J713, the J773g or a J604) at this head, with the VM timer FIQ working and no AIC warnings. The M4 mini lead can run it on the J773g.

Because the AIC is shared by every Mac, it also needs one boot at this head on a non-M4 Mac with no AIC warnings before it merges.

Checked: no Apple material. 1a815301 changes only comments. The register is treated as read-only only when there's no CTXR window.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 25, 2026 06:15

Superseded by the review at 1a81530

@github-actions github-actions Bot removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Row at 1a815301: J713 (M4 Air, macOS 27.2 stub, aura-booted). PASS, for the unchanged path only

Kernel: main 42d693c + this PR + #2672 (both merge cleanly), on the default fleet command line.

  • This J713 boots with a CTXR exec window (ctxr-execmem: reserved exec window ... enforcing), so this is the "aura-booted T8132 is unchanged" case.
  • It boots with all 10 CPUs, and the AIC comes up with 7 FIQs.
  • s2idle 1/1 (16.4 s, same boot), Wi-Fi ping 5/5.
  • 0 AVC denials, 0 failed units, 0 firmware crashes, GPU faults or kernel faults.

Not covered: the no-window path this PR fixes. That's your J715 on 26.5/26.6.2, and there's no such boot in our lab.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

Why not just update your boot object to latest and have the CTXR window?

@github-actions github-actions Bot added the ready-to-merge Meets the merge policy: merge it (bot) label Nov 25, 2026
@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

1a81530166e3 (batched cleanly in J616s Batch #3 cc59e9b94d16 over main 7c0c2fc25ffc, 0 merge-tree diffs across all 1 changed files) J616s (MacBook Pro 16" M4 Pro, T6040, Apple M4 Pro (G16S B1), macOS 26.6.2 fw, guarded one-shot 7.3.0-aurora-pr2905+, default cmdline, stock Stage 2 1.0.0b17, boot_id=01629efb) PASS: 0 failed units, Enforcing, 0 new AVC (1 matching baseline), 0 GPU faults, 0 subsystem errors, real rtc1 s2idle 2/2 (success=2 fail=0), eDP connected pre/post-sleep, 406600000.sep + 514600000.mtp RTKit v12 clean, Borealis VK dEQP-VK.api.smoke.* 8/8 (pre & post-sleep) + glsl.loops.* 624/624, Wi-Fi 3/3 ping pre/post-sleep; stock 7.3.0-aurora-fleet89 restored & verified (946097c2).

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Nov 26, 2026
@DjDeveloperr
DjDeveloperr merged commit 6ccfbd0 into aurora-silicon:main Nov 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants