rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Edwin Peer" <epeer@nvidia.com>, "Zhi Wang" <zhiw@nvidia.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	nouveau@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v9 4/4] gpu: nova-core: provide a clear error report for unsupported GPUs
Date: Fri, 14 Nov 2025 17:12:36 -0800	[thread overview]
Message-ID: <a467f1e6-4e18-479e-a165-68a5b5ea5db8@nvidia.com> (raw)
In-Reply-To: <20251115010923.1192144-5-jhubbard@nvidia.com>

On 11/14/25 5:09 PM, John Hubbard wrote:
> Pass in a PCI device to Spec::new(), and provide a Display
> implementation for boot42, in order to provide a clear, concise report
> of what happened: the driver read NV_PMC_BOOT42, and found that the GPU
> is not supported.
> 
> For very old GPUs (older than Fermi), the driver still returns ENOTSUPP,

ENODEV, actually, now.


thanks,
-- 
John Hubbard

> but it does so without a driver-specific dmesg report. That is exactly
> appropriate, because if such a GPU is installed, it can only be
> supported by Nouveau. And if so, the user is not helped by additional
> error messages from Nova.
> 
> Here's the full dmesg output for a Blackwell (not yet supported) GPU:
> 
> NovaCore 0000:01:00.0: Probe Nova Core GPU driver.
> NovaCore 0000:01:00.0: Unsupported chipset: boot42 = 0x1b2a1000 (architecture 0x1b, implementation 0x2)
> NovaCore 0000:01:00.0: probe with driver NovaCore failed with error -524
> 
> Cc: Alexandre Courbot <acourbot@nvidia.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Timur Tabi <ttabi@nvidia.com>
> Cc: Joel Fernandes <joelagnelf@nvidia.com>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
>  drivers/gpu/nova-core/gpu.rs  |  9 ++++++---
>  drivers/gpu/nova-core/regs.rs | 18 ++++++++++++++++++
>  2 files changed, 24 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
> index 8e04628ca3d9..2bbc084e2095 100644
> --- a/drivers/gpu/nova-core/gpu.rs
> +++ b/drivers/gpu/nova-core/gpu.rs
> @@ -191,7 +191,7 @@ pub(crate) struct Spec {
>  }
>  
>  impl Spec {
> -    fn new(bar: &Bar0) -> Result<Spec> {
> +    fn new(dev: &device::Device, bar: &Bar0) -> Result<Spec> {
>          // Some brief notes about boot0 and boot42, in chronological order:
>          //
>          // NV04 through NV50:
> @@ -216,7 +216,10 @@ fn new(bar: &Bar0) -> Result<Spec> {
>              return Err(ENODEV);
>          }
>  
> -        Spec::try_from(regs::NV_PMC_BOOT_42::read(bar))
> +        let boot42 = regs::NV_PMC_BOOT_42::read(bar);
> +        Spec::try_from(boot42).inspect_err(|_| {
> +            dev_err!(dev, "Unsupported chipset: {}\n", boot42);
> +        })
>      }
>  }
>  
> @@ -268,7 +271,7 @@ pub(crate) fn new<'a>(
>          bar: &'a Bar0,
>      ) -> impl PinInit<Self, Error> + 'a {
>          try_pin_init!(Self {
> -            spec: Spec::new(bar).inspect(|spec| {
> +            spec: Spec::new(pdev.as_ref(), bar).inspect(|spec| {
>                  dev_info!(pdev.as_ref(),"NVIDIA ({})\n", spec);
>              })?,
>  
> diff --git a/drivers/gpu/nova-core/regs.rs b/drivers/gpu/nova-core/regs.rs
> index c6e2e08c754b..a53b013f2eca 100644
> --- a/drivers/gpu/nova-core/regs.rs
> +++ b/drivers/gpu/nova-core/regs.rs
> @@ -67,6 +67,24 @@ pub(crate) fn chipset(self) -> Result<Chipset> {
>              })
>              .and_then(Chipset::try_from)
>      }
> +
> +    /// Returns the raw architecture value from the register.
> +    fn architecture_raw(self) -> u8 {
> +        ((self.0 >> 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.0,
> +            self.architecture_raw(),
> +            self.implementation()
> +        )
> +    }
>  }
>  
>  // PBUS



  reply	other threads:[~2025-11-15  1:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-15  1:09 [PATCH v9 0/4] gpu: nova: add boot42 support for next-gen GPUs John Hubbard
2025-11-15  1:09 ` [PATCH v9 1/4] gpu: nova-core: prepare Spec and Revision types for boot0/boot42 John Hubbard
2025-11-15  1:09 ` [PATCH v9 2/4] gpu: nova-core: make Architecture behave as a u8 type John Hubbard
2025-11-15  1:09 ` [PATCH v9 3/4] gpu: nova-core: add boot42 support for next-gen GPUs John Hubbard
2025-11-15 14:13   ` Alexandre Courbot
2025-11-15 20:59     ` John Hubbard
2025-11-15  1:09 ` [PATCH v9 4/4] gpu: nova-core: provide a clear error report for unsupported GPUs John Hubbard
2025-11-15  1:12   ` John Hubbard [this message]
2025-11-15 14:13     ` Alexandre Courbot
2025-11-15 14:25 ` [PATCH v9 0/4] gpu: nova: add boot42 support for next-gen GPUs Alexandre Courbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a467f1e6-4e18-479e-a165-68a5b5ea5db8@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=epeer@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --cc=zhiw@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).