Skip to contentSkip to conversation

gpu: nova-core: Move PFB and PBUS register

PATCH Applied Antonin Malzieu Ridolfi 2 participants 5 messages Jul 27 – Jul 30

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover gpu: nova-core: Move PFB and PBUS register

Split part of the registers definitions grouped in nova root register file to belonging modules whom actually use them.
Add WPR2 range query function to fb module.

To: Danilo Krummrich <[email protected]>
To: Alexandre Courbot <[email protected]>
To: Alice Ryhl <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
Antonin Malzieu Ridolfi (3):
gpu: nova-core: Add function to query WPR2 range
gpu: nova-core: Move PFB registers definitions
gpu: nova-core: Move one PBUS register definition

 drivers/gpu/nova-core/fb.rs            |  14 ++++
 drivers/gpu/nova-core/fb/hal/ga100.rs  |   8 +-
 drivers/gpu/nova-core/fb/hal/gb100.rs  |   6 +-
 drivers/gpu/nova-core/fb/hal/gb202.rs  |   6 +-
 drivers/gpu/nova-core/fb/hal/gh100.rs  |   6 +-
 drivers/gpu/nova-core/fb/hal/tu102.rs  |   8 +-
 drivers/gpu/nova-core/fb/regs.rs       | 132 ++++++++++++++++++++++++++++++++-
 drivers/gpu/nova-core/gsp/hal/tu102.rs |  56 +++++++-------
 drivers/gpu/nova-core/gsp/regs.rs      |  11 +++
 drivers/gpu/nova-core/regs.rs          | 132 ---------------------------------
 10 files changed, 203 insertions(+), 176 deletions(-)

---
base-commit: 6dcbb4b1320fa91fee349462a52bb69135f2e45e
change-id: 20260721-nova-core-regs-split-d73383a155ed

Best regards,

Signature · 1 line
Antonin Malzieu Ridolfi <[email protected]>
#1 lore raw

PATCH v2 1/3 gpu: nova-core: Add function to query WPR2 range

Create new function abstracting WPR2 region range query. Refactor gsp hal tu102 to query the WPR2 region range using this new function.

---
 drivers/gpu/nova-core/fb.rs            | 14 +++++++++
 drivers/gpu/nova-core/gsp/hal/tu102.rs | 54 +++++++++++++++-------------------
 2 files changed, 38 insertions(+), 30 deletions(-)
drivers/gpu/nova-core/fb.rs +14 -0
index 365db7abf7db..8934efc5f436 100644
@@ -289,3 +289,17 @@ pub(crate) fn new(
         })
     }
 }
+
+/// Reads the WPR2 memory region registers and returns the range if set.
+/// Returns `None` if the WPR2 region is not set.
+pub(crate) fn wpr2_range(bar: Bar0<'_>) -> Option<Range<u64>> {
+    let wpr2_hi = bar.read(crate::regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI);
+
+    if !wpr2_hi.is_wpr2_set() {
+        return None;
+    }
+
+    let wpr2_lo = bar.read(crate::regs::NV_PFB_PRI_MMU_WPR2_ADDR_LO);
+
+    Some(wpr2_lo.lower_bound()..wpr2_hi.higher_bound())
+}
drivers/gpu/nova-core/gsp/hal/tu102.rs +24 -30

89 lines not on this page · raw message

Signature · 1 line
2.55.0
#2 lore raw

PATCH v2 2/3 gpu: nova-core: Move PFB registers definitions

In reply to Antonin Malzieu Ridolfi

Move PFB registers definitions into fb module and update registers visibility.

