On Mon Nov 30, 2026 at 11:27 AM JST, Eliot Courtney wrote: > On Mon Nov 30, 2026 at 12:11 AM JST, Alexandre Courbot wrote: >> From: John Hubbard <[email protected]> >> >> `Gsp::new()` names each log buffer in the init argument array itself, >> which requires the buffers to be visible outside of their module. >> >> Move that code into `LogBuffers::init_arguments()`, and add >> `LogBuffers::COUNT` for the index of the argument that follows. >> >> No functional change. >> >> Signed-off-by: John Hubbard <[email protected]> >> Signed-off-by: Alexandre Courbot <[email protected]> >> --- >> drivers/gpu/nova-core/gsp.rs | 14 +++---------- >> drivers/gpu/nova-core/gsp/logbuffer.rs | 37 >> ++++++++++++++++++++++++++++++---- >> 2 files changed, 36 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs >> index bf0028e52e3c..eb5b62aa8bc0 100644 >> --- a/drivers/gpu/nova-core/gsp.rs >> +++ b/drivers/gpu/nova-core/gsp.rs >> @@ -137,19 +137,11 @@ pub(crate) fn new( >> GFP_KERNEL, >> )?; >> >> + log_buffers.init_arguments(&mut libos)?; >> libos.init_at( >> - 0, >> - LibosMemoryRegionInitArgument::new("LOGINIT", >> &log_buffers.loginit.0), >> + LogBuffers::COUNT, >> + LibosMemoryRegionInitArgument::new("RMARGS", >> rmargs), >> )?; >> - libos.init_at( >> - 1, >> - LibosMemoryRegionInitArgument::new("LOGINTR", >> &log_buffers.logintr.0), >> - )?; >> - libos.init_at( >> - 2, >> - LibosMemoryRegionInitArgument::new("LOGRM", >> &log_buffers.logrm.0), >> - )?; >> - libos.init_at(3, >> LibosMemoryRegionInitArgument::new("RMARGS", rmargs))?; >> >> libos.into() >> }, > > Instead of maintaining a separate constant LogBuffers::COUNT which could > get out of sync with how many buffers `init_arguments` uses, what about > returning the count from `init_arguments`? You could also chuck each > init argument into an array and iterate it to avoid hard coding the > indices too.
Good idea. Ideally we could also have a writer type that keeps track of the current index, let me see if that would be difficult to do.
