Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ea6e158
drm/asahi: g16: make slot VM/arena holding and mask scans O(claims)
DjDeveloperr Nov 22, 2026
e36c01a
drm/asahi: g16: add host-refill CPU boost and active-burst GPU ramp
DjDeveloperr Nov 22, 2026
fd60c5e
drm/asahi: g16: reuse clean same-VM compute WC descriptor in place
DjDeveloperr Nov 23, 2026
30d091b
drm/asahi: g16: route pipelined completion polls to an unbound workqueue
DjDeveloperr Nov 22, 2026
55ac312
drm/asahi: admit the USC cache invalidate in the G15/G16 VDM root bar…
erikwb Nov 20, 2026
60b9af8
drm/asahi: g16: support DRM_ASAHI_RENDER_FEW_PRIMITIVES
DjDeveloperr Nov 22, 2026
e355c7e
drm/asahi: g16: defer housekeeping off SUBMIT, adapt repoll, and pin …
DjDeveloperr Nov 22, 2026
703cbfb
drm/asahi: g16: support DRM_ASAHI_FEATURE_CUMULATIVE_SIGNALS
DjDeveloperr Nov 22, 2026
c168ccc
drm/asahi: g16: cache VM-epoch span proofs and unify CDM validation lock
DjDeveloperr Nov 22, 2026
7db1b4a
drm/asahi: g16: sustain CPU boost on short d>=2 pipelines and raise c…
DjDeveloperr Nov 22, 2026
11727d5
drm/asahi: mmu: make Vm::is_closed() lock-free with AtomicBool
DjDeveloperr Nov 22, 2026
9a5155e
drm/asahi/g16: slim pass_scrub and selectively write clean render scenes
DjDeveloperr Nov 22, 2026
0f9e744
drm/asahi/g16: pace unfinished TA passes in <=3-pass waves with immed…
DjDeveloperr Nov 22, 2026
b5afc55
drm/asahi/g16: cache firmware-owned queue graph records and skip qinf…
DjDeveloperr Nov 22, 2026
47ede20
drm/asahi/g16: fold cross-job same-queue render horizons up to TA wav…
DjDeveloperr Nov 22, 2026
9c19eb2
drm/asahi: g16: allow cross-VM compute overlap with recovery proof
DjDeveloperr Nov 22, 2026
6d68800
drm/asahi: g16: assign per-slot render UMA descriptors and multi-acti…
DjDeveloperr Nov 22, 2026
69d1023
drm/asahi: g16: pipeline warm cross-VM renders and eliminate hold[0] …
DjDeveloperr Nov 22, 2026
0cdc039
drm/asahi: g16: tighten completion wakeup and housekeeping cadence
DjDeveloperr Nov 22, 2026
b17e320
drm/asahi: g16: raise TA wave window and overlap pre-gfx compute
DjDeveloperr Nov 22, 2026
71a3a31
drm/asahi: g16: overlap barrier-free compute across two CDM pipes
DjDeveloperr Nov 23, 2026
3882292
thermal: apple-pmp: hold brief -ENODATA glitches below passive trip
DjDeveloperr Nov 23, 2026
eba5854
drm/asahi: g16: cap TA wave depth at 4 passes and fix ta_wave_wait wa…
DjDeveloperr Nov 24, 2026
4c5beb4
drm/asahi: g16: avoid TVB partial-render spills on heavy scenes
DjDeveloperr Nov 23, 2026
23d0ffd
drm/asahi/g16: eliminate multi-kilobyte kernel stack frames in probe …
DjDeveloperr Nov 23, 2026
6a873a2
drm/asahi: g16: resolve same-VM cross-queue fences into firmware barr…
DjDeveloperr Nov 23, 2026
4ec3675
drm/asahi: g16: coalesce timeline fence chains per queue for fw barriers
DjDeveloperr Nov 23, 2026
9cd259d
drm/asahi: g16: prefer warm VM-affine compute units when claiming
DjDeveloperr Nov 23, 2026
e30cdb9
drm/asahi: g16: scale warm render PB/UMA slots to 16 and keep pass sl…
DjDeveloperr Nov 23, 2026
393cd79
drm/asahi/g16: reclaim displaced closed-VM slot leases and retain fir…
DjDeveloperr Nov 23, 2026
6bd4317
drm/asahi/g16: split compute arenas per unit to bound closed-VM pins
DjDeveloperr Nov 23, 2026
047b934
drm/asahi: g16: keep closed VMs' PB epochs until their slot is replaced
DjDeveloperr 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
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/asahi_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ module! {
description: "G16: compute completion-stamp deadline, ms (0 permits unbounded compute; firmware recovery stays active)",
},
g16_repoll_us: u32 {
default: 15,
default: 8,
description: "G16: repoll interval while publication waits for record consumption, us",
},
g16_resnap_us: u32 {
Expand Down
4 changes: 3 additions & 1 deletion drivers/gpu/drm/asahi/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@ impl File {
gpu.get_params(&mut params)?;

params.features |= gpu.feature_flags();
// Every backend admits the USC cache invalidate in the VDM root barrier.
params.features |= uapi::DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE as u64;
if Self::supports_user_memory(reg_data) {
params.features |= uapi::DRM_ASAHI_FEATURE_USERPTR as u64;
}
Expand Down Expand Up @@ -1881,7 +1883,7 @@ impl File {
data.syncs,
data.in_sync_count,
data.out_sync_count,
gpu.as_any().is::<crate::g17::Gpu>(),
gpu.as_any().is::<crate::g17::Gpu>() || gpu.as_any().is::<crate::g16::Gpu>(),
) {
Ok(syncs) => syncs,
Err(e) => {
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/asahi/fwid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ impl fmt::Display for Identity {
/// Identifies the firmware build loaded at `text` (DATA `data_size` bytes) among `builds`,
/// before any firmware-visible write.
#[cfg_attr(not(CONFIG_DRM_ASAHI_G16), allow(dead_code))]
#[inline(never)]
pub(crate) fn identify(
dev: &device::Device,
text: Range<u64>,
Expand Down
11 changes: 8 additions & 3 deletions drivers/gpu/drm/asahi/g15/gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

//! Stream admission gates (safety nets for userspace encoders).
//!
//! VDM: the root stream's first word is 0x21000960. CDM walk from `cdm_ctrl_stream_base` through
//! VDM: the root stream's first word is 0x21000960, or 0x21000968 with the USC cache invalidate.
//!
//! CDM walk from `cdm_ctrl_stream_base` through
//! links until TERMINATE (0x40000000), at most 64 links and [`CDM_MAX_BYTES`] of records (a
//! longer or cyclic stream is rejected): barriers 0x60000160, 0x60001560, 0x600215fe, 0x600201fe;
//! link 0x2000XXXX; direct launch (40 B, the G15 layout), indirect launches 36 B
Expand All @@ -20,6 +22,8 @@ use super::{command::cover, command::USC_WINDOW, params};
use crate::mmu;

const VDM_ROOT: u32 = 0x21000960;
/// USC cache invalidate bit of the VDM root barrier (DRM_ASAHI_FEATURE_VDM_USC_INVALIDATE).
const VDM_ROOT_USC_INVAL: u32 = 0x8;
const CDM_TERMINATE: u32 = 0x40000000;
const CDM_BARRIERS: [u32; 4] = [0x60000160, 0x600215fe, 0x60001560, 0x600201fe];
const CDM_LINK: u32 = 0x20000000;
Expand Down Expand Up @@ -148,15 +152,16 @@ fn arguments(vm: &mut mmu::VmReadGuard<'_>, address: u64, checked: &mut Checked)
Ok(())
}

/// VDM admission: a normal root stream opens with exactly the G15 barrier.
/// VDM admission: a normal root stream opens with the G15 barrier, with or
/// without the USC cache invalidate.
pub(crate) fn vdm(vm: &mut mmu::VmReadGuard<'_>, va: u64) -> Result {
if !params::stream_gate() {
return Ok(());
}
let mut bytes = [0u8; 4];
vm.read_user(va, &mut bytes).map_err(|_| EFAULT)?;
let word = u32::from_le_bytes(bytes);
if word != VDM_ROOT {
if word & !VDM_ROOT_USC_INVAL != VDM_ROOT {
return Err(reject("VDM root", va, &[word]));
}
Ok(())
Expand Down
7 changes: 4 additions & 3 deletions drivers/gpu/drm/asahi/g15/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
//! Module parameters and the GET_PARAMS identity.
//!
//! With the shared `file.rs` additions (VM_STATUS and VM_STATUS_MIRROR from `supports_vm_status`,
//! INDEPENDENT_QUEUES from `queue_limits`, SOFT_FAULTS suppressed by `soft_faults`), the feature
//! word is exactly 0x3e (0xbe with `g15_early_tiling`). Never advertise SOFT_FAULTS,
//! FEW_PRIMITIVES or RENDER_RAY_QUERY on G15S.
//! INDEPENDENT_QUEUES from `queue_limits`, SOFT_FAULTS suppressed by `soft_faults`, and
//! VDM_USC_INVALIDATE, bit 40 in both numberings), the feature word is exactly 0x3e (0xbe with
//! `g15_early_tiling`) plus bit 40. Never advertise SOFT_FAULTS, FEW_PRIMITIVES or
//! RENDER_RAY_QUERY on G15S.

use kernel::prelude::*;

Expand Down
26 changes: 15 additions & 11 deletions drivers/gpu/drm/asahi/g16/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ pub(crate) fn layout(dev: &device::Device) -> Option<&'static hw::FwLayout> {
}

/// Validates the FDT contract and returns the reserved physical regions, read-only.
pub(crate) fn read(dev: &device::Device) -> Result<GpuAdt> {
#[inline(never)]
pub(crate) fn read(dev: &device::Device) -> Result<KBox<GpuAdt>> {
let node = dev.of_node().ok_or(EINVAL)?;
let (version, vas, flags) = handoff(dev)?;
let names: KVec<u8> = node.get_property(c_str!("memory-region-names"))?;
Expand Down Expand Up @@ -223,14 +224,17 @@ pub(crate) fn read(dev: &device::Device) -> Result<GpuAdt> {
performance.count
);
let [ttbs, tables, handoff, shared_l2, text, data] = regions;
Ok(GpuAdt {
ttbs,
tables,
handoff,
shared_l2,
text,
data,
performance,
layout,
})
Ok(KBox::init(
init!(GpuAdt {
ttbs,
tables,
handoff,
shared_l2,
text,
data,
performance,
layout,
}),
GFP_KERNEL,
)?)
}
93 changes: 66 additions & 27 deletions drivers/gpu/drm/asahi/g16/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl Rtkit {
/// The result of admission: everything probe-time checks established, nothing written.
pub(crate) struct Admitted {
pub(crate) regs: regs::Regs,
pub(crate) adt: GpuAdt,
pub(crate) adt: KBox<GpuAdt>,
}

/// The running firmware session: RTKit, MMIO and the adopted UAT. (The
Expand All @@ -472,7 +472,7 @@ pub(crate) struct Session {
pub(crate) shared: Arc<Shared>,
pub(crate) rtkit: Rtkit,
pub(crate) regs: regs::Regs,
pub(crate) adt: GpuAdt,
pub(crate) adt: KBox<GpuAdt>,
uat: Arc<mmu::Uat>,
/// The PPL handoff page, mapped here only to read the firmware's powered flag
/// ([`hw::FwLayout::powered`]); `None` when the firmware keeps the GPU powered.
Expand Down Expand Up @@ -602,7 +602,7 @@ pub(crate) fn admit(
_dev: &AsahiDrmDevice,
cfg: &'static Config,
res: shared_regs::G16Resources,
) -> Result<Admitted> {
) -> Result<KBox<Admitted>> {
let dev = pdev.as_ref();
// The board check guards the PMP AGX vote, which only the 25G83 start sends. A firmware
// whose handoff names the start without the vote (26B123) rests on the firmware identity
Expand Down Expand Up @@ -677,7 +677,7 @@ pub(crate) fn admit(
return Err(Error::from_errno(-(bindings::EHOSTDOWN as i32)));
}
dev_info!(dev, "T8132 G16G admitted, ASC={:#x}\n", regs.asc_control()?);
Ok(Admitted { regs, adt })
Ok(KBox::init(init!(Admitted { regs, adt }), GFP_KERNEL)?)
}

/// Posts one device control with only the opcode and waits for it.
Expand Down Expand Up @@ -758,6 +758,7 @@ fn publish_loader_table(session: &Session, init: &InitData, offset: u64) -> Resu
}

/// Wake the sole firmware instance, publish its loader table, then qualify NOP and policy.
#[inline(never)]
fn run(
session: &mut Session,
events: &mut Events,
Expand Down Expand Up @@ -900,15 +901,54 @@ fn run(
Ok(())
}

/// Retains a failed firmware start out-of-line so [`start`] never reserves an [`Orphan`] slot on
/// its normal stack frame.
#[cold]
#[inline(never)]
fn retain_start_failure(
shared: &Shared,
session: Session,
objects: Objects,
built: Option<(InitData, Channels, u32)>,
events: Events,
) {
let (init, channels) = match built {
Some((init, channels, _)) => (Some(init), Some(channels)),
None => (None, None),
};
match KBox::<Orphan>::new_uninit(GFP_KERNEL) {
Ok(slot) => {
let orphan = slot
.write_init(init!(Orphan {
session,
_objects: objects,
channels,
_init: init,
events,
}))
.unwrap_or_else(|e| match e {});
shared.retain_failed(super::Retained::Orphan(orphan));
}
Err(_) => {
dev_err!(
shared.dev.as_ref(),
"G16: cannot keep the failed session; leaked\n"
);
// Without memory for the box, leak the firmware-reachable parts.
core::mem::forget((session, objects, channels, init, events));
}
}
}

/// Brings the firmware to READY.
#[inline(never)]
pub(crate) fn start(
admitted: Admitted,
admitted: KBox<Admitted>,
dev: &AsahiDrmDevice,
cfg: &'static Config,
shared: &Arc<Shared>,
) -> Result<Booted> {
let Admitted { regs, adt } = admitted;
) -> Result<KBox<Booted>> {
let Admitted { regs, adt } = KBox::into_inner(admitted);
let d: ARef<device::Device> = shared.dev.clone();
// Cold ownership must hold before the PMP vote as well as immediately before RUN.
if regs.asc_control()? & regs::ASC_RUN != 0 {
Expand Down Expand Up @@ -1005,6 +1045,13 @@ pub(crate) fn start(
return Err(e);
}
};
let booted_slot = match KBox::<Booted>::new_uninit(GFP_KERNEL) {
Ok(slot) => slot,
Err(e) => {
core::mem::forget(objects);
return Err(e.into());
}
};
let mut session = Session {
dev: d.clone(),
shared: shared.clone(),
Expand Down Expand Up @@ -1074,27 +1121,19 @@ pub(crate) fn start(
"G16 start failed: {:?}; session retained until reboot\n",
e
);
let (init, channels) = match built {
Some((init, channels, _)) => (Some(init), Some(channels)),
None => (None, None),
};
shared.orphan(Orphan {
session,
_objects: objects,
channels,
_init: init,
events,
});
retain_start_failure(shared, session, objects, built, events);
return Err(e);
}
let (init, channels, max_frequency_khz) = built.ok_or(EINVAL)?;
Ok(Booted {
session,
init,
objects,
channels,
events,
id,
max_frequency_khz,
})
Ok(booted_slot
.write_init(init!(Booted {
session,
init,
objects,
channels,
events,
id,
max_frequency_khz,
}))
.unwrap_or_else(|e| match e {}))
}
Loading