[PATCH v9 04/31] gpu: nova-core: add Copy/Clone to Spec and Revision, add chipset() accessor

John Hubbard
2026-03-26T01:39:29Z

Derive Clone and Copy for Revision and Spec. Both are small
value types (4 bytes total) and Copy makes them easier to use
in later patches that pass them across function boundaries.

Add a Spec::chipset() accessor for use by later patches that
need the chipset outside of gpu.rs.

Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
drivers/gpu/nova-core/gpu.rs | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 0c68bca7bf65..685ae4c81268 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -183,6 +183,7 @@ fn from(value: Architecture) -> Self {
}
}

+#[derive(Clone, Copy)]
pub(crate) struct Revision {
major: u8,
minor: u8,
@@ -204,6 +205,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,
revision: Revision,
@@ -240,6 +242,12 @@ fn new(dev: &device::Device, bar: &Bar0) -> Result<Spec> {
dev_err!(dev, "Unsupported chipset: {}\n", boot42);
})
}
+
+ /// Returns this GPU's chipset.
+ #[expect(dead_code)]
+ pub(crate) fn chipset(self) -> Chipset {
+ self.chipset
+ }
}

impl TryFrom<regs::NV_PMC_BOOT_42> for Spec {
--
2.53.0