Skip to contentSkip to conversation

gpu: nova-core: consolidate GSP boot parameters into GspBootContext

PATCH New Zhi Wang 1 participant 1 message Feb 18

Subsystems (4)
lore
Share & tools
lore

Zhi Wang

author
#0 lore raw

PATCH 1/1 gpu: nova-core: consolidate GSP boot parameters into GspBootContext

The GSP boot path threads pdev, bar, chipset, gsp_falcon and sec2_falcon individually through boot() -> run_fwsec_frts() -> sequencer.

Bundle them into a GspBootContext struct to cut down on parameter passing and the associated import boilerplate. It is for easily introducing other boot params like vGPU enable, WRP size in future.

No functional change is intended.

---
 drivers/gpu/nova-core/gpu.rs           | 16 ++++-
 drivers/gpu/nova-core/gsp.rs           | 22 ++++++
 drivers/gpu/nova-core/gsp/boot.rs      | 97 ++++++++++----------------
 drivers/gpu/nova-core/gsp/sequencer.rs | 71 ++++++++-----------
 4 files changed, 99 insertions(+), 107 deletions(-)
drivers/gpu/nova-core/gpu.rs +14 -2
index 9b042ef1a308..61a90ebad7f8 100644
@@ -18,7 +18,10 @@
     },
     fb::SysmemFlush,
     gfw,
-    gsp::Gsp,
+    gsp::{
+        Gsp,
+        GspBootContext, //
+    },
     regs,
 };
 
@@ -283,7 +286,16 @@ pub(crate) fn new<'a>(
 
             gsp <- Gsp::new(pdev),
 
-            _: { gsp.boot(pdev, bar, spec.chipset, gsp_falcon, sec2_falcon)? },
+            _: {
+                let ctx = GspBootContext {
+                    pdev,
+                    bar,
+                    chipset: spec.chipset,
+                    gsp_falcon,
+                    sec2_falcon,
+                };
+                gsp.boot(&ctx)?
+            },
 
             bar: devres_bar,
         })
drivers/gpu/nova-core/gsp.rs +22 -0
index 174feaca0a6b..afb8304286d3 100644
@@ -25,6 +25,13 @@
 };
 
 use crate::{
+    driver::Bar0,
+    falcon::{
+        gsp::Gsp as GspFalcon,
+        sec2::Sec2 as Sec2Falcon,
+        Falcon, //
+    },
+    gpu::Chipset,
     gsp::cmdq::Cmdq,
     gsp::fw::{
         GspArgumentsPadded,
@@ -39,6 +46,21 @@
 /// Number of GSP pages to use in a RM log buffer.
 const RM_LOG_BUFFER_NUM_PAGES: usize = 0x10;
 
+/// Common context for the GSP boot process.
+pub(crate) struct GspBootContext<'a> {
+    pub(crate) pdev: &'a pci::Device<device::Bound>,
+    pub(crate) bar: &'a Bar0,
+    pub(crate) chipset: Chipset,
+    pub(crate) gsp_falcon: &'a Falcon<GspFalcon>,
+    pub(crate) sec2_falcon: &'a Falcon<Sec2Falcon>,
+}
+
+impl GspBootContext<'_> {
+    pub(crate) fn dev(&self) -> &device::Device<device::Bound> {
+        self.pdev.as_ref()
+    }
+}
+
 /// Array of page table entries, as understood by the GSP bootloader.
 #[repr(C)]
 struct PteArray<const NUM_ENTRIES: usize>([u64; NUM_ENTRIES]);
drivers/gpu/nova-core/gsp/boot.rs +35 -62

205 lines not on this page · raw message

drivers/gpu/nova-core/gsp/sequencer.rs +28 -43

166 lines not on this page · raw message

Signature · 1 line
2.51.0