[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ab8d6f00-bf94-4fbc-a1c5-d7d22af9479f@nvidia.com>
Date: Tue, 13 Jan 2026 19:03:04 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Gary Guo <gary@...yguo.net>, Danilo Krummrich <dakr@...nel.org>
Cc: Alexandre Courbot <acourbot@...dia.com>,
Joel Fernandes <joelagnelf@...dia.com>, Timur Tabi <ttabi@...dia.com>,
Alistair Popple <apopple@...dia.com>, Edwin Peer <epeer@...dia.com>,
Zhi Wang <zhiw@...dia.com>, David Airlie <airlied@...il.com>,
Simona Vetter <simona@...ll.ch>, Bjorn Helgaas <bhelgaas@...gle.com>,
Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>,
Andreas Hindborg <a.hindborg@...nel.org>, Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>, nouveau@...ts.freedesktop.org,
rust-for-linux@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 07/31] gpu: nova-core: set DMA mask width based on GPU
architecture
On 1/13/26 5:43 AM, Gary Guo wrote:
> On Wed Dec 3, 2025 at 5:58 AM GMT, John Hubbard wrote:
...
>> +impl Architecture {
>> + /// Returns the number of DMA address bits supported by this architecture.
>> + ///
>> + /// Hopper and Blackwell support 52-bit DMA addresses, while earlier architectures
>> + /// (Turing, Ampere, Ada) support 47-bit DMA addresses.
>> + pub(crate) const fn dma_addr_bits(&self) -> u32 {
>
> How about just return `DmaMask` from here? This get rids of the fallible
> constructor call of `DmaMask`.
Yes, that's a nice touch, I'll do that.
>
>> + match self {
>> + Self::Turing | Self::Ampere | Self::Ada => 47,
>> + Self::Hopper | Self::Blackwell => 52,
>> + }
>> + }
>> +}
>> +
>> impl TryFrom<u8> for Architecture {
>> type Error = Error;
>>
>> @@ -203,6 +216,20 @@ pub(crate) struct Spec {
>> revision: Revision,
>> }
>>
>> +/// Reads the GPU architecture from BAR0 registers.
>> +///
>> +/// This is a lightweight check used early in probe to determine the correct DMA address width
>> +/// before the full [`Spec`] is constructed.
>> +pub(crate) fn read_architecture(bar: &Bar0) -> Result<Architecture> {
>> + let boot0 = regs::NV_PMC_BOOT_0::read(bar);
>> +
>> + if boot0.is_older_than_fermi() {
>> + return Err(ENODEV);
>> + }
>> +
>> + regs::NV_PMC_BOOT_42::read(bar).architecture()
>
> Can this just be `Spec::new`?
Yes it can. I've fixed it locally, to do Spec::new() early and pass
the Spec into Gpu::new(), and it does result in less code here. Good.
thanks,
--
John Hubbard
Powered by blists - more mailing lists