Re: [PATCH v5 03/13] gpu: nova-core: falcon: Move mbox functionalities into helper
From: Alexandre Courbot
Date: Sat Nov 15 2025 - 06:27:30 EST
On Sat Nov 15, 2025 at 4:55 AM JST, Joel Fernandes wrote:
> Move falcon reading/writing to mbox functionality into helper so we can
> use it from the sequencer resume flow.
>
> Reviewed-by: Lyude Paul <lyude@xxxxxxxxxx>
> Signed-off-by: Joel Fernandes <joelagnelf@xxxxxxxxxx>
> ---
> drivers/gpu/nova-core/falcon.rs | 51 +++++++++++++++++++++++----------
> 1 file changed, 36 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/nova-core/falcon.rs b/drivers/gpu/nova-core/falcon.rs
> index 30af7fc2814d..5c9f054a0f42 100644
> --- a/drivers/gpu/nova-core/falcon.rs
> +++ b/drivers/gpu/nova-core/falcon.rs
> @@ -578,19 +578,13 @@ pub(crate) fn start(&self, bar: &Bar0) -> Result<()> {
> Ok(())
> }
>
> - /// Start running the loaded firmware.
> - ///
> - /// `mbox0` and `mbox1` are optional parameters to write into the `MBOX0` and `MBOX1` registers
> - /// prior to running.
> - ///
> - /// Wait up to two seconds for the firmware to complete, and return its exit status read from
> - /// the `MBOX0` and `MBOX1` registers.
> - pub(crate) fn boot(
> + /// Writes values to the mailbox registers if provided.
> + pub(crate) fn write_mailboxes(
> &self,
> bar: &Bar0,
> mbox0: Option<u32>,
> mbox1: Option<u32>,
> - ) -> Result<(u32, u32)> {
> + ) -> Result<()> {
> if let Some(mbox0) = mbox0 {
> regs::NV_PFALCON_FALCON_MAILBOX0::default()
> .set_value(mbox0)
> @@ -602,18 +596,45 @@ pub(crate) fn boot(
> .set_value(mbox1)
> .write(bar, &E::ID);
> }
> + Ok(())
> + }
>
> - self.start(bar)?;
> - self.wait_till_halted(bar)?;
> + /// Reads the value from `mbox0` register.
> + pub(crate) fn read_mailbox0(&self, bar: &Bar0) -> Result<u32> {
None of these methods can ever fail, so there is no need to return a
`Result` here. I'll make them infallible when applying.