[PATCH 08/13] gpu: nova-core: gsp: ensure LibOS DMA allocation lives long enough
From: Eliot Courtney
Date: Mon Jun 15 2026 - 10:48:12 EST
Currently, `GspSequencer` stores a raw DMA handle. Instead, store a
reference to `Coherent` to statically ensure that the allocation lives
long enough.
Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
---
drivers/gpu/nova-core/gsp/hal/tu102.rs | 2 +-
drivers/gpu/nova-core/gsp/sequencer.rs | 18 +++++++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/nova-core/gsp/hal/tu102.rs b/drivers/gpu/nova-core/gsp/hal/tu102.rs
index eb7166148cc9..1e08c482fd39 100644
--- a/drivers/gpu/nova-core/gsp/hal/tu102.rs
+++ b/drivers/gpu/nova-core/gsp/hal/tu102.rs
@@ -344,7 +344,7 @@ fn post_boot(
// Create and run the GSP sequencer.
let seq_params = GspSequencerParams {
bootloader_app_version: gsp_fw.bootloader.app_version,
- libos_dma_handle: gsp.libos.dma_handle(),
+ libos: &gsp.libos,
gsp_falcon,
sec2_falcon,
dev,
diff --git a/drivers/gpu/nova-core/gsp/sequencer.rs b/drivers/gpu/nova-core/gsp/sequencer.rs
index e0850d21adca..ddb6abc45a37 100644
--- a/drivers/gpu/nova-core/gsp/sequencer.rs
+++ b/drivers/gpu/nova-core/gsp/sequencer.rs
@@ -6,6 +6,7 @@
use kernel::{
device,
+ dma::Coherent,
io::{
poll::read_poll_timeout,
Io, //
@@ -31,6 +32,7 @@
MessageFromGsp, //
},
fw,
+ LibosMemoryRegionInitArgument, //
},
num::FromSafeCast,
sbuffer::SBufferIter,
@@ -136,8 +138,8 @@ pub(crate) struct GspSequencer<'a> {
sec2_falcon: &'a Falcon<Sec2>,
/// GSP falcon for core operations.
gsp_falcon: &'a Falcon<Gsp>,
- /// LibOS DMA handle address.
- libos_dma_handle: u64,
+ /// LibOS memory region init arguments.
+ libos: &'a Coherent<[LibosMemoryRegionInitArgument]>,
/// Bootloader application version.
bootloader_app_version: u32,
/// Device for logging.
@@ -233,11 +235,13 @@ fn run(&self, seq: &GspSequencer<'_>) -> Result {
// Reset the GSP to prepare it for resuming.
seq.gsp_falcon.reset(seq.bar)?;
+ let libos_dma_handle = seq.libos.dma_handle();
+
// Write the libOS DMA handle to GSP mailboxes.
seq.gsp_falcon.write_mailboxes(
seq.bar,
- Some(seq.libos_dma_handle as u32),
- Some((seq.libos_dma_handle >> 32) as u32),
+ Some(libos_dma_handle as u32),
+ Some((libos_dma_handle >> 32) as u32),
);
// Start the SEC2 falcon which will trigger GSP-RM to resume on the GSP.
@@ -342,8 +346,8 @@ fn iter(&self) -> GspSeqIter<'_> {
pub(crate) struct GspSequencerParams<'a> {
/// Bootloader application version.
pub(crate) bootloader_app_version: u32,
- /// LibOS DMA handle address.
- pub(crate) libos_dma_handle: u64,
+ /// LibOS memory region init arguments.
+ pub(crate) libos: &'a Coherent<[LibosMemoryRegionInitArgument]>,
/// GSP falcon for core operations.
pub(crate) gsp_falcon: &'a Falcon<Gsp>,
/// SEC2 falcon for core operations.
@@ -369,7 +373,7 @@ pub(crate) fn run(cmdq: &Cmdq, params: GspSequencerParams<'a>) -> Result {
bar: params.bar,
sec2_falcon: params.sec2_falcon,
gsp_falcon: params.gsp_falcon,
- libos_dma_handle: params.libos_dma_handle,
+ libos: params.libos,
bootloader_app_version: params.bootloader_app_version,
dev: params.dev,
};
--
2.54.0