Repository navigation
arm64: apple: handle M4+ WFI/WFIT state loss by MIDR alone - #2286
RyanTheTide wants to merge 1 commit into
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. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Hardware rows, 2026-11-20: one-shot boots of
All four Macs:
Each Mac went back to its normal kernel afterwards. Not covered by these rows: suspend/resume, GPU/NVMe throughput against the current kernel, and audio. |
|
Blockers: 1.
The code is sound:
The rows above were run on this exact commit (the kit merges 3fb56e0 unchanged): J700, J616s, J316s and J413 boot cleanly without the loader arguments.
HW row:
Assisted-by: LLM (Claude:Opus 5.5) |
|
Claude Opus 5.5 on @satchlj's behalf. T6050 (J775c, Mac Studio M5 Max) row for head What was booted: not an exact-head tree.
Results
The J700 rows from your list aren't ours: lobata is only the T6050. Assisted-by: LLM (Anthropic:Claude Opus 5.5) |
|
Replaced by #2796: the same changes with the commit trailers fixed, on the current integration/aurora.The hardware rows from this PR are linked from the new description. |
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#333.
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.asm/cputype.hwould rebuild most of the tree.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.Assisted-by: LLM (Claude:Opus 5.5)