[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DE3ADB75TBUH.3ROHW8XJAC6K0@nvidia.com>
Date: Sat, 08 Nov 2025 20:45:02 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "John Hubbard" <jhubbard@...dia.com>, "Timur Tabi" <ttabi@...dia.com>,
"dakr@...nel.org" <dakr@...nel.org>
Cc: "Alexandre Courbot" <acourbot@...dia.com>, "lossin@...nel.org"
<lossin@...nel.org>, "a.hindborg@...nel.org" <a.hindborg@...nel.org>,
"boqun.feng@...il.com" <boqun.feng@...il.com>, "aliceryhl@...gle.com"
<aliceryhl@...gle.com>, "Zhi Wang" <zhiw@...dia.com>, "simona@...ll.ch"
<simona@...ll.ch>, "alex.gaynor@...il.com" <alex.gaynor@...il.com>,
"ojeda@...nel.org" <ojeda@...nel.org>, "tmgross@...ch.edu"
<tmgross@...ch.edu>, "nouveau@...ts.freedesktop.org"
<nouveau@...ts.freedesktop.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "rust-for-linux@...r.kernel.org"
<rust-for-linux@...r.kernel.org>, "bjorn3_gh@...tonmail.com"
<bjorn3_gh@...tonmail.com>, "Edwin Peer" <epeer@...dia.com>,
"airlied@...il.com" <airlied@...il.com>, "Joel Fernandes"
<joelagnelf@...dia.com>, "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"gary@...yguo.net" <gary@...yguo.net>, "Alistair Popple"
<apopple@...dia.com>, "Nouveau" <nouveau-bounces@...ts.freedesktop.org>
Subject: Re: [PATCH v6 3/4] gpu: nova-core: make Architecture behave as a u8
type
On Sat Nov 8, 2025 at 2:08 PM JST, John Hubbard wrote:
> On 11/7/25 9:03 PM, Timur Tabi wrote:
>> On Fri, 2025-11-07 at 20:39 -0800, John Hubbard wrote:
>>> /// Enum representation of the GPU generation.
>>> -#[derive(fmt::Debug)]
>>> +#[derive(fmt::Debug, Default, Copy, Clone)]
>>> +#[repr(u8)]
>>> pub(crate) enum Architecture {
>>> + #[default]
>>> Turing = 0x16,
>>> Ampere = 0x17,
>>> Ada = 0x19,
>>> @@ -142,6 +144,13 @@ fn try_from(value: u8) -> Result<Self> {
>>> }
>>> }
>>
>> Does it make sense to designate a default Architecture? Turing is not a fallback for Ampere --
>
> Definitely not! However, we do want to use Architecture in places
> (register! and bitfield! macros) that expect u8 or u32, and that also
> expect to use integer defaults.
>
> So that's why we have to supply it.
To be precise, we need to supply this because of a shortcoming in the
`register`` macro: it doesn't support read-only registers yet, and write
support requires a `Default` implementation for its fields. This is
subject to be fixed in the future but for now we need this little
workaround.
Powered by blists - more mailing lists