[PATCH v4 5/6] gpu: nova-core: gsp: logbuffer: add RetainedLogBuffers::is_empty()

From: Alexandre Courbot

Date: Tue Dec 01 2026 - 03:16:44 EST


From: John Hubbard <jhubbard@xxxxxxxxxx>

Move the check for retained logs that the GSP never wrote to into a
helper, so that it stays in one place when buffers are added.

No functional change.

Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
Reviewed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
---
drivers/gpu/nova-core/gsp/logbuffer.rs | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/nova-core/gsp/logbuffer.rs b/drivers/gpu/nova-core/gsp/logbuffer.rs
index 4aba4919d110..124e6aee2c63 100644
--- a/drivers/gpu/nova-core/gsp/logbuffer.rs
+++ b/drivers/gpu/nova-core/gsp/logbuffer.rs
@@ -161,7 +161,7 @@ fn retain(&self) -> Result {
logrm: self.logrm.snapshot()?,
};

- if logs.loginit.is_empty() && logs.logintr.is_empty() && logs.logrm.is_empty() {
+ if logs.is_empty() {
return Ok(());
}

@@ -207,6 +207,20 @@ struct RetainedLogBuffers {
logrm: VVec<u8>,
}

+impl RetainedLogBuffers {
+ /// Returns `true` if the GSP never wrote to any of the buffers.
+ fn is_empty(&self) -> bool {
+ let Self {
+ name: _,
+ loginit,
+ logintr,
+ logrm,
+ } = self;
+
+ loginit.is_empty() && logintr.is_empty() && logrm.is_empty()
+ }
+}
+
/// Copies of the log buffers of all GPUs that are no longer bound.
pub(crate) struct RetainedLogs(KVec<Pin<KBox<debugfs::Scope<RetainedLogBuffers>>>>);


--
2.56.1