diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index 19f7283ce4ec6a..68a9b6704fe7a1 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -132,10 +132,12 @@ pub(crate) const CONFIG: Config = Config { version: 0x07041100, counts: 0x0021040a, }], - // The stubs the boot chains of this J516C leave loaded (RTKit-2419.140.12): the macOS 14.7 - // chain's and the macOS 14.8 boot volume's. Same segment sizes and marker; the layout, board - // images and initdata below do not depend on which one is loaded. A further build can be - // admitted for one boot with `g15_accept_text_prefix`, which logs its digest. + // The stubs the boot chains of J516Cs leave loaded (RTKit-2419.140.12): the macOS 14.7 + // chain's, the macOS 14.8 boot volume's and a third TEXT seen on two further J516Cs (omacom + // /linux-aurora#289). Same segment sizes and marker; the layout, board images and initdata + // below do not depend on which one is loaded. The names say where a digest was measured, + // not that it identifies one build. A further digest can be admitted for one boot with + // `g15_accept_text_prefix`, which logs it. firmware: &[ FirmwareBuild { name: "macOS 14.7 stub firmware (iBoot-10151.140.19.700.2), J516C", @@ -161,6 +163,21 @@ pub(crate) const CONFIG: Config = Config { 0x9d, 0x6b, 0xcd, 0xa0, 0x26, 0xcf, ], }, + // Two J516Cs (iBoot2 iBoot-10151.140.19.700.2, OS firmware 14.7; iBoot1 mBoot-20457.1.29 + // and mBoot-20457.41.3) load this TEXT. On the second, 10 boots, glxinfo on the M3 Max + // renderer and a GLES compute job with no mismatches, no GPU faults (#289). + FirmwareBuild { + name: "J516C stub firmware, TEXT 125f0497 (seen with iBoot-10151.140.19.700.2)", + machine: Some(kernel::c_str!("apple,j516c")), + text_size: 0x64000, + data_size: 0x140000, + marker: 0x5cf28, + text_sha256: [ + 0x12, 0x5f, 0x04, 0x97, 0xc7, 0x90, 0x4f, 0xde, 0x87, 0xb0, 0x5a, 0x92, 0x64, + 0xa8, 0x8c, 0xf0, 0x3b, 0xdb, 0x35, 0x72, 0xa1, 0x71, 0x5c, 0xec, 0x91, 0xbd, + 0x0f, 0x9b, 0x78, 0x24, 0x55, 0x44, + ], + }, // Measured by the normal driver on J514C's 14.7 boot chain (system // firmware 26.5.2). Short native GL/Vulkan and normal-login checks passed; // power/thermal qualification remains open. Exact board identity is required. @@ -176,6 +193,22 @@ pub(crate) const CONFIG: Config = Config { 0x70, 0xc6, 0x6d, 0x2b, 0x0a, 0x1e, 0x87, 0x86, ], }, + // The same TEXT as the J516C row above, on one J514C (OS firmware 14.7, system firmware + // 26.6.2). With `g15_accept_text_prefix`, 3 boots with the GPU up; OpenGL 4.6 accelerated + // and no asahi-g15 errors on the one checked; idle only. Exact board identity is + // required; Vulkan, load and power/thermal qualification remain open. + FirmwareBuild { + name: "J514C stub firmware, TEXT 125f0497", + machine: Some(kernel::c_str!("apple,j514c")), + text_size: 0x64000, + data_size: 0x140000, + marker: 0x5cf28, + text_sha256: [ + 0x12, 0x5f, 0x04, 0x97, 0xc7, 0x90, 0x4f, 0xde, 0x87, 0xb0, 0x5a, 0x92, 0x64, + 0xa8, 0x8c, 0xf0, 0x3b, 0xdb, 0x35, 0x72, 0xa1, 0x71, 0x5c, 0xec, 0x91, 0xbd, + 0x0f, 0x9b, 0x78, 0x24, 0x55, 0x44, + ], + }, ], // This is the reference board. The exact J514C/T6031 pair also uses this // configuration through normal admission, with the unmeasured reference diff --git a/tools/asahi/g15-j514c-firmware-tests.py b/tools/asahi/g15-j514c-firmware-tests.py index 13c2969be48765..857d84a5104a88 100755 --- a/tools/asahi/g15-j514c-firmware-tests.py +++ b/tools/asahi/g15-j514c-firmware-tests.py @@ -29,7 +29,7 @@ } machine = re.search(r'machine:\s*Some\(kernel::c_str!\("([^"]+)"\)\)', body) rows.append((fields, digest, machine.group(1) if machine else None)) -assert sum(machine == "apple,j514c" for _, _, machine in rows) == 1 +assert sum(machine == "apple,j514c" for _, _, machine in rows) == 2 assert any(machine == "apple,j516c" for _, _, machine in rows) assert all(machine == "apple,j516c" for _, _, machine in rows if machine != "apple,j514c") measurements = [] @@ -51,13 +51,24 @@ (m, b.map_or(true, |b| b == board)) }).collect() } +// A digest may be bound to more than one board (one row per board); the expected +// verdict on `board` is the first row with that digest bound to it or to no board. +fn expected(sha256: &[u8; 32], board: &str) -> Verdict { + let all = rows(board); + match all.iter().zip(MACHINES).position(|((m, _), b)| { + &m.sha256 == sha256 && b.map_or(true, |b| b == board) + }) { + Some(i) => Verdict::Pinned(i), + None => Verdict::Refused, + } +} #[test] fn j514c_exact_candidate() { - let index = MACHINES.iter().position(|b| *b == Some("apple,j514c")).unwrap(); + for index in (0..MACHINES.len()).filter(|&i| MACHINES[i] == Some("apple,j514c")) { let exact = rows("apple,j514c")[index].0; assert_eq!(lookup::verdict(&exact, rows("apple,j514c"), 0), Verdict::Pinned(index)); for board in ["apple,j516c", "apple,j514m", "apple,j516m"] { - assert_eq!(lookup::verdict(&exact, rows(board), 0), Verdict::Refused); + assert_eq!(lookup::verdict(&exact, rows(board), 0), expected(&exact.sha256, board)); } let mut bad = exact; bad.sha256[31] ^= 1; assert_eq!(lookup::verdict(&bad, rows("apple,j514c"), 0), Verdict::Refused); @@ -67,6 +78,7 @@ assert_eq!(lookup::verdict(&bad, rows("apple,j514c"), 0), Verdict::Refused); let mut bad = exact; bad.marker += 8; assert_eq!(lookup::verdict(&bad, rows("apple,j514c"), 0), Verdict::Refused); + } } #[test] fn existing_rows_unchanged() { @@ -76,7 +88,7 @@ assert_eq!(lookup::verdict(&measured, rows("apple,j516c"), 0), Verdict::Pinned(index)); if board.is_some() { for other in ["apple,j514c", "apple,j514m", "apple,j516m"] { - assert_eq!(lookup::verdict(&measured, rows(other), 0), Verdict::Refused); + assert_eq!(lookup::verdict(&measured, rows(other), 0), expected(&measured.sha256, other)); } } }