* [PATCH] gpu: nova-core: Extract PMC registers definitions
@ 2026-08-03 22:34 Antonin Malzieu Ridolfi via B4 Relay
2026-08-17 15:15 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Antonin Malzieu Ridolfi via B4 Relay @ 2026-08-03 22:34 UTC (permalink / raw)
To: Danilo Krummrich, Alexandre Courbot, Alice Ryhl, David Airlie,
Simona Vetter
Cc: linux-kernel, nova-gpu, dri-devel, Antonin Malzieu Ridolfi
From: Antonin Malzieu Ridolfi <dev@nanonej.com>
Move PMC register definitions (NV_PMC_BOOT_0, NV_PMC_BOOT_42) and
their associated implementations from the root regs.rs file into the
gpu module that own them, in the new gpu/regs.rs file.
This follows the same pattern established by previous commits for
GSP, PDISP, PFB, and PBUS registers: register definitions move to
the module that owns them, visibility changes to pub(super), and
cross-module access is provided via pub(crate) helper functions.
Since falcon.rs (outside the gpu module) also reads NV_PMC_BOOT_0 for
its raw value, a pub(crate) helper function boot_0_raw() is added in
gpu.rs to provide that access without exposing the register type
directly.
Signed-off-by: Antonin Malzieu Ridolfi <dev@nanonej.com>
---
Move PMC register definitions (NV_PMC_BOOT_0, NV_PMC_BOOT_42) and
their associated implementations from the root regs.rs file into the
gpu module that own them, in the new gpu/regs.rs file.
This follows the same pattern established by previous commits for
GSP, PDISP, PFB, and PBUS registers: register definitions move to
the module that owns them, visibility changes to pub(super), and
cross-module access is provided via pub(crate) helper functions.
Since falcon.rs (outside the gpu module) also reads NV_PMC_BOOT_0 for
its raw value, a pub(crate) helper function boot_0_raw() is added in
gpu.rs to provide that access without exposing the register type
directly.
---
| 2 +-
| 7 +++-
| 82 +++++++++++++++++++++++++++++++++++++++
| 75 -----------------------------------
4 files changed, 89 insertions(+), 77 deletions(-)
--git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
index a91cbdd5d636..5bc03cc0d33f 100644
--- a/drivers/gpu/nova-core/falcon.rs
+++ b/drivers/gpu/nova-core/falcon.rs
@@ -394,7 +394,7 @@ pub(crate) fn reset(&self) -> Result {
self.bar.write(
WithBase::of::<E>(),
- regs::NV_PFALCON_FALCON_RM::from(self.bar.read(regs::NV_PMC_BOOT_0).into_raw()),
+ regs::NV_PFALCON_FALCON_RM::from(crate::gpu::boot_0_raw(self.bar)),
);
Ok(())
--git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
index 42a4cd7971fa..9e4232645a7e 100644
--- a/drivers/gpu/nova-core/gpu.rs
+++ b/drivers/gpu/nova-core/gpu.rs
@@ -29,11 +29,11 @@
Gsp,
GspBootContext, //
},
- regs,
vgpu::VgpuManager, //
};
mod hal;
+mod regs;
macro_rules! define_chipset {
({ $($variant:ident = $value:expr),* $(,)* }) =>
@@ -414,3 +414,8 @@ pub(crate) fn new(
})
}
}
+
+/// Reads the boot0 register and returns its raw value.
+pub(crate) fn boot_0_raw(bar: Bar0<'_>) -> u32 {
+ bar.read(regs::NV_PMC_BOOT_0).into_raw()
+}
--git a/drivers/gpu/nova-core/gpu/regs.rs b/drivers/gpu/nova-core/gpu/regs.rs
new file mode 100644
index 000000000000..1c4db9625250
--- /dev/null
+++ b/drivers/gpu/nova-core/gpu/regs.rs
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0
+
+use kernel::{
+ io::register,
+ prelude::*, //
+};
+
+use super::{
+ Architecture,
+ Chipset, //
+};
+
+// PMC
+
+register! {
+ /// Basic revision information about the GPU.
+ pub(super) NV_PMC_BOOT_0(u32) @ 0x00000000 {
+ /// Lower bits of the architecture.
+ 28:24 architecture_0;
+ /// Implementation version of the architecture.
+ 23:20 implementation;
+ /// MSB of the architecture.
+ 8:8 architecture_1;
+ /// Major revision of the chip.
+ 7:4 major_revision;
+ /// Minor revision of the chip.
+ 3:0 minor_revision;
+ }
+
+ /// Extended architecture information.
+ pub(super) NV_PMC_BOOT_42(u32) @ 0x00000a00 {
+ /// Architecture value.
+ 29:24 architecture ?=> Architecture;
+ /// Implementation version of the architecture.
+ 23:20 implementation;
+ /// Major revision of the chip.
+ 19:16 major_revision;
+ /// Minor revision of the chip.
+ 15:12 minor_revision;
+ }
+}
+
+impl NV_PMC_BOOT_0 {
+ pub(super) fn is_older_than_fermi(self) -> bool {
+ // From https://github.com/NVIDIA/open-gpu-doc/tree/master/manuals :
+ const NV_PMC_BOOT_0_ARCHITECTURE_GF100: u32 = 0xc;
+
+ // Older chips left arch1 zeroed out. That, combined with an arch0 value that is less than
+ // GF100, means "older than Fermi".
+ self.architecture_1() == 0 && self.architecture_0() < NV_PMC_BOOT_0_ARCHITECTURE_GF100
+ }
+}
+
+impl NV_PMC_BOOT_42 {
+ /// Combines `architecture` and `implementation` to obtain a code unique to the chipset.
+ pub(super) fn chipset(self) -> Result<Chipset> {
+ self.architecture()
+ .map(|arch| {
+ ((arch as u32) << Self::IMPLEMENTATION_RANGE.len())
+ | u32::from(self.implementation())
+ })
+ .and_then(Chipset::try_from)
+ }
+
+ /// Returns the raw architecture value from the register.
+ fn architecture_raw(self) -> u8 {
+ ((self.into_raw() >> Self::ARCHITECTURE_RANGE.start())
+ & ((1 << Self::ARCHITECTURE_RANGE.len()) - 1)) as u8
+ }
+}
+
+impl kernel::fmt::Display for NV_PMC_BOOT_42 {
+ fn fmt(&self, f: &mut kernel::fmt::Formatter<'_>) -> kernel::fmt::Result {
+ write!(
+ f,
+ "boot42 = 0x{:08x} (architecture 0x{:x}, implementation 0x{:x})",
+ self.inner,
+ self.architecture_raw(),
+ self.implementation()
+ )
+ }
+}
--git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
index caeef4d85874..7ebb62e504b4 100644
--- a/drivers/gpu/nova-core/regs.rs
+++ b/drivers/gpu/nova-core/regs.rs
@@ -28,83 +28,8 @@
PFalconBase,
PeregrineCoreSelect, //
},
- gpu::{
- Architecture,
- Chipset, //
- },
};
-// PMC
-
-register! {
- /// Basic revision information about the GPU.
- pub(crate) NV_PMC_BOOT_0(u32) @ 0x00000000 {
- /// Lower bits of the architecture.
- 28:24 architecture_0;
- /// Implementation version of the architecture.
- 23:20 implementation;
- /// MSB of the architecture.
- 8:8 architecture_1;
- /// Major revision of the chip.
- 7:4 major_revision;
- /// Minor revision of the chip.
- 3:0 minor_revision;
- }
-
- /// Extended architecture information.
- pub(crate) NV_PMC_BOOT_42(u32) @ 0x00000a00 {
- /// Architecture value.
- 29:24 architecture ?=> Architecture;
- /// Implementation version of the architecture.
- 23:20 implementation;
- /// Major revision of the chip.
- 19:16 major_revision;
- /// Minor revision of the chip.
- 15:12 minor_revision;
- }
-}
-
-impl NV_PMC_BOOT_0 {
- pub(crate) fn is_older_than_fermi(self) -> bool {
- // From https://github.com/NVIDIA/open-gpu-doc/tree/master/manuals :
- const NV_PMC_BOOT_0_ARCHITECTURE_GF100: u32 = 0xc;
-
- // Older chips left arch1 zeroed out. That, combined with an arch0 value that is less than
- // GF100, means "older than Fermi".
- self.architecture_1() == 0 && self.architecture_0() < NV_PMC_BOOT_0_ARCHITECTURE_GF100
- }
-}
-
-impl NV_PMC_BOOT_42 {
- /// Combines `architecture` and `implementation` to obtain a code unique to the chipset.
- pub(crate) fn chipset(self) -> Result<Chipset> {
- self.architecture()
- .map(|arch| {
- ((arch as u32) << Self::IMPLEMENTATION_RANGE.len())
- | u32::from(self.implementation())
- })
- .and_then(Chipset::try_from)
- }
-
- /// Returns the raw architecture value from the register.
- fn architecture_raw(self) -> u8 {
- ((self.into_raw() >> Self::ARCHITECTURE_RANGE.start())
- & ((1 << Self::ARCHITECTURE_RANGE.len()) - 1)) as u8
- }
-}
-
-impl kernel::fmt::Display for NV_PMC_BOOT_42 {
- fn fmt(&self, f: &mut kernel::fmt::Formatter<'_>) -> kernel::fmt::Result {
- write!(
- f,
- "boot42 = 0x{:08x} (architecture 0x{:x}, implementation 0x{:x})",
- self.inner,
- self.architecture_raw(),
- self.implementation()
- )
- }
-}
-
// PBUS
register! {
---
base-commit: 44e7e7f7cffb10a93bb88e7cb59b7b8b3e2deb1c
change-id: 20260804-b4-extract-pmc-registers-to-gpu-mod-793ee2078a23
Best regards,
--
Antonin Malzieu Ridolfi <dev@nanonej.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpu: nova-core: Extract PMC registers definitions
2026-08-03 22:34 [PATCH] gpu: nova-core: Extract PMC registers definitions Antonin Malzieu Ridolfi via B4 Relay
@ 2026-08-17 15:15 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-08-17 15:15 UTC (permalink / raw)
To: Antonin Malzieu Ridolfi via B4 Relay, Danilo Krummrich,
Alexandre Courbot, Alice Ryhl, David Airlie, Simona Vetter
Cc: llvm, oe-kbuild-all, linux-kernel, nova-gpu, dri-devel,
Antonin Malzieu Ridolfi
Hi Antonin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 44e7e7f7cffb10a93bb88e7cb59b7b8b3e2deb1c]
url: https://github.com/intel-lab-lkp/linux/commits/Antonin-Malzieu-Ridolfi-via-B4-Relay/gpu-nova-core-Extract-PMC-registers-definitions/20260814-143445
base: 44e7e7f7cffb10a93bb88e7cb59b7b8b3e2deb1c
patch link: https://lore.kernel.org/r/20260804-b4-extract-pmc-registers-to-gpu-mod-v1-1-86c0895b6072%40nanonej.com
patch subject: [PATCH] gpu: nova-core: Extract PMC registers definitions
config: arm64-randconfig-003-20260817 (https://download.01.org/0day-ci/archive/20260817/202608172357.txha23v7-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
rustc: rustc 1.96.0 (ac68faa20 2026-05-25)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260817/202608172357.txha23v7-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608172357.txha23v7-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> warning: unused import: `prelude::*`
--> drivers/gpu/nova-core/regs.rs:10:5
|
10 | prelude::*,
| ^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-17 15:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 22:34 [PATCH] gpu: nova-core: Extract PMC registers definitions Antonin Malzieu Ridolfi via B4 Relay
2026-08-17 15:15 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox