diff --git a/drivers/gpu/drm/asahi/g15/hw.rs b/drivers/gpu/drm/asahi/g15/hw.rs index cac11c55d3ca0..c43f3729baa17 100644 --- a/drivers/gpu/drm/asahi/g15/hw.rs +++ b/drivers/gpu/drm/asahi/g15/hw.rs @@ -177,27 +177,13 @@ pub(crate) mod t6030 { 0xe7, 0x9b, 0xb9, 0xb0, 0x22, 0x09, 0xdb, 0x53, ], }, - // J514S firmware measured on the 14.7 boot chain; desktop rendering - // was verified with the bring-up prefix override (issue #247). + // B0 TEXT image measured on the 14.7 boot chain on both the J514S + // and the J516S; desktop rendering was verified with the bring-up + // prefix override (issue #247). The image is not board-specific, so + // it pins on any T6030. FirmwareBuild { - name: "J514S cd05 firmware (14.7 boot chain)", - machine: Some(kernel::c_str!("apple,j514s")), - text_size: 0x5c000, - data_size: 0x114000, - marker: 0x58e88, - text_sha256: [ - 0xcd, 0x05, 0xaf, 0x6a, 0x82, 0x8b, 0x52, 0xe4, - 0xc2, 0xfe, 0xd2, 0x00, 0x86, 0xd3, 0xd1, 0x8a, - 0x7d, 0xb4, 0x2e, 0x03, 0xa8, 0xfd, 0x6f, 0x83, - 0x54, 0xf9, 0xf0, 0x6e, 0x0a, 0x61, 0x36, 0x3e, - ], - }, - // Some J516S units on the same 14.7 boot chain load a different B0 - // TEXT image with identical sizes and marker. Pin its complete - // measured digest for the J516S only. - FirmwareBuild { - name: "J516S cd05 firmware (14.7 boot chain)", - machine: Some(kernel::c_str!("apple,j516s")), + name: "cd05 firmware (14.7 boot chain)", + machine: None, text_size: 0x5c000, data_size: 0x114000, marker: 0x58e88, @@ -208,28 +194,12 @@ pub(crate) mod t6030 { 0x54, 0xf9, 0xf0, 0x6e, 0x0a, 0x61, 0x36, 0x3e, ], }, - // J514S (14-inch) firmware measured on the 14.7 boot chain with - // system firmware 26.6.2; the GPU reached READY with the bring-up - // prefix override (issue #247). + // B0 TEXT image measured on the 14.7 boot chain with system firmware + // 26.6.2 on both the J514S and the J516S; the GPU reached READY with + // the bring-up prefix override (issue #247). It pins on any T6030. FirmwareBuild { - name: "J514S 4118 firmware (14.7 boot chain)", - machine: Some(kernel::c_str!("apple,j514s")), - text_size: 0x5c000, - data_size: 0x114000, - marker: 0x58e88, - text_sha256: [ - 0x41, 0x18, 0x33, 0xa7, 0xde, 0xd7, 0x73, 0xfe, - 0xea, 0xc4, 0xa1, 0x81, 0x55, 0x2e, 0x3f, 0xf5, - 0x58, 0x2e, 0xaf, 0x44, 0x35, 0xf2, 0xdd, 0x8f, - 0x62, 0x0c, 0x1e, 0xd0, 0xb3, 0x1d, 0xf1, 0xb0, - ], - }, - // J516S (16-inch) firmware measured on the 14.7 boot chain with - // system firmware 26.6.2; the GPU reached READY with the bring-up - // prefix override (issue #247). - FirmwareBuild { - name: "J516S 4118 firmware (14.7 boot chain)", - machine: Some(kernel::c_str!("apple,j516s")), + name: "4118 firmware (14.7 boot chain)", + machine: None, text_size: 0x5c000, data_size: 0x114000, marker: 0x58e88, diff --git a/tools/asahi/g15-maintained-handoff-tests.py b/tools/asahi/g15-maintained-handoff-tests.py index 738facb331e52..a6c4e4729fde2 100644 --- a/tools/asahi/g15-maintained-handoff-tests.py +++ b/tools/asahi/g15-maintained-handoff-tests.py @@ -137,16 +137,24 @@ def item(s, marker): OWNER_CALLS.set(0); let bytes = fixture(kind); assert!(parse(&dev, &Adt { data: &bytes }).is_err()); assert_eq!(OWNER_CALLS.get(), 0); } - assert_eq!(BUILDS.len(), 7, "maintained B0 firmware row must not require an absent profile symbol"); + assert_eq!(BUILDS.len(), 5, "maintained B0 firmware row must not require an absent profile symbol"); for (row, machine) in [(1, &b"apple,j516s"[..]), (2, &b"apple,j514s"[..])] { assert_eq!(BUILDS[row].machine.unwrap().to_bytes(), machine); assert_eq!((BUILDS[row].text_size, BUILDS[row].data_size, BUILDS[row].marker), (0x5c000, 0x114000, 0x58e88)); assert_eq!(BUILDS[row].text_sha256, [0xda,0x26,0xec,0xca,0xb1,0xf8,0x59,0x8d,0xa8,0x0c,0x85,0x5e,0xca,0x91,0x65,0x20,0x40,0x6d,0x1d,0x06,0x70,0xf1,0xd4,0x70,0xe7,0x9b,0xb9,0xb0,0x22,0x09,0xdb,0x53]); } - assert_eq!(BUILDS[4].machine.unwrap().to_bytes(), b"apple,j516s"); - assert_eq!((BUILDS[4].text_size, BUILDS[4].data_size, BUILDS[4].marker), (0x5c000, 0x114000, 0x58e88)); - assert_eq!(BUILDS[4].text_sha256, [0xcd,0x05,0xaf,0x6a,0x82,0x8b,0x52,0xe4,0xc2,0xfe,0xd2,0x00,0x86,0xd3,0xd1,0x8a,0x7d,0xb4,0x2e,0x03,0xa8,0xfd,0x6f,0x83,0x54,0xf9,0xf0,0x6e,0x0a,0x61,0x36,0x3e]); - // Issue #247: this J514S build must pin without the bring-up override. + // Issue #247: the cd05 and 4118 images are the same on the J514S and the J516S, + // so each has one board-independent row. + assert!(BUILDS[3].machine.is_none() && BUILDS[4].machine.is_none()); + assert_eq!((BUILDS[3].text_size, BUILDS[3].data_size, BUILDS[3].marker), (0x5c000, 0x114000, 0x58e88)); + assert_eq!(BUILDS[3].text_sha256, [0xcd,0x05,0xaf,0x6a,0x82,0x8b,0x52,0xe4,0xc2,0xfe,0xd2,0x00,0x86,0xd3,0xd1,0x8a,0x7d,0xb4,0x2e,0x03,0xa8,0xfd,0x6f,0x83,0x54,0xf9,0xf0,0x6e,0x0a,0x61,0x36,0x3e]); + for (i, a) in BUILDS.iter().enumerate() { + for b in &BUILDS[i + 1..] { + assert!(a.text_sha256 != b.text_sha256 || a.machine.is_some(), + "a board-independent row must not be duplicated per board"); + } + } + // The cd05 build must pin without the bring-up override. use identity::lookup::{Measured, Verdict, verdict}; let measured = Measured { text_size: 0x5c000, data_size: 0x114000, marker: 0x58e88, @@ -160,38 +168,31 @@ def item(s, marker): marker: b.marker, sha256: b.text_sha256 }, b.machine.map_or(true, |board| board.to_bytes() == machine), )), 0); - assert!(matches!(identify(&measured, b"apple,j514s"), Verdict::Pinned(3)), - "J514S cd05 firmware must pin without a prefix override"); - assert_eq!(identify(&measured, b"apple,j516s"), Verdict::Pinned(4)); - let mut changed = measured; - changed.sha256[31] ^= 1; - assert_eq!(identify(&changed, b"apple,j514s"), Verdict::Refused); - changed = measured; changed.text_size += 0x1000; - assert_eq!(identify(&changed, b"apple,j514s"), Verdict::Refused); - changed = measured; changed.data_size += 0x1000; - assert_eq!(identify(&changed, b"apple,j514s"), Verdict::Refused); - changed = measured; changed.marker += 8; - assert_eq!(identify(&changed, b"apple,j514s"), Verdict::Refused); - // Issue #247: the 4118 build pins on the J514S and the J516S, each to - // its own row, without the bring-up override. + for machine in [&b"apple,j514s"[..], b"apple,j516s", b"apple,t6030"] { + assert_eq!(identify(&measured, machine), Verdict::Pinned(3), + "cd05 firmware must pin without a prefix override"); + let mut changed = measured; + changed.sha256[31] ^= 1; + assert_eq!(identify(&changed, machine), Verdict::Refused); + changed = measured; changed.text_size += 0x1000; + assert_eq!(identify(&changed, machine), Verdict::Refused); + changed = measured; changed.data_size += 0x1000; + assert_eq!(identify(&changed, machine), Verdict::Refused); + changed = measured; changed.marker += 8; + assert_eq!(identify(&changed, machine), Verdict::Refused); + } + // Issue #247: the 4118 build pins to its one row on any T6030 board, + // without the bring-up override. let digest = [0x41,0x18,0x33,0xa7,0xde,0xd7,0x73,0xfe, 0xea,0xc4,0xa1,0x81,0x55,0x2e,0x3f,0xf5, 0x58,0x2e,0xaf,0x44,0x35,0xf2,0xdd,0x8f, 0x62,0x0c,0x1e,0xd0,0xb3,0x1d,0xf1,0xb0]; - for (row, machine) in [(5, &b"apple,j514s"[..]), (6, &b"apple,j516s"[..])] { - assert_eq!(BUILDS[row].machine.unwrap().to_bytes(), machine); - assert_eq!((BUILDS[row].text_size, BUILDS[row].data_size, BUILDS[row].marker), (0x5c000, 0x114000, 0x58e88)); - assert_eq!(BUILDS[row].text_sha256, digest); - } + assert_eq!((BUILDS[4].text_size, BUILDS[4].data_size, BUILDS[4].marker), (0x5c000, 0x114000, 0x58e88)); + assert_eq!(BUILDS[4].text_sha256, digest); let measured = Measured { text_size: 0x5c000, data_size: 0x114000, marker: 0x58e88, sha256: digest }; - assert_eq!(identify(&measured, b"apple,j514s"), Verdict::Pinned(5), - "J514S 4118 firmware must pin without a prefix override"); - assert_eq!(identify(&measured, b"apple,j516s"), Verdict::Pinned(6), - "J516S 4118 firmware must pin without a prefix override"); - for other in [&b"apple,j514c"[..], b"apple,j516c", b"apple,j514m", b"apple,j516m", b"apple,t6030"] { - assert_eq!(identify(&measured, other), Verdict::Refused); - } - for machine in [&b"apple,j514s"[..], b"apple,j516s"] { + for machine in [&b"apple,j514s"[..], b"apple,j516s", b"apple,t6030"] { + assert_eq!(identify(&measured, machine), Verdict::Pinned(4), + "4118 firmware must pin without a prefix override"); let mut changed = measured; changed.sha256[31] ^= 1; assert_eq!(identify(&changed, machine), Verdict::Refused); diff --git a/tools/asahi/g15-zero-words-tests.py b/tools/asahi/g15-zero-words-tests.py index f4d18bc9685ac..6f684a2af10ce 100644 --- a/tools/asahi/g15-zero-words-tests.py +++ b/tools/asahi/g15-zero-words-tests.py @@ -20,12 +20,11 @@ UAT adoption (two #[cfg] lines; the tables are unchanged). Its T6030 configuration module is independently pinned to the original bytes, -except for the J514S B0 FirmwareBuild row, the J514S cd05 and J516S cd05 -FirmwareBuild rows and the J514S 4118 and J516S 4118 FirmwareBuild rows added -to its firmware table: the module is the original pinned bytes (0079ae08) plus -those five rows, and the whole hw.rs pin was refreshed with each (with the 4118 -rows removed, both pins are their earlier values fb2118b6 and 2667963a; with -the cd05 rows also removed, e9b80be9 and cab592b5). prepare_board() is pinned too; +except for the J514S B0 FirmwareBuild row and the board-independent cd05 and +4118 FirmwareBuild rows added to its firmware table: the module is the original +pinned bytes (0079ae08) plus those three rows, and the whole hw.rs pin was +refreshed with each (with the 4118 and cd05 rows removed, both pins are their +earlier values c54a4f83 and cab592b5). prepare_board() is pinned too; it was refreshed for the same Board change (its T6030 arm is unchanged). """ @@ -42,11 +41,11 @@ GOLDEN_FILES = { "board/data.rs": "7c5ff1077ca3296cbfc9e7144294162b6dea78a3774c38eeed4b0f59a14d7a5c", "board/template.rs": "286872f5474a67534f214e83e659253299f85143f3dc59035fa80894022e2549", - "hw.rs": "9fa2d6e5f5d14127574448cafd6523d2151dab77c66d16e74500fafde21e8d92", + "hw.rs": "eff5ef8e43b46b4b54ac5ffb4046041deee531db205ba67918399e9eaac521a1", "power/idle.rs": "4928ecf7699b3ca85ff5143eb6e996efd40d47321e29a238a02c8873bc9f102c", } GOLDEN_FUNCTIONS = { - ("hw.rs", "pub(crate) mod t6030 {"): "4016ec0d46831482382a92791b625e10fb2f6e4e28115a9498fdde0776f82e52", + ("hw.rs", "pub(crate) mod t6030 {"): "e4f2c8a7af059df9556cf95e2ef7314cbca54c35045313182ad81b94dc3edea9", ("initdata.rs", "fn templates("): "c3115c9926d3d7d93317cb8510e93b04f30b0c256811d7137568e822dd93b8ee", ("initdata.rs", "pub(crate) fn prepare_board("): "ebef64ab87ef7b1f994eb7fa2a2424d05bc4fc9e88cbfbf18e51570bdfc4222d", ("board.rs", "pub(crate) fn from_adt("): "cecd0b28db5bd94d3b75c1bbb5f35204e8bf0699f74e5b3d08228c59025f6ac2",