* [PATCH v2] gpu: nova-core: fix aux device registration for multi-GPU systems
@ 2026-02-05 22:17 John Hubbard
2026-02-06 1:16 ` Gary Guo
2026-02-13 0:09 ` Alexandre Courbot
0 siblings, 2 replies; 3+ messages in thread
From: John Hubbard @ 2026-02-05 22:17 UTC (permalink / raw)
To: Danilo Krummrich, Alexandre Courbot
Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
Zhi Wang, David Airlie, Simona Vetter, Bjorn Helgaas,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, nouveau, rust-for-linux, LKML, John Hubbard
The auxiliary device registration was using a hardcoded ID of 0, which
caused probe() to fail on multi-GPU systems with:
sysfs: cannot create duplicate filename '/bus/auxiliary/devices/NovaCore.nova-drm.0'
Fix this by using an LKMM atomic counter to generate unique IDs for each
GPU's aux device registration. The TODO item to eventually use XArray
for recycling aux device IDs is retained (and modified slightly: IDA
might be better) but for now, this works very nicely.
This has the side effect of making debugfs[1] work on multi-GPU systems.
[1] https://lore.kernel.org/20260203224757.871729-1-ttabi@nvidia.com
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Gary Guo <gary@garyguo.net>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
drivers/gpu/nova-core/driver.rs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
Changes in v2:
* Use LKMM atomics (kernel::sync::atomic::Atomic<u32>) instead of Rust
standard library atomics (core::sync::atomic::AtomicU32).
* Fix vertical import formatting (add rustfmt guard comment).
* Remove stray "we" from TODO comment.
diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
index 5a4cc047bcfc..eec8871aa6a5 100644
--- a/drivers/gpu/nova-core/driver.rs
+++ b/drivers/gpu/nova-core/driver.rs
@@ -14,11 +14,18 @@
},
prelude::*,
sizes::SZ_16M,
+ sync::atomic::{
+ Atomic,
+ Relaxed, //
+ },
sync::Arc, //
};
use crate::gpu::Gpu;
+/// Counter for generating unique auxiliary device IDs.
+static AUXILIARY_ID_COUNTER: Atomic<u32> = Atomic::new(0);
+
#[pin_data]
pub(crate) struct NovaCore {
#[pin]
@@ -85,12 +92,17 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, E
GFP_KERNEL,
)?;
+ // TODO[XARR]: Use XArray or perhaps IDA for proper ID allocation/recycling. For now,
+ // use a simple atomic counter that never recycles IDs. A unique ID is required for
+ // multi-GPU systems; without it, probe() fails for all but the first GPU.
+ let aux_id = AUXILIARY_ID_COUNTER.fetch_add(1, Relaxed);
+
Ok(try_pin_init!(Self {
gpu <- Gpu::new(pdev, bar.clone(), bar.access(pdev.as_ref())?),
_reg <- auxiliary::Registration::new(
pdev.as_ref(),
c"nova-drm",
- 0, // TODO[XARR]: Once it lands, use XArray; for now we don't use the ID.
+ aux_id,
crate::MODULE_NAME
),
}))
base-commit: 9845cf73f7db6094c0d8419d6adb848028f4a921
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] gpu: nova-core: fix aux device registration for multi-GPU systems
2026-02-05 22:17 [PATCH v2] gpu: nova-core: fix aux device registration for multi-GPU systems John Hubbard
@ 2026-02-06 1:16 ` Gary Guo
2026-02-13 0:09 ` Alexandre Courbot
1 sibling, 0 replies; 3+ messages in thread
From: Gary Guo @ 2026-02-06 1:16 UTC (permalink / raw)
To: John Hubbard, Danilo Krummrich, Alexandre Courbot
Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
Zhi Wang, David Airlie, Simona Vetter, Bjorn Helgaas,
Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, nouveau, rust-for-linux, LKML
On Thu Feb 5, 2026 at 10:17 PM GMT, John Hubbard wrote:
> The auxiliary device registration was using a hardcoded ID of 0, which
> caused probe() to fail on multi-GPU systems with:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/NovaCore.nova-drm.0'
>
> Fix this by using an LKMM atomic counter to generate unique IDs for each
> GPU's aux device registration. The TODO item to eventually use XArray
> for recycling aux device IDs is retained (and modified slightly: IDA
> might be better) but for now, this works very nicely.
>
> This has the side effect of making debugfs[1] work on multi-GPU systems.
>
> [1] https://lore.kernel.org/20260203224757.871729-1-ttabi@nvidia.com
>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Gary Guo <gary@garyguo.net>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> drivers/gpu/nova-core/driver.rs | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> Changes in v2:
>
> * Use LKMM atomics (kernel::sync::atomic::Atomic<u32>) instead of Rust
> standard library atomics (core::sync::atomic::AtomicU32).
>
> * Fix vertical import formatting (add rustfmt guard comment).
>
> * Remove stray "we" from TODO comment.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] gpu: nova-core: fix aux device registration for multi-GPU systems
2026-02-05 22:17 [PATCH v2] gpu: nova-core: fix aux device registration for multi-GPU systems John Hubbard
2026-02-06 1:16 ` Gary Guo
@ 2026-02-13 0:09 ` Alexandre Courbot
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Courbot @ 2026-02-13 0:09 UTC (permalink / raw)
To: John Hubbard
Cc: Danilo Krummrich, Joel Fernandes, Alistair Popple, Eliot Courtney,
Zhi Wang, Simona Vetter, Bjorn Helgaas, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, nouveau,
rust-for-linux, LKML
On Fri Feb 6, 2026 at 7:17 AM JST, John Hubbard wrote:
> The auxiliary device registration was using a hardcoded ID of 0, which
> caused probe() to fail on multi-GPU systems with:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/NovaCore.nova-drm.0'
>
> Fix this by using an LKMM atomic counter to generate unique IDs for each
> GPU's aux device registration. The TODO item to eventually use XArray
> for recycling aux device IDs is retained (and modified slightly: IDA
> might be better) but for now, this works very nicely.
>
> This has the side effect of making debugfs[1] work on multi-GPU systems.
>
> [1] https://lore.kernel.org/20260203224757.871729-1-ttabi@nvidia.com
>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Gary Guo <gary@garyguo.net>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Queued for merging into `drm-rust-next` when it repoens - thanks for the
fix!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-13 0:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-05 22:17 [PATCH v2] gpu: nova-core: fix aux device registration for multi-GPU systems John Hubbard
2026-02-06 1:16 ` Gary Guo
2026-02-13 0:09 ` Alexandre Courbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox