[PATCH v2 07/11] gpu: nova-core: gsp: logbuffer: add RetainedLogBuffers::is_empty()

From: Alexandre Courbot

Date: Sun Nov 29 2026 - 10:12:10 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>
Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
---
drivers/gpu/nova-core/gsp/logbuffer.rs | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/nova-core/gsp/logbuffer.rs b/drivers/gpu/nova-core/gsp/logbuffer.rs
index 40fb6682d83d..bfc1712ea458 100644
--- a/drivers/gpu/nova-core/gsp/logbuffer.rs
+++ b/drivers/gpu/nova-core/gsp/logbuffer.rs
@@ -175,7 +175,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(());
}

@@ -221,6 +221,13 @@ struct RetainedLogBuffers {
logrm: VVec<u8>,
}

+impl RetainedLogBuffers {
+ /// Returns `true` if the GSP never wrote to any of the buffers.
+ fn is_empty(&self) -> bool {
+ self.loginit.is_empty() && self.logintr.is_empty() && self.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