From c2bace5bb28512471318d71abd5073b2bc7e2af1 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Sat, 24 Oct 2026 00:30:52 +1100 Subject: [PATCH 1/2] soc: apple: pmp: start endpoint 7 on every T6041 PMP The M4 Pro (T6040, J616s) PMP firmware advertises system endpoint 7 and asks for a 0x2000 byte buffer on it during its RTKit boot. Unless the endpoint is started and the buffer is given, the firmware never acknowledges the IOP power state and the probe fails with "IOP power acknowledgment failed: -62". The endpoint 7 handling RTKit already has for the J713 PMP (CoreAnalytics: type 0 buffer request, type 1 reply with a 4K or 1M unit) is the same exchange, so only the gate changes: the T6041 configuration starts endpoint 7 on every board, while T8132 keeps the retained-J713 check. Verified on a J616s: before, -62 after the EP01/EP04 buffer replies; with endpoint 7 served, "PMP firmware and endpoint ready" and the firmware logs "io.cpp:54: PMP started". Niklas Sheth found the same endpoint 7 dependency for the M4 Pro PMP in GravityLinux (877c574dfa, rtkit endpoint-7 hunks); this uses our existing CoreAnalytics path instead of carrying that code. Assisted-by: LLM Signed-off-by: Ryan Murray --- drivers/soc/apple/pmp.rs | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/drivers/soc/apple/pmp.rs b/drivers/soc/apple/pmp.rs index 5e780bb4568b8..c239fae558cee 100644 --- a/drivers/soc/apple/pmp.rs +++ b/drivers/soc/apple/pmp.rs @@ -654,34 +654,48 @@ struct PmpHwConfig { /// Check the firmware's `uuid` header before trusting the boot argument /// block it points to. check_bootargs_uuid: bool, - coreanalytics: bool, + /// When the firmware needs system endpoint 7 (CoreAnalytics) started + /// and given its buffer before it acknowledges the IOP power state. + coreanalytics: Ep7, +} + +/// Whether a PMP firmware needs endpoint 7 to finish its RTKit boot. +#[derive(Clone, Copy, PartialEq, Eq)] +enum Ep7 { + /// Never started. + No, + /// Only on the retained J713 board. + RetainedBoard, + /// On every board with this SoC. + Always, } const HW_CFG_DEFAULT: PmpHwConfig = PmpHwConfig { dma_mask: None, check_bootargs_uuid: false, - coreanalytics: false, + coreanalytics: Ep7::No, }; /// T8140: the DART translates 42 bits and its DMA window starts at 1 TiB. const HW_CFG_T8140: PmpHwConfig = PmpHwConfig { dma_mask: Some(DmaMask::new::<42>()), check_bootargs_uuid: false, - coreanalytics: false, + coreanalytics: Ep7::No, }; /// T6041: the DART window starts at 1 TiB; the boot argument header is -/// version 5. +/// version 5. The firmware advertises endpoint 7 and does not acknowledge +/// the IOP power state (-ETIME) until it is started and has its buffer. const HW_CFG_T6041: PmpHwConfig = PmpHwConfig { dma_mask: Some(DmaMask::new::<42>()), check_bootargs_uuid: true, - coreanalytics: false, + coreanalytics: Ep7::Always, }; const HW_CFG_T8132: PmpHwConfig = PmpHwConfig { dma_mask: None, check_bootargs_uuid: false, - coreanalytics: true, + coreanalytics: Ep7::RetainedBoard, }; impl Drop for PmpDriver { @@ -747,10 +761,14 @@ impl platform::Driver for PmpDriver { patches.push((from_fourcc(b"PMCB"), (v >> 3) & 1), GFP_KERNEL)?; } data.patch_bootargs(&pmp_mmio, &patches, cfg.check_bootargs_uuid)?; - // EP7 is a qualified startup dependency only on the retained J713 PMP. - // SAFETY: the predicate only reads machine compatibility. - let needs_coreanalytics = - cfg.coreanalytics && unsafe { bindings::apple_pmp_telemetry_retained_board() }; + // EP7 is a startup dependency on every T6041 PMP, and on the + // retained J713 PMP among the T8132 boards. + let needs_coreanalytics = match cfg.coreanalytics { + Ep7::No => false, + Ep7::Always => true, + // SAFETY: the predicate only reads machine compatibility. + Ep7::RetainedBoard => unsafe { bindings::apple_pmp_telemetry_retained_board() }, + }; let rtkit = if needs_coreanalytics { rtkit::RtKit::::new_with_coreanalytics(&dev, None, 0, data.clone())? } else { From c4722f38cdccca6dbbbc446dfa2d715ab96e9554 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Sat, 24 Oct 2026 01:05:12 +1100 Subject: [PATCH 2/2] arm64: dts: apple: t6040: Do not claim the GPU's PMP report entry at boot The pmp-gfx report entry tells the PMP that the GPU (soc-device 13) is on. It was marked always-on, so the PMP report driver claimed it at boot although this tree has no GPU node and nothing powers the GPU. On a J616s the PMP firmware then crashes 20 to 70 ms after it logs "io.cpp:54: PMP started": an SError (ESR 0xbe000000) in the firmware, at the same PC on every boot. The PMP stays dead for the rest of the boot and the CPU clusters keep their fail-safe frequency caps. With the entry left unclaimed, the PMP keeps running and the CPUs get their full frequency ladder. The CPU cluster entries stay always-on. Label the entry so that the GPU node can take it as a power domain; the GPU driver then claims it only while it has the GPU powered. Assisted-by: LLM Signed-off-by: Ryan Murray --- arch/arm64/boot/dts/apple/t6040.dtsi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/apple/t6040.dtsi b/arch/arm64/boot/dts/apple/t6040.dtsi index 85114b04d9b20..e5a87f1331d54 100644 --- a/arch/arm64/boot/dts/apple/t6040.dtsi +++ b/arch/arm64/boot/dts/apple/t6040.dtsi @@ -866,15 +866,17 @@ /* * The GPU (soc-device 13). Without it the running PMP treats - * the GPU as off and holds it at its lowest state. + * the GPU as off and holds it at its lowest state, but claiming + * it while nothing powers the GPU crashes the PMP firmware + * (SError) right after it starts. The GPU node takes it as a + * power domain, so it is on only while the GPU driver runs. */ - report@d { + pmp_gfx: report@d { compatible = "apple,t6041-pmp-v2-report-entry", "apple,t6000-pmp-v2-report-entry"; reg = <0xd>; label = "pmp-gfx"; #power-domain-cells = <0>; - apple,always-on; }; };