From 5ce904e3d4fe64bd05e54486ab4542b906ea2496 Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Wed, 4 Nov 2026 21:08:10 -0800 Subject: [PATCH 01/11] drm/asahi: add explicit J514C bring-up admission J514C has the same four-cluster T6031 GPU as J516C, but the existing machine check refuses it before the shared display and firmware gates. Add a default-off parameter requiring exactly 1 and both J514C/T6031 compatibles on the DeviceTree platform. Preserve display publication, DT/ADT shape, hardware identity, core-mask and cold-start admission. This is an experimental same-die bring-up. The maximum-power, relative-power and two MTR mask groups remain J516C reference words; they have not been independently measured on J514C. The opt-in warning keeps this assumption visible. Do not claim thermal qualification. The production admission harness covers the exact board/SoC/parameter gates and native-display ordering, with compiled C and Rust mutants. Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/gpu/drm/asahi/asahi_core.rs | 4 ++ drivers/gpu/drm/asahi/g15/boot.rs | 20 +++++++- drivers/gpu/drm/asahi/g15/hw/t6031.rs | 5 +- drivers/gpu/drm/asahi/g15/params.rs | 6 +++ tools/asahi/g15-display-order-tests.py | 70 ++++++++++++++++++++++---- 5 files changed, 91 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/asahi/asahi_core.rs b/drivers/gpu/drm/asahi/asahi_core.rs index b6ddde4e3bcace..82d7d17eb35b30 100644 --- a/drivers/gpu/drm/asahi/asahi_core.rs +++ b/drivers/gpu/drm/asahi/asahi_core.rs @@ -186,6 +186,10 @@ module! { default: 0, description: "G15: admit an unpinned GPU firmware build whose TEXT SHA-256 starts with these 8 bytes (bring-up only)", }, + g15_j514c_bringup: u32 { + default: 0, + description: "G15: opt into J514C/T6031 bring-up with the J516C reference power/thermal words (1 only; unqualified on J514C)", + }, stats_export: u8 { default: 1, // permissions: 0, diff --git a/drivers/gpu/drm/asahi/g15/boot.rs b/drivers/gpu/drm/asahi/g15/boot.rs index 45e244531323d7..e05b2b55aef9e9 100644 --- a/drivers/gpu/drm/asahi/g15/boot.rs +++ b/drivers/gpu/drm/asahi/g15/boot.rs @@ -46,7 +46,7 @@ use super::fw::initdata::runtime; use super::hw; use super::initdata::{self, InitData}; use super::object::Objects; -use super::{identity, regs, uat, Config, Shared}; +use super::{identity, params, regs, uat, Config, Shared}; use crate::driver::AsahiDrmDevice as AsahiDevice; use crate::mmu; @@ -467,6 +467,16 @@ pub(crate) fn admit( ) -> Result { let dev = pdev.as_ref(); let pmp = cfg.platform == hw::Platform::AdtWithPmp; + // Experimental same-die candidate, not a qualification of the J516C + // reference words for the 14-inch chassis. Keep exact board AND SoC checks; + // T6034 boards must never inherit this four-cluster T6031 configuration. + // The remaining display, DT/ADT, full firmware identity, hardware identity + // and record-builder admission below is unchanged. + let j514c_candidate = cfg.chip_id == 0x6031 + && cfg.platform == hw::Platform::DeviceTree + && params::j514c_bringup() + && glue::machine(kernel::c_str!("apple,j514c")) + && glue::machine(kernel::c_str!("apple,t6031")); if pmp { if !glue::board() { return Err(ENODEV); @@ -481,7 +491,7 @@ pub(crate) fn admit( } return Err(err); } - } else if !glue::machine(cfg.machine) { + } else if !glue::machine(cfg.machine) && !j514c_candidate { dev_err!(dev, "G15: not a {} machine\n", cfg.name); return Err(ENODEV); } else { @@ -496,6 +506,12 @@ pub(crate) fn admit( return Err(err); } } + if j514c_candidate { + dev_warn!( + dev, + "J514C bring-up: using J516C reference power/thermal words; this board is not qualified\n" + ); + } let adt = adt::read(dev, cfg) .inspect_err(|e| dev_err!(dev, "GPU regions not admitted: {:?}\n", e))?; identity::firmware(dev, &adt, cfg.firmware) diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index 8bac33989db648..3f4f6d67f95d69 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -1,6 +1,9 @@ // SPDX-License-Identifier: GPL-2.0-only OR MIT -//! T6031 (M3 Max, G15C) configuration, admitted on J516C only. +//! T6031 (M3 Max, G15C) configuration, qualified on J516C only. +//! +//! J514C may explicitly opt into a bring-up candidate using these reference +//! words with `g15_j514c_bringup=1`. This is not J514C power/thermal qualification. //! //! One die, four clusters of ten core slots. The firmware is the same RTKit 2419 generation as //! the T6030's and the initdata graph keeps the T6030 canonical VAs; what differs is the SoC diff --git a/drivers/gpu/drm/asahi/g15/params.rs b/drivers/gpu/drm/asahi/g15/params.rs index 858cec0a291c5e..d20c7ec2f2bfe1 100644 --- a/drivers/gpu/drm/asahi/g15/params.rs +++ b/drivers/gpu/drm/asahi/g15/params.rs @@ -103,6 +103,12 @@ pub(crate) fn accept_text_prefix() -> u64 { *module_parameters::g15_accept_text_prefix.value() } +/// Opt into the J514C candidate only at exactly 1. The default keeps the +/// qualified J516C-only board admission. This does not override firmware identity. +pub(crate) fn j514c_bringup() -> bool { + *module_parameters::g15_j514c_bringup.value() == 1 +} + /// The parameter for the PB growth maximum the firmware is given, in blocks, clamped to /// 64..=4095. [`super::pools::Pools::soft_max`] raises it to at least the initial posting; the /// blocks above it, up to the 4095 posted at most, answer the synchronous requests of partial diff --git a/tools/asahi/g15-display-order-tests.py b/tools/asahi/g15-display-order-tests.py index a6666efdf2776b..5164700af6af9f 100644 --- a/tools/asahi/g15-display-order-tests.py +++ b/tools/asahi/g15-display-order-tests.py @@ -228,6 +228,8 @@ def c_source(root): RS_PREFIX = r''' #![allow(dead_code, unused_variables, unused_imports, unused_macros, non_snake_case)] +extern crate self as kernel; +#[macro_export] macro_rules! c_str { ($s:literal) => { $s }; } use std::cell::RefCell; use std::marker::PhantomData; #[derive(Copy, Clone, PartialEq, Eq, Debug)] @@ -241,15 +243,22 @@ def c_source(root): macro_rules! dev_err { ($($args:tt)*) => {{}}; } macro_rules! dev_info { ($($args:tt)*) => {{}}; } macro_rules! dev_warn { ($($args:tt)*) => {{ warned(); }}; } -struct State { board: bool, machine: bool, pmp: i32, display: i32, sleep_hold: bool, asc_fail: bool } +struct State { board: bool, machine: bool, pmp: i32, display: i32, sleep_hold: bool, asc_fail: bool, j514c: bool, t6031: bool, bringup: u32 } thread_local! { static CALLS: RefCell> = const { RefCell::new(Vec::new()) }; - static STATE: RefCell = const { RefCell::new(State { board: true, machine: true, pmp: 0, display: 0, sleep_hold: true, asc_fail: false }) }; + static STATE: RefCell = const { RefCell::new(State { board: true, machine: true, pmp: 0, display: 0, sleep_hold: true, asc_fail: false, j514c: false, t6031: false, bringup: 0 }) }; static HOLD: RefCell> = const { RefCell::new(None) }; static WARNINGS: RefCell = const { RefCell::new(0) }; } fn warned() { WARNINGS.with(|w| *w.borrow_mut() += 1); } +mod module_parameters { + #[allow(non_upper_case_globals)] pub static g15_j514c_bringup: Parameter = Parameter; + pub struct Parameter; + impl Parameter { pub fn value(&self) -> Box { Box::new(super::STATE.with(|s| s.borrow().bringup)) } } +} mod params { + use super::module_parameters; + @J514C_GETTER@ pub fn sleep_hold() -> bool { super::STATE.with(|s| s.borrow().sleep_hold) } } fn call(name: &'static str) { CALLS.with(|c| c.borrow_mut().push(name)); } @@ -267,7 +276,7 @@ def c_source(root): #[derive(Copy, Clone, PartialEq, Eq)] pub enum Platform { AdtWithPmp, DeviceTree } #[derive(Copy, Clone, PartialEq, Eq)] pub enum Board { None, Templates, Blob } } -struct Config { platform: hw::Platform, machine: &'static str, name: &'static str, firmware: (), board: hw::Board } +struct Config { chip_id: u32, platform: hw::Platform, machine: &'static str, name: &'static str, firmware: (), board: hw::Board } mod adt { pub struct GpuAdt; pub fn read(_: &super::device::Device, _: &super::Config) -> super::Result { super::call("adt"); Ok(GpuAdt) } @@ -292,7 +301,7 @@ def c_source(root): mod glue { use super::{call, STATE}; pub fn board() -> bool { call("board"); STATE.with(|s| s.borrow().board) } - pub fn machine(_: &str) -> bool { call("machine"); STATE.with(|s| s.borrow().machine) } + pub fn machine(name: &str) -> bool { call("machine"); STATE.with(|s| { let s=s.borrow(); match name { "apple,j514c" => s.j514c, "apple,t6031" => s.t6031, _ => s.machine } }) } pub unsafe fn asahi_g15_pmp_prepare(_: *mut core::ffi::c_void) -> core::ffi::c_int { call("pmp"); STATE.with(|s| s.borrow().pmp) } pub unsafe fn asahi_g15_display_prepare(_: *mut core::ffi::c_void) -> core::ffi::c_int { call("display"); STATE.with(|s| s.borrow().display) } pub fn dma_coherent(_: &super::device::Device) -> bool { call("coherent"); false } @@ -302,12 +311,12 @@ def c_source(root): ''' RS_MAIN = r''' -static T6031: Config = Config { platform: hw::Platform::DeviceTree, machine: "apple,j516c", name: "T6031 G15C", firmware: (), board: hw::Board::Blob }; -static T6030: Config = Config { platform: hw::Platform::AdtWithPmp, machine: "apple,t6030", name: "T6030 G15S", firmware: (), board: hw::Board::Templates }; +static T6031: Config = Config { chip_id: 0x6031, platform: hw::Platform::DeviceTree, machine: "apple,j516c", name: "T6031 G15C", firmware: (), board: hw::Board::Blob }; +static T6030: Config = Config { chip_id: 0x6030, platform: hw::Platform::AdtWithPmp, machine: "apple,t6030", name: "T6030 G15S", firmware: (), board: hw::Board::Templates }; const TAIL: [&str; 6] = ["adt", "identity", "coherent", "board_images", "regs", "hold"]; fn run(cfg: &'static Config, machine: bool, pmp: i32, display: i32) -> (Result<()>, Vec<&'static str>) { CALLS.with(|c| c.borrow_mut().clear()); - STATE.with(|s| *s.borrow_mut() = State { board: true, machine, pmp, display, sleep_hold: true, asc_fail: false }); + STATE.with(|s| *s.borrow_mut() = State { board: true, machine, pmp, display, sleep_hold: true, asc_fail: false, j514c: false, t6031: false, bringup: 0 }); HOLD.with(|h| *h.borrow_mut() = None); WARNINGS.with(|w| *w.borrow_mut() = 0); let pdev = platform::Device(device::Device, Core(PhantomData)); @@ -316,7 +325,41 @@ def c_source(root): } fn with_tail(head: &[&'static str]) -> Vec<&'static str> { head.iter().chain(TAIL.iter()).copied().collect() } @SLEEP_HOLD_RUN@ +fn candidate_for(cfg: &'static Config, board: bool, soc: bool, value: u32, display: i32) -> (Result<()>, Vec<&'static str>, u32) { + CALLS.with(|c| c.borrow_mut().clear()); + STATE.with(|s| *s.borrow_mut() = State { board: true, machine: false, pmp: 0, display, sleep_hold: true, asc_fail: false, j514c: board, t6031: soc, bringup: value }); + WARNINGS.with(|w| *w.borrow_mut() = 0); + let pdev = platform::Device(device::Device, Core(PhantomData)); + let result = admit(&pdev, &AsahiDevice, cfg).map(|_| ()); + (result, CALLS.with(|c| c.borrow().clone()), WARNINGS.with(|w| *w.borrow())) +} +fn candidate(board: bool, soc: bool, value: u32, display: i32) -> (Result<()>, Vec<&'static str>, u32) { + candidate_for(&T6031, board, soc, value, display) +} +static T6034: Config = Config { chip_id: 0x6034, platform: hw::Platform::DeviceTree, machine: "apple,j514m", name: "T6034", firmware: (), board: hw::Board::Blob }; fn main() { + let (result, calls, _) = candidate_for(&T6034, true, true, 1, 0); + assert_eq!(result, Err(ENODEV), "wrong Config cannot inherit this candidate"); + assert!(!calls.contains(&"display") && !calls.contains(&"adt")); + for value in [0, 2, u32::MAX] { + let (result, calls, _) = candidate(true, true, value, 0); + assert_eq!(result, Err(ENODEV), "J514C requires exactly 1"); + assert!(!calls.contains(&"display") && !calls.contains(&"adt")); + } + for (board, soc) in [(false, true), (true, false), (false, false)] { + let (result, calls, _) = candidate(board, soc, 1, 0); + assert_eq!(result, Err(ENODEV), "wrong board or SoC must not inherit T6031"); + assert!(!calls.contains(&"display") && !calls.contains(&"adt")); + } + let (result, calls, warnings) = candidate(true, true, 1, 0); + assert_eq!(result, Ok(())); + assert!(calls.ends_with(&TAIL)); + assert_eq!(warnings, 1, "candidate must identify its unqualified reference assumptions"); + for code in [-517, -19] { + let (result, calls, _) = candidate(true, true, 1, code); + assert_eq!(result, Err(Error(code)), "candidate still requires its native display"); + assert!(!calls.contains(&"adt") && !calls.contains(&"hold")); + } assert_eq!(run(&T6031, true, 0, -517), (Err(EPROBE_DEFER), vec!["machine", "display"]), "T6031 defers before firmware"); assert_eq!(run(&T6031, true, 0, -19), (Err(ENODEV), vec!["machine", "display"]), "T6031 refusal stops admission"); assert_eq!(run(&T6031, true, 0, 0), (Ok(()), with_tail(&["machine", "display"])), "T6031 admitted after its display"); @@ -333,7 +376,7 @@ def c_source(root): SLEEP_HOLD_RUN = r''' fn run_hold(cfg: &'static Config, sleep_hold: bool, asc_fail: bool) -> (Result<()>, Vec<&'static str>, Option, u32) { CALLS.with(|c| c.borrow_mut().clear()); - STATE.with(|s| *s.borrow_mut() = State { board: true, machine: true, pmp: 0, display: 0, sleep_hold, asc_fail }); + STATE.with(|s| *s.borrow_mut() = State { board: true, machine: true, pmp: 0, display: 0, sleep_hold, asc_fail, j514c: false, t6031: false, bringup: 0 }); HOLD.with(|h| *h.borrow_mut() = None); WARNINGS.with(|w| *w.borrow_mut() = 0); let pdev = platform::Device(device::Device, Core(PhantomData)); @@ -360,6 +403,10 @@ def c_source(root): } RS_MUTANTS = { + "candidate-ignores-config-chip": ("cfg.chip_id == 0x6031", "true"), + "candidate-ignores-opt-in": ("&& params::j514c_bringup()", "&& true"), + "candidate-ignores-board": ('&& glue::machine(kernel::c_str!("apple,j514c"))', "&& true"), + "candidate-ignores-soc": ('&& glue::machine(kernel::c_str!("apple,t6031"))', "&& true"), "display-refusal-ignored": ("dev_err!(dev, \"native display not admitted: {:?}\\n\", err);\n }\n return Err(err);", "dev_err!(dev, \"native display not admitted: {:?}\\n\", err);\n }"), "display-order-skipped": ("let ret = unsafe { glue::asahi_g15_display_prepare(dev.as_raw().cast()) };", "let ret = 0;"), @@ -392,10 +439,10 @@ def c_failures(exe): return [s for s in C_SCENARIOS if subprocess.run([str(exe), s], capture_output=True).returncode] -def rs_model(admit): +def rs_model(admit, getter): """The prelude and main for this admit(): with the system-sleep hold argument (g15_sleep_hold) or without.""" sleep = "glue::hold_power(dev, sleep_hold);" in admit - prefix = RS_PREFIX.replace("@HOLD_POWER@", HOLD_SLEEP if sleep else HOLD_PLAIN) + prefix = RS_PREFIX.replace("@HOLD_POWER@", HOLD_SLEEP if sleep else HOLD_PLAIN).replace("@J514C_GETTER@", getter) main = RS_MAIN.replace("@SLEEP_HOLD_RUN@", SLEEP_HOLD_RUN if sleep else "").replace("@SLEEP_HOLD_CHECKS@", SLEEP_HOLD_CHECKS if sleep else "") return sleep, prefix, main @@ -441,7 +488,8 @@ def main(): checks = static_checks(args.root) source = c_source(args.root) admit = item((args.root / BOOT).read_text(), "pub(crate) fn admit(") - model = rs_model(admit) + getter = item((args.root / "drivers/gpu/drm/asahi/g15/params.rs").read_text(), "pub(crate) fn j514c_bringup(") + model = rs_model(admit, getter) rs_mutants = dict(RS_MUTANTS, **(SLEEP_HOLD_MUTANTS if model[0] else {})) with tempfile.TemporaryDirectory(prefix="g15-display-order-", dir=os.environ.get("TMPDIR")) as tmp: work = Path(tmp) From fbf42245d5811cd6bca2f12ec47b4d5ea2c50361 Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Wed, 4 Nov 2026 22:16:22 -0800 Subject: [PATCH 02/11] drm/asahi: pin the J514C bring-up firmware candidate exactly The opted-in J514C rejects its loaded GFX TEXT because neither J516C pin matches. Record the canonical digest measured by the normal driver on the J514C/T6031 40-core target: OS boot-chain firmware 14.7, system firmware 26.5.2. No private firmware image was extracted or published. Pin the full canonical digest to J514C: 669913fba2736e4b8f8a0f81eadc5ac00c9dc51fdd4c9d3770c66d2b0a1e8786 Require TEXT 0x64000, DATA 0x140000 and GKTS marker 0x5cf28 as well. The eight entropy bytes after the single validated marker are zeroed by the existing canonical hash path. No digest-prefix override is needed. The original pre-review hardware cohort reached firmware READY on all 40 cores, displayed 3024x1964 at 120 Hz and passed short native GLES/Vulkan pixel checks with no wrong pixels. A later normal installed boot also passed automatic login with the separate local SDDM readiness fix. These runs do not establish CTS, sustained-load or thermal qualification. Link: https://github.com/omacom/linux-aurora/pull/363 Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/gpu/drm/asahi/g15/hw/t6031.rs | 15 ++++++++ tools/asahi/g15-j514c-firmware-tests.py | 50 +++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100755 tools/asahi/g15-j514c-firmware-tests.py diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index 3f4f6d67f95d69..8611844c987402 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -161,6 +161,21 @@ pub(crate) const CONFIG: Config = Config { 0x9d, 0x6b, 0xcd, 0xa0, 0x26, 0xcf, ], }, + // Measured by the normal driver on J514C's 14.7 boot chain. The + // board still needs explicit g15_j514c_bringup=1; runtime qualification + // is pending. Keep the full canonical digest and exact machine bound. + FirmwareBuild { + name: "J514C macOS 14.7 boot-chain candidate (runtime qualification pending)", + machine: Some(kernel::c_str!("apple,j514c")), + text_size: 0x64000, + data_size: 0x140000, + marker: 0x5cf28, + text_sha256: [ + 0x66, 0x99, 0x13, 0xfb, 0xa2, 0x73, 0x6e, 0x4b, 0x8f, 0x8a, 0x0f, 0x81, + 0xea, 0xdc, 0x5a, 0xc0, 0x0c, 0x9d, 0xc5, 0x1f, 0xdd, 0x4c, 0x9d, 0x37, + 0x70, 0xc6, 0x6d, 0x2b, 0x0a, 0x1e, 0x87, 0x86, + ], + }, ], // The reference words and measured layout belong to the J516C, not // every T6031 board (in particular, not the 14-inch J514C). diff --git a/tools/asahi/g15-j514c-firmware-tests.py b/tools/asahi/g15-j514c-firmware-tests.py new file mode 100755 index 00000000000000..4b28f58a6e82a4 --- /dev/null +++ b/tools/asahi/g15-j514c-firmware-tests.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python3 +"""Exercise production full firmware lookup against the actual T6031 rows. + +No firmware image is read. The J514C row is a bring-up candidate, not a hardware pass. +""" +from pathlib import Path +import re,subprocess,tempfile +root=Path(__file__).resolve().parents[2];hw=root/'drivers/gpu/drm/asahi/g15' +source=(hw/'hw/t6031.rs').read_text();rows=[] +for m in re.finditer(r'FirmwareBuild\s*\{(.*?)text_sha256:\s*\[(.*?)\],\s*\}',source,re.S): + body,raw=m.groups();digest=re.findall(r'0x[0-9a-f]+',raw);assert len(digest)==32 + fields={key:re.search(r'\b'+key+r':\s*(0x[0-9a-f]+)',body).group(1) for key in ('text_size','data_size','marker')} + machine=re.search(r'machine:\s*Some\(kernel::c_str!\("([^"]+)"\)\)',body) + rows.append((fields,digest,machine.group(1) if machine else None)) +assert len(rows)==3 and rows[2][2]=='apple,j514c' +measured=[];machines=[] +for f,d,machine in rows: + measured.append('Measured {text_size:'+f['text_size']+',data_size:'+f['data_size']+',marker:'+f['marker']+',sha256:['+','.join(d)+']}') + machines.append('None' if machine is None else 'Some("'+machine+'")') +code='''#[path="MATCHING"] mod matching; +#[path="LOOKUP"] mod lookup; +use lookup::{Measured,Verdict}; +fn rows(board:&str)->Vec<(Measured,bool)> { + let measurements=[MEASUREMENTS];let machines:[Option<&str>;3]=[MACHINES]; + measurements.into_iter().zip(machines).map(|(m,b)|(m,b.map_or(true,|b|b==board))).collect() +} +#[test] fn j514c_exact_candidate() { + let exact=rows("apple,j514c")[2].0; + assert_eq!(lookup::verdict(&exact,rows("apple,j514c"),0),Verdict::Pinned(2)); + for board in ["apple,j516c","apple,j514m","apple,j516m"] { + assert_eq!(lookup::verdict(&exact,rows(board),0),Verdict::Refused); + } + let mut bad=exact;bad.sha256[31]^=1; + assert_eq!(lookup::verdict(&bad,rows("apple,j514c"),0),Verdict::Refused); + let mut bad=exact;bad.text_size+=0x4000; + assert_eq!(lookup::verdict(&bad,rows("apple,j514c"),0),Verdict::Refused); + let mut bad=exact;bad.data_size+=0x4000; + 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() { + for i in 0..2 {let m=rows("apple,j516c")[i].0; + assert_eq!(lookup::verdict(&m,rows("apple,j516c"),0),Verdict::Pinned(i));} +} +'''.replace('MATCHING',str(hw/'identity/matching.rs')).replace('LOOKUP',str(hw/'identity/lookup.rs')).replace('MEASUREMENTS',','.join(measured)).replace('MACHINES',','.join(machines)) +with tempfile.TemporaryDirectory(prefix='g15-fw-') as td: + p=Path(td);(p/'test.rs').write_text(code) + subprocess.run(['rustc','--edition=2021','--test',str(p/'test.rs'),'-o',str(p/'test')],check=True) + subprocess.run([str(p/'test')],check=True) From f35f6cf8753fb393ee27024f2c6048a2ff3018be Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 04:17:39 -0800 Subject: [PATCH 03/11] ci: register the J514C firmware identity host test The CI manifest coverage check rejects the new firmware test because it is absent from host-tests.json. Register it in the tools group with the maintained Rust toolchain so normal CI executes the exact lookup checks rather than merely discovering the script. The registered suite passes 14 Rust tests. All 148 CI self-tests and the complete tracked-file manifest audit pass. This changes only the CI registry, without altering the hardware-tested production source. Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- tools/aurora-ci/host-tests.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/aurora-ci/host-tests.json b/tools/aurora-ci/host-tests.json index a1b93d695dfd6e..733b8cd8e9a910 100644 --- a/tools/aurora-ci/host-tests.json +++ b/tools/aurora-ci/host-tests.json @@ -2199,6 +2199,16 @@ "rust": "1.93.1", "note": "Actual display publication, T6030/T6031 link and admit() bodies on OF/device-link and admission-order models; C and admit() mutants must build and fail. No hardware or private fixtures." }, + { + "name": "tools/asahi/g15-j514c-firmware-tests.py", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/g15-j514c-firmware-tests.py" + ], + "rust": "1.93.1", + "note": "Production full firmware lookup against T6031 rows; exact J514C identity and other-board refusal. Public synthetic inputs only; no firmware images." + }, { "name": "tools/testing/selftests/drivers/gpu/asahi-g15/run.py", "group": "tools", From a5d1ca284d9d30c5c931a439e04a926723ac9d90 Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 06:36:09 -0800 Subject: [PATCH 04/11] drm/asahi: refine the J514C bring-up diagnostics and pin tests The J514C lookup test assumes exactly three table rows and a fixed J514C index. Another J516C firmware pin or table reordering breaks the harness without changing the lookup implementation. Find the J514C row by its board binding, derive the array size from the source and check all J516C or unscoped rows. Retain exact digest/size/marker refusal. Bind the current J516C rows explicitly so an opted-in J514C cannot use a pin belonging to that board. Log all four selected reference groups on the opted-in J514C path: maximum power, relative powers and both MTR masks. The warning reads the actual configured Reference. Do not derive a new cap from m1n1's OPP powers: they are stand-ins and not measured J514C chassis limits. The inherited values are still experimental and need native macOS measurement before any general qualification claim. Update the firmware label to reflect the earlier short native pixel and normal-login result. This revision has host checks only; the live target retains the previous hardware-tested package. Production admission tests type-check and assert the logged reference values. Exact lookup passes 14 tests both with reordered rows and with PR340's proposed additional row; removing the J514C binding is caught. The maintained handoff suite and 148 CI self-tests also pass. Link: https://github.com/omacom/linux-aurora/pull/363#issuecomment-6659196535 Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/gpu/drm/asahi/g15/boot.rs | 14 ++- drivers/gpu/drm/asahi/g15/hw/t6031.rs | 12 +-- tools/asahi/g15-display-order-tests.py | 32 ++++-- tools/asahi/g15-j514c-firmware-tests.py | 132 ++++++++++++++++-------- 4 files changed, 132 insertions(+), 58 deletions(-) diff --git a/drivers/gpu/drm/asahi/g15/boot.rs b/drivers/gpu/drm/asahi/g15/boot.rs index e05b2b55aef9e9..e231dcb6aa440c 100644 --- a/drivers/gpu/drm/asahi/g15/boot.rs +++ b/drivers/gpu/drm/asahi/g15/boot.rs @@ -507,10 +507,16 @@ pub(crate) fn admit( } } if j514c_candidate { - dev_warn!( - dev, - "J514C bring-up: using J516C reference power/thermal words; this board is not qualified\n" - ); + if let hw::Board::DeviceTree(reference) = cfg.board { + dev_warn!( + dev, + "J514C bring-up: unqualified J516C reference: max_power_mw={} relative_power={:?} fast_die_mask={:#018x} alarm_mask={:#018x}; OPP powers are boot-loader stand-ins\n", + reference.max_power_mw, + reference.relative_power, + reference.fast_die_mask, + reference.alarm_mask + ); + } } let adt = adt::read(dev, cfg) .inspect_err(|e| dev_err!(dev, "GPU regions not admitted: {:?}\n", e))?; diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index 8611844c987402..479dc270b1e83b 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -139,7 +139,7 @@ pub(crate) const CONFIG: Config = Config { firmware: &[ FirmwareBuild { name: "macOS 14.7 stub firmware (iBoot-10151.140.19.700.2), J516C", - machine: None, + machine: Some(kernel::c_str!("apple,j516c")), text_size: 0x64000, data_size: 0x140000, marker: 0x5cf28, @@ -151,7 +151,7 @@ pub(crate) const CONFIG: Config = Config { }, FirmwareBuild { name: "macOS 14.8 stub firmware, J516C", - machine: None, + machine: Some(kernel::c_str!("apple,j516c")), text_size: 0x64000, data_size: 0x140000, marker: 0x5cf28, @@ -161,11 +161,11 @@ pub(crate) const CONFIG: Config = Config { 0x9d, 0x6b, 0xcd, 0xa0, 0x26, 0xcf, ], }, - // Measured by the normal driver on J514C's 14.7 boot chain. The - // board still needs explicit g15_j514c_bringup=1; runtime qualification - // is pending. Keep the full canonical digest and exact machine bound. + // 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. Explicit bring-up opt-in only. FirmwareBuild { - name: "J514C macOS 14.7 boot-chain candidate (runtime qualification pending)", + name: "J514C macOS 14.7 boot-chain firmware (experimental bring-up)", machine: Some(kernel::c_str!("apple,j514c")), text_size: 0x64000, data_size: 0x140000, diff --git a/tools/asahi/g15-display-order-tests.py b/tools/asahi/g15-display-order-tests.py index 5164700af6af9f..722b53f7d6e686 100644 --- a/tools/asahi/g15-display-order-tests.py +++ b/tools/asahi/g15-display-order-tests.py @@ -242,15 +242,22 @@ def c_source(root): const EPROBE_DEFER: Error = Error(-517); macro_rules! dev_err { ($($args:tt)*) => {{}}; } macro_rules! dev_info { ($($args:tt)*) => {{}}; } -macro_rules! dev_warn { ($($args:tt)*) => {{ warned(); }}; } +macro_rules! dev_warn { ($dev:expr, $($args:tt)*) => {{ warned(format!($($args)*)); }}; } struct State { board: bool, machine: bool, pmp: i32, display: i32, sleep_hold: bool, asc_fail: bool, j514c: bool, t6031: bool, bringup: u32 } thread_local! { static CALLS: RefCell> = const { RefCell::new(Vec::new()) }; static STATE: RefCell = const { RefCell::new(State { board: true, machine: true, pmp: 0, display: 0, sleep_hold: true, asc_fail: false, j514c: false, t6031: false, bringup: 0 }) }; static HOLD: RefCell> = const { RefCell::new(None) }; static WARNINGS: RefCell = const { RefCell::new(0) }; + static WARNING_TEXT: RefCell = const { RefCell::new(String::new()) }; } -fn warned() { WARNINGS.with(|w| *w.borrow_mut() += 1); } +fn warned(text: String) { WARNINGS.with(|w| *w.borrow_mut() += 1); WARNING_TEXT.with(|w| *w.borrow_mut() = text); } +mod board { pub mod record { + const RELATIVE_STATES: usize = 7; + #[derive(Copy, Clone, Debug, PartialEq, Eq)] + @REFERENCE_TYPE@ + @REFERENCE_VALUE@; +} } mod module_parameters { #[allow(non_upper_case_globals)] pub static g15_j514c_bringup: Parameter = Parameter; pub struct Parameter; @@ -274,7 +281,7 @@ def c_source(root): struct AsahiDevice; mod hw { #[derive(Copy, Clone, PartialEq, Eq)] pub enum Platform { AdtWithPmp, DeviceTree } - #[derive(Copy, Clone, PartialEq, Eq)] pub enum Board { None, Templates, Blob } + #[derive(Copy, Clone, PartialEq, Eq)] pub enum Board { None, Templates, DeviceTree(&'static super::board::record::Reference) } } struct Config { chip_id: u32, platform: hw::Platform, machine: &'static str, name: &'static str, firmware: (), board: hw::Board } mod adt { @@ -311,7 +318,7 @@ def c_source(root): ''' RS_MAIN = r''' -static T6031: Config = Config { chip_id: 0x6031, platform: hw::Platform::DeviceTree, machine: "apple,j516c", name: "T6031 G15C", firmware: (), board: hw::Board::Blob }; +static T6031: Config = Config { chip_id: 0x6031, platform: hw::Platform::DeviceTree, machine: "apple,j516c", name: "T6031 G15C", firmware: (), board: hw::Board::DeviceTree(&board::record::J516C) }; static T6030: Config = Config { chip_id: 0x6030, platform: hw::Platform::AdtWithPmp, machine: "apple,t6030", name: "T6030 G15S", firmware: (), board: hw::Board::Templates }; const TAIL: [&str; 6] = ["adt", "identity", "coherent", "board_images", "regs", "hold"]; fn run(cfg: &'static Config, machine: bool, pmp: i32, display: i32) -> (Result<()>, Vec<&'static str>) { @@ -336,7 +343,7 @@ def c_source(root): fn candidate(board: bool, soc: bool, value: u32, display: i32) -> (Result<()>, Vec<&'static str>, u32) { candidate_for(&T6031, board, soc, value, display) } -static T6034: Config = Config { chip_id: 0x6034, platform: hw::Platform::DeviceTree, machine: "apple,j514m", name: "T6034", firmware: (), board: hw::Board::Blob }; +static T6034: Config = Config { chip_id: 0x6034, platform: hw::Platform::DeviceTree, machine: "apple,j514m", name: "T6034", firmware: (), board: hw::Board::DeviceTree(&board::record::J516C) }; fn main() { let (result, calls, _) = candidate_for(&T6034, true, true, 1, 0); assert_eq!(result, Err(ENODEV), "wrong Config cannot inherit this candidate"); @@ -355,6 +362,14 @@ def c_source(root): assert_eq!(result, Ok(())); assert!(calls.ends_with(&TAIL)); assert_eq!(warnings, 1, "candidate must identify its unqualified reference assumptions"); + WARNING_TEXT.with(|w| { + let text = w.borrow(); + for value in ["max_power_mw=116739", "relative_power=[11, 23, 33, 44, 55, 71, 90]", + "fast_die_mask=0x802a002b802a002b", "alarm_mask=0x902a102b802a002b", + "OPP powers are boot-loader stand-ins"] { + assert!(text.contains(value), "warning lacks {}: {}", value, text); + } + }); for code in [-517, -19] { let (result, calls, _) = candidate(true, true, 1, code); assert_eq!(result, Err(Error(code)), "candidate still requires its native display"); @@ -439,10 +454,13 @@ def c_failures(exe): return [s for s in C_SCENARIOS if subprocess.run([str(exe), s], capture_output=True).returncode] -def rs_model(admit, getter): +def rs_model(admit, getter, root): """The prelude and main for this admit(): with the system-sleep hold argument (g15_sleep_hold) or without.""" sleep = "glue::hold_power(dev, sleep_hold);" in admit prefix = RS_PREFIX.replace("@HOLD_POWER@", HOLD_SLEEP if sleep else HOLD_PLAIN).replace("@J514C_GETTER@", getter) + record = (root / "drivers/gpu/drm/asahi/g15/board/record.rs").read_text() + prefix = prefix.replace("@REFERENCE_TYPE@", item(record, "pub(crate) struct Reference {")) + prefix = prefix.replace("@REFERENCE_VALUE@", item(record, "pub(crate) const J516C: Reference = Reference {")) main = RS_MAIN.replace("@SLEEP_HOLD_RUN@", SLEEP_HOLD_RUN if sleep else "").replace("@SLEEP_HOLD_CHECKS@", SLEEP_HOLD_CHECKS if sleep else "") return sleep, prefix, main @@ -489,7 +507,7 @@ def main(): source = c_source(args.root) admit = item((args.root / BOOT).read_text(), "pub(crate) fn admit(") getter = item((args.root / "drivers/gpu/drm/asahi/g15/params.rs").read_text(), "pub(crate) fn j514c_bringup(") - model = rs_model(admit, getter) + model = rs_model(admit, getter, args.root) rs_mutants = dict(RS_MUTANTS, **(SLEEP_HOLD_MUTANTS if model[0] else {})) with tempfile.TemporaryDirectory(prefix="g15-display-order-", dir=os.environ.get("TMPDIR")) as tmp: work = Path(tmp) diff --git a/tools/asahi/g15-j514c-firmware-tests.py b/tools/asahi/g15-j514c-firmware-tests.py index 4b28f58a6e82a4..9c3e94451805c3 100755 --- a/tools/asahi/g15-j514c-firmware-tests.py +++ b/tools/asahi/g15-j514c-firmware-tests.py @@ -1,50 +1,100 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only OR MIT """Exercise production full firmware lookup against the actual T6031 rows. -No firmware image is read. The J514C row is a bring-up candidate, not a hardware pass. +Only public table identities are read, never firmware images. --table allows +integration checks against a table containing another proposed firmware row. """ +import argparse from pathlib import Path -import re,subprocess,tempfile -root=Path(__file__).resolve().parents[2];hw=root/'drivers/gpu/drm/asahi/g15' -source=(hw/'hw/t6031.rs').read_text();rows=[] -for m in re.finditer(r'FirmwareBuild\s*\{(.*?)text_sha256:\s*\[(.*?)\],\s*\}',source,re.S): - body,raw=m.groups();digest=re.findall(r'0x[0-9a-f]+',raw);assert len(digest)==32 - fields={key:re.search(r'\b'+key+r':\s*(0x[0-9a-f]+)',body).group(1) for key in ('text_size','data_size','marker')} - machine=re.search(r'machine:\s*Some\(kernel::c_str!\("([^"]+)"\)\)',body) - rows.append((fields,digest,machine.group(1) if machine else None)) -assert len(rows)==3 and rows[2][2]=='apple,j514c' -measured=[];machines=[] -for f,d,machine in rows: - measured.append('Measured {text_size:'+f['text_size']+',data_size:'+f['data_size']+',marker:'+f['marker']+',sha256:['+','.join(d)+']}') - machines.append('None' if machine is None else 'Some("'+machine+'")') -code='''#[path="MATCHING"] mod matching; +import re +import subprocess +import tempfile + +root = Path(__file__).resolve().parents[2] +hw = root / "drivers/gpu/drm/asahi/g15" +parser = argparse.ArgumentParser(description=__doc__) +parser.add_argument("--table", type=Path, default=hw / "hw/t6031.rs") +args = parser.parse_args() +rows = [] +for match in re.finditer( + r"FirmwareBuild\s*\{(.*?)text_sha256:\s*\[(.*?)\],\s*\}", + args.table.read_text(), re.S): + body, raw = match.groups() + digest = re.findall(r"0x[0-9a-f]+", raw) + assert len(digest) == 32 + fields = { + key: re.search(r"\b" + key + r":\s*(0x[0-9a-f]+)", body).group(1) + for key in ("text_size", "data_size", "marker") + } + 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 any(machine in (None, "apple,j516c") for _, _, machine in rows) +measurements = [] +machines = [] +for fields, digest, machine in rows: + measurements.append( + "Measured {text_size:" + fields["text_size"] + ",data_size:" + + fields["data_size"] + ",marker:" + fields["marker"] + + ",sha256:[" + ",".join(digest) + "]}" + ) + machines.append("None" if machine is None else 'Some("' + machine + '")') +code = r'''#[path="MATCHING"] mod matching; #[path="LOOKUP"] mod lookup; -use lookup::{Measured,Verdict}; -fn rows(board:&str)->Vec<(Measured,bool)> { - let measurements=[MEASUREMENTS];let machines:[Option<&str>;3]=[MACHINES]; - measurements.into_iter().zip(machines).map(|(m,b)|(m,b.map_or(true,|b|b==board))).collect() +use lookup::{Measured, Verdict}; +const MACHINES: [Option<&str>; ROW_COUNT] = [BOARD_BINDINGS]; +fn rows(board: &str) -> Vec<(Measured, bool)> { + let measurements = [MEASUREMENTS]; + measurements.into_iter().zip(MACHINES).map(|(m, b)| { + (m, b.map_or(true, |b| b == board)) + }).collect() } -#[test] fn j514c_exact_candidate() { - let exact=rows("apple,j514c")[2].0; - assert_eq!(lookup::verdict(&exact,rows("apple,j514c"),0),Verdict::Pinned(2)); - for board in ["apple,j516c","apple,j514m","apple,j516m"] { - assert_eq!(lookup::verdict(&exact,rows(board),0),Verdict::Refused); - } - let mut bad=exact;bad.sha256[31]^=1; - assert_eq!(lookup::verdict(&bad,rows("apple,j514c"),0),Verdict::Refused); - let mut bad=exact;bad.text_size+=0x4000; - assert_eq!(lookup::verdict(&bad,rows("apple,j514c"),0),Verdict::Refused); - let mut bad=exact;bad.data_size+=0x4000; - 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 j514c_exact_candidate() { + let index = MACHINES.iter().position(|b| *b == Some("apple,j514c")).unwrap(); + 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); + } + let mut bad = exact; bad.sha256[31] ^= 1; + assert_eq!(lookup::verdict(&bad, rows("apple,j514c"), 0), Verdict::Refused); + let mut bad = exact; bad.text_size += 0x4000; + assert_eq!(lookup::verdict(&bad, rows("apple,j514c"), 0), Verdict::Refused); + let mut bad = exact; bad.data_size += 0x4000; + 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() { - for i in 0..2 {let m=rows("apple,j516c")[i].0; - assert_eq!(lookup::verdict(&m,rows("apple,j516c"),0),Verdict::Pinned(i));} +#[test] +fn existing_rows_unchanged() { + for (index, board) in MACHINES.into_iter().enumerate() { + if board.is_none() || board == Some("apple,j516c") { + let measured = rows("apple,j516c")[index].0; + 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); + } + } + } + } } -'''.replace('MATCHING',str(hw/'identity/matching.rs')).replace('LOOKUP',str(hw/'identity/lookup.rs')).replace('MEASUREMENTS',','.join(measured)).replace('MACHINES',','.join(machines)) -with tempfile.TemporaryDirectory(prefix='g15-fw-') as td: - p=Path(td);(p/'test.rs').write_text(code) - subprocess.run(['rustc','--edition=2021','--test',str(p/'test.rs'),'-o',str(p/'test')],check=True) - subprocess.run([str(p/'test')],check=True) +''' +for token, replacement in { + "MATCHING": str(hw / "identity/matching.rs"), + "LOOKUP": str(hw / "identity/lookup.rs"), + "ROW_COUNT": str(len(rows)), + "MEASUREMENTS": ",".join(measurements), + "BOARD_BINDINGS": ",".join(machines), +}.items(): + code = code.replace(token, replacement) +with tempfile.TemporaryDirectory(prefix="g15-fw-") as directory: + path = Path(directory) + (path / "test.rs").write_text(code) + subprocess.run([ + "rustc", "--edition=2021", "--test", str(path / "test.rs"), + "-o", str(path / "test"), + ], check=True) + subprocess.run([str(path / "test")], check=True) From 09dec8cde2374e6ea1fd02351d8ff1836ec21c44 Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 06:57:06 -0800 Subject: [PATCH 05/11] drm/asahi: start J514C graphics on normal boots A supported J514C boot must reach native graphics without an extra kernel enable parameter. Admit its exact board and T6031 compatible on the existing DeviceTree path and remove g15_j514c_bringup entirely. Native display publication, the full board-scoped firmware digest, segment shape, hardware identity/core masks, cold-start and record checks still apply. T6034 and other boards do not inherit this path. Keep the explicit diagnostic of the inherited reference power words; automatic startup does not establish power/thermal qualification. Run the production admission harness with no parameter model. Its normal J514C path passes, wrong board/SoC/config and native display failure controls refuse, and compiled mutants catch gate bypasses. The exact firmware suite passes all 14 tests. Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/gpu/drm/asahi/asahi_core.rs | 4 --- drivers/gpu/drm/asahi/g15/boot.rs | 11 +++--- drivers/gpu/drm/asahi/g15/hw/t6031.rs | 2 +- drivers/gpu/drm/asahi/g15/params.rs | 6 ---- tools/asahi/g15-display-order-tests.py | 48 ++++++++++---------------- 5 files changed, 24 insertions(+), 47 deletions(-) diff --git a/drivers/gpu/drm/asahi/asahi_core.rs b/drivers/gpu/drm/asahi/asahi_core.rs index 82d7d17eb35b30..b6ddde4e3bcace 100644 --- a/drivers/gpu/drm/asahi/asahi_core.rs +++ b/drivers/gpu/drm/asahi/asahi_core.rs @@ -186,10 +186,6 @@ module! { default: 0, description: "G15: admit an unpinned GPU firmware build whose TEXT SHA-256 starts with these 8 bytes (bring-up only)", }, - g15_j514c_bringup: u32 { - default: 0, - description: "G15: opt into J514C/T6031 bring-up with the J516C reference power/thermal words (1 only; unqualified on J514C)", - }, stats_export: u8 { default: 1, // permissions: 0, diff --git a/drivers/gpu/drm/asahi/g15/boot.rs b/drivers/gpu/drm/asahi/g15/boot.rs index e231dcb6aa440c..3b7daf647211a4 100644 --- a/drivers/gpu/drm/asahi/g15/boot.rs +++ b/drivers/gpu/drm/asahi/g15/boot.rs @@ -467,14 +467,13 @@ pub(crate) fn admit( ) -> Result { let dev = pdev.as_ref(); let pmp = cfg.platform == hw::Platform::AdtWithPmp; - // Experimental same-die candidate, not a qualification of the J516C - // reference words for the 14-inch chassis. Keep exact board AND SoC checks; + // J514C uses the same-die T6031 path on a normal boot. This does not qualify + // the inherited J516C reference words. Keep exact board AND SoC checks; // T6034 boards must never inherit this four-cluster T6031 configuration. // The remaining display, DT/ADT, full firmware identity, hardware identity // and record-builder admission below is unchanged. - let j514c_candidate = cfg.chip_id == 0x6031 + let j514c_board = cfg.chip_id == 0x6031 && cfg.platform == hw::Platform::DeviceTree - && params::j514c_bringup() && glue::machine(kernel::c_str!("apple,j514c")) && glue::machine(kernel::c_str!("apple,t6031")); if pmp { @@ -491,7 +490,7 @@ pub(crate) fn admit( } return Err(err); } - } else if !glue::machine(cfg.machine) && !j514c_candidate { + } else if !glue::machine(cfg.machine) && !j514c_board { dev_err!(dev, "G15: not a {} machine\n", cfg.name); return Err(ENODEV); } else { @@ -506,7 +505,7 @@ pub(crate) fn admit( return Err(err); } } - if j514c_candidate { + if j514c_board { if let hw::Board::DeviceTree(reference) = cfg.board { dev_warn!( dev, diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index 479dc270b1e83b..db24b9bff56ce9 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -163,7 +163,7 @@ pub(crate) const CONFIG: Config = Config { }, // 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. Explicit bring-up opt-in only. + // power/thermal qualification remains open. Exact board identity is required. FirmwareBuild { name: "J514C macOS 14.7 boot-chain firmware (experimental bring-up)", machine: Some(kernel::c_str!("apple,j514c")), diff --git a/drivers/gpu/drm/asahi/g15/params.rs b/drivers/gpu/drm/asahi/g15/params.rs index d20c7ec2f2bfe1..858cec0a291c5e 100644 --- a/drivers/gpu/drm/asahi/g15/params.rs +++ b/drivers/gpu/drm/asahi/g15/params.rs @@ -103,12 +103,6 @@ pub(crate) fn accept_text_prefix() -> u64 { *module_parameters::g15_accept_text_prefix.value() } -/// Opt into the J514C candidate only at exactly 1. The default keeps the -/// qualified J516C-only board admission. This does not override firmware identity. -pub(crate) fn j514c_bringup() -> bool { - *module_parameters::g15_j514c_bringup.value() == 1 -} - /// The parameter for the PB growth maximum the firmware is given, in blocks, clamped to /// 64..=4095. [`super::pools::Pools::soft_max`] raises it to at least the initial posting; the /// blocks above it, up to the 4095 posted at most, answer the synchronous requests of partial diff --git a/tools/asahi/g15-display-order-tests.py b/tools/asahi/g15-display-order-tests.py index 722b53f7d6e686..202a63e59f1e54 100644 --- a/tools/asahi/g15-display-order-tests.py +++ b/tools/asahi/g15-display-order-tests.py @@ -243,10 +243,10 @@ def c_source(root): macro_rules! dev_err { ($($args:tt)*) => {{}}; } macro_rules! dev_info { ($($args:tt)*) => {{}}; } macro_rules! dev_warn { ($dev:expr, $($args:tt)*) => {{ warned(format!($($args)*)); }}; } -struct State { board: bool, machine: bool, pmp: i32, display: i32, sleep_hold: bool, asc_fail: bool, j514c: bool, t6031: bool, bringup: u32 } +struct State { board: bool, machine: bool, pmp: i32, display: i32, sleep_hold: bool, asc_fail: bool, j514c: bool, t6031: bool } thread_local! { static CALLS: RefCell> = const { RefCell::new(Vec::new()) }; - static STATE: RefCell = const { RefCell::new(State { board: true, machine: true, pmp: 0, display: 0, sleep_hold: true, asc_fail: false, j514c: false, t6031: false, bringup: 0 }) }; + static STATE: RefCell = const { RefCell::new(State { board: true, machine: true, pmp: 0, display: 0, sleep_hold: true, asc_fail: false, j514c: false, t6031: false }) }; static HOLD: RefCell> = const { RefCell::new(None) }; static WARNINGS: RefCell = const { RefCell::new(0) }; static WARNING_TEXT: RefCell = const { RefCell::new(String::new()) }; @@ -258,14 +258,7 @@ def c_source(root): @REFERENCE_TYPE@ @REFERENCE_VALUE@; } } -mod module_parameters { - #[allow(non_upper_case_globals)] pub static g15_j514c_bringup: Parameter = Parameter; - pub struct Parameter; - impl Parameter { pub fn value(&self) -> Box { Box::new(super::STATE.with(|s| s.borrow().bringup)) } } -} mod params { - use super::module_parameters; - @J514C_GETTER@ pub fn sleep_hold() -> bool { super::STATE.with(|s| s.borrow().sleep_hold) } } fn call(name: &'static str) { CALLS.with(|c| c.borrow_mut().push(name)); } @@ -308,7 +301,7 @@ def c_source(root): mod glue { use super::{call, STATE}; pub fn board() -> bool { call("board"); STATE.with(|s| s.borrow().board) } - pub fn machine(name: &str) -> bool { call("machine"); STATE.with(|s| { let s=s.borrow(); match name { "apple,j514c" => s.j514c, "apple,t6031" => s.t6031, _ => s.machine } }) } + pub fn machine(name: &str) -> bool { if name != "apple,j514c" && name != "apple,t6031" { call("machine"); } STATE.with(|s| { let s=s.borrow(); match name { "apple,j514c" => s.j514c, "apple,t6031" => s.t6031, _ => s.machine } }) } pub unsafe fn asahi_g15_pmp_prepare(_: *mut core::ffi::c_void) -> core::ffi::c_int { call("pmp"); STATE.with(|s| s.borrow().pmp) } pub unsafe fn asahi_g15_display_prepare(_: *mut core::ffi::c_void) -> core::ffi::c_int { call("display"); STATE.with(|s| s.borrow().display) } pub fn dma_coherent(_: &super::device::Device) -> bool { call("coherent"); false } @@ -323,7 +316,7 @@ def c_source(root): const TAIL: [&str; 6] = ["adt", "identity", "coherent", "board_images", "regs", "hold"]; fn run(cfg: &'static Config, machine: bool, pmp: i32, display: i32) -> (Result<()>, Vec<&'static str>) { CALLS.with(|c| c.borrow_mut().clear()); - STATE.with(|s| *s.borrow_mut() = State { board: true, machine, pmp, display, sleep_hold: true, asc_fail: false, j514c: false, t6031: false, bringup: 0 }); + STATE.with(|s| *s.borrow_mut() = State { board: true, machine, pmp, display, sleep_hold: true, asc_fail: false, j514c: false, t6031: false }); HOLD.with(|h| *h.borrow_mut() = None); WARNINGS.with(|w| *w.borrow_mut() = 0); let pdev = platform::Device(device::Device, Core(PhantomData)); @@ -332,33 +325,28 @@ def c_source(root): } fn with_tail(head: &[&'static str]) -> Vec<&'static str> { head.iter().chain(TAIL.iter()).copied().collect() } @SLEEP_HOLD_RUN@ -fn candidate_for(cfg: &'static Config, board: bool, soc: bool, value: u32, display: i32) -> (Result<()>, Vec<&'static str>, u32) { +fn candidate_for(cfg: &'static Config, board: bool, soc: bool, display: i32) -> (Result<()>, Vec<&'static str>, u32) { CALLS.with(|c| c.borrow_mut().clear()); - STATE.with(|s| *s.borrow_mut() = State { board: true, machine: false, pmp: 0, display, sleep_hold: true, asc_fail: false, j514c: board, t6031: soc, bringup: value }); + STATE.with(|s| *s.borrow_mut() = State { board: true, machine: false, pmp: 0, display, sleep_hold: true, asc_fail: false, j514c: board, t6031: soc }); WARNINGS.with(|w| *w.borrow_mut() = 0); let pdev = platform::Device(device::Device, Core(PhantomData)); let result = admit(&pdev, &AsahiDevice, cfg).map(|_| ()); (result, CALLS.with(|c| c.borrow().clone()), WARNINGS.with(|w| *w.borrow())) } -fn candidate(board: bool, soc: bool, value: u32, display: i32) -> (Result<()>, Vec<&'static str>, u32) { - candidate_for(&T6031, board, soc, value, display) +fn candidate(board: bool, soc: bool, display: i32) -> (Result<()>, Vec<&'static str>, u32) { + candidate_for(&T6031, board, soc, display) } static T6034: Config = Config { chip_id: 0x6034, platform: hw::Platform::DeviceTree, machine: "apple,j514m", name: "T6034", firmware: (), board: hw::Board::DeviceTree(&board::record::J516C) }; fn main() { - let (result, calls, _) = candidate_for(&T6034, true, true, 1, 0); + let (result, calls, _) = candidate_for(&T6034, true, true, 0); assert_eq!(result, Err(ENODEV), "wrong Config cannot inherit this candidate"); assert!(!calls.contains(&"display") && !calls.contains(&"adt")); - for value in [0, 2, u32::MAX] { - let (result, calls, _) = candidate(true, true, value, 0); - assert_eq!(result, Err(ENODEV), "J514C requires exactly 1"); - assert!(!calls.contains(&"display") && !calls.contains(&"adt")); - } for (board, soc) in [(false, true), (true, false), (false, false)] { - let (result, calls, _) = candidate(board, soc, 1, 0); + let (result, calls, _) = candidate(board, soc, 0); assert_eq!(result, Err(ENODEV), "wrong board or SoC must not inherit T6031"); assert!(!calls.contains(&"display") && !calls.contains(&"adt")); } - let (result, calls, warnings) = candidate(true, true, 1, 0); + let (result, calls, warnings) = candidate(true, true, 0); assert_eq!(result, Ok(())); assert!(calls.ends_with(&TAIL)); assert_eq!(warnings, 1, "candidate must identify its unqualified reference assumptions"); @@ -371,7 +359,7 @@ def c_source(root): } }); for code in [-517, -19] { - let (result, calls, _) = candidate(true, true, 1, code); + let (result, calls, _) = candidate(true, true, code); assert_eq!(result, Err(Error(code)), "candidate still requires its native display"); assert!(!calls.contains(&"adt") && !calls.contains(&"hold")); } @@ -391,7 +379,7 @@ def c_source(root): SLEEP_HOLD_RUN = r''' fn run_hold(cfg: &'static Config, sleep_hold: bool, asc_fail: bool) -> (Result<()>, Vec<&'static str>, Option, u32) { CALLS.with(|c| c.borrow_mut().clear()); - STATE.with(|s| *s.borrow_mut() = State { board: true, machine: true, pmp: 0, display: 0, sleep_hold, asc_fail, j514c: false, t6031: false, bringup: 0 }); + STATE.with(|s| *s.borrow_mut() = State { board: true, machine: true, pmp: 0, display: 0, sleep_hold, asc_fail, j514c: false, t6031: false }); HOLD.with(|h| *h.borrow_mut() = None); WARNINGS.with(|w| *w.borrow_mut() = 0); let pdev = platform::Device(device::Device, Core(PhantomData)); @@ -419,7 +407,6 @@ def c_source(root): RS_MUTANTS = { "candidate-ignores-config-chip": ("cfg.chip_id == 0x6031", "true"), - "candidate-ignores-opt-in": ("&& params::j514c_bringup()", "&& true"), "candidate-ignores-board": ('&& glue::machine(kernel::c_str!("apple,j514c"))', "&& true"), "candidate-ignores-soc": ('&& glue::machine(kernel::c_str!("apple,t6031"))', "&& true"), "display-refusal-ignored": ("dev_err!(dev, \"native display not admitted: {:?}\\n\", err);\n }\n return Err(err);", @@ -454,10 +441,10 @@ def c_failures(exe): return [s for s in C_SCENARIOS if subprocess.run([str(exe), s], capture_output=True).returncode] -def rs_model(admit, getter, root): +def rs_model(admit, root): """The prelude and main for this admit(): with the system-sleep hold argument (g15_sleep_hold) or without.""" sleep = "glue::hold_power(dev, sleep_hold);" in admit - prefix = RS_PREFIX.replace("@HOLD_POWER@", HOLD_SLEEP if sleep else HOLD_PLAIN).replace("@J514C_GETTER@", getter) + prefix = RS_PREFIX.replace("@HOLD_POWER@", HOLD_SLEEP if sleep else HOLD_PLAIN) record = (root / "drivers/gpu/drm/asahi/g15/board/record.rs").read_text() prefix = prefix.replace("@REFERENCE_TYPE@", item(record, "pub(crate) struct Reference {")) prefix = prefix.replace("@REFERENCE_VALUE@", item(record, "pub(crate) const J516C: Reference = Reference {")) @@ -504,10 +491,11 @@ def main(): args = parser.parse_args() rustcs = args.rustc or ["rustc"] checks = static_checks(args.root) + for path in ("drivers/gpu/drm/asahi/asahi_core.rs", "drivers/gpu/drm/asahi/g15/params.rs"): + assert "g15_j514c_bringup" not in (args.root / path).read_text(), "normal boot must not require an enable flag" source = c_source(args.root) admit = item((args.root / BOOT).read_text(), "pub(crate) fn admit(") - getter = item((args.root / "drivers/gpu/drm/asahi/g15/params.rs").read_text(), "pub(crate) fn j514c_bringup(") - model = rs_model(admit, getter, args.root) + model = rs_model(admit, args.root) rs_mutants = dict(RS_MUTANTS, **(SLEEP_HOLD_MUTANTS if model[0] else {})) with tempfile.TemporaryDirectory(prefix="g15-display-order-", dir=os.environ.get("TMPDIR")) as tmp: work = Path(tmp) From 24a62a3d7237c64daba75ca10fe5c52105dade9c Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 07:13:33 -0800 Subject: [PATCH 06/11] drm/asahi: describe normal J514C profile admission Remove the obsolete enable-parameter description from the T6031 hardware profile. J514C now follows normal board, firmware and hardware admission on boot; the inherited power and thermal qualification limits remain explicit. Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/gpu/drm/asahi/g15/hw/t6031.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index db24b9bff56ce9..46b31ab36890e2 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -2,8 +2,8 @@ //! T6031 (M3 Max, G15C) configuration, qualified on J516C only. //! -//! J514C may explicitly opt into a bring-up candidate using these reference -//! words with `g15_j514c_bringup=1`. This is not J514C power/thermal qualification. +//! J514C uses these reference words on normal boots after its board, firmware, +//! and hardware checks pass. This is not J514C power/thermal qualification. //! //! One die, four clusters of ten core slots. The firmware is the same RTKit 2419 generation as //! the T6030's and the initdata graph keeps the T6030 canonical VAs; what differs is the SoC From c64bc8099c60005aea9e22f63ec17e1a46dd910f Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 07:26:19 -0800 Subject: [PATCH 07/11] soc: apple: default J514C native display on normal boots Admit the exact J514C and T6031 pair in the native-display default selector, alongside J516C. An explicit display disable still wins. Keep all loader handoff, PMP and display publication checks before G15 firmware startup. Update the device-tree and wait diagnostics so they no longer describe an enable flag as required on J514C. The production selector and request helper pass host tests for both supported boards, wrong SoCs and boards, and explicit owner choices. Mutants that remove J514C, drop the SoC check or lose the disable choice are rejected. Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- arch/arm64/boot/dts/apple/t6031-dcp.dtsi | 4 +- drivers/gpu/drm/asahi/g15/glue.c | 2 +- drivers/soc/apple/t6030-display-gate.c | 25 ++++++--- .../asahi/g15-j514c-display-default-tests.py | 51 +++++++++++++++++++ 4 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 tools/asahi/g15-j514c-display-default-tests.py diff --git a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi index f679c57b97709c..f79f0e217f8185 100644 --- a/arch/arm64/boot/dts/apple/t6031-dcp.dtsi +++ b/arch/arm64/boot/dts/apple/t6031-dcp.dtsi @@ -11,8 +11,8 @@ * Every node stays status = "disabled". The display gate enables the DCP, * its mailbox, the two DARTs and the display subsystem only when the boot * loader has set apple,t6031-handoff = <1> and the native display is - * requested: by default on the J516C, with apple_t6031_display.enable=1 on - * the other boards, never with apple_t6031_display.enable=0. Compatibles are t6031-specific, + * requested: by default on J514C and J516C, with apple_t6031_display.enable=1 on + * other T6031 boards, never with apple_t6031_display.enable=0. Compatibles are t6031-specific, * so a kernel that does not know them leaves the nodes unbound. * * Only the T6031 board files include this file: t6034.dtsi includes diff --git a/drivers/gpu/drm/asahi/g15/glue.c b/drivers/gpu/drm/asahi/g15/glue.c index 385b9fde390538..8e1767ea61912c 100644 --- a/drivers/gpu/drm/asahi/g15/glue.c +++ b/drivers/gpu/drm/asahi/g15/glue.c @@ -163,7 +163,7 @@ int asahi_g15_display_prepare(struct device *dev) return ret; np = of_find_compatible_node(NULL, NULL, "apple,t6031-display-subsystem"); if (!np || !of_device_is_available(np)) - dev_info_once(dev, "G15: waiting for the T6031 native display, which this boot did not enable (it needs the boot loader's display handoff, and apple_t6031_display.enable=1 except on the J516C)\n"); + dev_info_once(dev, "G15: waiting for the T6031 native display, which this boot did not enable (it needs the boot loader's display handoff, and an admitted native-display board)\n"); else dev_info_once(dev, "G15: waiting for the T6031 native display to come up: the GPU firmware starts only after the display is published\n"); of_node_put(np); diff --git a/drivers/soc/apple/t6030-display-gate.c b/drivers/soc/apple/t6030-display-gate.c index 7ee02087c969b8..fc391515d677e0 100644 --- a/drivers/soc/apple/t6030-display-gate.c +++ b/drivers/soc/apple/t6030-display-gate.c @@ -53,8 +53,8 @@ * option. * * On T6031 (M3 Max) the gate serves the same handoff, marked - * apple,t6031-handoff. Its default is scoped to the J516C: there the native - * display is on unless apple_t6031_display.enable=0; the other T6031 boards + * apple,t6031-handoff. Its default is scoped to J514C and J516C: there the native + * display is on unless apple_t6031_display.enable=0; other T6031 boards * need apple_t6031_display.enable=1. The T6031 GPU starts its firmware only * after this native display is up, so enable=0 (or a display that never * comes up) keeps the GPU off for that boot too: it is not a display-only @@ -147,10 +147,19 @@ static bool gate_requested __initdata = true; /* * apple_t6031_display.enable: -1 while it is not on the command line, else 0 - * or 1. Unset, the T6031 native display is on only on gate_t6031_board. + * or 1. Unset, the native display is on for the exact J514C/J516C + T6031 pairs. */ static int gate_t6031_switch __initdata = -1; -static const char *gate_t6031_board __initdata = "apple,j516c"; +static const char *__init gate_t6031_default_board(void) +{ + if (!of_machine_is_compatible("apple,t6031")) + return NULL; + if (of_machine_is_compatible("apple,j516c")) + return "apple,j516c"; + if (of_machine_is_compatible("apple,j514c")) + return "apple,j514c"; + return NULL; +} /* The resolved request, set by gate_run() on a T6031. */ static bool gate_t6031_requested __initdata; @@ -252,7 +261,7 @@ static const struct gate_soc gate_t8122 __initconst = { /* * T6031 (M3 Max): the T6030 handoff at the T6031 addresses, on by default on - * the J516C and off unless apple_t6031_display.enable=1 on the other boards; + * J514C/J516C and off unless apple_t6031_display.enable=1 on other boards; * apple_t6031_display.enable=0 keeps it, and with it the GPU, off everywhere. * The PMP values must come from the boot * loader: there is no built-in fallback. The PMP image is T6031's own; @@ -1971,12 +1980,12 @@ static void __init gate_run(void) gate_describe(); if (gate_soc == &gate_t6031) { - bool board = of_machine_is_compatible(gate_t6031_board); + const char *board = gate_t6031_default_board(); - gate_t6031_requested = gate_t6031_wanted(gate_t6031_switch, board); + gate_t6031_requested = gate_t6031_wanted(gate_t6031_switch, !!board); if (gate_t6031_switch < 0 && board) gate_info("native display on by default on %s; apple_t6031_display.enable=0 keeps the boot framebuffer\n", - gate_t6031_board); + board); } if (!*gate_soc->requested) { diff --git a/tools/asahi/g15-j514c-display-default-tests.py b/tools/asahi/g15-j514c-display-default-tests.py new file mode 100644 index 00000000000000..4c2366321f9c82 --- /dev/null +++ b/tools/asahi/g15-j514c-display-default-tests.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-only OR MIT +"""Check the real T6031 native-display default selector and owner opt-out.""" +import pathlib, subprocess, tempfile +ROOT = pathlib.Path(__file__).resolve().parents[2] +s = (ROOT / 'drivers/soc/apple/t6030-display-gate.c').read_text() +def item(name): + a=s.index(name);a=s.rfind('static ',0,a);b=s.index('\n}',a)+2;return s[a:b] +selector=item('gate_t6031_default_board(void)') +wanted=item('gate_t6031_wanted(int sw, bool default_board)') +assert 'const char *board = gate_t6031_default_board();' in s +assert 'gate_t6031_wanted(gate_t6031_switch, !!board)' in s +source=r''' +#include +#include +#include +#include +#define __init +static const char *board, *soc; +static int of_machine_is_compatible(const char *s) +{ return (board && !strcmp(board,s)) || (soc && !strcmp(soc,s)); } +'''+selector+'\n'+wanted+r''' +int main(void) +{ + const char *boards[]={"apple,j514c","apple,j516c","apple,j514m","apple,j516m","apple,j514s","apple,j999"}; + const char *socs[]={"apple,t6031","apple,t6034","apple,t6030",NULL}; + for(unsigned i=0;i Date: Thu, 5 Nov 2026 07:30:49 -0800 Subject: [PATCH 08/11] drm/asahi: require a board binding on every J516C pin Reject any non-J514C firmware row that is not explicitly bound to J516C. Checking for only one correctly bound row allowed another unscoped J516C row to survive. Confirm that removing one of the two J516C bindings now fails the suite. Update the normal-boot J514C firmware name and reference-board comment. Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/gpu/drm/asahi/g15/hw/t6031.rs | 7 ++++--- tools/asahi/g15-j514c-firmware-tests.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/asahi/g15/hw/t6031.rs b/drivers/gpu/drm/asahi/g15/hw/t6031.rs index 46b31ab36890e2..19f7283ce4ec6a 100644 --- a/drivers/gpu/drm/asahi/g15/hw/t6031.rs +++ b/drivers/gpu/drm/asahi/g15/hw/t6031.rs @@ -165,7 +165,7 @@ pub(crate) const CONFIG: Config = Config { // firmware 26.5.2). Short native GL/Vulkan and normal-login checks passed; // power/thermal qualification remains open. Exact board identity is required. FirmwareBuild { - name: "J514C macOS 14.7 boot-chain firmware (experimental bring-up)", + name: "J514C macOS 14.7 boot-chain firmware", machine: Some(kernel::c_str!("apple,j514c")), text_size: 0x64000, data_size: 0x140000, @@ -177,8 +177,9 @@ pub(crate) const CONFIG: Config = Config { ], }, ], - // The reference words and measured layout belong to the J516C, not - // every T6031 board (in particular, not the 14-inch J514C). + // This is the reference board. The exact J514C/T6031 pair also uses this + // configuration through normal admission, with the unmeasured reference + // power words reported explicitly for that chassis. machine: kernel::c_str!("apple,j516c"), platform: super::Platform::DeviceTree, layout: &LAYOUT, diff --git a/tools/asahi/g15-j514c-firmware-tests.py b/tools/asahi/g15-j514c-firmware-tests.py index 9c3e94451805c3..13c2969be48765 100755 --- a/tools/asahi/g15-j514c-firmware-tests.py +++ b/tools/asahi/g15-j514c-firmware-tests.py @@ -30,7 +30,8 @@ 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 any(machine in (None, "apple,j516c") for _, _, machine in rows) +assert any(machine == "apple,j516c" for _, _, machine in rows) +assert all(machine == "apple,j516c" for _, _, machine in rows if machine != "apple,j514c") measurements = [] machines = [] for fields, digest, machine in rows: From 03d5e5ece144d10139d51c888d6d8c95c9bf1a43 Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 07:39:29 -0800 Subject: [PATCH 09/11] ci: register normal J514C native-display admission checks Run the production display default selector and owner opt-out control in the normal host manifest so future edits cannot silently restore the manual enable requirement. Align the Kconfig help with normal J514C and J516C startup. Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/soc/apple/Kconfig | 2 +- tools/aurora-ci/host-tests.json | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig index ba57db91f8860b..6aa64cb0354168 100644 --- a/drivers/soc/apple/Kconfig +++ b/drivers/soc/apple/Kconfig @@ -229,7 +229,7 @@ config APPLE_T6030_DISPLAY_GATE It also serves T6031 (M3 Max) device trees with apple,t6031-handoff, in the same way and only with the PMP values the boot loader passes. - There the native display is on by default on the J516C, unless + There the native display is on by default on J514C and J516C, unless apple_t6031_display.enable=0; the other T6031 boards need apple_t6031_display.enable=1 on the kernel command line. The T6031 GPU driver starts its firmware only after this native display is diff --git a/tools/aurora-ci/host-tests.json b/tools/aurora-ci/host-tests.json index 733b8cd8e9a910..b73ea9977e5dd9 100644 --- a/tools/aurora-ci/host-tests.json +++ b/tools/aurora-ci/host-tests.json @@ -2199,6 +2199,15 @@ "rust": "1.93.1", "note": "Actual display publication, T6030/T6031 link and admit() bodies on OF/device-link and admission-order models; C and admit() mutants must build and fail. No hardware or private fixtures." }, + { + "name": "tools/asahi/g15-j514c-display-default-tests.py", + "group": "tools", + "argv": [ + "python3", + "tools/asahi/g15-j514c-display-default-tests.py" + ], + "note": "Production J514C/J516C display default selector and owner choice with compiled missing-board, missing-SoC and lost-disable mutants; no hardware/private fixtures." + }, { "name": "tools/asahi/g15-j514c-firmware-tests.py", "group": "tools", From 1563cffb4686a0f05841b8a7fee2ec12c013fc96 Mon Sep 17 00:00:00 2001 From: Chris Kearney <303316+chriskearney@users.noreply.github.com> Date: Thu, 5 Nov 2026 08:01:35 -0800 Subject: [PATCH 10/11] soc: apple: scope display-default fixtures to each KUnit case Replacing gate_t6031_board with the exact J514C/J516C plus T6031 selector left the display-gate fixture referring to the removed variable. CONFIG_APPLE_DISPLAY_GATE_KUNIT_TEST no longer builds, and merely removing those references would stop its default-on cases selecting a test board. Add a KUnit-only static-stub point around the root compatibility query. Keep the actual board/SoC selector and gate_run() active in the tests. The replacement reads the current case context; KUnit owns the task-scoped stub resource and frees it at case cleanup. Normal boot and other tasks retain the real device-tree identity, including on unsupported boards. Run the default-on, explicit-disable and missing-marker paths for both J514C and J516C. Assert the resolved request as well as the resulting node/PMP state. Remove the obsolete global save/restore and retain the non-default case to catch test identity leakage. Keep the production host selector/mutation checks compiling the real compatibility wrapper. Reproduced the undeclared-variable failure in CI run 42057524071. The arm64 display-gate object builds with KUnit enabled under LLVM 22; production selector mutations, firmware admission and display ordering host tests pass. The full arm64 QEMU suites run in CI after this push. This is a build/test regression, not a kernel security-boundary issue. Fixes: b55bcaaba520 ("soc: apple: default J514C native display on normal boots") Assisted-by: Codex:GPT-6 Signed-off-by: Scott Jones --- drivers/soc/apple/Kconfig | 2 +- drivers/soc/apple/t6030-display-gate-test.c | 45 +++++++++++++------ drivers/soc/apple/t6030-display-gate.c | 20 +++++++-- .../asahi/g15-j514c-display-default-tests.py | 7 +-- 4 files changed, 53 insertions(+), 21 deletions(-) diff --git a/drivers/soc/apple/Kconfig b/drivers/soc/apple/Kconfig index 6aa64cb0354168..f00718c130dc43 100644 --- a/drivers/soc/apple/Kconfig +++ b/drivers/soc/apple/Kconfig @@ -264,7 +264,7 @@ config APPLE_DISPLAY_GATE_KUNIT_TEST help Runs the display gate on test device trees with the T6030, T6031 and T8122 display nodes, without Apple hardware. On T6031: on by - default only on the default board (the J516C), otherwise only with + default only on J514C and J516C, otherwise only with apple_t6031_display.enable=1, off with apple_t6031_display.enable=0, only with the boot loader's handoff marker and this Mac's PMP values, and with nothing changed when a check fails. On T6030: on by default, as diff --git a/drivers/soc/apple/t6030-display-gate-test.c b/drivers/soc/apple/t6030-display-gate-test.c index 15725a38ab5c7d..fc68bb6208a6e0 100644 --- a/drivers/soc/apple/t6030-display-gate-test.c +++ b/drivers/soc/apple/t6030-display-gate-test.c @@ -8,8 +8,8 @@ * the T6031 switch does not change it. Run first: the T6031 and T8122 * trees describe a PMP, and the T6030 gate refuses to add a second one. * - T6031 (t6031-gate-test.dtso): on by default only on the default board - * (the J516C; the cases point it at the test tree's own root to run that - * path), otherwise only with apple_t6031_display.enable=1, never with + * (J514C or J516C; the cases supply a synthetic root identity), + * otherwise only with apple_t6031_display.enable=1, never with * apple_t6031_display.enable=0; always with the full handoff, and nothing * changed when a check fails. * - T8122 (t8122-gate-test.dtso): on by default, with the full handoff, @@ -146,7 +146,7 @@ struct gate_test { struct of_changeset cs; /* this case's own edits to the test tree */ bool requested, t6031_requested; int t6031_switch; - const char *t6031_board; + const char *default_board; }; static struct device_node *__init gt_node(struct kunit *test, const char *path) @@ -385,6 +385,16 @@ static int __init gt_suite_init_t8122(struct kunit_suite *suite) return gt_apply_fixture(>_t8122, >_fixture_t8122); } +/* Static-stub resources are task-scoped and removed by KUnit case cleanup. */ +static bool __init gt_root_is_compatible(const char *compat) +{ + struct kunit *test = kunit_get_current_test(); + struct gate_test *t = test->priv; + + return t->default_board && + (!strcmp(compat, "apple,t6031") || !strcmp(compat, t->default_board)); +} + static int __init gt_init(struct kunit *test, const struct gt_soc *s) { struct gate_test *t = kunit_kzalloc(test, sizeof(*t), GFP_KERNEL); @@ -397,7 +407,6 @@ static int __init gt_init(struct kunit *test, const struct gt_soc *s) t->requested = gate_requested; t->t6031_requested = gate_t6031_requested; t->t6031_switch = gate_t6031_switch; - t->t6031_board = gate_t6031_board; of_changeset_init(&t->cs); gate_soc = s->soc; gate_pmp_values = NULL; @@ -408,6 +417,7 @@ static int __init gt_init(struct kunit *test, const struct gt_soc *s) gate_t6031_switch = -1; if (gt_live_soc) kunit_skip(test, "the booted device tree has its own /soc"); + kunit_activate_static_stub(test, gate_t6031_is_compatible, gt_root_is_compatible); return 0; } @@ -452,7 +462,6 @@ static void __init gt_exit(struct kunit *test) gate_requested = t->requested; gate_t6031_requested = t->t6031_requested; gate_t6031_switch = t->t6031_switch; - gate_t6031_board = t->t6031_board; gate_soc = NULL; } @@ -465,7 +474,7 @@ static void __init gate_t6031_param(struct kunit *test) KUNIT_EXPECT_FALSE(test, t->t6031_requested); KUNIT_EXPECT_EQ(test, t->t6031_switch, -1); - KUNIT_EXPECT_STREQ(test, t->t6031_board, "apple,j516c"); + KUNIT_EXPECT_NULL(test, gate_t6031_default_board()); KUNIT_EXPECT_TRUE(test, t->requested); KUNIT_EXPECT_EQ(test, gate_setup_t6031("1"), 0); @@ -503,14 +512,19 @@ static void __init gate_t6031_resolution(struct kunit *test) KUNIT_EXPECT_TRUE(test, gate_t6031_wanted(1, false)); } -/* Points the default board at the test tree's root, so gate_run() takes that path. */ +static const char * const gt_default_boards[] = { + "apple,j514c", + "apple,j516c", +}; +KUNIT_ARRAY_PARAM(gt_default_board, gt_default_boards, NULL); + +/* Exercise the real selector and gate_run(), with a test-scoped identity. */ static void __init gt_default_board(struct kunit *test) { - const char *root = NULL; + struct gate_test *t = test->priv; - if (of_property_read_string(of_root, "compatible", &root) || !root) - kunit_skip(test, "the test tree's root has no compatible"); - gate_t6031_board = root; + t->default_board = *(const char * const *)test->param_value; + KUNIT_ASSERT_STREQ(test, gate_t6031_default_board(), t->default_board); } /* On the default board, the full handoff and no switch: enabled. */ @@ -518,6 +532,7 @@ static void __init gate_t6031_default_board_on(struct kunit *test) { gt_default_board(test); gt_run(test); + KUNIT_EXPECT_TRUE(test, gate_t6031_requested); gt_expect_enabled(test); } @@ -527,6 +542,7 @@ static void __init gate_t6031_default_board_switched_off(struct kunit *test) gt_default_board(test); KUNIT_ASSERT_EQ(test, gate_setup_t6031("0"), 0); gt_run(test); + KUNIT_EXPECT_FALSE(test, gate_t6031_requested); gt_expect_untouched(test); } @@ -536,6 +552,7 @@ static void __init gate_t6031_default_board_no_marker(struct kunit *test) gt_default_board(test); gt_remove(test, gt_t6031.dcp, "apple,t6031-handoff"); gt_run(test); + KUNIT_EXPECT_TRUE(test, gate_t6031_requested); gt_expect_untouched(test); } @@ -890,9 +907,9 @@ static struct kunit_case gate_t6031_cases[] __refdata = { KUNIT_CASE(gate_t6031_param), KUNIT_CASE(gate_t6031_resolution), KUNIT_CASE(gate_t6031_off_by_default), - KUNIT_CASE(gate_t6031_default_board_on), - KUNIT_CASE(gate_t6031_default_board_switched_off), - KUNIT_CASE(gate_t6031_default_board_no_marker), + KUNIT_CASE_PARAM(gate_t6031_default_board_on, gt_default_board_gen_params), + KUNIT_CASE_PARAM(gate_t6031_default_board_switched_off, gt_default_board_gen_params), + KUNIT_CASE_PARAM(gate_t6031_default_board_no_marker, gt_default_board_gen_params), KUNIT_CASE(gate_t6031_switched_off), KUNIT_CASE(gate_t6031_enabled), KUNIT_CASE(gate_t6031_no_dcp_marker), diff --git a/drivers/soc/apple/t6030-display-gate.c b/drivers/soc/apple/t6030-display-gate.c index fc391515d677e0..83960cf5b1697f 100644 --- a/drivers/soc/apple/t6030-display-gate.c +++ b/drivers/soc/apple/t6030-display-gate.c @@ -85,6 +85,10 @@ #include #include