From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Alistair Popple" <apopple@nvidia.com>
Cc: <nova-gpu@lists.linux.dev>, "Danilo Krummrich" <dakr@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"David Airlie" <airlied@gmail.com>,
"Benno Lossin" <lossin@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"John Hubbard" <jhubbard@nvidia.com>,
<linux-kernel@vger.kernel.org>, <dri-devel@lists.freedesktop.org>,
<rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH v2 3/5] drm: nova: Add GETPARAM parameter to read the GPU chipset
Date: Thu, 09 Jul 2026 21:35:03 +0900 [thread overview]
Message-ID: <DJU1LZQLJ38P.2OHWQWKDYJ86J@nvidia.com> (raw)
In-Reply-To: <20260709085204.565159-4-apopple@nvidia.com>
On Thu Jul 9, 2026 at 5:52 PM JST, Alistair Popple wrote:
> One of the first things a user needs to know about a GPU is its chipset,
> so add an ioctl to return that.
We are not adding an ioctl though, just a GETPARAM parameter.
<...>
> diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
> index 43c3f4f8df71..1f4c5f3aa8ea 100644
> --- a/drivers/gpu/nova-core/gpu.rs
> +++ b/drivers/gpu/nova-core/gpu.rs
> @@ -10,7 +10,8 @@
> num::Bounded,
> pci,
> prelude::*,
> - sizes::SizeConstants, //
> + sizes::SizeConstants,
> + uapi, //
> };
>
> use crate::{
> @@ -34,12 +35,12 @@
> mod hal;
>
> macro_rules! define_chipset {
> - ({ $($variant:ident = $value:expr),* $(,)* }) =>
> + ({ $($variant:ident = $value:path),* $(,)* }) =>
> {
> /// Enum representation of the GPU chipset.
> #[derive(fmt::Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq)]
> - pub(crate) enum Chipset {
> - $($variant = $value),*,
> + pub enum Chipset {
> + $($variant = $value as isize),*,
> }
>
> impl Chipset {
> @@ -82,39 +83,39 @@ fn try_from(value: u32) -> Result<Self, Self::Error> {
>
> define_chipset!({
> // Turing
> - TU102 = 0x162,
> - TU104 = 0x164,
> - TU106 = 0x166,
> - TU117 = 0x167,
> - TU116 = 0x168,
> + TU102 = uapi::drm_nova_chipset_NOVA_DRM_CHIPSET_TU102,
> + TU104 = uapi::drm_nova_chipset_NOVA_DRM_CHIPSET_TU104,
> + TU106 = uapi::drm_nova_chipset_NOVA_DRM_CHIPSET_TU106,
> + TU117 = uapi::drm_nova_chipset_NOVA_DRM_CHIPSET_TU117,
> + TU116 = uapi::drm_nova_chipset_NOVA_DRM_CHIPSET_TU116,
If we are going to remove the actual values, let's at least generate the
right-hand side in the macro as it is just verbose without bringing any
new information. The following diff lets you remove the `= uapi::...`
for each chipset declaration.
The UAPI definitions come technically from nova-drm (and are defined as
such), which introduces a dependency of sorts from nova-core to
nova-drm. I'm not saying this is a problem, but mentioning it as we want
to make that decision consciously.
I also think the introduction of UAPI variants and modification of
`define_chipset` should be its own patch, as these are pretty
mechanical.
diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 202adfbfa176..5b67f25399de 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -35,12 +35,13 @@
mod hal;
macro_rules! define_chipset {
- ({ $($variant:ident = $value:path),* $(,)* }) =>
+ ({ $($variant:ident),* $(,)* }) =>
{
+ ::kernel::macros::paste!(
/// Enum representation of the GPU chipset.
#[derive(fmt::Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq)]
pub enum Chipset {
- $($variant = $value as isize),*,
+ $($variant = uapi::[<drm_nova_chipset_NOVA_DRM_CHIPSET_ $variant:upper>] as isize),*,
}
impl Chipset {
@@ -48,7 +49,6 @@ impl Chipset {
$( Chipset::$variant, )*
];
- ::kernel::macros::paste!(
/// Returns the name of this chipset, in lowercase.
///
/// # Examples
@@ -64,7 +64,6 @@ pub(crate) const fn name(&self) -> &'static str {
)*
}
}
- );
}
// TODO[FPRI]: replace with something like derive(FromPrimitive)
@@ -73,45 +72,49 @@ impl TryFrom<u32> for Chipset {
fn try_from(value: u32) -> Result<Self, Self::Error> {
match value {
- $( $value => Ok(Chipset::$variant), )*
+ $(
+ uapi::[<drm_nova_chipset_NOVA_DRM_CHIPSET_ $variant:upper>]
+ => Ok(Chipset::$variant),
+ )*
_ => Err(ENODEV),
}
}
}
+ );
}
}
next prev parent reply other threads:[~2026-07-09 12:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 8:51 [PATCH v2 0/5] gpu: nova: Export parameters from nova-core to nova-drm Alistair Popple
2026-07-09 8:52 ` [PATCH v2 1/5] gpu: nova-core: Add public driver API to nova-core Alistair Popple
2026-07-09 12:34 ` Alexandre Courbot
2026-07-09 8:52 ` [PATCH v2 2/5] gpu: nova: Add DRM registration data Alistair Popple
2026-07-09 12:34 ` Alexandre Courbot
2026-07-09 8:52 ` [PATCH v2 3/5] drm: nova: Add GETPARAM parameter to read the GPU chipset Alistair Popple
2026-07-09 12:35 ` Alexandre Courbot [this message]
2026-07-09 22:28 ` Danilo Krummrich
2026-07-09 8:52 ` [PATCH v2 4/5] drm: nova: Add a GETPARAM parameter to read usable VRAM size Alistair Popple
2026-07-09 8:52 ` [PATCH v2 5/5] drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter Alistair Popple
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=DJU1LZQLJ38P.2OHWQWKDYJ86J@nvidia.com \
--to=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
/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