Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 Documentation/gpu/asahi-g17-capacity.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
G17 capacity diagnostics
=======================

The read-only ``/sys/kernel/debug/asahi-g17/capacity`` file samples the live
The read-only ``/sys/kernel/debug/aurora-g17/capacity`` file samples the live
firmware session. It does not wake firmware or reclaim resources. An absent
session reports ``online=0``. The format is diagnostic, not a stable ABI.
Counts exclude reserved identities. Sub-pool locks and atomic snapshots mean
Expand Down
11 changes: 7 additions & 4 deletions drivers/gpu/drm/asahi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ config RUST_DRM_GPUVM
select DRM_GPUVM

config DRM_ASAHI
tristate "Asahi (DRM support for Apple AGX GPUs)"
tristate "Aurora (DRM support for Apple AGX GPUs)"
depends on RUST
depends on DRM=y
depends on (ARM64 && ARCH_APPLE) || (COMPILE_TEST && !GENERIC_ATOMIC64)
Expand All @@ -23,16 +23,19 @@ config DRM_ASAHI
select RUST_APPLE_RTKIT
select CRYPTO_LIB_SHA256
help
DRM driver for Apple AGX GPUs (G13x, found in the M1 SoC family)
DRM driver for Apple AGX GPUs, from the M1 family onwards.

To compile this driver as a module, choose M here: the module will
be called aurora. It keeps "asahi" as a module alias.

config DRM_ASAHI_G16
bool "Apple M4 (G16G) support (experimental)"
depends on DRM_ASAHI && ARM64
depends on APPLE_PMP=y || APPLE_PMP=DRM_ASAHI
depends on THERMAL_OF
help
Rust Asahi backend for the qualified J713/T8132 GPU firmware.
Load asahi explicitly after the native display and GFX TVM supplier
Rust backend for the qualified J713/T8132 GPU firmware.
Load aurora explicitly after the native display and GFX TVM supplier
are ready. Firmware-visible storage remains retained until a verified
retirement or reboot. Keep the working kernel available during bring-up.
A rendering VM pins about 0.7 GiB; memory-cgroup limits are advisable.
Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/asahi/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_DRM_ASAHI) += asahi.o
asahi-y := asahi_core.o fwid.o sysfs.o g17/sync_input.o g17/sync_output.o g17/sync_scope.o g17/trace.o g17/clpc.o
obj-$(CONFIG_DRM_ASAHI) += aurora.o
aurora-y := asahi_core.o fwid.o sysfs.o g17/sync_input.o g17/sync_output.o g17/sync_scope.o g17/trace.o g17/clpc.o
CFLAGS_g17/trace.o := -I$(src)/g17

asahi-$(CONFIG_DRM_ASAHI_G15) += g15/glue.o
aurora-$(CONFIG_DRM_ASAHI_G15) += g15/glue.o

