From 2fe1609b88fe7dc41a04e746f1c6cf15d1701cd2 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Thu, 3 Dec 2026 03:13:59 -0500 Subject: [PATCH 1/2] drm/asahi: g17: t6041: admit the shipped 26B123 image on every Mac The 26B123 list holds two measured TEXT digests, one 40-core J616C and one 32-core J616C. iBoot fills part of the loaded TEXT for each Mac, so a J614C or a J575C on a 27.2 stub matches neither, and the GPU does not start. List the shipped image (build b000 of armfw_g16c.im4p, the G16C B1 one) with every range iBoot fills zeroed: the two header words, the values of the 39 boot parameter records and the two tunable tables. The ranges follow the record tags and lengths in the image and are the ones T8132's 26B123 entry zeroes, 0x318f bytes earlier. The per-Mac entries stay for now. Signed-off-by: DjDeveloperr --- drivers/gpu/drm/asahi/fwid.rs | 19 +++++++++ drivers/gpu/drm/asahi/hw/t6041.rs | 70 ++++++++++++++++++++++++++++++- 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/asahi/fwid.rs b/drivers/gpu/drm/asahi/fwid.rs index 1f7c016ecf990..134beb33f0602 100644 --- a/drivers/gpu/drm/asahi/fwid.rs +++ b/drivers/gpu/drm/asahi/fwid.rs @@ -556,6 +556,25 @@ mod tests { assert!(measured(build.images, 0x13c000, entropy, digest).is_none()); } } + // The first 26B123 image is the shipped one, with what iBoot fills zeroed. + let filled = crate::hw::t6041::BOOT_FILLED_26B123; + let shipped = &builds[3].images[0]; + assert_eq!(shipped.boot_filled, filled); + assert!(builds[3].images[1..].iter().all(|image| image.boot_filled.is_empty())); + let [gkts, ecap] = shipped.entropy[0]; + assert_eq!(filled[..2], [(0x224, 4), (0x23c, 8)]); + // One value per parameter record, each after its 8-byte tag and length, back to back. + let mut next = gkts; + for &(off, len) in &filled[2..filled.len() - 4] { + assert_eq!(off, next + 8); + next = off + len; + } + assert!(filled.contains(&(gkts + 8, 8)) && filled.contains(&(ecap + 8, 8))); + // Then each tunable table's count byte and body. + for (i, table) in [next, next + 0x350].into_iter().enumerate() { + let at = filled.len() - 4 + 2 * i; + assert_eq!(filled[at..at + 2], [(table + 3, 1), (table + 4, 0x34c)]); + } for image in builds[3].images { let digest = image.text_sha256; let found = lookup(builds[3].images, image.text_size, image.data_size, |_| { diff --git a/drivers/gpu/drm/asahi/hw/t6041.rs b/drivers/gpu/drm/asahi/hw/t6041.rs index 78322a4d29c60..2cf98220b3476 100644 --- a/drivers/gpu/drm/asahi/hw/t6041.rs +++ b/drivers/gpu/drm/asahi/hw/t6041.rs @@ -96,9 +96,23 @@ const BUILDS: [fw::variant::Build; 5] = [ pub(super) const BUILD_26B123: fw::variant::Build = fw::variant::Build { os_version: [27, 2, 0], name: "macOS 27.2 (26B123, iBoot mBoot-20457.41.3)", - // iBoot fills part of the loaded TEXT for each Mac, so each admitted image is a - // measurement. images: &[ + // Build b000 (G16C B1) of armfw_g16c.im4p, with every range iBoot fills zeroed + // (`BOOT_FILLED_26B123`): the digest of the shipped image with the same ranges zeroed, + // which any Mac that loads it has. + crate::fwid::FirmwareBuild { + name: "Apple GFX 26B123 for T6041 (build b000, iBoot-filled ranges zeroed)", + text_size: 0x64000, + data_size: 0xcc000, + entropy: &[[0x5d88c, 0x5d96f]], + boot_filled: BOOT_FILLED_26B123, + text_sha256: [ + 0x9a, 0x56, 0x06, 0x13, 0xa5, 0xc7, 0x4d, 0x8f, 0x0a, 0x54, 0xda, 0x43, 0xce, 0x5e, + 0x06, 0x89, 0x68, 0x1d, 0x76, 0xbe, 0x41, 0x18, 0xb3, 0xde, 0x59, 0x12, 0xc3, 0x55, + 0x4d, 0x9b, 0xed, 0x6f, + ], + }, + // The per-Mac measurements below stay until a Mac has booted with only the entry above. // 40-core J616C. crate::fwid::FirmwareBuild { name: "Apple GFX 26B123 for T6041 (normalized loaded image)", @@ -135,6 +149,58 @@ pub(super) const BUILD_26B123: fw::variant::Build = fw::variant::Build { config: None, }; +/// What iBoot writes into the 26B123 build b000 TEXT it loads, in TEXT order: the same header +/// words, 39 boot parameter records and two tunable tables as on T8132 +/// (`g16::hw::t8132::BOOT_FILLED_26B123_B000`), the records from 0x5d88c and the tables from +/// 0x5dabd. +pub(crate) const BOOT_FILLED_26B123: &[(u32, u32)] = &[ + (0x224, 4), + (0x23c, 8), + (0x5d894, 8), + (0x5d8a4, 8), + (0x5d8b4, 8), + (0x5d8c4, 8), + (0x5d8d4, 8), + (0x5d8e4, 8), + (0x5d8f4, 8), + (0x5d904, 4), + (0x5d910, 1), + (0x5d919, 8), + (0x5d929, 8), + (0x5d939, 4), + (0x5d945, 8), + (0x5d955, 1), + (0x5d95e, 1), + (0x5d967, 8), + (0x5d977, 8), + (0x5d987, 8), + (0x5d997, 8), + (0x5d9a7, 8), + (0x5d9b7, 8), + (0x5d9c7, 8), + (0x5d9d7, 8), + (0x5d9e7, 8), + (0x5d9f7, 8), + (0x5da07, 8), + (0x5da17, 8), + (0x5da27, 4), + (0x5da33, 8), + (0x5da43, 4), + (0x5da4f, 4), + (0x5da5b, 8), + (0x5da6b, 8), + (0x5da7b, 1), + (0x5da84, 8), + (0x5da94, 8), + (0x5daa4, 4), + (0x5dab0, 1), + (0x5dab9, 4), + (0x5dac0, 1), + (0x5dac1, 0x34c), + (0x5de10, 1), + (0x5de11, 0x34c), +]; + const BUILD_25F84: fw::variant::Build = fw::variant::Build { os_version: [26, 5, 2], name: "macOS 26.5.2 (25F84, iBoot mBoot-18000.121.3)", From df50aba1031e28d6630c211786ab3f46d9df709c Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Thu, 3 Dec 2026 03:14:15 -0500 Subject: [PATCH 2/2] drm/asahi: g17: t6041: restart the 40-core GPU after a deep sleep on 26B123 The 40-core M4 Max runs BASE on 26B123. BASE leaves sleep_restart off, so sleep_prepare() refuses every deep sleep with "no firmware restart on this chip". The 32-core part on 26B123 and both parts on 25G83 have it on, and restart the GPU in every deep sleep they have run. Signed-off-by: DjDeveloperr --- drivers/gpu/drm/asahi/fwid.rs | 3 +++ drivers/gpu/drm/asahi/hw/t6041.rs | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/asahi/fwid.rs b/drivers/gpu/drm/asahi/fwid.rs index 134beb33f0602..9b28048acffe0 100644 --- a/drivers/gpu/drm/asahi/fwid.rs +++ b/drivers/gpu/drm/asahi/fwid.rs @@ -615,8 +615,11 @@ mod tests { assert_eq!(g83_32.windows.len(), map.len()); let b123_40 = builds[3].config.unwrap(); assert_eq!(b123_40.core_layout.cores, Some((4, 40))); + // Both restart the GPU after a real sleep; without it every deep sleep is refused. + assert!(b123_40.sleep_restart); let b123_32 = builds[4].config.unwrap(); assert_eq!(b123_32.core_layout.cores, Some((4, 32))); + assert!(b123_32.sleep_restart); assert_eq!(b123_32.windows.len(), map.len()); } diff --git a/drivers/gpu/drm/asahi/hw/t6041.rs b/drivers/gpu/drm/asahi/hw/t6041.rs index 2cf98220b3476..360933e899e6d 100644 --- a/drivers/gpu/drm/asahi/hw/t6041.rs +++ b/drivers/gpu/drm/asahi/hw/t6041.rs @@ -64,7 +64,8 @@ pub(super) const BASE: Config = Config { }; /// The 40-core M4 Max. 25F84 runs this configuration; 25G83 runs [`CONFIG_25G83`], 26B123 runs -/// [`BASE`], and a 32-core part runs [`super::t6041_25g83::CONFIG`] on both 25G83 and 26B123. +/// [`CONFIG_26B123`], and a 32-core part runs [`super::t6041_25g83::CONFIG`] on both 25G83 and +/// 26B123. pub(crate) const CONFIG: Config = Config { firmware: fw::variant::Firmware::Identified(&BUILDS), ..BASE @@ -83,7 +84,7 @@ const BUILDS: [fw::variant::Build; 5] = [ ..BUILD_25G83_32CORE }, fw::variant::Build { - config: Some(&BASE), + config: Some(&CONFIG_26B123), ..BUILD_26B123 }, fw::variant::Build { @@ -324,6 +325,13 @@ const CONFIG_25G83: Config = Config { ..BASE }; +/// The 40-core M4 Max on 26B123: the 25F84 configuration. +const CONFIG_26B123: Config = Config { + // The GPU is restarted after a real sleep, as on the 32-core part. + sleep_restart: true, + ..BASE +}; + pub(crate) const CHIP_ID: u32 = 0x6041; pub(crate) const REGISTER_WINDOWS: [RegisterWindow; 25] = [