Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
96c882e
drm/asahi: G14 compute on GPU firmware 27.2
satchlj Nov 20, 2026
a47acf0
drm/asahi: run the G14 firmware-27.2 runtime from firmware notifications
satchlj Nov 20, 2026
660936a
drm/asahi: advance a G14 27.2 pool slot's cursor only after the firmw…
satchlj Nov 20, 2026
4c4f313
drm/asahi: let the G14 firmware-27.2 GPU through suspend-to-idle
satchlj Nov 20, 2026
27d1f77
drm/asahi: establish G14 compute ownership before firmware publication
RyanTheTide Nov 23, 2026
027f0b2
drm/asahi: drain G14 submissions before completing or stopping
RyanTheTide Nov 23, 2026
6f67df2
drm/asahi: require the firmware handoff SRAM voltage table
RyanTheTide Nov 23, 2026
9111ff5
drm/asahi: select G14 by firmware compatibility and signal suspend drain
RyanTheTide Nov 23, 2026
db645f4
Merge G14 compute ownership fixes onto the shared teardown fix
satchlj Nov 24, 2026
25ac88a
drm/asahi: build the G14 firmware-27.2 path without the M3 runtime
satchlj Nov 20, 2026
181fe18
drm/asahi: take the G14 27.2 thermal controller values from the chip …
RyanTheTide Nov 24, 2026
9ced286
Merge the G14 27.2 thermal config change (#2544) into #2545
RyanTheTide Nov 24, 2026
fc17d37
Merge integration/aurora into the G14 27.2 compute series
RyanTheTide Nov 24, 2026
94fd507
Merge integration/aurora (via the updated base) into #2545
RyanTheTide Nov 24, 2026
f9e7bab
Merge remote-tracking branch 'aurora/integration/aurora' into HEAD
RyanTheTide Nov 24, 2026
5f998a4
Merge the published #2544 head into #2545
RyanTheTide Nov 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions drivers/gpu/drm/asahi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ config DRM_ASAHI_M3_T8122
boards and firmware do not gain automatic admission. Other GPUs
are not affected.

config DRM_ASAHI_G14_V27_2
bool "Apple M2 (G14G) on GPU firmware 27.2, compute only"
depends on DRM_ASAHI
# The firmware's UAT is adopted through the G15 backend's handoff helpers.
depends on DRM_ASAHI_G15
default y
help
Start an M2 GPU (G14G) whose boot loader reports GPU firmware
27.2, and register a compute-only DRM device on it. Clients use
the 26.x submission interface; render commands are refused.
Other GPUs and firmware versions are not affected.

config DRM_ASAHI_G15
bool "Apple M3 Pro/Max (G15) support"
depends on DRM_ASAHI
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ aurora-$(CONFIG_DRM_ASAHI_G15) += g15/glue.o

aurora-$(CONFIG_DRM_ASAHI_G16) += g16/glue.o

aurora-y += retain.o cpu_capacity.o g17/mesh_tvb_floor.o g17/mesh_exclusion.o
aurora-y += retain.o cpu_capacity.o g17/mesh_tvb_floor.o g17/mesh_exclusion.o rtkit_dump.o
aurora-$(CONFIG_DRM_ASAHI_G18) += g18/sync_input.o
aurora-$(CONFIG_DRM_ASAHI_G18) += g18/demand.o
2 changes: 2 additions & 0 deletions drivers/gpu/drm/asahi/asahi_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ mod g18;
#[cfg(CONFIG_DRM_ASAHI_M5)]
mod m5;
mod gpu;
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
mod g14_v27_2;
mod hw;
mod initdata;
mod m3;
Expand Down
112 changes: 101 additions & 11 deletions drivers/gpu/drm/asahi/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ pub(crate) struct AsahiPlatformDriverData<'bound> {
#[cfg(CONFIG_DRM_ASAHI_G16)]
pub(crate) g16: Option<Arc<crate::g16::Gpu>>,
m3: Option<M3Backend>,
/// The G14 firmware-27.2 backend, whose firmware must be stopped on unbind.
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: Option<Arc<crate::g14_v27_2::Backend>>,
/// Raw `struct device *` of the platform device. Stored once at probe
/// time so the `Drop` impl can find the sysfs file on unregister.
raw_dev: *mut bindings::device,
Expand Down Expand Up @@ -150,6 +153,7 @@ impl drm::driver::Driver for AsahiDrmDriver {
/// Firmware interface selected by the hardware compatible.
pub(crate) enum ProbeConfig {
Legacy(&'static hw::HwConfig),
LegacyWithG14Handoff(&'static hw::HwConfig),
G17(&'static g17::Config),
/// M5 Pro, Max and Ultra: the ID registers select the configuration.
G17M5,
Expand Down Expand Up @@ -197,7 +201,7 @@ macro_rules! asahi_of_device_table {
),
(
of::DeviceId::new(c"apple,agx-t8112"),
ProbeConfig::Legacy(&hw::t8112::HWCONFIG)
ProbeConfig::LegacyWithG14Handoff(&hw::t8112::HWCONFIG)
),
(
of::DeviceId::new(c"apple,agx-t6000"),
Expand Down Expand Up @@ -267,12 +271,23 @@ unsafe fn sleep_data<'a>(dev: *mut bindings::device) -> &'a AsahiPlatformDriverD

/// Runs before any device suspends, so the GPU goes first and work still in flight can finish.
unsafe extern "C" fn sleep_prepare(dev: *mut bindings::device) -> core::ffi::c_int {
// SAFETY: Called by the PM core.
let data = unsafe { sleep_data(dev) };
// G14 on firmware 27.2: the firmware keeps running through suspend-to-idle, with nothing in
// flight; a sleep that powers the SoC down would lose it, and it has no cold restart, so that
// is refused.
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
if let Some(backend) = data.g14_v27_2.as_ref() {
// SAFETY: Reads a global flag word.
if unsafe { bindings::pm_suspend_via_firmware() } {
return EBUSY.to_errno();
}
return kernel::error::from_result(|| backend.sleep_prepare().map(|_| 0));
}
// SAFETY: Reads a global flag word.
if !unsafe { bindings::pm_suspend_via_firmware() } {
return 0;
}
// SAFETY: Called by the PM core.
let data = unsafe { sleep_data(dev) };
match data.g17.as_ref() {
Some(gpu) => kernel::error::from_result(|| gpu.sleep_prepare().map(|_| 0)),
None => EBUSY.to_errno(),
Expand All @@ -282,7 +297,12 @@ unsafe extern "C" fn sleep_prepare(dev: *mut bindings::device) -> core::ffi::c_i
/// Runs after every device resumed. Does nothing unless [`sleep_prepare`] stopped the firmware.
unsafe extern "C" fn sleep_complete(dev: *mut bindings::device) {
// SAFETY: Called by the PM core.
if let Some(gpu) = unsafe { sleep_data(dev) }.g17.as_ref() {
let data = unsafe { sleep_data(dev) };
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
if let Some(backend) = data.g14_v27_2.as_ref() {
backend.sleep_complete();
}
if let Some(gpu) = data.g17.as_ref() {
gpu.sleep_complete();
}
}
Expand Down Expand Up @@ -339,6 +359,10 @@ impl platform::Driver for AsahiPlatformDriver {
if let Some(m3) = this.m3.as_ref() {
m3.stop();
}
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
if let Some(backend) = this.g14_v27_2.as_ref() {
backend.stop();
}
this.close_binding();
}

Expand All @@ -355,8 +379,9 @@ impl platform::Driver for AsahiPlatformDriver {

dev_info!(pdev.as_ref(), "Probing...\n");

let cfg = match info.ok_or(ENODEV)? {
ProbeConfig::Legacy(cfg) => *cfg,
let (cfg, has_g14_handoff) = match info.ok_or(ENODEV)? {
ProbeConfig::Legacy(cfg) => (*cfg, false),
ProbeConfig::LegacyWithG14Handoff(cfg) => (*cfg, true),
ProbeConfig::G17(cfg) => {
return AsahiPlatformDriver::probe_g17(pdev, regs::G17Resources::new(pdev)?, cfg)
}
Expand All @@ -370,6 +395,21 @@ impl platform::Driver for AsahiPlatformDriver {
ProbeConfig::M5 => return Err(ENODEV),
};

let fwnode = pdev.as_ref().fwnode().ok_or(EIO)?;
let compat: KVec<u32> = fwnode
.property_read_array_vec(c"apple,firmware-compat", 3)?
.required_by(pdev.as_ref())?;

// The loader advertises the supported wire layout independently of the image version.
if has_g14_handoff && compat.as_slice() == [27, 2, 0] {
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
return AsahiPlatformDriver::probe_g14_v27_2(
pdev, cfg, hw::t8112::REGISTERS_V27_2, hw::t8112::WRITABLE_V27_2,
);
#[cfg(not(CONFIG_DRM_ASAHI_G14_V27_2))]
return Err(ENODEV);
}

// SAFETY: The selected SoC's UAT output width bounds all device DMA.
unsafe { pdev.dma_set_mask_and_coherent(DmaMask::try_new(cfg.uat_oas)?)? };

Expand All @@ -381,11 +421,6 @@ impl platform::Driver for AsahiPlatformDriver {
// Start the coprocessor CPU, so UAT can initialize the handoff
regs::Resources::start_cpu(pdev)?;

let fwnode = pdev.as_ref().fwnode().ok_or(EIO)?;
let compat: KVec<u32> = fwnode
.property_read_array_vec(c"apple,firmware-compat", 3)?
.required_by(pdev.as_ref())?;

let drm = drm::UnregisteredDevice::<AsahiDrmDriver>::new(pdev, Ok(()))?;
// SAFETY: Every adapter calls close_binding in unbind before devres;
// probe errors drop this local owner while the bound callback is live.
Expand Down Expand Up @@ -451,6 +486,8 @@ impl platform::Driver for AsahiPlatformDriver {
_reg: reg,
g17: None,
m3: None,
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: None,
#[cfg(CONFIG_DRM_ASAHI_G16)]
g16: None,
raw_dev,
Expand All @@ -463,6 +500,43 @@ impl platform::Driver for AsahiPlatformDriver {
}

impl AsahiPlatformDriver {
/// G14 with firmware 27.2: start the firmware and register a compute-only DRM device.
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
fn probe_g14_v27_2<'bound>(
pdev: &'bound platform::Device<Core<'_>>,
cfg: &'static hw::HwConfig,
registers: &'static [hw::RegisterV27_2],
writable: u64,
) -> Result<AsahiPlatformDriverData<'bound>> {
let crate::g14_v27_2::Started { backend, drm, binding, resources } =
crate::g14_v27_2::start(pdev, cfg, registers, writable)?;
let gpu = backend.clone() as Arc<dyn gpu::Gpu>;
let data = try_pin_init!(AsahiDrmRegistrationData { gpu, resources });
// SAFETY: The registration is stored in the platform data and unregistered when it is
// dropped, after the backend has stopped the firmware.
let reg = match unsafe { drm::Registration::new(pdev.as_ref(), drm, data, 0) } {
Ok(reg) => reg,
Err(error) => {
backend.stop();
return Err(error);
}
};
dev_info!(pdev.as_ref(), "G14 firmware 27.2 running; compute-only DRM device registered\n");
Ok(AsahiPlatformDriverData {
binding,
_device: reg.device().into(),
_reg: reg,
g17: None,
#[cfg(CONFIG_DRM_ASAHI_G16)]
g16: None,
m3: None,
g14_v27_2: Some(backend),
raw_dev: core::ptr::null_mut(),
raw_stats: core::ptr::null_mut(),
stats: None,
})
}

#[cfg(CONFIG_DRM_ASAHI_G15)]
pub(crate) fn probe_g15<'bound>(
pdev: &'bound platform::Device<Core<'_>>,
Expand All @@ -489,6 +563,8 @@ impl AsahiPlatformDriver {
_reg: reg,
g17: None,
m3: None,
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: None,
#[cfg(CONFIG_DRM_ASAHI_G16)]
g16: None,
raw_dev: core::ptr::null_mut(),
Expand Down Expand Up @@ -531,6 +607,8 @@ impl AsahiPlatformDriver {
_reg: reg,
g17: None,
m3: Some(backend),
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: None,
raw_dev: core::ptr::null_mut(),
raw_stats: core::ptr::null_mut(),
stats: None,
Expand Down Expand Up @@ -612,6 +690,8 @@ impl AsahiPlatformDriver {
_reg: reg,
g17: Some(gpu),
m3: None,
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: None,
#[cfg(CONFIG_DRM_ASAHI_G16)]
g16: None,
raw_dev,
Expand Down Expand Up @@ -659,6 +739,8 @@ impl AsahiPlatformDriver {
_reg: reg,
g17: None,
m3: None,
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: None,
#[cfg(CONFIG_DRM_ASAHI_G16)]
g16: None,
raw_dev: core::ptr::null_mut(),
Expand Down Expand Up @@ -698,6 +780,8 @@ impl AsahiPlatformDriver {
_reg: reg,
g17: None,
m3: None,
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: None,
g16: Some(gpu),
raw_dev,
raw_stats,
Expand Down Expand Up @@ -754,6 +838,8 @@ impl AsahiPlatformDriver {
_reg: reg,
g17: None,
m3: None,
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
g14_v27_2: None,
#[cfg(CONFIG_DRM_ASAHI_G16)]
g16: None,
raw_dev: core::ptr::null_mut(),
Expand Down Expand Up @@ -789,5 +875,9 @@ impl Drop for AsahiPlatformDriverData<'_> {
if let Some(m3) = self.m3.as_ref() {
m3.stop();
}
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
if let Some(backend) = self.g14_v27_2.as_ref() {
backend.stop();
}
}
}
11 changes: 11 additions & 0 deletions drivers/gpu/drm/asahi/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ pub(crate) type Event = slotalloc::Guard<EventInner>;
pub(crate) struct EventValue(u32);

impl EventValue {
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
pub(crate) fn raw(self) -> u32 {
self.0
}

/// Returns the `EventValue` that succeeds this one.
pub(crate) fn next(&self) -> EventValue {
EventValue(self.0.wrapping_add(0x100))
Expand Down Expand Up @@ -199,6 +204,12 @@ impl EventManager {
Ok(ev)
}

/// Reserve the normal stamp pair for a kernel queue that polls its own completion.
#[cfg(CONFIG_DRM_ASAHI_G14_V27_2)]
pub(crate) fn try_get_polled(&self) -> Result<Event> {
self.alloc.try_get(None)
}

/// Signals an event by slot, indicating completion (of one or more commands).
pub(crate) fn signal(&self, slot: u32) {
match self
Expand Down
Loading
Loading