diff --git a/Documentation/gpu/asahi-g17-capacity.rst b/Documentation/gpu/asahi-g17-capacity.rst index 68d261682f842..43c61b6364688 100644 --- a/Documentation/gpu/asahi-g17-capacity.rst +++ b/Documentation/gpu/asahi-g17-capacity.rst @@ -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 diff --git a/drivers/gpu/drm/asahi/Kconfig b/drivers/gpu/drm/asahi/Kconfig index 3903ee68b162b..647f8f37507d4 100644 --- a/drivers/gpu/drm/asahi/Kconfig +++ b/drivers/gpu/drm/asahi/Kconfig @@ -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) @@ -23,7 +23,10 @@ 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)" @@ -31,8 +34,8 @@ config DRM_ASAHI_G16 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. diff --git a/drivers/gpu/drm/asahi/Makefile b/drivers/gpu/drm/asahi/Makefile index fd8421f27590d..db13d06336b3c 100644 --- a/drivers/gpu/drm/asahi/Makefile +++ b/drivers/gpu/drm/asahi/Makefile @@ -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 diff --git a/drivers/gpu/drm/asahi/asahi_core.rs b/drivers/gpu/drm/asahi/asahi_core.rs index 57c3f16e7df2a..42843e3459217 100644 --- a/drivers/gpu/drm/asahi/asahi_core.rs +++ b/drivers/gpu/drm/asahi/asahi_core.rs @@ -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( ::NAME, module, @@ -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, diff --git a/drivers/gpu/drm/asahi/cleanup.rs b/drivers/gpu/drm/asahi/cleanup.rs index e3dd5ad95dc0c..52436b40304c0 100644 --- a/drivers/gpu/drm/asahi/cleanup.rs +++ b/drivers/gpu/drm/asahi/cleanup.rs @@ -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, ) diff --git a/drivers/gpu/drm/asahi/driver.rs b/drivers/gpu/drm/asahi/driver.rs index caf0ef32ca427..a89728cc2f2b3 100644 --- a/drivers/gpu/drm/asahi/driver.rs +++ b/drivers/gpu/drm/asahi/driver.rs @@ -79,12 +79,18 @@ pub(crate) type AsahiDevRef = ARef; 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`. diff --git a/drivers/gpu/drm/asahi/g15/engine.rs b/drivers/gpu/drm/asahi/g15/engine.rs index e5c18a15e0c3b..51b3cfd10d594 100644 --- a/drivers/gpu/drm/asahi/g15/engine.rs +++ b/drivers/gpu/drm/asahi/g15/engine.rs @@ -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, @@ -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 { @@ -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>>>>, - /// The `asahi-g15/pstate` file. + /// The `aurora-g15/pstate` file. pub(crate) debugfs_pstate: Option>>>>, scratch: Option>, } diff --git a/drivers/gpu/drm/asahi/g15/fence.rs b/drivers/gpu/drm/asahi/g15/fence.rs index a959ff00d4bb1..bb85764228070 100644 --- a/drivers/gpu/drm/asahi/g15/fence.rs +++ b/drivers/gpu/drm/asahi/g15/fence.rs @@ -32,7 +32,7 @@ pub(crate) struct JobFenceOps; #[vtable] impl FenceOps for JobFenceOps { fn get_driver_name<'a>(self: &'a FenceObject) -> &'a CStr { - c_str!("asahi") + c_str!("aurora") } fn get_timeline_name<'a>(self: &'a FenceObject) -> &'a CStr { @@ -63,11 +63,11 @@ pub(crate) struct Timeline { impl Timeline { pub(crate) fn new() -> Result> { - 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, diff --git a/drivers/gpu/drm/asahi/g15/glue.c b/drivers/gpu/drm/asahi/g15/glue.c index 662c9c8258e21..b949a4b9b61ed 100644 --- a/drivers/gpu/drm/asahi/g15/glue.c +++ b/drivers/gpu/drm/asahi/g15/glue.c @@ -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); } diff --git a/drivers/gpu/drm/asahi/g15/job.rs b/drivers/gpu/drm/asahi/g15/job.rs index 159eea1dec3bc..5f6669f06d1b0 100644 --- a/drivers/gpu/drm/asahi/g15/job.rs +++ b/drivers/gpu/drm/asahi/g15/job.rs @@ -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)?; diff --git a/drivers/gpu/drm/asahi/g15/mod.rs b/drivers/gpu/drm/asahi/g15/mod.rs index e39180f02248a..713a1360b5687 100644 --- a/drivers/gpu/drm/asahi/g15/mod.rs +++ b/drivers/gpu/drm/asahi/g15/mod.rs @@ -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 { diff --git a/drivers/gpu/drm/asahi/g15/poll.rs b/drivers/gpu/drm/asahi/g15/poll.rs index bf04984b7ed17..566995eb342c9 100644 --- a/drivers/gpu/drm/asahi/g15/poll.rs +++ b/drivers/gpu/drm/asahi/g15/poll.rs @@ -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, f: &mut fmt::Formatter<'_>) -> fmt::Result { let state = shared.state.lock(); match state.as_deref() { @@ -63,7 +63,7 @@ fn stats_show(shared: &Arc, f: &mut fmt::Formatter<'_>) -> fmt::Result { } } -/// The `asahi-g15/pstate` file contents. +/// The `aurora-g15/pstate` file contents. fn pstate_show(shared: &Arc, f: &mut fmt::Formatter<'_>) -> fmt::Result { let state = shared.state.lock(); match state.as_deref() { @@ -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) -> 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, @@ -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; diff --git a/drivers/gpu/drm/asahi/g15/power.rs b/drivers/gpu/drm/asahi/g15/power.rs index 58b6636fde383..69680f4636499 100644 --- a/drivers/gpu/drm/asahi/g15/power.rs +++ b/drivers/gpu/drm/asahi/g15/power.rs @@ -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; @@ -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 { diff --git a/drivers/gpu/drm/asahi/g15/power/pstate.rs b/drivers/gpu/drm/asahi/g15/power/pstate.rs index 411fe22413893..0ea68f02ac180 100644 --- a/drivers/gpu/drm/asahi/g15/power/pstate.rs +++ b/drivers/gpu/drm/asahi/g15/power/pstate.rs @@ -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 freq_khz source `, from the newest power-state record //! seen, or HardwareDataA's current state when the stats ring has carried none. //! @@ -181,7 +181,7 @@ impl fmt::Display for Khz { } } -/// The `asahi-g15/pstate` file: +/// The `aurora-g15/pstate` file: /// /// ```text /// pstate freq_khz source diff --git a/drivers/gpu/drm/asahi/g15/recovery.rs b/drivers/gpu/drm/asahi/g15/recovery.rs index 0827385e92c5f..b81734b1d5f2d 100644 --- a/drivers/gpu/drm/asahi/g15/recovery.rs +++ b/drivers/gpu/drm/asahi/g15/recovery.rs @@ -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) } diff --git a/drivers/gpu/drm/asahi/g15/slots.rs b/drivers/gpu/drm/asahi/g15/slots.rs index aae6d8804ee7f..8767eea321a0d 100644 --- a/drivers/gpu/drm/asahi/g15/slots.rs +++ b/drivers/gpu/drm/asahi/g15/slots.rs @@ -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, ) }; @@ -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 diff --git a/drivers/gpu/drm/asahi/g16/engine.rs b/drivers/gpu/drm/asahi/g16/engine.rs index a1202afb25f0d..f53293578316f 100644 --- a/drivers/gpu/drm/asahi/g16/engine.rs +++ b/drivers/gpu/drm/asahi/g16/engine.rs @@ -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, @@ -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 { @@ -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>>>>, scratch: Option>, } diff --git a/drivers/gpu/drm/asahi/g16/fence.rs b/drivers/gpu/drm/asahi/g16/fence.rs index afd89cc588a6a..01ba768b313b7 100644 --- a/drivers/gpu/drm/asahi/g16/fence.rs +++ b/drivers/gpu/drm/asahi/g16/fence.rs @@ -76,7 +76,7 @@ pub(crate) struct JobFenceOps; #[vtable] impl FenceOps for JobFenceOps { fn get_driver_name<'a>(self: &'a FenceObject) -> &'a CStr { - c_str!("asahi") + c_str!("aurora") } fn get_timeline_name<'a>(self: &'a FenceObject) -> &'a CStr { @@ -107,11 +107,11 @@ pub(crate) struct Timeline { impl Timeline { pub(crate) fn new() -> Result> { - 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, diff --git a/drivers/gpu/drm/asahi/g16/glue.c b/drivers/gpu/drm/asahi/g16/glue.c index 0160187a0dd2c..db0576a1e0fe0 100644 --- a/drivers/gpu/drm/asahi/g16/glue.c +++ b/drivers/gpu/drm/asahi/g16/glue.c @@ -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); diff --git a/drivers/gpu/drm/asahi/g16/job.rs b/drivers/gpu/drm/asahi/g16/job.rs index 9787907e68c0d..31f06c80ab8bf 100644 --- a/drivers/gpu/drm/asahi/g16/job.rs +++ b/drivers/gpu/drm/asahi/g16/job.rs @@ -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)?; diff --git a/drivers/gpu/drm/asahi/g16/mod.rs b/drivers/gpu/drm/asahi/g16/mod.rs index ef1e6f360db31..2c10fedd1e0be 100644 --- a/drivers/gpu/drm/asahi/g16/mod.rs +++ b/drivers/gpu/drm/asahi/g16/mod.rs @@ -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; @@ -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 { diff --git a/drivers/gpu/drm/asahi/g16/poll.rs b/drivers/gpu/drm/asahi/g16/poll.rs index 018c335a930b0..b94fb3a4cd36f 100644 --- a/drivers/gpu/drm/asahi/g16/poll.rs +++ b/drivers/gpu/drm/asahi/g16/poll.rs @@ -56,7 +56,7 @@ impl HrTimerCallback for Shared { } } -/// The `asahi-g16/stats` debugfs file contents. +/// The `aurora-g16/stats` debugfs file contents. fn stats_show(shared: &Arc, f: &mut fmt::Formatter<'_>) -> fmt::Result { let state = shared.state.lock(); match state.as_deref() { @@ -177,9 +177,9 @@ impl Shared { self.mod_poll(1); } - /// Starts what the engine needs besides the firmware state: the `asahi-g16/stats` file. + /// Starts what the engine needs besides the firmware state: the `aurora-g16/stats` file. pub(crate) fn start_engine(self: &Arc) -> Result { - let dir = debugfs::Dir::new(c_str!("asahi-g16")); + let dir = debugfs::Dir::new(c_str!("aurora-g16")); let file = KBox::pin_init( dir.read_callback_file(c_str!("stats"), self.clone(), &stats_show), GFP_KERNEL, @@ -834,7 +834,7 @@ impl Firmware { } } - /// The `asahi-g16/stats` contents. Scripts parse the keys: keep them stable. + /// The `aurora-g16/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; diff --git a/drivers/gpu/drm/asahi/g17/availability.rs b/drivers/gpu/drm/asahi/g17/availability.rs index 8014266f0b0ab..c76a20db7007a 100644 --- a/drivers/gpu/drm/asahi/g17/availability.rs +++ b/drivers/gpu/drm/asahi/g17/availability.rs @@ -40,7 +40,7 @@ impl Availability { State { generation: 0, waiters: None }, "g17::Availability" ), - fences: FenceContexts::new(1, c_str!("asahi_resource"), kernel::static_lock_class!())?, + fences: FenceContexts::new(1, c_str!("aurora_resource"), kernel::static_lock_class!())?, }), GFP_KERNEL, ) diff --git a/drivers/gpu/drm/asahi/g17/fence.rs b/drivers/gpu/drm/asahi/g17/fence.rs index 81d1d6fe43960..71107371640bd 100644 --- a/drivers/gpu/drm/asahi/g17/fence.rs +++ b/drivers/gpu/drm/asahi/g17/fence.rs @@ -32,7 +32,7 @@ fn signal_exported(fence: &dyn RawDmaFence) { #[vtable] impl FenceOps for CompletionFence { fn get_driver_name<'a>(self: &'a FenceObject) -> &'a CStr { - c_str!("asahi") + c_str!("aurora") } fn get_timeline_name<'a>(self: &'a FenceObject) -> &'a CStr { @@ -69,7 +69,7 @@ static EXPORT_OPS: AtomicUsize = AtomicUsize::new(0); #[vtable] impl FenceOps for ExportFence { fn get_driver_name<'a>(self: &'a FenceObject) -> &'a CStr { - c_str!("asahi") + c_str!("aurora") } fn get_timeline_name<'a>(self: &'a FenceObject) -> &'a CStr { c_str!("g17-aggregate") diff --git a/drivers/gpu/drm/asahi/g17/job.rs b/drivers/gpu/drm/asahi/g17/job.rs index ad9adcecf0f81..76cc8809358f6 100644 --- a/drivers/gpu/drm/asahi/g17/job.rs +++ b/drivers/gpu/drm/asahi/g17/job.rs @@ -418,8 +418,8 @@ impl Fences { impl Scheduler { pub(crate) fn new(dev: &AsahiDrmDevice, backend: Arc, engine: Engine) -> Result { let (credits, name) = match engine { - Engine::Render => (RENDER_CREDITS, c_str!("asahi_g17_render")), - Engine::Compute => (COMPUTE_CREDITS, c_str!("asahi_g17_compute")), + Engine::Render => (RENDER_CREDITS, c_str!("aurora_g17_render")), + Engine::Compute => (COMPUTE_CREDITS, c_str!("aurora_g17_compute")), }; let scheduler = sched::Scheduler::new(dev.as_ref().as_ref(), 1, credits, 0, TIMEOUT_MS, name)?; let entity = sched::Entity::new(&scheduler, sched::Priority::Kernel)?; diff --git a/drivers/gpu/drm/asahi/g17/mod.rs b/drivers/gpu/drm/asahi/g17/mod.rs index 2a0a9c0a63222..cc3b1297f0467 100644 --- a/drivers/gpu/drm/asahi/g17/mod.rs +++ b/drivers/gpu/drm/asahi/g17/mod.rs @@ -1256,7 +1256,7 @@ impl Gpu { GFP_KERNEL, )?; - let directory = kernel::debugfs::Dir::new(c"asahi-g17"); + let directory = kernel::debugfs::Dir::new(c"aurora-g17"); let capacity = KBox::pin_init( directory.read_only_file(c"capacity", capacity::View(shared.clone())), GFP_KERNEL, diff --git a/drivers/gpu/drm/asahi/g17/queue/mod.rs b/drivers/gpu/drm/asahi/g17/queue/mod.rs index e593c5879cf74..ab6b6a55f93e8 100644 --- a/drivers/gpu/drm/asahi/g17/queue/mod.rs +++ b/drivers/gpu/drm/asahi/g17/queue/mod.rs @@ -69,7 +69,7 @@ impl Frontend { return Err(EINVAL); } let window = UscWindow::new(usc_base, range.clone())?; - let fences = FenceContexts::new(1, c_str!("asahi_g17_queue"), FENCE_KEY)?; + let fences = FenceContexts::new(1, c_str!("aurora_g17_queue"), FENCE_KEY)?; let allocation_failure = super::fence::allocation_failure(&fences)?; Ok(Self { fences, diff --git a/drivers/gpu/drm/asahi/g17/sync_scope.c b/drivers/gpu/drm/asahi/g17/sync_scope.c index a3153f3122b94..73dc096d119c9 100644 --- a/drivers/gpu/drm/asahi/g17/sync_scope.c +++ b/drivers/gpu/drm/asahi/g17/sync_scope.c @@ -57,7 +57,7 @@ static struct asahi_g17_scope *to_scope(struct dma_fence *fence) static const char *scope_driver_name(struct dma_fence *fence) { - return "asahi"; + return "aurora"; } static const char *scope_timeline_name(struct dma_fence *fence) diff --git a/drivers/gpu/drm/asahi/memacct.rs b/drivers/gpu/drm/asahi/memacct.rs index b7c996d0c6f6e..12fc90b23d8eb 100644 --- a/drivers/gpu/drm/asahi/memacct.rs +++ b/drivers/gpu/drm/asahi/memacct.rs @@ -131,7 +131,7 @@ fn try_add_within(counter: &AtomicU64, bytes: u64, limit: u64, extra: u64) -> bo fn sub(counter: &AtomicU64, bytes: u64) { let prev = counter.fetch_sub(bytes, Ordering::AcqRel); if prev < bytes { - pr_warn!("asahi: GPU memory accounting underflow ({} < {})\n", prev, bytes); + pr_warn!("GPU memory accounting underflow ({} < {})\n", prev, bytes); counter.store(0, Ordering::Relaxed); } } @@ -162,7 +162,7 @@ impl Ledger { ); self.set_limits(limits); pr_info!( - "asahi: GPU memory limits: device {} MiB, per client {} MiB (0 = none)\n", + "GPU memory limits: device {} MiB, per client {} MiB (0 = none)\n", limits.device >> 20, limits.client >> 20 ); diff --git a/drivers/gpu/drm/asahi/mmu/residency.rs b/drivers/gpu/drm/asahi/mmu/residency.rs index 49c2241bc399f..1df852184b31d 100644 --- a/drivers/gpu/drm/asahi/mmu/residency.rs +++ b/drivers/gpu/drm/asahi/mmu/residency.rs @@ -266,7 +266,7 @@ impl VmShrinker { )?; // SAFETY: The format is static and has no format arguments. let raw = - unsafe { kernel::bindings::shrinker_alloc(0, c_str!("asahi-idle-vm").as_char_ptr()) }; + unsafe { kernel::bindings::shrinker_alloc(0, c_str!("aurora-idle-vm").as_char_ptr()) }; if raw.is_null() { return Err(ENOMEM); } diff --git a/drivers/gpu/drm/asahi/queue/mod.rs b/drivers/gpu/drm/asahi/queue/mod.rs index 93c4eb0351187..aa5dc1fba4723 100644 --- a/drivers/gpu/drm/asahi/queue/mod.rs +++ b/drivers/gpu/drm/asahi/queue/mod.rs @@ -194,7 +194,7 @@ impl JobFence::ver { #[vtable] impl dma_fence::FenceOps for JobFence::ver { fn get_driver_name<'a>(self: &'a FenceObject) -> &'a CStr { - c_str!("asahi") + c_str!("aurora") } fn get_timeline_name<'a>(self: &'a FenceObject) -> &'a CStr { c_str!("queue") @@ -468,7 +468,7 @@ impl Drop for QueueJob::ver { } } -static QUEUE_NAME: &CStr = c_str!("asahi_fence"); +static QUEUE_NAME: &CStr = c_str!("aurora_fence"); static QUEUE_CLASS_KEY: Pin<&LockClassKey> = kernel::static_lock_class!(); #[versions(AGX)] @@ -526,7 +526,7 @@ impl Queue::ver { WQ_SIZE, 0, 100000, - c_str!("asahi_sched"), + c_str!("aurora_sched"), )?; let entity = sched::Entity::new(&sched, sched::Priority::Kernel)?; diff --git a/drivers/gpu/drm/asahi/sysfs.c b/drivers/gpu/drm/asahi/sysfs.c index a704e3f1f7afd..7132e6de41c09 100644 --- a/drivers/gpu/drm/asahi/sysfs.c +++ b/drivers/gpu/drm/asahi/sysfs.c @@ -316,4 +316,4 @@ EXPORT_SYMBOL_GPL(asahi_sysfs_unregister); MODULE_AUTHOR("AGX driver maintainer"); MODULE_LICENSE("Dual MIT/GPL"); -MODULE_DESCRIPTION("Asahi AGX firmware stats sysfs shim"); +MODULE_DESCRIPTION("AGX firmware stats sysfs shim"); diff --git a/tools/asahi/g15-probe-init-tests.py b/tools/asahi/g15-probe-init-tests.py index 9d6ec7c0096eb..65cc9c0b69c9f 100644 --- a/tools/asahi/g15-probe-init-tests.py +++ b/tools/asahi/g15-probe-init-tests.py @@ -160,8 +160,8 @@ def item(text, marker): try_pin_init!(Self { stage: { let stage = match name.to_bytes() { - b"asahi-g15" => 1, - b"asahi-g16" => 3, + b"aurora-g15" => 1, + b"aurora-g16" => 3, _ => 2, }; // Model driver_attach and a late driver_add_groups failure. A deferred @@ -338,7 +338,7 @@ def main(): g16_registration = aliases + "\n" + item(core, "fn register_g16(") module_struct = item(core, "#[pin_data]\nstruct DriverModule") module_init = item(core, " fn init(module:") - module_code = module_struct + "\nimpl InPlaceModule for DriverModule {\n" + module_init + "\n}\nimpl ModuleMetadata for DriverModule { const NAME: &'static std::ffi::CStr = c\"asahi\"; }\n" + module_code = module_struct + "\nimpl InPlaceModule for DriverModule {\n" + module_init + "\n}\nimpl ModuleMetadata for DriverModule { const NAME: &'static std::ffi::CStr = c\"aurora\"; }\n" kbox = item(sources["rust/kernel/alloc/kbox.rs"], " fn try_pin_init(") assert "Box::<_, A>::new_uninit(flags)?.write_pin_init(init)" in kbox reprobe = item(sources["drivers/gpu/drm/asahi/g15/glue.c"], "void asahi_g15_reprobe(void)\n{") @@ -408,7 +408,7 @@ def main(): if name == "activation-before-g16-registration" and not enable_g16: continue # Macro definitions precede the fake registration, just as kernel prelude exports them. - source = macro + "\n" + PREFIX.replace("#![allow(dead_code, unused_variables)]\n", "").replace(" // SET_DRVDATA", set_data) + "\n" + ready + "\n" + driver + "\nimpl platform::Driver for Driver<'_> {\n type IdInfo = &'static Config;\n type Data<'bound> = Driver<'bound>;\n" + method + "\n}\nmod g15 { use super::*; pub type Driver<'a> = super::Driver<'a>; " + activate + "\n}\ntype G15Registration = driver::Registration>>;\n" + "mod g16 { pub struct Driver; pub const DRIVER_NAME: &std::ffi::CStr = c\"asahi-g16\"; }\n" + g16_registration + "\n" + module_variant + "\n" + SUFFIX.replace(" // CALLBACK", callback) + source = macro + "\n" + PREFIX.replace("#![allow(dead_code, unused_variables)]\n", "").replace(" // SET_DRVDATA", set_data) + "\n" + ready + "\n" + driver + "\nimpl platform::Driver for Driver<'_> {\n type IdInfo = &'static Config;\n type Data<'bound> = Driver<'bound>;\n" + method + "\n}\nmod g15 { use super::*; pub type Driver<'a> = super::Driver<'a>; " + activate + "\n}\ntype G15Registration = driver::Registration>>;\n" + "mod g16 { pub struct Driver; pub const DRIVER_NAME: &std::ffi::CStr = c\"aurora-g16\"; }\n" + g16_registration + "\n" + module_variant + "\n" + SUFFIX.replace(" // CALLBACK", callback) source = "#![allow(dead_code, unused_variables, private_bounds, private_interfaces)]\n" + source label = ("g16-" if enable_g16 else "") + name src = out / (label + ".rs"); src.write_text(source) diff --git a/tools/asahi/g17-capacity-watch.sh b/tools/asahi/g17-capacity-watch.sh index 5438413b2ec21..f3d203e506833 100644 --- a/tools/asahi/g17-capacity-watch.sh +++ b/tools/asahi/g17-capacity-watch.sh @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-2.0-only OR MIT # Run inside an already authorized test session. Does not mount debugfs. set -eu -capacity_file=${1:-/sys/kernel/debug/asahi-g17/capacity} +capacity_file=${1:-/sys/kernel/debug/aurora-g17/capacity} interval=${2:-5} case "$interval" in ''|*[!0-9]*|0) echo 'interval must be positive integer seconds' >&2; exit 2;; esac test -r "$capacity_file" diff --git a/tools/testing/selftests/drivers/gpu/asahi-m4/README b/tools/testing/selftests/drivers/gpu/asahi-m4/README index c88abd122428e..040a90a056ef6 100644 --- a/tools/testing/selftests/drivers/gpu/asahi-m4/README +++ b/tools/testing/selftests/drivers/gpu/asahi-m4/README @@ -64,7 +64,7 @@ paired native Mesa installation: make hardware MESA=/path/to/installed/mesa RENDER_NODE=/dev/dri/renderD128 ROUNDS=32 -This builds native-gl46.c, verifies asahi-g16 owns the render node, selects the +This builds native-gl46.c, verifies aurora-g16 (asahi-g16 on older kernels) owns the render node, selects the requested Mesa libraries, clears software/translation/API-version overrides, and runs native OpenGL 4.6 triangle readback, compute and geometry-feedback checks. Results include kernel/boot identity and Mesa/binary hashes. Ordinary diff --git a/tools/testing/selftests/drivers/gpu/asahi-m4/native-ioctl-regression.c b/tools/testing/selftests/drivers/gpu/asahi-m4/native-ioctl-regression.c index 5f19e9f6eef97..aa324b7976525 100644 --- a/tools/testing/selftests/drivers/gpu/asahi-m4/native-ioctl-regression.c +++ b/tools/testing/selftests/drivers/gpu/asahi-m4/native-ioctl-regression.c @@ -170,7 +170,10 @@ struct compute_stats { static int compute_stats(struct compute_stats *s) { - FILE *file = fopen("/sys/kernel/debug/asahi-g16/stats", "re"); + /* Kernels before the Aurora rename used "asahi-g16". */ + FILE *file = fopen("/sys/kernel/debug/aurora-g16/stats", "re"); + if (!file) + file = fopen("/sys/kernel/debug/asahi-g16/stats", "re"); char *line = NULL; size_t size = 0; bool compute = false, mixed = false, publications = false; @@ -410,7 +413,7 @@ static int identity(const char *release, const char *boot, const char *source, c if (n < 0) return -1; target[n] = 0; const char *owner = strrchr(target, '/'); - if (!owner || strcmp(owner + 1, "asahi-g16") || + if (!owner || (strcmp(owner + 1, "aurora-g16") && strcmp(owner + 1, "asahi-g16")) || access("/sys/module/gpu_m4_drm", F_OK) == 0 || access("/sys/module/apple_gpu_m4_power", F_OK) == 0) return -1; return 0; diff --git a/tools/testing/selftests/drivers/gpu/asahi-m4/run-hardware-tests.py b/tools/testing/selftests/drivers/gpu/asahi-m4/run-hardware-tests.py index b2f01f06cefc8..d9b09d5820a04 100644 --- a/tools/testing/selftests/drivers/gpu/asahi-m4/run-hardware-tests.py +++ b/tools/testing/selftests/drivers/gpu/asahi-m4/run-hardware-tests.py @@ -31,8 +31,8 @@ def main(): node = args.render_node.resolve(strict=True) device = (Path('/sys/class/drm') / node.name / 'device').resolve(strict=True) owners = [p / 'driver' for p in [device, *device.parents] if (p / 'driver').is_symlink()] - if not any(p.resolve().name == 'asahi-g16' for p in owners): - parser.error('Selected render node is not owned by the Rust asahi-g16 platform driver') + if not any(p.resolve().name in ('aurora-g16', 'asahi-g16') for p in owners): + parser.error('Selected render node is not owned by the Rust G16 platform driver (aurora-g16)') output = (args.output or Path(tempfile.mkdtemp(prefix='asahi-m4-hardware-'))).resolve() output.mkdir(parents=True, exist_ok=True) environment = os.environ.copy() diff --git a/tools/testing/selftests/drivers/gpu/asahi-m4/run-native-ioctl-regression.py b/tools/testing/selftests/drivers/gpu/asahi-m4/run-native-ioctl-regression.py index 06b71eb83a90c..0932dc9f13fe5 100644 --- a/tools/testing/selftests/drivers/gpu/asahi-m4/run-native-ioctl-regression.py +++ b/tools/testing/selftests/drivers/gpu/asahi-m4/run-native-ioctl-regression.py @@ -20,7 +20,11 @@ UNPATCHED = {'78d2519c82fca4c0403315e040d595628bc5a4d6', 'df583754ae2b3607af4155ba0442bc93077bdce8'} FAULT = re.compile(r'Kernel panic|BUG:|WARNING: CPU|SError|Oops:|Unable to handle kernel|' - r'\b(?:asahi|G16|GPU|PPL)\b.*(?:fault|fail(?:ed|ure)?|timeout|timed out|quarantin)', re.I) + r'\b(?:aurora|asahi|G16|GPU|PPL)\b.*(?:fault|fail(?:ed|ure)?|timeout|timed out|quarantin)', re.I) +# The G16 platform driver and its debugfs directory; kernels before the Aurora +# rename used the asahi-g16 name. +G16_DRIVERS = ('aurora-g16', 'asahi-g16') +G16_STATS = [Path('/sys/kernel/debug') / name / 'stats' for name in G16_DRIVERS] EXPECTED_REJECTION = re.compile(r'IOCTL: submit failed! \(submission ID: \d+ err: E2BIG\)\s*$') @@ -41,7 +45,8 @@ def self_test(): 'Kernel panic - not syncing: ' + expected, expected + ' GPU fault bank 0', expected.replace('err: E2BIG', 'err: EIO'), - 'asahi-g16: GPU fault bank 0; ' + expected] + 'asahi-g16: GPU fault bank 0; ' + expected, + 'aurora-g16: GPU fault bank 0; ' + expected] for line in harmless: assert not kernel_fault(line), 'False fault match: ' + line for line in failures: @@ -96,8 +101,9 @@ def preflight(args): if not stat.S_ISCHR(node.stat().st_mode): raise RuntimeError('Expected a DRM character device') device = Path('/sys/class/drm') / node.name / 'device' - if (device / 'driver').resolve(strict=True).name != 'asahi-g16': - raise RuntimeError('Rust asahi-g16 does not own the requested render node') + owner = (device / 'driver').resolve(strict=True).name + if owner not in G16_DRIVERS: + raise RuntimeError('The Rust G16 platform driver does not own the requested render node') if any((Path('/sys/module') / name).exists() for name in ['gpu_m4_drm', 'apple_gpu_m4_power']): raise RuntimeError('Legacy C GPU provider is loaded') active = root_json('/run/aurorasilicon/m4-asahi-rust.json') @@ -118,7 +124,7 @@ def preflight(args): raise RuntimeError('Qualification marker already exists; rollback supervisor may disarm') return {'boot_id': boot, 'source_commit': args.expected_source, 'kernel_release': os.uname().release, 'kernel_image_sha256': sha(image), 'asahi_module_sha256': sha(module), - 'source_state_sha256': sha(source_path), 'render_node': str(node), 'owner': 'asahi-g16', + 'source_state_sha256': sha(source_path), 'render_node': str(node), 'owner': owner, 'rollback_guard': guard, 'activation': active} @@ -149,7 +155,7 @@ def compile_helper(args, output): def snapshot(): - stats = Path('/sys/kernel/debug/asahi-g16/stats').read_text() + stats = next(p for p in G16_STATS if p.exists()).read_text() published = re.search(r'^publications: compute (\d+) render (\d+)\s*$', stats, re.M) if not published: raise RuntimeError('Missing actual firmware-producer publication counters; refuse live regression')