Re: [PATCH 6/6] gpu: nova-core: add NVKV GSP_INIT schemas

[email protected]
Newsgroups org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] KVVec<RegKey> encoding does not increment NVKV element indices, causing all array elements to be sent with index 0.
--

--- Patch [6]: [PATCH 6/6] gpu: nova-core: add NVKV GSP_INIT schemas ---
commit 2486533ab3027e1001c092bef8bd2ab3fb8541bf
Author: Eliot Courtney <[email protected]>

gpu: nova-core: add NVKV GSP_INIT schemas

This commit adds the first user of NVKV encode/decode, which is the request
and response for GSP init. It supports these messages for unit tests.

> diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
> index 6dc31d1bf5ae4..4de44c2dc6aa3 100644
> --- a/drivers/gpu/nova-core/gsp/fw/commands.rs
> +++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
[ ... ]
> +impl Encodable for KVVec<RegKey> {
> +    fn encode(&self, encoder: &mut Encoder) -> Result {
> +        for regkey in self {
> +            regkey.encode(encoder)?;
> +        }
> +        Ok(())
> +    }
> +}

[Severity: High]
When iterating over the KVVec<RegKey> array in this custom Encodable
implementation, does this code need a mechanism to increment the NVKV
element index?

Because the underlying Key type appears to hardcode Index::new::<0>() for
all encodings (as Encodable::encode does not accept an index parameter), it
looks like all array elements will be encoded with index 0.

Will the GSP firmware overwrite earlier items with the last one or reject
the message due to the missing incrementing index when multiple registry
keys are present?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.