---
 drivers/gpu/nova-core/fb.rs           |   4 +-
 drivers/gpu/nova-core/fb/hal/ga100.rs |   8 ++-
 drivers/gpu/nova-core/fb/hal/gb100.rs |   6 +-
 drivers/gpu/nova-core/fb/hal/gb202.rs |   6 +-
 drivers/gpu/nova-core/fb/hal/gh100.rs |   6 +-
 drivers/gpu/nova-core/fb/hal/tu102.rs |   8 ++-
 drivers/gpu/nova-core/fb/regs.rs      | 132 +++++++++++++++++++++++++++++++++-
 drivers/gpu/nova-core/regs.rs         | 127 --------------------------------
 8 files changed, 155 insertions(+), 142 deletions(-)
drivers/gpu/nova-core/fb.rs +2 -2
index 8934efc5f436..9e475efb1150 100644
@@ -293,13 +293,13 @@ pub(crate) fn new(
 /// Reads the WPR2 memory region registers and returns the range if set.
 /// Returns `None` if the WPR2 region is not set.
 pub(crate) fn wpr2_range(bar: Bar0<'_>) -> Option<Range<u64>> {
-    let wpr2_hi = bar.read(crate::regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI);
+    let wpr2_hi = bar.read(regs::NV_PFB_PRI_MMU_WPR2_ADDR_HI);
 
     if !wpr2_hi.is_wpr2_set() {
         return None;
     }
 
-    let wpr2_lo = bar.read(crate::regs::NV_PFB_PRI_MMU_WPR2_ADDR_LO);
+    let wpr2_lo = bar.read(regs::NV_PFB_PRI_MMU_WPR2_ADDR_LO);
 
     Some(wpr2_lo.lower_bound()..wpr2_hi.higher_bound())
 }
drivers/gpu/nova-core/fb/hal/ga100.rs +5 -3
index 3cc1caf361c7..d13c9a826eef 100644
@@ -9,8 +9,10 @@
 
 use crate::{
     driver::Bar0,
-    fb::hal::FbHal,
-    regs, //
+    fb::{
+        hal::FbHal,
+        regs, //
+    },
 };
 
 use super::tu102::FLUSH_SYSMEM_ADDR_SHIFT;
@@ -41,7 +43,7 @@ pub(super) fn write_sysmem_flush_page_ga100(bar: Bar0<'_>, addr: u64) {
 }
 
 pub(super) fn display_enabled_ga100(bar: Bar0<'_>) -> bool {
-    !bar.read(regs::ga100::NV_FUSE_STATUS_OPT_DISPLAY)
+    !bar.read(crate::regs::ga100::NV_FUSE_STATUS_OPT_DISPLAY)
         .display_disabled()
 }
 
drivers/gpu/nova-core/fb/hal/gb100.rs +4 -2
index 6e0eba101ca1..ec55ec3fc7e1 100644
@@ -22,9 +22,11 @@
 
 use crate::{
     driver::Bar0,
-    fb::hal::FbHal,
+    fb::{
+        hal::FbHal,
+        regs, //
+    },
     num::usize_into_u32,
-    regs, //
 };
 
 struct Gb100;
drivers/gpu/nova-core/fb/hal/gb202.rs +4 -2
index b78e0970f66d..69ba35d2ea08 100644
@@ -12,8 +12,10 @@
 
 use crate::{
     driver::Bar0,
-    fb::hal::FbHal,
-    regs, //
+    fb::{
+        hal::FbHal,
+        regs, //
+    },
 };
 
 struct Gb202;
drivers/gpu/nova-core/fb/hal/gh100.rs +4 -2
index d39fe99537ed..2867ae058d0a 100644
@@ -10,8 +10,10 @@
 
 use crate::{
     driver::Bar0,
-    fb::hal::FbHal,
-    regs, //
+    fb::{
+        hal::FbHal,
+        regs, //
+    },
 };
 
 struct Gh100;
drivers/gpu/nova-core/fb/hal/tu102.rs +5 -3
index f629e8e9d5d5..541f163b52d3 100644
@@ -9,8 +9,10 @@
 
 use crate::{
     driver::Bar0,
-    fb::hal::FbHal,
-    regs, //
+    fb::{
+        hal::FbHal,
+        regs, //
+    },
 };
 
 /// Shift applied to the sysmem address before it is written into `NV_PFB_NISO_FLUSH_SYSMEM_ADDR`,
@@ -31,7 +33,7 @@ pub(super) fn write_sysmem_flush_page_gm107(bar: Bar0<'_>, addr: u64) -> Result
 }
 
 pub(super) fn display_enabled_gm107(bar: Bar0<'_>) -> bool {
-    !bar.read(regs::gm107::NV_FUSE_STATUS_OPT_DISPLAY)
+    !bar.read(crate::regs::gm107::NV_FUSE_STATUS_OPT_DISPLAY)
         .display_disabled()
 }
 
drivers/gpu/nova-core/fb/regs.rs +131 -1

140 lines not on this page · raw message

drivers/gpu/nova-core/regs.rs +0 -127

133 lines not on this page · raw message

Signature · 1 line
2.55.0
#3 lore raw

PATCH v2 3/3 gpu: nova-core: Move one PBUS register definition

In reply to Antonin Malzieu Ridolfi

Move NV_PBUS_SW_SCRATCH_0E_FRTS_ERR register definition into gsp module and update registers visibility.

---
 drivers/gpu/nova-core/gsp/hal/tu102.rs |  2 +-
 drivers/gpu/nova-core/gsp/regs.rs      | 11 +++++++++++
 drivers/gpu/nova-core/regs.rs          |  5 -----
 3 files changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/nova-core/gsp/hal/tu102.rs +1 -1
index 03861add8e20..03133f723faf 100644
@@ -40,12 +40,12 @@
             GspHal,
             UnloadBundle, //
         },
