mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Eliot Courtney" <ecourtney@nvidia.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	"Uladzislau Rezki" <urezki@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "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>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Onur Özkan" <work@onurozkan.dev>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Alistair Popple" <apopple@nvidia.com>,
	"Timur Tabi" <ttabi@nvidia.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
	dri-devel <dri-devel-bounces@lists.freedesktop.org>
Subject: Re: [PATCH v3 7/8] gpu: nova-core: add NVKV typed decoding
Date: Thu, 15 Oct 2026 22:12:48 +0900	[thread overview]
Message-ID: <DM5FSADEZ25P.35QGZD4HBK81J@nvidia.com> (raw)
In-Reply-To: <DM5FAT7JWWZP.24VCIV1SXFQM2@nvidia.com>

On Thu Oct 15, 2026 at 9:49 PM JST, Eliot Courtney wrote:
> On Wed Oct 7, 2026 at 3:30 PM JST, Alexandre Courbot wrote:
>> On Mon Sep 28, 2026 at 5:42 PM JST, Eliot Courtney wrote:
>>> Similar to the typed encoding layer, add some decoding type machinery.
>>> Add a simple macro `nvkv_decode!` which implements `Schema` for a struct
>>> by composing visit calls to each member. Add some common `Schema` kinds,
>>> such as `Array` which collects an array value into a fixed maximum size
>>> array, and `Required` which fails a decode if the value is not sent.
>>>
>>> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
>>> ---
>>>  drivers/gpu/nova-core/gsp/nvkv.rs        |  11 +-
>>>  drivers/gpu/nova-core/gsp/nvkv/decode.rs | 622 ++++++++++++++++++++++++++++++-
>>>  2 files changed, 628 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/gpu/nova-core/gsp/nvkv.rs b/drivers/gpu/nova-core/gsp/nvkv.rs
>>> index 7ac3a459a98b..5791df07a7fa 100644
>>> --- a/drivers/gpu/nova-core/gsp/nvkv.rs
>>> +++ b/drivers/gpu/nova-core/gsp/nvkv.rs
>>> @@ -9,7 +9,7 @@
>>>  //! function calls will map to some struct - for example, f(GPU_NAME_STRING_KEY, 0, b"some gpu")
>>>  //! naturally maps to storing a &str with the GPU name.
>>>  
>>> -#![expect(unused_imports)]
>>> +#![cfg_attr(not(CONFIG_KUNIT), expect(unused_imports))]
>>>  #![cfg_attr(not(CONFIG_KUNIT), expect(unused_macros))]
>>>  
>>>  use core::{
>>> @@ -23,7 +23,8 @@
>>>  use kernel::{
>>>      alloc::{
>>>          allocator::KVmalloc,
>>> -        Allocator, //
>>> +        Allocator,
>>> +        ArrayVec, //
>>>      },
>>>      bitfield,
>>>      num::Bounded,
>>> @@ -148,6 +149,12 @@ fn default() -> Self {
>>>      }
>>>  }
>>>  
>>> +/// A schema field for an array value under the NVKV key `KEY_ID`.
>>> +#[repr(transparent)]
>>> +pub(crate) struct Array<T: Default + Copy, const N: usize, const KEY_ID: KeyId> {
>>> +    vec: ArrayVec<T, N>,
>>> +}
>>
>> I still don't see why this needs to be declared in this module when no
>> encoder element ever uses it, and the module reexports everything from
>> `decode` anyway. Can this be moved next to the other schema kinds?
>
> This will be used soon [1] for encoding. The convention I have been
> using is if a type is used for both encoding and decoding, I put it in
> nvkv.rs (since it doesn't fit obviously in either - the
> encoding/decoding related impls can go in there though). If we put
> IndexedKey in nvkv.rs as pub crate since we'll use it soon, it's
> consistent to keep Array here as well. WDYT?

Sure, if encoding is to use it then let's put it in its eventual
destination from the start.

  reply	other threads:[~2026-10-15 13:12 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28  8:42 [PATCH v3 0/8] gpu: nova-core: add NVKV codec Eliot Courtney
2026-09-28  8:42 ` [PATCH v3 1/8] rust: alloc: add Vec::try_push_init Eliot Courtney
2026-10-06  5:52   ` Alexandre Courbot
2026-10-13  6:22     ` Eliot Courtney
2026-09-28  8:42 ` [PATCH v3 2/8] rust: alloc: add Vec::push_init Eliot Courtney
2026-10-06  6:10   ` Alexandre Courbot
2026-09-28  8:42 ` [PATCH v3 3/8] rust: alloc: add ArrayVec Eliot Courtney
2026-10-07  6:27   ` Alexandre Courbot
2026-10-13  9:13     ` Eliot Courtney
2026-09-28  8:42 ` [PATCH v3 4/8] gpu: nova-core: add NVKV encoder Eliot Courtney
2026-10-07  3:43   ` Alexandre Courbot
2026-10-07  3:48     ` Alexandre Courbot
2026-10-07 11:33       ` John Hubbard
2026-10-07 11:56         ` Alexandre Courbot
2026-10-13  7:08           ` Eliot Courtney
2026-09-28  8:42 ` [PATCH v3 5/8] gpu: nova-core: add NVKV decoder Eliot Courtney
2026-10-07  4:51   ` Alexandre Courbot
2026-10-13  8:26     ` Eliot Courtney
2026-10-14 14:00       ` Alexandre Courbot
2026-09-28  8:42 ` [PATCH v3 6/8] gpu: nova-core: add NVKV typed encoding Eliot Courtney
2026-10-07  6:30   ` Alexandre Courbot
2026-10-15  1:33     ` Eliot Courtney
2026-09-28  8:42 ` [PATCH v3 7/8] gpu: nova-core: add NVKV typed decoding Eliot Courtney
2026-10-07  6:30   ` Alexandre Courbot
2026-10-15 12:49     ` Eliot Courtney
2026-10-15 13:12       ` Alexandre Courbot [this message]
2026-10-07 12:05   ` Alexandre Courbot
2026-10-15 12:51     ` Eliot Courtney
2026-09-28  8:42 ` [PATCH v3 8/8] gpu: nova-core: add NVKV GSP_INIT schemas Eliot Courtney
2026-10-07 10:53   ` Alexandre Courbot
2026-10-15 14:31     ` Eliot Courtney

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=DM5FSADEZ25P.35QGZD4HBK81J@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=apopple@nvidia.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=dri-devel-bounces@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ecourtney@nvidia.com \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ljs@kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=ttabi@nvidia.com \
    --cc=urezki@gmail.com \
    --cc=vbabka@kernel.org \
    --cc=work@onurozkan.dev \
    /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

all inboxes | Powered by JetHome®