Repository navigation
arm64: apple: handle M4+ WFI/WFIT state loss by MIDR alone - #2796
Conversation
Apple M4 and later cores (MIDR part 0x052 and up) can come back from WFI and WFIT with their general-purpose and FP/SIMD registers cleared. The kernel already handles this on every such part through midr_is_apple_m4_or_later(): cpu_do_idle() saves the registers around WFI (d58647b, 34649b4) and cpuinfo records WFxT as absent (5186d2e), so ARM64_HAS_WFXT and HWCAP2_WFXT stay off. Several per-chip leftovers from before that predicate remained: - has_wfxt() (848cb14, Thomas Glanzmann) kept a T8142/T6050/T8152 MIDR list. The sanitised ID_AA64ISAR2_EL1 already reads WFxT as 0 on those parts and on every other M4+ part, so the list never changes the result. Go back to has_cpuid_feature() and HWCAP_CAP() for WFxT. Its comment also pointed at apple_m5_needs_wait_save(), which no longer exists. - __delay() busy-waited on T8142 and T6050 only (dbb5e44), to stay off WFIT. WFIT cannot be reached there any more, and the WFE event-stream loop that remains is the same path arm64.nowfxt selected on T8152 (0 bad SHA-256 runs in 288 under schedutil on J873) and the path T8140 and T6040 run today. WFE is also what smp_cond_load_*() and the spinlocks run on these cores all the time. Drop the list. - An idle=nop from the boot loader was ignored on T8142 and T6050 only (5c9cbb2, 72f8eec). Ignore it on every part that takes the register-saving WFI. Older aura and m1n1 append it on every M4+ chip, after the user's arguments; spinning idle costs 85-92 C against 43 C on T8140, about 90 C on T8142 and about 10 W on T6050. apple_keep_idle_nop still keeps it for comparisons. - t8140-j700.dts set bootargs = "arm64.nowfxt" in /chosen, marked temporary until the kernel stopped using WFxT on T8140. The kernel already did (part 0x060/0x061 is matched). Remove it. Document the per-part evidence at midr_is_apple_m4_or_later(), and why parts nobody measured are matched (the same core generations, and later parts by default). On EFI boots (U-Boot -> GRUB -> EFI stub) the stub replaces /chosen/bootargs with the loader's command line, so neither the DT bootargs nor the arguments aura appends reached the kernel there. For those users the only change is __delay() on T8142/T6050 using WFE instead of spinning. Direct (non-EFI) boots stop depending on loader arguments. Signed-off-by: Ryan Murray <[email protected]>
|
Review at 06633f4 (non-author, draft). No blocker found; ready once the direct-boot row and the T8142 row below are in.
Small points, not blocking:
Assisted-by: LLM (Claude:Opus 5.5) |
|
J813 (MacBook Air 13-inch M5, T8142) exact-head row at
|
|
J714s (MacBook Pro 14-inch M5 Pro, T6050) hardware row with this PR's
The default boot was restored afterwards, and the whole ESP is byte-identical to the start. |
|
J773g (Mac mini, M4, T8132) exact-head row at Kernel: current T8132 (part 0x052/0x053) was already matched by
Not covered: this boot chain doesn't pass |
Replaces #2286 (same changes, commit trailers fixed).
Apple M4 and later cores (MIDR part 0x052 and up) can lose their general-purpose and FP/SIMD registers in WFI and WFIT. This kernel already handles that on every such part through
midr_is_apple_m4_or_later():cpu_do_idle()saves the registers around WFI, and cpuinfo records WFxT as absent, soARM64_HAS_WFXTandHWCAP2_WFXTstay off. This PR removes the per-chip leftovers from before that predicate, plus the J700 device-tree boot argument.What changes
has_wfxt()with a T8142/T6050/T8152 MIDR listhas_cpuid_feature()/HWCAP_CAP(), as upstream. The sanitisedID_AA64ISAR2_EL1.WFxTalready reads 0 on every M4+ part, so the list never changed the result.__delay()busy-waits on T8142/T6050 onlysmp_cond_load_*()and the spinlocks already run WFE on these cores all the time.idle=nopis ignored on T8142/T6050 onlyapple_keep_idle_nopstill keeps it for comparisons.t8140-j700.dts/chosenbootargs = "arm64.nowfxt"("Temporary")midr_is_apple_m4_or_later()with a one-line commentWho this affects
On EFI boots (U-Boot -> GRUB -> EFI stub),
drivers/firmware/efi/libstub/fdt.creplaces/chosen/bootargswith the loader's command line. Neither the DTarm64.nowfxtnor theidle=nop arm64.nowfxtaura appends ever reached those kernels, and they already ran WFI with the register save and no WFxT. For them the only change is that__delay()on T8142/T6050 uses WFE instead of spinning.Direct (non-EFI) boots from aura or m1n1 no longer depend on loader arguments. The companion aura change stops appending them: aurora-silicon/aura#453.
Testing
7.3.0-aurora-fleet74, LLVM=1):arch/arm64/kernel/{idle,cpufeature,cpuinfo,setup,smp}.oandarch/arm64/lib/delay.o, using the newasm/cputype.h, with 0 warnings.has_wfxtand its MIDR table are gone fromcpufeature.o.t8140-j700.dtb: dtc shows 0 warnings. Its decompiled tree differs from the fleet74 DTB only in the removedbootargsline.--strict: 0 errors, 0 warnings.asm/cputype.hwould rebuild most of the tree.Rows from #2286
arm64.nowfxt/idle=nop: WFI register save on the M4+ parts,wfxthidden, cpuidle entered on every CPU, SHA-256 loops 216/504/360/288 runs with 0 wrong, 0 failed units/AVC/oops/DART faults. Those boots were not direct (non-EFI) boots and did not cover s2idle.__delay()WFE path, WFxT off and s2idle, 70,768 + 37,539 (cpufreq stress) + 14,115 (after 3 freezes) SHA-256 runs with 0 wrong. Itsidle.cwas hand-merged with another T6050 change, so theidle=noppath on T6050 is not covered.Hardware row still needed (MacBook Neo, T8140), on a direct boot with no
arm64.nowfxtoridle=nop:/proc/cmdlinewithout either,wfxtabsent from/proc/cpuinfoFeatures, cpuidleusagecounters increasing on every CPU, a SHA-256 correctness loop under schedutil, and s2idle. The idle and WFxT paths have no other per-chip logic left to test on J616s (T6040), M1 Pro or M2.