+        regs,
         sequencer::GspSequencer,
         Gsp,
         GspBootContext,
         GspFwWprMeta, //
     },
-    regs,
     vbios::Vbios, //
 };
 
drivers/gpu/nova-core/gsp/regs.rs +11 -0
index a76dea3c3ab0..9a48aa87e7fb 100644
@@ -2,6 +2,8 @@
 
 use kernel::io::register;
 
+use crate::regs::NV_PBUS_SW_SCRATCH;
+
 // PGSP
 
 register! {
@@ -9,3 +11,12 @@
         31:0    address;
     }
 }
+
+// PBUS
+
+register! {
+    /// Scratch register 0xe used as FRTS firmware error code.
+    pub(super) NV_PBUS_SW_SCRATCH_0E_FRTS_ERR(u32) => NV_PBUS_SW_SCRATCH[0xe] {
+        31:16   frts_err_code;
+    }
+}
drivers/gpu/nova-core/regs.rs +0 -5
index d58dc6dd0f04..caeef4d85874 100644
@@ -109,11 +109,6 @@ fn fmt(&self, f: &mut kernel::fmt::Formatter<'_>) -> kernel::fmt::Result {
 
 register! {
     pub(crate) NV_PBUS_SW_SCRATCH(u32)[64] @ 0x00001400 {}
-
-    /// Scratch register 0xe used as FRTS firmware error code.
-    pub(crate) NV_PBUS_SW_SCRATCH_0E_FRTS_ERR(u32) => NV_PBUS_SW_SCRATCH[0xe] {
-        31:16   frts_err_code;
-    }
 }
 
 // PGC6 register space.
Signature · 1 line
2.55.0
maintainer Applied
#4 lore raw
In reply to Antonin Malzieu Ridolfi
Quoted 14 lines · On Tue Jul 28, 2026 at 12:51 AM JST, Antonin Malzieu Ridolfi via B4 Relay wrote:

Split part of the registers definitions grouped in nova root register file to belonging modules whom actually use them.
Add WPR2 range query function to fb module.

To: Danilo Krummrich <[email protected]>
To: Alexandre Courbot <[email protected]>
To: Alice Ryhl <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

Quoted 3 lines

Pushed to drm-rust-next, thank you!