Re: [PATCH v3 6/8] gpu: nova-core: build SetRegistry entries dynamically
"Alexandre Courbot" <[email protected]>
| Newsgroups | dev.linux.lists.nova-gpu,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Wed Jul 1, 2026 at 3:26 PM JST, Zhi Wang wrote: > The GSP SetRegistry command currently stores its registry entries in a > fixed-size array. That makes every additional runtime-dependent registry > object require reshaping the command data structure at the same time as the > feature that needs the new entry. > > Keep the existing registry contents unchanged, but store them in a KVec so > SetRegistry can be constructed dynamically. The constructor now returns a > Result to propagate allocation failures while the command payload layout is > still computed from the final entry list. > > Cc: Alexandre Courbot <[email protected]> > Signed-off-by: Zhi Wang <[email protected]> Pushed to drm-rust-next, thanks! With one minor change documented below. > --- > drivers/gpu/nova-core/gsp/boot.rs | 2 +- > drivers/gpu/nova-core/gsp/commands.rs | 74 ++++++++++++++++----------- > 2 files changed, 44 insertions(+), 32 deletions(-) > > diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs > index 5abab54639a4..139cedacffd2 100644 > --- a/drivers/gpu/nova-core/gsp/boot.rs > +++ b/drivers/gpu/nova-core/gsp/boot.rs > @@ -102,7 +102,7 @@ pub(crate) fn boot( > self.cmdq > .send_command_no_wait(bar, commands::SetSystemInfo::new(pdev, chipset))?; > self.cmdq > - .send_command_no_wait(bar, commands::SetRegistry::new())?; > + .send_command_no_wait(bar, commands::SetRegistry::new()?)?; > > hal.post_boot(&self, ctx, &gsp_fw)?; > > diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs > index 86a3747cd31c..dfb9f04e284d 100644 > --- a/drivers/gpu/nova-core/gsp/commands.rs > +++ b/drivers/gpu/nova-core/gsp/commands.rs > @@ -67,37 +67,46 @@ struct RegistryEntry { > > /// The `SetRegistry` command. > pub(crate) struct SetRegistry { > - entries: [RegistryEntry; Self::NUM_ENTRIES], > + entries: KVec<RegistryEntry>, > } > > impl SetRegistry { > // For now we hard-code the registry entries. Future work will allow others to > // be added as module parameters. That comment is now orphan, so I removed it.