From 25b5b73fcbfbdf9cdd7733c796867df6bfe61ae0 Mon Sep 17 00:00:00 2001 From: Sean Dolbec Date: Thu, 19 Nov 2026 10:21:15 -0500 Subject: [PATCH] soc: apple: t8132: apply the PMGR policy on any firmware The platform handoff that applies the M4 PMGR ownership policy runs only where apple_t8132_firmware_path() is true: the Airs, or OS firmware 26.6.2. On any other firmware the T8132 power states are registered as the SoC tree describes them and Linux switches domains the firmware owns. A J773g on the macOS 27.2 stub resets two to four seconds into every boot that way. The policy describes the SoC's power manager, so select it by the hardware it is written for: run the handoff on every T8132 tree. It walks the apple,t8132-pmgr nodes and marks each power state with the status and ownership of the embedded policy tree, whatever the OS firmware. No version string is compared for it. pmgr-pwrstate follows: with the handoff built, a T8132 power state it did not mark fails with "missing M4 power-domain policy" on any firmware, not only on the Airs and 26.6.2. That includes the case where the handoff cannot resolve a live PMGR node in its policy tree and drops the whole changeset: every T8132 power state that has no status of its own in the tree then fails closed; a state the tree marks itself (all of them on the complete J713 tree) is registered or left out as the tree says. A kernel built without the handoff used to fail closed on the Airs' loader tree and on 26.6.2; it now registers those states. Within the handoff apple_t8132_air() and the policy tree's apple,policy-machine entries stay: they choose between the legacy J713 loader tree's rules and the others', not whether the policy runs. Every T8132 Mac off 26.6.2 now gets the policy. Only the J773g has been run there; no J604, J623 or J624 off 26.6.2 has. Assisted-by: LLM Signed-off-by: Sean Dolbec --- drivers/pmdomain/apple/pmgr-pwrstate.c | 12 +++++++----- drivers/soc/apple/Kconfig | 12 +++++++----- drivers/soc/apple/t8132-platform-handoff.c | 6 +++--- include/linux/soc/apple/t8132.h | 7 ++++--- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/pmdomain/apple/pmgr-pwrstate.c b/drivers/pmdomain/apple/pmgr-pwrstate.c index d6ac0c2cebd9f..13976f269835d 100644 --- a/drivers/pmdomain/apple/pmgr-pwrstate.c +++ b/drivers/pmdomain/apple/pmgr-pwrstate.c @@ -854,12 +854,14 @@ static int apple_pmgr_ps_probe(struct platform_device *pdev) t8132 = of_device_is_compatible(node, "apple,t8132-pmgr-pwrstate"); /* - * On the M4 firmware path some domains are the firmware's, which Linux - * cannot access. The early compatibility adapter supplies the explicit - * status and ownership before population; fail closed if it was not - * enabled. Other firmware keeps the tree's own domain descriptions. + * Some T8132 power states are the firmware's, which Linux cannot + * access. The platform handoff supplies the explicit status and + * ownership of every one before population, on any firmware: fail + * closed on a state it did not mark. A kernel built without the + * handoff keeps the tree's own domain descriptions. */ - if (t8132 && apple_t8132_firmware_path() && !of_property_present(node, "status")) + if (t8132 && IS_ENABLED(CONFIG_APPLE_T8132_PLATFORM_HANDOFF) && + !of_property_present(node, "status")) return dev_err_probe(dev, -ENODEV, "missing M4 power-domain policy\n"); tvm = of_parse_phandle(node, "power-domains", 0); diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig index a0c18035d2168..bbde5957ccc08 100644 --- a/drivers/soc/apple/Kconfig +++ b/drivers/soc/apple/Kconfig @@ -285,11 +285,13 @@ config APPLE_T8132_PLATFORM_HANDOFF depends on OF_DYNAMIC && OF_FLATTREE default y if APPLE_PMP help - Supply missing cache and PMC descriptions, and the J713 board's PMGR - availability/ownership policy, for the original loader tree before devices - are populated. Native memory-controller descriptions take precedence. - Required for that legacy tree to keep inaccessible PMGR domains from - probing; kernels using the complete J713 DT do not require this adapter. + Supply missing cache and PMC descriptions for the original J713 + loader tree, and the T8132 PMGR availability/ownership policy for + every T8132 tree, before devices are populated. Native + memory-controller descriptions take precedence. Required to keep + PMGR domains the firmware owns from being switched. With it, a T8132 + power state it could not mark is not registered; without it every + T8132 power state is registered as the tree describes it. config APPLE_T8132_PLATFORM_KUNIT_TEST tristate "KUnit tests for T8132 platform descriptions" if !KUNIT_ALL_TESTS diff --git a/drivers/soc/apple/t8132-platform-handoff.c b/drivers/soc/apple/t8132-platform-handoff.c index 1be411aafd7a1..099996aa68011 100644 --- a/drivers/soc/apple/t8132-platform-handoff.c +++ b/drivers/soc/apple/t8132-platform-handoff.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only OR MIT /* Supply missing platform descriptions for the original J713 loader ABI, - * which the J715 shares, and the M4 PMGR ownership policy on the qualified - * firmware for every M4 Mac. + * which the J715 shares, and the M4 PMGR ownership policy for every T8132 + * tree: the policy describes the SoC's power manager, whatever the firmware. * Keep the shared m1n1 payload usable by the stable kernel. Hardware control * remains in the ordinary MCC, PMC and CLPC drivers, with one DTS data source. * J713 PMGR ownership/status also comes from its board DTS, before any domain @@ -319,7 +319,7 @@ static int __init t8132_platform_handoff(void) unsigned int added = 0, changed = 0; int root, node, ret; - if (!apple_t8132_firmware_path() || !of_machine_is_compatible("apple,t8132")) + if (!of_machine_is_compatible("apple,t8132")) return 0; if (fdt_check_header(data)) return -EINVAL; diff --git a/include/linux/soc/apple/t8132.h b/include/linux/soc/apple/t8132.h index ec91e8faaa9b5..2a25496d1c6cf 100644 --- a/include/linux/soc/apple/t8132.h +++ b/include/linux/soc/apple/t8132.h @@ -32,9 +32,10 @@ static inline bool apple_t8132_pro_mini_imac(void) } /* - * The OS firmware the M4 PMP, PMGR ownership, display and GPU paths are - * qualified on, as the boot loader reports it: macOS 26.6.2 (iBoot - * mBoot-18000.161.10). These paths depend on the firmware, not the board. + * The OS firmware the M4 PMP, display and GPU paths are qualified on, as + * the boot loader reports it: macOS 26.6.2 (iBoot mBoot-18000.161.10). + * These paths depend on the firmware, not the board. The PMGR ownership + * policy does not: the platform handoff applies it on any firmware. */ static inline bool apple_t8132_qualified_firmware(void) {