Re: [PATCH v6 3/4] gpu: nova-core: make Architecture behave as a u8 type

From: John Hubbard

Date: Sat Nov 08 2025 - 00:09:16 EST


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.


thanks,
--
John Hubbard