Skip to content

irqchip/apple-aic: mask t6041 guest timers through EL02 controls - #430

Closed
jgoyvaerts wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/aic-t6041-guest-timers
Closed

jgoyvaerts wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
jgoyvaerts:m4pro/aic-t6041-guest-timers

Conversation

@jgoyvaerts

Copy link
Copy Markdown
Contributor

KVM guests don't boot on the T6040 (M4 Pro). A muvm/libkrun guest sits at 100% on vCPU 0, and the host's "kvm guest vtimer" IRQ fires about 1.3 million times a second on that core: the guest timer FIQ is never masked.

The T6040's AIC ("apple,t6041-aic3", "apple,t8122-aic3") matches the generic t8122 entry, which masks the guest timers by writing VM_TMR_FIQ_ENA_EL2. On this SoC that write is silently ignored. T8142 traps the same write and already has aic3_t8142_info (vm_timer_fiq_readonly), which masks them through CNTP/CNTV_CTL_EL02 IMASK instead. This adds apple,t6041-aic3 to that entry; the binding already lists the compatible (#396). aic3_t8142_info differs from aic3_info only in that flag, and of_match_node() prefers the DT's first compatible, so nothing else changes for the T6040.

Tested: J616s; our daily 7.3 kernel carried this on 2026-10-23, and muvm/libkrun guests booted with it (a Battle.net session under muvm). Without it, the storm above. Built with W=1, checkpatch --strict clean.

Probably needed elsewhere, untested: the T8132 (M4) and T8140 (A18 Pro) device trees also fall to the generic t8122 entry. If their cores ignore the write the same way, their KVM guests storm too. I can't test those.

🤖 Generated with Claude Code

With KVM enabled on the T6040 (M4 Pro), a muvm/libkrun guest never
boots: vCPU 0 sits at 100% on one guest PC, and the host "kvm guest
vtimer" IRQ fires about 1.3M times a second on that core. kvm_exit
traces show back-to-back IRQ exits roughly every 8us with almost no
timer state updates.

The T6040's AIC matches the generic "apple,t8122-aic3" entry, so the
driver masks the guest timers by writing VM_TMR_FIQ_ENA_EL2. On this
SoC that write has no effect (it is silently ignored; T8142 traps it),
so the guest vtimer FIQ is never masked and storms. Give
"apple,t6041-aic3", the first compatible in t6040.dtsi, the T8142 info,
so the guest timers are masked through CNTP/CNTV_CTL_EL02 IMASK instead.

Signed-off-by: Jonathan Goyvaerts <jonathan.goyvaerts@gmail.com>
Assisted-by: LLM
@jgoyvaerts

Copy link
Copy Markdown
Contributor Author

Closing, my mistake: this isn't needed on the current tree. I opened it from a storm we recorded on 2026-10-23 on an older base, without re-testing. On our daily kernel (integration/aurora 420a1c8 + our board commits, without this patch), a muvm/libkrun guest running Steam has been up for 2 h 40 min with about 430 guest-vtimer IRQs a second across all cores, no storm. Something merged since (most likely the broken-SEIS workaround, #411) fixed what we saw. Sorry for the noise.

@jgoyvaerts jgoyvaerts closed this Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant