Re: [PATCH FOR REFERENCE v8 10/10] gpu: nova-core: use the kernel `register!` macro
From: John Hubbard
Date: Mon Mar 09 2026 - 14:54:58 EST
On 3/9/26 11:42 AM, Danilo Krummrich wrote:
> On Mon Mar 9, 2026 at 7:34 PM CET, John Hubbard wrote:
>> On 3/9/26 11:28 AM, Gary Guo wrote:
>>> On Mon Mar 9, 2026 at 6:01 PM GMT, John Hubbard wrote:
>>>> On 3/9/26 10:51 AM, Joel Fernandes wrote:
>>>>> On 3/9/2026 1:34 PM, John Hubbard wrote:
>>>>>> On 3/9/26 8:43 AM, Joel Fernandes wrote:
>>>>>>> On 3/9/2026 11:14 AM, Alexandre Courbot wrote:
>>>> ...
>>>> What about this instead (*very* approximately):
>>>>
>>>> // set up or construct NV_PFALCON_FALCON_MAILBOX1:
>>>>
>>>> let reg = NV_PFALCON_FALCON_MAILBOX1::zeroed(&bar);
>>>
>>> This doesn't really make sense. What does "zeroed(&bar)" even mean? You're
>>> neither zeroing the register on the bar, nor constructing a zeroed value?
>>>
>>
>> The idea was to separate constructing with a zeroed value, from
>> the actual register write. I am not surprised that the syntax
>> is All Wrong at this point, I'm just hoping to spark more ideas
>> about how to make this clear and nice to read.
>
> This is where you would use write_val(), i.e.
>
> // Construct with some custom constructor.
> let reg = regs::NV_PFALCON_FALCON_MAILBOX1::new(...);
>
> bar.write_val(reg);
Beautiful! That's what I wish I had written. :)
thanks,
--
John Hubbard