From 2e6b2d9027a509c9f192c36dd767123efd6322fe Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sun, 8 Nov 2026 22:09:17 -0500 Subject: [PATCH] drm/asahi: g17: Run the M5 Pro on bare metal The M5 Pro (J714s) is the last M5 board probe refused ("M5 Pro bare-metal GPU tables not yet available"): its configuration named no firmware and kept the profile without bare-metal tables. Give it the M5 Max's bare-metal profile, with each value checked against the J714s 27.0 ADT and the firmware iBoot loads: - Both roles publish their kernel roots. The boot arguments iBoot writes into each role's TEXT put the primary's tables at the ADT gfx-shared-region (BPTP 0x10ffff28000, the `pagetables` region) and the secondary's 0x40000 above it (BPTP 0x10ffff68000), each 0x40000 long (SPTP), so the secondary root is at 0x40000. - Each role places its own buffers, and its crash log is in its __DATA_SHARED_RO, inside `fw-data` (crash logs in fw-data). The data segments have the M5 Max's layout: DATA 0xc0000 and 0xb4000, each followed by 0x8000 of shared RO, 0x184000 in all. - The M5 Max and Ultra's UAT policy. - Admit only the G17S 26A428 build of both roles: TEXT 0x50000 then 0x54000 back to back, the entropy records and boot-filled ranges at the Max's offsets. The digest is the one two J714s boots measured, and the driver's own digest code admits both boots' TEXT with it. No board uses the no-bare-metal-tables profile any more, so it goes, with its probe refusal. The firmware identity test covers the M5 Pro's image too. On the J714s booting from its SSD with this change (integration/aurora with #1012, 2026-11-10), the GPU binds with the 26A428 G17S build identified and the Hyprland desktop runs on it through zink. Signed-off-by: Diljit Singh --- drivers/gpu/drm/asahi/driver.rs | 4 --- drivers/gpu/drm/asahi/fwid.rs | 6 +++- drivers/gpu/drm/asahi/g17/mod.rs | 4 +-- drivers/gpu/drm/asahi/hw/t6050.rs | 55 ++++++++++++++++++++++--------- 4 files changed, 45 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/asahi/driver.rs b/drivers/gpu/drm/asahi/driver.rs index 3c7dca6cda7d9..2b8bdac35f43d 100644 --- a/drivers/gpu/drm/asahi/driver.rs +++ b/drivers/gpu/drm/asahi/driver.rs @@ -474,10 +474,6 @@ impl AsahiPlatformDriver { id.variant, id.num_dies); ENODEV })?; - if let g17::FirmwareProfile::M5NoBareMetalTables = cfg.profile { - dev_err!(pdev.as_ref(), "M5 Pro bare-metal GPU tables not yet available\n"); - return Err(ENODEV); - } Self::probe_g17(pdev, res, cfg) } diff --git a/drivers/gpu/drm/asahi/fwid.rs b/drivers/gpu/drm/asahi/fwid.rs index ac122b26c0b5f..8b7666e076334 100644 --- a/drivers/gpu/drm/asahi/fwid.rs +++ b/drivers/gpu/drm/asahi/fwid.rs @@ -536,7 +536,11 @@ mod tests { #[test] fn t6050_admits_only_its_pinned_image() { - for cfg in [&crate::hw::t6050::CONFIG_ULTRA, &crate::hw::t6050::CONFIG_MAX] { + for cfg in [ + &crate::hw::t6050::CONFIG_ULTRA, + &crate::hw::t6050::CONFIG_MAX, + &crate::hw::t6050::CONFIG, + ] { let crate::g17::fw::variant::Firmware::Identified(builds) = cfg.firmware else { panic!("an M5 board on bare metal must identify its loaded firmware"); }; diff --git a/drivers/gpu/drm/asahi/g17/mod.rs b/drivers/gpu/drm/asahi/g17/mod.rs index 63e04695c6c39..91604ba7b564f 100644 --- a/drivers/gpu/drm/asahi/g17/mod.rs +++ b/drivers/gpu/drm/asahi/g17/mod.rs @@ -168,8 +168,6 @@ pub(crate) enum FirmwareProfile { /// The firmware publishes its kernel roots and the driver owns the page tables (A18 Pro, /// M4 Pro). PublishedRoots, - /// An M5 board without bare-metal GPU tables yet: probe refuses it. - M5NoBareMetalTables, /// The M5 firmware on bare metal: both roles publish their kernel roots /// ([`mmu::UatFirmware::PublishedRoots`]) and the driver owns the page tables. M5PublishedRoots, @@ -195,7 +193,7 @@ impl Config { impl FirmwareProfile { /// The M5 firmware's protocol (26A428 InitData graph, queues and submission). pub(crate) const fn is_m5(self) -> bool { - matches!(self, Self::M5NoBareMetalTables | Self::M5PublishedRoots) + matches!(self, Self::M5PublishedRoots) } } diff --git a/drivers/gpu/drm/asahi/hw/t6050.rs b/drivers/gpu/drm/asahi/hw/t6050.rs index 0eeac7387cef8..ae2b48d9184d1 100644 --- a/drivers/gpu/drm/asahi/hw/t6050.rs +++ b/drivers/gpu/drm/asahi/hw/t6050.rs @@ -3,18 +3,11 @@ //! //! The M5 firmware builds its HW data, performance tables and region C in its own graph //! ([`crate::g17::fw::m5::initdata`]), so the 26A428/25G83 graph tables of [`Config`] are empty. -use crate::g17::{Config, CoreLayout, CrashBuffers, FirmwareProfile, FixedBuffer, Identity}; +use crate::g17::{Config, CoreLayout, CrashBuffers, FirmwareProfile, Identity}; use crate::hw::{GpuGen, GpuVariant}; use crate::regs::G17Id; -// The coprocessors request a crash log buffer at these addresses (primary first) when they start and hand -// its contents back when they crash; outside the canonical range of dynamic objects. They are the -// ADT sgx gfx-data-shared-ro-base and gfx1-data-shared-ro-base (each 0x8000), so they differ per board. -const J714_CRASH_BUFFERS: [FixedBuffer; 2] = [ - FixedBuffer { va: 0x100_025b_4000, size: 0x8000 }, - FixedBuffer { va: 0x100_0267_0000, size: 0x8000 }, -]; - +/// M5 Pro (J714s): ID variant 3, GPU variant S, on bare metal like the M5 Max. pub(crate) const CONFIG: Config = Config { chip_id: 0x6050, identity: Identity { @@ -27,16 +20,21 @@ pub(crate) const CONFIG: Config = Config { }, uat_ias: 42, uat_oas: 42, - // Unknown until the board has bare-metal page tables. - secondary_root_offset: None, - crash_buffers: CrashBuffers::Fixed(J714_CRASH_BUFFERS), - profile: FirmwareProfile::M5NoBareMetalTables, + // Both roles publish their kernel roots. The boot arguments iBoot writes into each role's + // TEXT give the primary's tables at `pagetables` (BPTP, the ADT gfx-shared-region) and the + // secondary's 0x40000 above it, 0x40000 each (SPTP). + secondary_root_offset: Some(0x40000), + // Each role places its own buffers. Its crash log goes in its __DATA_SHARED_RO, inside + // `fw-data`, as on the M5 Max, whose data segments have the same layout. + crash_buffers: CrashBuffers::FirmwareData, + profile: FirmwareProfile::M5PublishedRoots, pm_metrics: None, windows: &[], reserved_slots: &[], perf: None, opps: 0, - uat_quirks: crate::mmu::UatQuirks::DEFAULT, + // The M5 Max and Ultra's UAT policy, for the same firmware family. + uat_quirks: CONFIG_ULTRA.uat_quirks, region_c: None, chip: None, m5: Some(&crate::g17::fw::m5::initdata::J714), @@ -44,8 +42,33 @@ pub(crate) const CONFIG: Config = Config { fabric_bridge: false, recovery_slot_keys: None, gpu_generation: GpuGen::G17, - // No loaded image is admitted: the board has no bare-metal page tables yet. - firmware: crate::g17::fw::variant::Firmware::Identified(&[]), + // The firmware in `fw-text` must be this build. iBoot loads the G17S build of both roles + // back to back: the primary's TEXT 0x50000, then the secondary's 0x54000, with the same + // entropy records and boot-filled ranges as the M5 Max. The digest is that of the + // firmware's TEXT with those ranges zeroed, measured on two J714s boots. + firmware: crate::g17::fw::variant::Firmware::Identified(&[crate::g17::fw::variant::Build { + os_version: [27, 0, 0], + name: "27.0 (26A428), G17S", + images: &[ + crate::fwid::FirmwareBuild { + name: "26A428 for T6050 G17S, primary then secondary", + text_size: 0xa4000, + data_size: 0x184000, + entropy: &[[0x49e60, 0x49f43], [0x9d918, 0x9d9fb]], + boot_filled: &[ + (0x224, 4), (0x23c, 8), (0x49720, 0x740), (0x49e60, 0x231), + (0x50224, 4), (0x5023c, 8), (0x9d1d8, 0x740), (0x9d918, 0x231), + ], + text_sha256: [ + 0x85, 0xd0, 0xfd, 0x82, 0x80, 0xf7, 0x24, 0x65, 0x5c, 0xa9, 0xa9, 0x71, 0x7b, + 0xc9, 0x1a, 0x8a, 0x5e, 0xf6, 0x09, 0x28, 0xd7, 0x72, 0x00, 0xf6, 0xd5, 0x3b, + 0xd0, 0x99, 0xb9, 0x47, 0x39, 0xc6, + ], + }, + ], + variant: &crate::g17::fw::variant::V26A428_M5, + config: None, + }]), // Two clusters of ten cores. The buffers are sized for every core slot of the board, so the // board's cluster and slot counts admit the GPU, whichever cores are fused off. core_layout: CoreLayout {