gpu: nova-core: register auxiliary device for nova-drm
authorDanilo Krummrich <dakr@kernel.org>
Thu, 24 Apr 2025 16:02:49 +0000 (18:02 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Mon, 12 May 2025 18:47:43 +0000 (20:47 +0200)
Register an auxiliary device for nova-drm.

For now always use zero for the auxiliary device's ID; we don't use it
yet anyways. However, once it lands, we should switch to XArray.

Acked-by: Dave Airlie <airlied@redhat.com>
Link: https://lore.kernel.org/r/20250424160452.8070-2-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/gpu/nova-core/Kconfig
drivers/gpu/nova-core/driver.rs
drivers/gpu/nova-core/nova_core.rs

index ad0c067565166db9cf5ff4f7b065fe8e63342451..67f99b6a023a5706bc809de18f9142938d1d0cd8 100644 (file)
@@ -1,5 +1,6 @@
 config NOVA_CORE
        tristate "Nova Core GPU driver"
+       depends on AUXILIARY_BUS
        depends on PCI
        depends on RUST
        depends on RUST_FW_LOADER_ABSTRACTIONS
index a08fb6599267a960f0e07b6efd0e3b6cdc296aa4..8c86101c26cb5fe5eb9a3d03268338c6b58baef7 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 
-use kernel::{bindings, c_str, device::Core, pci, prelude::*};
+use kernel::{auxiliary, bindings, c_str, device::Core, pci, prelude::*};
 
 use crate::gpu::Gpu;
 
@@ -8,6 +8,7 @@ use crate::gpu::Gpu;
 pub(crate) struct NovaCore {
     #[pin]
     pub(crate) gpu: Gpu,
+    _reg: auxiliary::Registration,
 }
 
 const BAR0_SIZE: usize = 8;
@@ -38,6 +39,12 @@ impl pci::Driver for NovaCore {
         let this = KBox::pin_init(
             try_pin_init!(Self {
                 gpu <- Gpu::new(pdev, bar)?,
+                _reg: auxiliary::Registration::new(
+                    pdev.as_ref(),
+                    c_str!("nova-drm"),
+                    0, // TODO: Once it lands, use XArray; for now we don't use the ID.
+                    crate::MODULE_NAME
+                )?,
             }),
             GFP_KERNEL,
         )?;
index a91cd924054b49966937a8db6aab9cd0614f10de..618632f0abcc8f5ef6945a04fc084acc4ecbf20b 100644 (file)
@@ -8,6 +8,8 @@ mod gpu;
 mod regs;
 mod util;
 
+pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;
+
 kernel::module_pci_driver! {
     type: driver::NovaCore,
     name: "NovaCore",