From: Alexandre Courbot <acourbot@nvidia.com>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Nicolas Schier" <nsc@kernel.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>
Cc: John Hubbard <jhubbard@nvidia.com>,
Alistair Popple <apopple@nvidia.com>,
Joel Fernandes <joelagnelf@nvidia.com>,
Timur Tabi <ttabi@nvidia.com>, Zhi Wang <zhiw@nvidia.com>,
Eliot Courtney <ecourtney@nvidia.com>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, nova-gpu@lists.linux.dev,
dri-devel@lists.freedesktop.org,
Alexandre Courbot <acourbot@nvidia.com>
Subject: [PATCH POC 7/7] drm: nova: demonstrate interaction with nova-core
Date: Thu, 30 Apr 2026 23:55:10 +0900 [thread overview]
Message-ID: <20260430-nova-exports-v1-7-7ca31664e983@nvidia.com> (raw)
In-Reply-To: <20260430-nova-exports-v1-0-7ca31664e983@nvidia.com>
Export a few items from nova-core and use them from nova-drm in order to
print the chipset of the GPU being probed.
Some documentation items are added to make Clippy happy.
This is only meant for demonstration purposes, and won't be merged.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drivers/gpu/drm/nova/driver.rs | 6 ++++++
drivers/gpu/nova-core/driver.rs | 20 ++++++++++++++++++--
drivers/gpu/nova-core/gpu.rs | 9 ++++++---
drivers/gpu/nova-core/nova_core.rs | 4 ++--
4 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/nova/driver.rs b/drivers/gpu/drm/nova/driver.rs
index b1af0a099551..e18e9fccc067 100644
--- a/drivers/gpu/drm/nova/driver.rs
+++ b/drivers/gpu/drm/nova/driver.rs
@@ -15,6 +15,8 @@
use crate::file::File;
use crate::gem::NovaObject;
+use nova_core::driver::NovaCore;
+
pub(crate) struct NovaDriver {
#[expect(unused)]
drm: ARef<drm::Device<Self>>,
@@ -54,6 +56,10 @@ impl auxiliary::Driver for NovaDriver {
const ID_TABLE: auxiliary::IdTable<Self::IdInfo> = &AUX_TABLE;
fn probe(adev: &auxiliary::Device<Core>, _info: &Self::IdInfo) -> impl PinInit<Self, Error> {
+ let chipset = NovaCore::chipset(adev)?;
+
+ pr_info!("Chipset from nova-core: {}\n", chipset);
+
let data = try_pin_init!(NovaData { adev: adev.into() });
let drm = drm::Device::<Self>::new(adev.as_ref(), data)?;
diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
index 84b0e1703150..985f65e13bd5 100644
--- a/drivers/gpu/nova-core/driver.rs
+++ b/drivers/gpu/nova-core/driver.rs
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
+//! Main driver module.
+
use kernel::{
auxiliary,
device::Core,
@@ -23,13 +25,17 @@
},
};
-use crate::gpu::Gpu;
+use crate::gpu::{
+ self,
+ Gpu, //
+};
/// Counter for generating unique auxiliary device IDs.
static AUXILIARY_ID_COUNTER: Atomic<u32> = Atomic::new(0);
+/// Driver-associated data.
#[pin_data]
-pub(crate) struct NovaCore {
+pub struct NovaCore {
#[pin]
pub(crate) gpu: Gpu,
#[pin]
@@ -112,3 +118,13 @@ fn unbind(pdev: &pci::Device<Core>, this: Pin<&Self>) {
this.gpu.unbind(pdev.as_ref());
}
}
+
+impl NovaCore {
+ /// Returns the chipset of this GPU.
+ pub fn chipset(adev: &auxiliary::Device<Core>) -> Result<gpu::Chipset> {
+ let dev = adev.parent();
+ let drvdata = dev.drvdata::<Self>()?;
+
+ Ok(drvdata.gpu.spec.chipset)
+ }
+}
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 659f6a24ee13..75190ca0693b 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
+//! Declares some core driver types.
+
use kernel::{
device,
devres::Devres,
@@ -31,7 +33,8 @@ macro_rules! define_chipset {
{
/// Enum representation of the GPU chipset.
#[derive(fmt::Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq)]
- pub(crate) enum Chipset {
+ #[allow(missing_docs)]
+ pub enum Chipset {
$($variant = $value),*,
}
@@ -185,7 +188,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// Structure holding a basic description of the GPU: `Chipset` and `Revision`.
#[derive(Clone, Copy)]
pub(crate) struct Spec {
- chipset: Chipset,
+ pub(crate) chipset: Chipset,
revision: Revision,
}
@@ -247,7 +250,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// Structure holding the resources required to operate the GPU.
#[pin_data]
pub(crate) struct Gpu {
- spec: Spec,
+ pub(crate) spec: Spec,
/// MMIO mapping of PCI BAR 0
bar: Arc<Devres<Bar0>>,
/// System memory page required for flushing all pending GPU-side memory writes done through
diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova-core/nova_core.rs
index 3a609f6937e4..ccb98c73457b 100644
--- a/drivers/gpu/nova-core/nova_core.rs
+++ b/drivers/gpu/nova-core/nova_core.rs
@@ -13,11 +13,11 @@
#[macro_use]
mod bitfield;
-mod driver;
+pub mod driver;
mod falcon;
mod fb;
mod firmware;
-mod gpu;
+pub mod gpu;
mod gsp;
#[macro_use]
mod num;
--
2.54.0
prev parent reply other threads:[~2026-04-30 14:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 14:55 [PATCH 0/7] gpu: drm: nova: enable calling into nova-core Alexandre Courbot
2026-04-30 14:55 ` [PATCH 1/7] scripts: modpost: detect and report truncated buf_printf() output Alexandre Courbot
2026-04-30 14:55 ` [PATCH 2/7] scripts: modpost: increase buf_printf's buffer size Alexandre Courbot
2026-05-01 13:02 ` Gary Guo
2026-05-01 15:31 ` Miguel Ojeda
2026-04-30 14:55 ` [PATCH 3/7] gpu: nova-core: rename module from nova_core to nova-core Alexandre Courbot
2026-04-30 15:07 ` Joel Fernandes
2026-05-01 3:25 ` Alexandre Courbot
2026-05-01 10:38 ` John Hubbard
2026-05-01 12:31 ` Danilo Krummrich
2026-04-30 14:55 ` [PATCH 4/7] gpu: nova-core: export Rust symbols for dependent modules Alexandre Courbot
2026-04-30 15:22 ` Joel Fernandes
2026-05-01 3:30 ` Alexandre Courbot
2026-05-01 10:24 ` Miguel Ojeda
2026-04-30 14:55 ` [PATCH 5/7] gpu: nova-core: emit Rust metadata " Alexandre Courbot
2026-04-30 14:55 ` [PATCH 6/7] gpu: drm: nova: build after nova-core metadata Alexandre Courbot
2026-04-30 14:55 ` Alexandre Courbot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260430-nova-exports-v1-7-7ca31664e983@nvidia.com \
--to=acourbot@nvidia.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=joelagnelf@nvidia.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nathan@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=nsc@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
--cc=ttabi@nvidia.com \
--cc=zhiw@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox