gpu: nova: add boot42 support for next-gen GPUs
Subsystems (4)
v7 cover gpu: nova: add boot42 support for next-gen GPUs
Changes in v7:
1) Added a TODO to eventually remove the Default trait from Architecture.
2) Further refined the logic and comments for reading boot0, then boot42.
Changes in v6:
1) Split out a separate patch for implementing Display for Spec.
2) Moved Spec implementation code to its proper location.
3) Significantly changed the use_boot42_instead() logic, and updated the comments accordingly.
4) Fixed the boot42 register and field values, which were wrong (and had not been exercised before).
5) Imported Revision, to save a few ::'s.
6) Rebased to the very latest drm-rust-next, which now includes the new "one 'use' item per line" updates.
Changes in v5:
Two fixes, both from Timur's review feedback (thanks!):
1) Updated both the cover letter, and patch 3 commit description, with the correct description of the future contents of NV_PMC_BOOT_0.
2) Removed a trailing "boot42" typo from a comment in the code.
Changes in v4:
1) Simplified and improved the decision logic: reads both arch_0 and arch_1 fields in boot0, and skips the unnecessary is_nv04() logic as well. Thanks to Timur Tabi and Danilo for noticing these issues.
2) Added a patch to represent Architecture as a u8. This simplifies a few things. (Thanks to Alex Courbot. I added your Suggested-by to that patch.)
3) Enhanced the Revision type to do more, which simplifies the callers. (Thanks to Danilo.)
Changes in v3:
1) Restored the Revision type as recommended by Danilo, but decoupled it from boot0.
2) Applied Alex Courbot's suggestion to use TryFrom<NV_PMC_BOOT_0/42> for Spec.
3) Reflowed the new comment documentation to 100 cols, to avoid wasting a few vertical lines.
Changes in v2:
1) Restored the Spec type, and used that to encapsulate the subsequent boot42 enhancements. Thanks to Danilo Krummrich's feedback for that improvement.
v1 cover letter (with typos fixed)
NVIDIA GPUs are moving away from using NV_PMC_BOOT_0 to contain architecture and revision details, and will instead use NV_PMC_BOOT_42 in the future. NV_PMC_BOOT_0 will contain a specific set of values that will mean "go read NV_PMC_BOOT_42 instead".
Change the selection logic in Nova so that it will claim Turing and later GPUs. This will work for the foreseeable future, without any further code changes here, because all NVIDIA GPUs are considered, from the oldest supported on Linux (NV04), through the future GPUs.
Add some comment documentation to explain, chronologically, how boot0 and boot42 change with the GPU eras, and how that affects the selection logic.
Also, remove the Revision type, because Revision is no longer valuable as a stand-alone type, because we only ever want the full information that Spec provides.
This is based on today's drm-rust-next, which in turn is based on Linux 6.18-rc2.
John Hubbard (4):
gpu: nova-core: implement Display for Spec
gpu: nova-core: prepare Spec and Revision types for boot0/boot42
gpu: nova-core: make Architecture behave as a u8 type
gpu: nova-core: add boot42 support for next-gen GPUs
drivers/gpu/nova-core/gpu.rs | 82 ++++++++++++++++++++++++++--------- drivers/gpu/nova-core/regs.rs | 33 +++++++++++--- 2 files changed, 87 insertions(+), 28 deletions(-)
base-commit: e54ad0cd3673c93cdafda58505eaa81610fe3aef
Signature · 1 line
2.51.2
PATCH v7 1/4 gpu: nova-core: implement Display for Spec
Implement Display for Spec. This simplifies the dev_info!() code for printing banners such as:
NVIDIA (Chipset: GA104, Architecture: Ampere, Revision: a.1)
--- drivers/gpu/nova-core/gpu.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/nova-core/gpu.rs +13 -7
@@ -180,6 +180,18 @@ fn new(bar: &Bar0) -> Result<Spec> { } } +impl fmt::Display for Spec { +fn fmt (&self, f: &mut fmt::Formatter <'_>) -> fmt::Result { +write! ( + f, +"Chipset: {}, Architecture: {:?}, Revision: {}" , + self.chipset, + self.chipset.arch (), + self.revision + ) + } +} +/// Structure holding the resources required to operate the GPU. #[pin_data] pub (crate )struct Gpu {
@@ -206,13 +218,7 @@ pub(crate) fn new<'a>( ) -> impl PinInit<Self, Error> + 'a {try_pin_init! (Self { spec:Spec ::new (bar).inspect (|spec| { -dev_info! ( - pdev.as_ref (), -"NVIDIA (Chipset: {}, Architecture: {:?}, Revision: {})\n" , - spec.chipset, - spec.chipset.arch (), - spec.revision - ); +dev_info! (pdev.as_ref (),"NVIDIA ({})\n" , spec); })?,// We must wait for GFW_BOOT completion before doing any significant setup on the GPU.
Signature · 1 line
2.51.2
PATCH v7 2/4 gpu: nova-core: prepare Spec and Revision types for boot0/boot42
In reply to John Hubbard1) Decouple Revision from boot0.
2) Enhance Revision, which in turn simplifies Spec::new().
3) Also, slightly enhance the comment about Spec, to be more precise.
--- drivers/gpu/nova-core/gpu.rs | 25 ++++++++++++------------- drivers/gpu/nova-core/regs.rs | 11 ++++++++++- 2 files changed, 22 insertions(+), 14 deletions(-)
drivers/gpu/nova-core/gpu.rs +12 -13
@@ -143,17 +143,8 @@ fn try_from(value: u8) -> Result<Self> { }pub (crate )struct Revision { - major:u8 , - minor:u8 , -} - -impl Revision { -fn from_boot0 (boot0: regs::NV_PMC_BOOT_0 ) ->Self { -Self { - major: boot0.major_revision (), - minor: boot0.minor_revision (), - } - } +pub (crate ) major:u8 , +pub (crate ) minor:u8 , }impl fmt::Display for Revision {
@@ -162,7 +153,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } } -/// Structure holding the metadata of the GPU. +/// Structure holding a basic description of the GPU: Architecture, Chipset and Revision. pub (crate )struct Spec { chipset:Chipset ,/// The revision of the chipset.
@@ -173,9 +164,17 @@ impl Spec {fn new (bar: &Bar0 ) ->Result <Spec > {let boot0 = regs::NV_PMC_BOOT_0 ::read (bar); +Spec ::try_from (boot0) + } +} + +impl TryFrom <regs::NV_PMC_BOOT_0 >for Spec { +type Error =Error ; + +fn try_from (boot0: regs::NV_PMC_BOOT_0 ) ->Result <Self > {Ok (Self { chipset: boot0.chipset ()?, - revision:Revision ::from_boot0 (boot0), + revision: boot0.revision (), }) } }
drivers/gpu/nova-core/regs.rs +10 -1
@@ -24,7 +24,8 @@ }, gpu::{ Architecture, - Chipset, // + Chipset, + Revision, // }, num::FromSafeCast, };
@@ -56,6 +57,14 @@ pub(crate) fn chipset(self) -> Result<Chipset> { }) .and_then (Chipset ::try_from) } + +/// Returns the revision information of the chip. +pub (crate )fn revision (self) ->Revision { +Revision { + major: self.major_revision (), + minor: self.minor_revision (), + } + } }// PBUS
Signature · 1 line
2.51.2
Re: [PATCH v7 2/4] gpu: nova-core: prepare Spec and Revision types for boot0/boot42
Quoted 40 lines · John Hubbard
1) Decouple Revision from boot0.
2) Enhance Revision, which in turn simplifies
Spec::new().3) Also, slightly enhance the comment about Spec, to be more precise.
Cc Alexandre Courbot <[email protected]>Cc Danilo Krummrich <[email protected]>Cc Timur Tabi <[email protected]>Signed-off-by John Hubbard <[email protected]>--- drivers/gpu/nova-core/gpu.rs | 25 ++++++++++++------------- drivers/gpu/nova-core/regs.rs | 11 ++++++++++- 2 files changed, 22 insertions(+), 14 deletions(-)drivers/gpu/nova-core/gpu.rs +2
-11@@ -143,17 +143,8 @@ fn try_from(value: u8) -> Result<Self> { }pub (crate )struct Revision { - major:u8 , - minor:u8 , -} - -impl Revision { -fn from_boot0 (boot0: regs::NV_PMC_BOOT_0 ) ->Self { -Self { - major: boot0.major_revision (), - minor: boot0.minor_revision (), - } - } +pub (crate ) major:u8 , +pub (crate ) minor:u8 , }impl fmt::Display for Revision {
drivers/gpu/nova-core/gpu.rs fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { · line 156
Quoted 5 lines
drivers/gpu/nova-core/gpu.rs +1
-1@@ -162,7 +153,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } } -/// Structure holding the metadata of the GPU. +/// Structure holding a basic description of the GPU: Architecture, Chipset and Revision.
nit: Can befixed on apply, but the types in the comment need backticks:Architecture, Chipset and Revision.
thanks,
- Joel
[...]
Re: [PATCH v7 2/4] gpu: nova-core: prepare Spec and Revision types for boot0/boot42
On 11/13/25 12:00 PM, Joel Fernandes wrote:
...
Quoted 6 lines
drivers/gpu/nova-core/gpu.rs fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { · line 156
Quoted 2 lines
drivers/gpu/nova-core/gpu.rs +1
-1-/// Structure holding the metadata of the GPU. +/// Structure holding a basic description of the GPU: Architecture, Chipset and Revision. nit: Can befixed on apply, but the types in the comment need backticks:
Architecture,ChipsetandRevision.
Will do.
thanks,
Signature · 1 line
John Hubbard
PATCH v7 3/4 gpu: nova-core: make Architecture behave as a u8 type
In reply to John HubbardThis allows Architecture to be passed into register!() and bitfield!() macro calls. That in turn requires a default implementation for Architecture.
This simplifies transforming BOOT0 (and later, BOOT42) register values into GPU architectures.
--- drivers/gpu/nova-core/gpu.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/nova-core/gpu.rs +14 -1
@@ -122,8 +122,14 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { }/// Enum representation of the GPU generation. -#[derive(fmt:: Debug )] +/// +/// TODO: remove the `Default` trait implementation, and the `#[default]` +/// attribute, once the register!() macro (which creates Architecture items) no +/// longer requires it for read-only fields. +#[derive(fmt:: Debug , Default , Copy , Clone )] +#[repr( u8 )] pub (crate )enum Architecture { +#[default] Turing =0x16 ,Ampere =0x17 ,Ada =0x19 ,
@@ -142,6 +148,13 @@ fn try_from(value: u8) -> Result<Self> { } } +impl From <Architecture >for u8 { +fn from (value:Architecture ) ->Self { +// CAST: `Architecture` is `repr(u8)`, so this cast is always lossless. + valueas u8 + } +} +pub (crate )struct Revision {pub (crate ) major:u8 ,pub (crate ) minor:u8 ,
Signature · 1 line
2.51.2
PATCH v7 4/4 gpu: nova-core: add boot42 support for next-gen GPUs
In reply to John HubbardNVIDIA GPUs are moving away from using NV_PMC_BOOT_0 to contain architecture and revision details, and will instead use NV_PMC_BOOT_42 in the future. NV_PMC_BOOT_0 will contain a specific set of values that will mean "go read NV_PMC_BOOT_42 instead".
Change the selection logic in Nova so that it will claim Turing and later GPUs. This will work for the foreseeable future, without any further code changes here, because all NVIDIA GPUs are considered, from the oldest supported on Linux (NV04), through the future GPUs.
Add some comment documentation to explain, chronologically, how boot0 and boot42 change with the GPU eras, and how that affects the selection logic.
--- drivers/gpu/nova-core/gpu.rs | 32 +++++++++++++++++++++++++++----- drivers/gpu/nova-core/regs.rs | 22 ++++++++++++++++------ 2 files changed, 43 insertions(+), 11 deletions(-)
drivers/gpu/nova-core/gpu.rs +27 -5
@@ -175,19 +175,41 @@ pub(crate) struct Spec {impl Spec {fn new (bar: &Bar0 ) ->Result <Spec > { +// Some brief notes about boot0 and boot42, in chronological order: +// +// NV04 through NV50: +// +// Not supported by Nova. boot0 is necessary and sufficient to identify these GPUs. +// boot42 may not even exist on some of these GPUs. +// +// Fermi through Volta: +// +// Not supported by Nova. boot0 is still sufficient to identify these GPUs, but boot42 +// is also guaranteed to be both present and accurate. +// +// Turing and later: +// +// Supported by Nova. Identified by first checking boot0 to ensure that the GPU is not +// from an earlier (pre-Fermi) era, and then using boot42 to precisely identify the GPU. +// Somewhere in the Rubin timeframe, boot0 will no longer have space to add new GPU IDs. +let boot0 = regs::NV_PMC_BOOT_0 ::read (bar); -Spec ::try_from (boot0) +if boot0.is_older_than_fermi () { +return Err (ENOTSUPP ); + } + +Spec ::try_from (regs::NV_PMC_BOOT_42 ::read (bar)) } } -impl TryFrom <regs::NV_PMC_BOOT_0 >for Spec { +impl TryFrom <regs::NV_PMC_BOOT_42 >for Spec {type Error =Error ; -fn try_from (boot0: regs::NV_PMC_BOOT_0 ) ->Result <Self > { +fn try_from (boot42: regs::NV_PMC_BOOT_42 ) ->Result <Self > {Ok (Self { - chipset: boot0.chipset ()?, - revision: boot0.revision (), + chipset: boot42.chipset ()?, + revision: boot42.revision (), }) } }
drivers/gpu/nova-core/regs.rs +16 -6
@@ -41,14 +41,24 @@ });impl NV_PMC_BOOT_0 { -/// 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 ()), - ) +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 :u8 =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 } +} + +register! (NV_PMC_BOOT_42 @0x00000a00 ,"Extended architecture information" { +15 :12 minor_revisionas u8 ,"Minor revision of the chip" ; +19 :16 major_revisionas u8 ,"Major revision of the chip" ; +23 :20 implementationas u8 ,"Implementation version of the architecture" ; +29 :24 architectureas u8 ?=>Architecture ,"Architecture value" ; +}); -/// Combines `architecture` and `implementation` to obtain a code unique to the chipset. +impl NV_PMC_BOOT_42 {pub (crate )fn chipset (self) ->Result <Chipset > { self.architecture () .map (|arch| {
Signature · 1 line
2.51.2
Alexandre Courbot
maintainerRe: [PATCH v7 4/4] gpu: nova-core: add boot42 support for next-gen GPUs
Quoted 10 lines · John Hubbard
NVIDIA GPUs are moving away from using
NV_PMC_BOOT_0to contain architecture and revision details, and will instead useNV_PMC_BOOT_42in the future.NV_PMC_BOOT_0will contain a specific set of values that will mean "go readNV_PMC_BOOT_42instead".Change the selection logic in Nova so that it will claim Turing and later GPUs. This will work for the foreseeable future, without any further code changes here, because all NVIDIA GPUs are considered, from the oldest supported on Linux (NV04), through the future GPUs.
Quoted 8 lines
Add some comment documentation to explain, chronologically, how boot0 and boot42 change with the GPU eras, and how that affects the selection logic.
Cc Alexandre Courbot <[email protected]>Cc Danilo Krummrich <[email protected]>Cc Timur Tabi <[email protected]>Signed-off-by John Hubbard <[email protected]>
Love it, it's super simple now. :)
<snip>
Quoted 10 lines
drivers/gpu/nova-core/regs.rs +0
-2@@ -41,14 +41,24 @@ });impl NV_PMC_BOOT_0 { -/// Combines `architecture_0` and `architecture_1` to obtain the architecture of the chip. -pub (crate )fn architecture (self) ->Result <Architecture > {
drivers/gpu/nova-core/regs.rs line 50
Quoted 10 lines
drivers/gpu/nova-core/regs.rs +7
-3-Architecture ::try_from ( - self.architecture_0 () | (self.architecture_1 () <<Self ::ARCHITECTURE_0_RANGE .len ()), - ) +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 :u8 =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
We could also keep architecture (making it private) and just test for self.architecture < NV_PMC_BOOT_0_ARCHITECTURE_GF100. John, I can do that when applying the series if you think that makes sense.
Considering that the series has been extensively reviewed during the previous iterations, I think we can safely apply it for 6.19, so will proceed once I have an answer.
Re: [PATCH v7 4/4] gpu: nova-core: add boot42 support for next-gen GPUs
Quoted 1 line · Alexandre Courbot
On Wed Nov 12, 2025 at 1:30 PM JST, John Hubbard wrote:
...
Quoted 14 lines
drivers/gpu/nova-core/regs.rs line 50
Quoted 13 lines
impl NV_PMC_BOOT_0 {drivers/gpu/nova-core/regs.rs +7
-5-/// 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 ()), - ) +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 :u8 =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
Quoted 3 lines
We could also keep
architecture(making it private) and just test forself.architecture < NV_PMC_BOOT_0_ARCHITECTURE_GF100. John, I can do that when applying the series if you think that makes sense.
Yes, I think that's a good change to make, sounds good to me.
Quoted 4 lines
Considering that the series has been extensively reviewed during the previous iterations, I think we can safely apply it for 6.19, so will proceed once I have an answer.
Great!
thanks,
Signature · 1 line
John Hubbard
Re: [PATCH v7 4/4] gpu: nova-core: add boot42 support for next-gen GPUs
In reply to Alexandre CourbotQuoted 1 line · Alexandre Courbot
On Wed Nov 12, 2025 at 1:30 PM JST, John Hubbard wrote:
...
Quoted 14 lines
drivers/gpu/nova-core/regs.rs line 50
Quoted 13 lines
impl
NV_PMC_BOOT_0{drivers/gpu/nova-core/regs.rs +7
-5-/// 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 ()), - ) +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 :u8 =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
Quoted 7 lines
We could also keep
architecture(making it private) and just test forself.architecture < NV_PMC_BOOT_0_ARCHITECTURE_GF100. John, I can do that when applying the series if you think that makes sense.Considering that the series has been extensively reviewed during the previous iterations, I think we can safely apply it for 6.19, so will proceed once I have an answer.
Hi Alex,
It turns out that this doesn't work well, because architecture() returns an Architecture, not a u8, and then we have to map it back and the whole things looks a lot worse: complexity on the screen that serves no purpose.
After looking at several approaches, I've come full circle back to what this patch has.
thanks,
Signature · 1 line
John Hubbard
Alexandre Courbot
maintainerRe: [PATCH v7 4/4] gpu: nova-core: add boot42 support for next-gen GPUs
Quoted 27 lines · John Hubbard
Quoted 1 line · Alexandre Courbot
On Wed Nov 12, 2025 at 1:30 PM JST, John Hubbard wrote:
...
Quoted 14 lines
drivers/gpu/nova-core/regs.rs line 50
Quoted 13 lines
impl
NV_PMC_BOOT_0{drivers/gpu/nova-core/regs.rs +7
-5-/// 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 ()), - ) +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 :u8 =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 Quoted 7 lines
We could also keep
architecture(making it private) and just test forself.architecture < NV_PMC_BOOT_0_ARCHITECTURE_GF100. John, I can do that when applying the series if you think that makes sense.Considering that the series has been extensively reviewed during the previous iterations, I think we can safely apply it for 6.19, so will proceed once I have an answer.
Hi Alex,
Quoted 7 lines
It turns out that this doesn't work well, because
architecture()returns an Architecture, not a u8, and then we have to map it back and the whole things looks a lot worse: complexity on the screen that serves no purpose.After looking at several approaches, I've come full circle back to what this patch has.
Ah right, we would need to add Fermi to Architecture, which would now include some architecture we don't support...
In the light of this I agree your original approach makes the most sense - thanks for checking it out!
Re: [PATCH v7 4/4] gpu: nova-core: add boot42 support for next-gen GPUs
In reply to John HubbardHi John,
Quoted 9 lines · John Hubbard
NVIDIA GPUs are moving away from using
NV_PMC_BOOT_0to contain architecture and revision details, and will instead useNV_PMC_BOOT_42in the future.NV_PMC_BOOT_0will contain a specific set of values that will mean "go readNV_PMC_BOOT_42instead".Change the selection logic in Nova so that it will claim Turing and later GPUs. This will work for the foreseeable future, without any further code changes here, because all NVIDIA GPUs are considered, from the oldest supported on Linux (NV04), through the future GPUs.
[...]
Quoted 24 lines
drivers/gpu/nova-core/gpu.rs +16
-0@@ -175,19 +175,41 @@ pub(crate) struct Spec {impl Spec {fn new (bar: &Bar0 ) ->Result <Spec > { +// Some brief notes about boot0 and boot42, in chronological order: +// +// NV04 through NV50: +// +// Not supported by Nova. boot0 is necessary and sufficient to identify these GPUs. +// boot42 may not even exist on some of these GPUs. +// +// Fermi through Volta: +// +// Not supported by Nova. boot0 is still sufficient to identify these GPUs, but boot42 +// is also guaranteed to be both present and accurate. +// +// Turing and later: +// +// Supported by Nova. Identified by first checking boot0 to ensure that the GPU is not +// from an earlier (pre-Fermi) era, and then using boot42 to precisely identify the GPU.
drivers/gpu/nova-core/gpu.rs pub(crate) struct Spec { · line 202
Quoted 10 lines
drivers/gpu/nova-core/gpu.rs +7
-1+// Somewhere in the Rubin timeframe, boot0 will no longer have space to add new GPU IDs. +let boot0 = regs::NV_PMC_BOOT_0 ::read (bar); -Spec ::try_from (boot0) +if boot0.is_older_than_fermi () { +return Err (ENOTSUPP ); + } + +Spec ::try_from (regs::NV_PMC_BOOT_42 ::read (bar))
There is an inconsistency in error return here, if NV04 through NV50, it returns -ENOTSUPP. For Fermi through Volta, it will read boot42 but will return -ENODEV because Spec::try_from() -> boot42.chipset() with return -ENODEV. I am Ok with either error return, but it would be good to make it consistent.
There also does not seem to be a diagnostic if the chipset is not supported. It would be good diagnostic that the chipset did not match, right now it will return -ENODEV, which could mean the device does not exist. -ENOTSUPP is better though but an actual dmesg error message would be nice.
With these,
Thanks.
Re: [PATCH v7 4/4] gpu: nova-core: add boot42 support for next-gen GPUs
Quoted 2 lines · Joel Fernandes
Hi John,
...
Quoted 7 lines
drivers/gpu/nova-core/gpu.rs pub(crate) struct Spec { · line 202
Quoted 6 lines
drivers/gpu/nova-core/gpu.rs +5
-1-Spec ::try_from (boot0) +if boot0.is_older_than_fermi () { +return Err (ENOTSUPP ); + } + +Spec ::try_from (regs::NV_PMC_BOOT_42 ::read (bar))
Quoted 5 lines
There is an inconsistency in error return here, if NV04 through NV50, it returns
-ENOTSUPP. For Fermi through Volta, it will read boot42 but will return-ENODEVbecauseSpec::try_from()->boot42.chipset()with return-ENODEV. I am Ok with either error return, but it would be good to make it consistent.
Yes, good catch. It should be -ENOTSUPP for sure.
Quoted 4 lines
There also does not seem to be a diagnostic if the chipset is not supported. It would be good diagnostic that the chipset did not match, right now it will return
-ENODEV, which could mean the device does not exist.-ENOTSUPPis better though but an actual dmesg error message would be nice.
Yes. The "not supported" case would happen in two situations:
a) Someone found a pre-Fermi GPU to use for (probably) display, and they also have a Turing+ GPU in the same system (!), and they have both Nouveau and Nova drivers available.
Here, it's not really an error situation. If this actually works, then Nova not supporting the older GPU is just expected operation.
But these older GPUs are not even really directly supported, so this is a fringe case anyway.
b) A newer GPU is installed, and Nova does not yet support it. Here, an error message is OK, because Nova is eventually (soon) going to support that GPU.
So I think that means an error message is reasonable here.
Quoted 5 lines
With these,
Reviewed-by Joel Fernandes <[email protected]>
Thanks for the review!
Alex, I think I'd better re-spin and re-test, in order to safely collect the various small fixes from you and Joel. I can do that today.
thanks,
Signature · 1 line
John Hubbard
Alexandre Courbot
maintainerRe: [PATCH v7 4/4] gpu: nova-core: add boot42 support for next-gen GPUs
Quoted 45 lines · John Hubbard
Quoted 2 lines · Joel Fernandes
Hi John,
...
Quoted 7 lines
drivers/gpu/nova-core/gpu.rs pub(crate) struct Spec { · line 202
Quoted 6 lines
drivers/gpu/nova-core/gpu.rs +5
-1-Spec ::try_from (boot0) +if boot0.is_older_than_fermi () { +return Err (ENOTSUPP ); + } + +Spec ::try_from (regs::NV_PMC_BOOT_42 ::read (bar))Quoted 5 lines
There is an inconsistency in error return here, if NV04 through NV50, it returns
-ENOTSUPP. For Fermi through Volta, it will read boot42 but will return-ENODEVbecauseSpec::try_from()->boot42.chipset()with return-ENODEV. I am Ok with either error return, but it would be good to make it consistent.Yes, good catch. It should be
-ENOTSUPPfor sure.Quoted 4 lines
There also does not seem to be a diagnostic if the chipset is not supported. It would be good diagnostic that the chipset did not match, right now it will return
-ENODEV, which could mean the device does not exist.-ENOTSUPPis better though but an actual dmesg error message would be nice.Yes. The "not supported" case would happen in two situations:
a) Someone found a pre-Fermi GPU to use for (probably) display, and they also have a Turing+ GPU in the same system (!), and they have both Nouveau and Nova drivers available.
Here, it's not really an error situation. If this actually works, then Nova not supporting the older GPU is just expected operation.
But these older GPUs are not even really directly supported, so this is a fringe case anyway.
b) A newer GPU is installed, and Nova does not yet support it. Here, an error message is OK, because Nova is eventually (soon) going to support that GPU.
So I think that means an error message is reasonable here.
Quoted 3 lines
With these,
Quoted 7 lines
Quoted 2 lines
Reviewed-by Joel Fernandes <[email protected]>Thanks for the review!
Alex, I think I'd better re-spin and re-test, in order to safely collect the various small fixes from you and Joel. I can do that today.
Agreed, that will limit the risk of me not capturing everything properly. Thanks!
Quoted 4 lines · John Hubbard
Changes in v7:
1) Added a TODO to eventually remove the Default trait from Architecture.
2) Further refined the logic and comments for reading boot0, then boot42.
Other than the few nits I left, looks really good. Thanks!
For all,
- Joel