summaryrefslogtreecommitdiff
path: root/drivers/gpu/nova-core
diff options
context:
space:
mode:
authorJoel Fernandes <joelagnelf@nvidia.com>2025-11-14 14:55:40 -0500
committerAlexandre Courbot <acourbot@nvidia.com>2025-11-15 17:28:03 +0900
commit2d981773e14c1d7fc8f8e19a19d306d8372db571 (patch)
tree7998c5c364bc6eb12a4a30b8632d9bfb929cb67e /drivers/gpu/nova-core
parent38b7cc448a5b6772cad2b853a011f507ad95306a (diff)
gpu: nova-core: falcon: Move waiting until halted to a helper
Move the "waiting until halted" functionality into a helper so that we can use it in the sequencer, which is a separate sequencer operation. Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Message-ID: <20251114195552.739371-2-joelagnelf@nvidia.com>
Diffstat (limited to 'drivers/gpu/nova-core')
-rw-r--r--drivers/gpu/nova-core/falcon.rs21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
index 05b124acbfc1..1e51b94d9585 100644
--- a/drivers/gpu/nova-core/falcon.rs
+++ b/drivers/gpu/nova-core/falcon.rs
@@ -551,6 +551,19 @@ impl<E: FalconEngine + 'static> Falcon<E> {
Ok(())
}
+ /// Wait until the falcon CPU is halted.
+ pub(crate) fn wait_till_halted(&self, bar: &Bar0) -> Result<()> {
+ // TIMEOUT: arbitrarily large value, firmwares should complete in less than 2 seconds.
+ read_poll_timeout(
+ || Ok(regs::NV_PFALCON_FALCON_CPUCTL::read(bar, &E::ID)),
+ |r| r.halted(),
+ Delta::ZERO,
+ Delta::from_secs(2),
+ )?;
+
+ Ok(())
+ }
+
/// Runs the loaded firmware and waits for its completion.
///
/// `mbox0` and `mbox1` are optional parameters to write into the `MBOX0` and `MBOX1` registers
@@ -585,13 +598,7 @@ impl<E: FalconEngine + 'static> Falcon<E> {
.write(bar, &E::ID),
}
- // TIMEOUT: arbitrarily large value, firmwares should complete in less than 2 seconds.
- read_poll_timeout(
- || Ok(regs::NV_PFALCON_FALCON_CPUCTL::read(bar, &E::ID)),
- |r| r.halted(),
- Delta::ZERO,
- Delta::from_secs(2),
- )?;
+ self.wait_till_halted(bar)?;
let (mbox0, mbox1) = (
regs::NV_PFALCON_FALCON_MAILBOX0::read(bar, &E::ID).value(),