[PATCH 5/6] gpu: nova-core: regs.rs: clean up chipset(), architecture()

John Hubbard posted 6 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH 5/6] gpu: nova-core: regs.rs: clean up chipset(), architecture()
Posted by John Hubbard 1 month, 1 week ago
In preparation for an upcoming commit that uses the GPU's reported
architecture, rather than deducing it from chipset().

This means that the architecture() method is no longer used, so
delete it.

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

diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
index 15145426f8a1..fcb319806391 100644
--- a/drivers/gpu/nova-core/regs.rs
+++ b/drivers/gpu/nova-core/regs.rs
@@ -33,21 +33,16 @@ pub(crate) fn use_boot42_instead(self) -> bool {
         self.architecture_0() == 0 && self.architecture_1() == 1
     }
 
-    /// Combines `architecture_0` and `architecture_1` to obtain the architecture of the chip.
-    pub(crate) fn architecture(self) -> Result<Architecture> {
-        Architecture::try_from(
-            self.architecture_0() | (self.architecture_1() << Self::ARCHITECTURE_0_RANGE.len()),
-        )
-    }
-
-    /// Combines `architecture` and `implementation` to obtain a code unique to the chipset.
+    /// "chipset" is a unique identifier for the GPU. Examples: GA100, GA102, GA103, GA104, GB202.
     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)
+        let arch_bits =
+            self.architecture_0() | (self.architecture_1() << Self::ARCHITECTURE_0_RANGE.len());
+
+        // Combine with implementation to form chipset value
+        let chipset_value =
+            (arch_bits as u32) << Self::IMPLEMENTATION_RANGE.len() | self.implementation() as u32;
+
+        Chipset::try_from(chipset_value)
     }
 
     /// Returns the revision information of the chip.
@@ -58,7 +53,6 @@ pub(crate) fn revision(self) -> crate::gpu::Revision {
         }
     }
 }
-
 register!(NV_PMC_BOOT_42 @ 0x00000108, "Extended architecture information" {
     7:0     implementation as u8, "Implementation version of the architecture";
     15:8    architecture as u8 ?=> Architecture, "Architecture value";
-- 
2.51.2
Re: [PATCH 5/6] gpu: nova-core: regs.rs: clean up chipset(), architecture()
Posted by Timur Tabi 1 month, 1 week ago
On Wed, 2025-11-05 at 19:54 -0800, John Hubbard wrote:
>  }
> -
>  register!(NV_PMC_BOOT_42 @ 0x00000108, "Extended architecture information" {

Did you intend to delete this blank line?
Re: [PATCH 5/6] gpu: nova-core: regs.rs: clean up chipset(), architecture()
Posted by John Hubbard 1 month, 1 week ago
On 11/6/25 6:39 AM, Timur Tabi wrote:
> On Wed, 2025-11-05 at 19:54 -0800, John Hubbard wrote:
>>   }
>> -
>>   register!(NV_PMC_BOOT_42 @ 0x00000108, "Extended architecture information" {
> 
> Did you intend to delete this blank line?

Nope. :)


thanks,
John Hubbard