From 77a225f27b0a81a8c448c81892f681fef768e578 Mon Sep 17 00:00:00 2001 From: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Date: Tue, 24 Nov 2026 17:34:55 -0500 Subject: [PATCH] arm64: idle: defer the idle=nop override until built-in drivers probe On M4 and later cores the kernel ignores a loader's idle=nop and idles in WFI. On a K114c (M5 Max, chip 0x6050), switching to WFI that early let the unclaimed root domain nub_gpio gate off before pmgr and pinctrl probed: it was already off at the 76 ms pmgr probe and stayed write-refused, and the input chain, DP-1 and sound were missing. Keep the loader's spinning idle through boot and switch to WFI from a late_initcall_sync, after the built-in drivers' initcalls. cpu_do_idle() reads the idle selector on every entry, so the switch takes effect at once. Boots without idle=nop are unchanged. Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com> Signed-off-by: Diljit Singh --- arch/arm64/kernel/idle.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/idle.c b/arch/arm64/kernel/idle.c index 91a7fee038848..a55e4f6144e09 100644 --- a/arch/arm64/kernel/idle.c +++ b/arch/arm64/kernel/idle.c @@ -52,6 +52,7 @@ early_param("idle", setup_idle); */ static bool apple_wfi_loses_regs __ro_after_init; static bool apple_keep_idle_nop __initdata; +static bool apple_wfi_deferred __initdata; /* * Older boot loaders append idle=nop after the user's arguments on these @@ -79,13 +80,32 @@ void __init apple_wfi_quirk_init(void) * WFI states spin too): on T8142 the SoC sits near 90 C and * throttles, on T6050 the system draws about 10 W more at idle, on * T8140 the die idles at 85-92 C instead of 43 C. WFI is safe here. + * + * The switch waits until the built-in drivers have probed: on a + * K114c (M5 Max, chip 0x6050), WFI early in boot gated the unclaimed + * root domain nub_gpio off before pmgr and pinctrl probed. */ if (idle == ARM64_IDLE_NOP && !apple_keep_idle_nop) { - idle = ARM64_IDLE_WFI; - pr_info("Apple: idling in WFI, ignoring idle=nop\n"); + apple_wfi_deferred = true; + pr_info("Apple: WFI idling deferred until built-in drivers probe\n"); } } +/* + * Runs after the built-in drivers' initcalls. cpu_do_idle() reads idle on + * every entry, so the switch takes effect at once. + */ +static int __init apple_wfi_defer_enable(void) +{ + if (!apple_wfi_deferred) + return 0; + + idle = ARM64_IDLE_WFI; + pr_info("Apple: idling in WFI, ignoring idle=nop (after built-in probes)\n"); + return 0; +} +late_initcall_sync(apple_wfi_defer_enable); + static __always_inline bool apple_wfi_needs_save(void) { return unlikely(READ_ONCE(apple_wfi_loses_regs));