asahi-$(CONFIG_DRM_ASAHI_G16) += g16/glue.o
aurora-$(CONFIG_DRM_ASAHI_G16) += g16/glue.o
5 changes: 3 additions & 2 deletions drivers/gpu/drm/asahi/asahi_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl kernel::InPlaceModule for DriverModule {
// Initialize the queue first, before registration can invoke probe.
_cleanup: cleanup::QueueOwner::new()?,
#[cfg(CONFIG_DRM_ASAHI_G15)]
_g15 <- kernel::driver::Registration::new(c"asahi-g15", module),
_g15 <- kernel::driver::Registration::new(c"aurora-g15", module),
_driver <- kernel::driver::Registration::new(
<Self as kernel::ModuleMetadata>::NAME,
module,
Expand All @@ -107,9 +107,10 @@ impl kernel::InPlaceModule for DriverModule {

module! {
type: DriverModule,
name: "asahi",
name: "aurora",
description: "AGX GPU driver for Apple silicon SoCs",
license: "Dual MIT/GPL",
alias: ["asahi"],
params: {
debug_flags: u64 {
default: 0,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl QueueOwner {
// SAFETY: The name is NUL terminated and contains no format specifiers.
let raw = unsafe {
bindings::alloc_workqueue_noprof(
c_str!("asahi-ts-cleanup").as_char_ptr(),
c_str!("aurora-ts-cleanup").as_char_ptr(),
bindings::wq_flags_WQ_UNBOUND | bindings::wq_flags_WQ_MEM_RECLAIM,
0,
)
Expand Down
12 changes: 9 additions & 3 deletions drivers/gpu/drm/asahi/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,18 @@ pub(crate) type AsahiDevRef = ARef<AsahiDrmDevice>;
pub(crate) type AsahiRegData<'drm> = AsahiDrmRegistrationData<'drm>;

/// DRM Driver metadata
///
/// The major version names the UAPI generation in include/uapi/drm/asahi_drm.h
/// and only changes if that ABI ever breaks. The minor version goes up with
/// each new ioctl, flag or feature bit, so userspace can tell what a kernel
/// accepts without probing. The patch level marks fixes userspace may need to
/// detect.
const INFO: drm::driver::DriverInfo = drm::driver::DriverInfo {
major: 0,
major: 1,
minor: 0,
patchlevel: 0,
name: c"asahi",
desc: c"Apple AGX Graphics",
name: c"aurora",
desc: c"Aurora GPU for Apple AGX",
};

/// DRM Driver implementation for `AsahiDriver`.
Expand Down
8 changes: 4 additions & 4 deletions drivers/gpu/drm/asahi/g15/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ struct Prefix {
fs_ts: bool,
}

/// Engine statistics, printed by `asahi-g15/stats`.
/// Engine statistics, printed by `aurora-g15/stats`.
#[derive(Default)]
pub(crate) struct Stats {
pub(crate) pub_ns: u64,
Expand Down Expand Up @@ -271,7 +271,7 @@ pub(crate) struct Stats {
}

/// Host-side phase timers of publication and polling, on with `debug_flags` bit 49
/// (`Debug1`); printed as the `prof:` line of `asahi-g15/stats`. A measurement aid: nothing is
/// (`Debug1`); printed as the `prof:` line of `aurora-g15/stats`. A measurement aid: nothing is
/// timed while the flag is off.
#[derive(Default)]
pub(crate) struct Prof {
Expand Down Expand Up @@ -391,9 +391,9 @@ pub(crate) struct Engine {
pub(crate) stats: Stats,
/// Phase timers (debug_flags bit 49).
pub(crate) prof: Prof,
/// The `asahi-g15/stats` file.
/// The `aurora-g15/stats` file.
pub(crate) debugfs: Option<Pin<KBox<kernel::debugfs::File<Arc<Shared>>>>>,
/// The `asahi-g15/pstate` file.
/// The `aurora-g15/pstate` file.
pub(crate) debugfs_pstate: Option<Pin<KBox<kernel::debugfs::File<Arc<Shared>>>>>,
scratch: Option<KBox<Scratch>>,
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/asahi/g15/fence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) struct JobFenceOps;
#[vtable]
impl FenceOps for JobFenceOps {
fn get_driver_name<'a>(self: &'a FenceObject<Self>) -> &'a CStr {
c_str!("asahi")
c_str!("aurora")
}

fn get_timeline_name<'a>(self: &'a FenceObject<Self>) -> &'a CStr {
Expand Down Expand Up @@ -63,11 +63,11 @@ pub(crate) struct Timeline {

impl Timeline {
pub(crate) fn new() -> Result<Arc<Self>> {
let errors = FenceContexts::new(1, c_str!("asahi_g15_refused"), ERROR_KEY)?;
let errors = FenceContexts::new(1, c_str!("aurora_g15_refused"), ERROR_KEY)?;
let allocation_failure = error_fence(&errors, ENOMEM)?;
Arc::pin_init(
try_pin_init!(Self {
jobs: FenceContexts::new(1, c_str!("asahi_g15_queue"), TIMELINE_KEY)?,
jobs: FenceContexts::new(1, c_str!("aurora_g15_queue"), TIMELINE_KEY)?,
errors,
pending <- new_mutex!(KVec::new(), "g15::Timeline::pending"),
allocation_failure,
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/asahi/g15/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ void asahi_g15_reprobe(void)
const struct device_driver *drv;
int ret;

drv = driver_find("asahi-g15", &platform_bus_type);
drv = driver_find("aurora-g15", &platform_bus_type);
if (!drv) {
pr_err("asahi-g15: registered adapter not found for activation\n");
pr_err("aurora-g15: registered adapter not found for activation\n");
return;
}
ret = driver_attach(drv);
if (ret)
pr_err("asahi-g15: activation attach failed: %d\n", ret);
pr_err("aurora-g15: activation attach failed: %d\n", ret);
}
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/g15/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl Scheduler {
hw::sizes::HORIZON_JOBS,
0,
hw::tuning::SCHED_TIMEOUT_MS,
c_str!("asahi_g15"),
c_str!("aurora_g15"),
)?;
// With one run queue, only the kernel priority is valid.
let entity = sched::Entity::new(&scheduler, sched::Priority::Kernel)?;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/g15/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ impl Gpu {
*shared.state.lock() = Some(firmware);
// The engine's statistics file (a debugfs failure does not fail the probe).
if let Err(error) = shared.start_engine() {
dev_warn!(dev.as_ref(), "G15: no asahi-g15 debugfs ({:?})\n", error);
dev_warn!(dev.as_ref(), "G15: no aurora-g15 debugfs ({:?})\n", error);
}
let gpu = Arc::new(
Gpu {
Expand Down
12 changes: 6 additions & 6 deletions drivers/gpu/drm/asahi/g15/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl HrTimerCallback for Shared {
}
}

/// The `asahi-g15/stats` debugfs file contents.
/// The `aurora-g15/stats` debugfs file contents.
fn stats_show(shared: &Arc<Shared>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let state = shared.state.lock();
match state.as_deref() {
Expand All @@ -63,7 +63,7 @@ fn stats_show(shared: &Arc<Shared>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
}
}

/// The `asahi-g15/pstate` file contents.
/// The `aurora-g15/pstate` file contents.
fn pstate_show(shared: &Arc<Shared>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let state = shared.state.lock();
match state.as_deref() {
Expand Down Expand Up @@ -160,10 +160,10 @@ impl Shared {
self.mod_poll(1);
}

/// Starts what the engine needs besides the firmware state: the `asahi-g15/stats` and
/// `asahi-g15/pstate` files.
/// Starts what the engine needs besides the firmware state: the `aurora-g15/stats` and
/// `aurora-g15/pstate` files.
pub(crate) fn start_engine(self: &Arc<Self>) -> Result {
let dir = debugfs::Dir::new(c_str!("asahi-g15"));
let dir = debugfs::Dir::new(c_str!("aurora-g15"));
let file = KBox::pin_init(
dir.read_callback_file(c_str!("stats"), self.clone(), &stats_show),
GFP_KERNEL,
Expand Down Expand Up @@ -654,7 +654,7 @@ impl Firmware {
}
}

/// The `asahi-g15/stats` contents. Scripts parse the keys: keep them stable.
/// The `aurora-g15/stats` contents. Scripts parse the keys: keep them stable.
pub(crate) fn write_stats(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = &self.engine.stats;
let slots = &self.slots.stats;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/asahi/g15/power.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//! - +0x2c idle decision enabled (template 1, unchanged).
//!
//! DVFS is firmware-run on the ADT tables. The state it runs at is read back by
//! `asahi-g15/pstate` ([`pstate`], [`super::Firmware::write_pstate`]): the newest power-state
//! `aurora-g15/pstate` ([`pstate`], [`super::Firmware::write_pstate`]): the newest power-state
//! record of the stats ring, and HardwareDataA's state words.

mod idle;
Expand Down Expand Up @@ -50,7 +50,7 @@ impl Firmware {
})
}

/// The `asahi-g15/pstate` file ([`pstate::write`]): the stats ring's records so far, those
/// The `aurora-g15/pstate` file ([`pstate::write`]): the stats ring's records so far, those
/// it holds unconsumed (read, not consumed), HardwareDataA's words and table A of the
/// device tree's operating points. Read-only: nothing firmware-visible is written.
pub(crate) fn write_pstate(&self, f: &mut impl fmt::Write) -> fmt::Result {
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/asahi/g15/power/pstate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//! An index counts the firmware's DVFS states, 0 (off) to 8; its frequency is the state's
//! table-A operating point ([`super::super::board`]), taken from the device tree.
//!
//! [`write`] prints the `asahi-g15/pstate` file. Its first line is what a sampler reads:
//! [`write`] prints the `aurora-g15/pstate` file. Its first line is what a sampler reads:
//! `pstate <index> freq_khz <kHz> source <stats|hwdata>`, from the newest power-state record
//! seen, or HardwareDataA's current state when the stats ring has carried none.
//!
Expand Down Expand Up @@ -181,7 +181,7 @@ impl fmt::Display for Khz {
}
}

/// The `asahi-g15/pstate` file:
/// The `aurora-g15/pstate` file:
///
/// ```text
/// pstate <index> freq_khz <kHz|unknown> source <stats|hwdata>
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/g15/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl Firmware {
self.recovery.armed.is_none() && !self.new_errors()
}

/// `(recoveries, hang_kills)` for `asahi-g15/stats`.
/// `(recoveries, hang_kills)` for `aurora-g15/stats`.
pub(crate) fn recovery_counts(&self) -> (u64, u64) {
(self.recovery.recoveries, self.recovery.hang_kills)
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/asahi/g15/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ impl ClearQueue {
// SAFETY: The name is a valid NUL-terminated string the C side copies.
let ptr = unsafe {
bindings::alloc_ordered_workqueue(
c_str!("asahi-g15-clear").as_char_ptr(),
c_str!("aurora-g15-clear").as_char_ptr(),
bindings::wq_flags_WQ_MEM_RECLAIM,
)
};
Expand Down Expand Up @@ -535,7 +535,7 @@ impl Claims {
}
}

/// Slot accounting statistics (`asahi-g15/stats`).
/// Slot accounting statistics (`aurora-g15/stats`).
#[derive(Copy, Clone, Default)]
pub(crate) struct SlotStats {
/// Clustering buffers zeroed at claim, pass slots reset at claim, compute slots scrubbed
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/asahi/g16/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ enum PublicationError {
Uncertain(Error),
}

/// Engine statistics, printed by `asahi-g16/stats`.
/// Engine statistics, printed by `aurora-g16/stats`.
#[derive(Default)]
pub(crate) struct Stats {
pub(crate) pub_ns: u64,
Expand Down Expand Up @@ -294,7 +294,7 @@ pub(crate) struct Stats {
}

/// Host-side phase timers of publication and polling, on with `debug_flags` bit 49
/// (`Debug1`); printed as the `prof:` line of `asahi-g16/stats`. A measurement aid: nothing is
/// (`Debug1`); printed as the `prof:` line of `aurora-g16/stats`. A measurement aid: nothing is
/// timed while the flag is off.
#[derive(Default)]
pub(crate) struct Prof {
Expand Down Expand Up @@ -411,7 +411,7 @@ pub(crate) struct Engine {
pub(crate) stats: Stats,
/// Phase timers (debug_flags bit 49).
pub(crate) prof: Prof,
/// The `asahi-g16/stats` file.
/// The `aurora-g16/stats` file.
pub(crate) debugfs: Option<Pin<KBox<kernel::debugfs::File<Arc<Shared>>>>>,
scratch: Option<KBox<Scratch>>,
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/asahi/g16/fence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub(crate) struct JobFenceOps;
#[vtable]
impl FenceOps for JobFenceOps {
fn get_driver_name<'a>(self: &'a FenceObject<Self>) -> &'a CStr {
c_str!("asahi")
c_str!("aurora")
}

fn get_timeline_name<'a>(self: &'a FenceObject<Self>) -> &'a CStr {
Expand Down Expand Up @@ -107,11 +107,11 @@ pub(crate) struct Timeline {

impl Timeline {
pub(crate) fn new() -> Result<Arc<Self>> {
let errors = FenceContexts::new(1, c_str!("asahi_g16_refused"), ERROR_KEY)?;
let errors = FenceContexts::new(1, c_str!("aurora_g16_refused"), ERROR_KEY)?;
let allocation_failure = error_fence(&errors, ENOMEM)?;
Arc::pin_init(
try_pin_init!(Self {
jobs: FenceContexts::new(1, c_str!("asahi_g16_queue"), TIMELINE_KEY)?,
jobs: FenceContexts::new(1, c_str!("aurora_g16_queue"), TIMELINE_KEY)?,
errors,
pending <- new_mutex!(KVec::new(), "g16::Timeline::pending"),
allocation_failure,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/g16/glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ struct asahi_g16_cooling *asahi_g16_cooling_register(struct device *dev)
goto put_node;
}
cooling->cdev = thermal_of_cooling_device_register(dev->of_node, 0,
"asahi-g16g", cooling,
"aurora-g16g", cooling,
&asahi_g16_cooling_ops);
if (IS_ERR(cooling->cdev)) {
ret = PTR_ERR(cooling->cdev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/g16/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ impl Scheduler {
hw::sizes::SCHEDULER_CREDITS,
0,
hw::tuning::SCHED_TIMEOUT_MS,
c_str!("asahi_g16"),
c_str!("aurora_g16"),
)?;
// With one run queue, only the kernel priority is valid.
let entity = sched::Entity::new(&scheduler, sched::Priority::Kernel)?;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/asahi/g16/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ use crate::driver::{AsahiDrmDevice, AsahiPlatformDriver};
use crate::{alloc, gem, gpu, mmu, regs as shared_regs};

/// Name of the G16 platform driver.
pub(crate) const DRIVER_NAME: &CStr = c_str!("asahi-g16");
pub(crate) const DRIVER_NAME: &CStr = c_str!("aurora-g16");

/// GPU generation reported to userspace.
pub(crate) const GPU_GENERATION: u32 = 16;
Expand Down Expand Up @@ -398,7 +398,7 @@ impl Gpu {
*shared.state.lock() = Some(firmware);
// The engine's statistics file (a debugfs failure does not fail the probe).
if let Err(error) = shared.start_engine() {
dev_warn!(dev.as_ref(), "G16: no asahi-g16 debugfs ({:?})\n", error);
dev_warn!(dev.as_ref(), "G16: no aurora-g16 debugfs ({:?})\n", error);
}
let gpu = Arc::new(
Gpu {
Expand Down
Loading