We want to move the `Fsp` instance into `Gpu`, which will require
passing it as part of the `GspBootContext` as `Fsp::boot_fmc` is a
mutable method.

Additionally, we will also want to make some methods of the `Falcon`s
mutable, which will also require passing them as mutable references.

To prepare for this, make the passed `GspBootContext` mutable, and pass
mutable references to it to the GSP boot HAL methods.

Signed-off-by: Alexandre Courbot <[email protected]>
---
 drivers/gpu/nova-core/gsp/boot.rs      | 6 +++---
 drivers/gpu/nova-core/gsp/hal.rs       | 9 +++++++--
 drivers/gpu/nova-core/gsp/hal/gh100.rs | 2 +-
 drivers/gpu/nova-core/gsp/hal/tu102.rs | 4 ++--
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/nova-core/gsp/boot.rs 
b/drivers/gpu/nova-core/gsp/boot.rs
index 336ad23c96f9..1e0d4793e96d 100644
--- a/drivers/gpu/nova-core/gsp/boot.rs
+++ b/drivers/gpu/nova-core/gsp/boot.rs
@@ -38,7 +38,7 @@ impl super::Gsp {
     /// [`Self::unload`]) returned.
     pub(crate) fn boot(
         self: Pin<&mut Self>,
-        ctx: super::GspBootContext<'_>,
+        mut ctx: super::GspBootContext<'_>,
     ) -> Result<Option<super::UnloadBundle>> {
         let pdev = ctx.pdev;
         let bar = ctx.bar;
@@ -55,7 +55,7 @@ pub(crate) fn boot(
         let wpr_meta = Coherent::init(dev, GFP_KERNEL, 
GspFwWprMeta::new(&gsp_fw, &fb_layout))?;
 
         // Perform the chipset-specific boot sequence, and retrieve the unload 
bundle.
-        let (res, unload_bundle) = hal.boot(&self, &ctx, &fb_layout, 
&wpr_meta);
+        let (res, unload_bundle) = hal.boot(&self, &mut ctx, &fb_layout, 
&wpr_meta);
 
         // Display error for unload bundle if any, and convert to `Option`.
         let unload_bundle = unload_bundle
@@ -89,7 +89,7 @@ pub(crate) fn boot(
             self.cmdq
                 .send_command_no_wait(bar, commands::SetRegistry::new())?;
 
-            hal.post_boot(&self, &ctx, &gsp_fw)?;
+            hal.post_boot(&self, &mut ctx, &gsp_fw)?;
 
             // Wait until GSP is fully initialized.
             commands::wait_gsp_init_done(&self.cmdq)
diff --git a/drivers/gpu/nova-core/gsp/hal.rs b/drivers/gpu/nova-core/gsp/hal.rs
index 9abdafbdbb57..15c6d86c0d51 100644
--- a/drivers/gpu/nova-core/gsp/hal.rs
+++ b/drivers/gpu/nova-core/gsp/hal.rs
@@ -48,7 +48,7 @@ pub(super) trait GspHal: Send {
     fn boot(
         &self,
         gsp: &Gsp,
-        ctx: &GspBootContext<'_>,
+        ctx: &mut GspBootContext<'_>,
         fb_layout: &FbLayout,
         wpr_meta: &Coherent<GspFwWprMeta>,
     ) -> (Result, Result<crate::gsp::UnloadBundle>);
@@ -57,7 +57,12 @@ fn boot(
     ///
     /// This method is called by the GSP boot code after the GSP is confirmed 
to be running, and
     /// after the initialization commands have been pushed onto its queue.
-    fn post_boot(&self, _gsp: &Gsp, _ctx: &GspBootContext<'_>, _gsp_fw: 
&GspFirmware) -> Result {
+    fn post_boot(
+        &self,
+        _gsp: &Gsp,
+        _ctx: &mut GspBootContext<'_>,
+        _gsp_fw: &GspFirmware,
+    ) -> Result {
         Ok(())
     }
 }
diff --git a/drivers/gpu/nova-core/gsp/hal/gh100.rs 
b/drivers/gpu/nova-core/gsp/hal/gh100.rs
index a87d526d2310..7bba18ba2f75 100644
--- a/drivers/gpu/nova-core/gsp/hal/gh100.rs
+++ b/drivers/gpu/nova-core/gsp/hal/gh100.rs
@@ -140,7 +140,7 @@ impl GspHal for Gh100 {
     fn boot(
         &self,
         gsp: &Gsp,
-        ctx: &GspBootContext<'_>,
+        ctx: &mut GspBootContext<'_>,
         fb_layout: &FbLayout,
         wpr_meta: &Coherent<GspFwWprMeta>,
     ) -> (Result, Result<crate::gsp::UnloadBundle>) {
diff --git a/drivers/gpu/nova-core/gsp/hal/tu102.rs 
b/drivers/gpu/nova-core/gsp/hal/tu102.rs
index 8e732f540af2..90c734c2f63e 100644
--- a/drivers/gpu/nova-core/gsp/hal/tu102.rs
+++ b/drivers/gpu/nova-core/gsp/hal/tu102.rs
@@ -263,7 +263,7 @@ impl GspHal for Tu102 {
     fn boot(
         &self,
         gsp: &Gsp,
-        ctx: &GspBootContext<'_>,
+        ctx: &mut GspBootContext<'_>,
         fb_layout: &FbLayout,
         wpr_meta: &Coherent<GspFwWprMeta>,
     ) -> (Result, Result<crate::gsp::UnloadBundle>) {
@@ -318,7 +318,7 @@ fn boot(
         (res, unload_bundle)
     }
 
-    fn post_boot(&self, gsp: &Gsp, ctx: &GspBootContext<'_>, gsp_fw: 
&GspFirmware) -> Result {
+    fn post_boot(&self, gsp: &Gsp, ctx: &mut GspBootContext<'_>, gsp_fw: 
&GspFirmware) -> Result {
         GspSequencer::run(
             &gsp.cmdq,
             ctx,

-- 
2.54.0

Reply via email to