Refactor the GSP boot function to return the GspStaticInfo and FbLayout. This enables access required for memory management initialization to: - bar1_pde_base: BAR1 page directory base. - bar2_pde_base: BAR2 page directory base. - usable memory regions in vidmem.
Signed-off-by: Joel Fernandes <[email protected]> --- drivers/gpu/nova-core/gpu.rs | 9 +++++++-- drivers/gpu/nova-core/gsp/boot.rs | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index 572e6d4502bc..91ec7f7910e9 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -20,7 +20,10 @@ }, fb::SysmemFlush, gfw, - gsp::Gsp, + gsp::{ + commands::GetGspStaticInfoReply, + Gsp, // + }, mm::GpuMm, regs, }; @@ -257,6 +260,8 @@ pub(crate) struct Gpu { /// GSP runtime data. Temporarily an empty placeholder. #[pin] gsp: Gsp, + /// Static GPU information from GSP. + gsp_static_info: GetGspStaticInfoReply, } impl Gpu { @@ -297,7 +302,7 @@ pub(crate) fn new<'a>( gsp <- Gsp::new(pdev), - _: { gsp.boot(pdev, bar, spec.chipset, gsp_falcon, sec2_falcon)? }, + gsp_static_info: { gsp.boot(pdev, bar, spec.chipset, gsp_falcon, sec2_falcon)?.0 }, bar: devres_bar, }) diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs index 581b412554dc..75f949bc4864 100644 --- a/drivers/gpu/nova-core/gsp/boot.rs +++ b/drivers/gpu/nova-core/gsp/boot.rs @@ -32,7 +32,10 @@ }, gpu::Chipset, gsp::{ - commands, + commands::{ + self, + GetGspStaticInfoReply, // + }, sequencer::{ GspSequencer, GspSequencerParams, // @@ -127,6 +130,12 @@ fn run_fwsec_frts( /// structures that the GSP will use at runtime. /// /// Upon return, the GSP is up and running, and its runtime object given as return value. + /// + /// Returns a tuple containing: + /// - [`GetGspStaticInfoReply`]: Static GPU information from GSP, including the BAR1 page + /// directory base address needed for memory management. + /// - [`FbLayout`]: Frame buffer layout computed during boot, containing memory regions + /// required for [`GpuMm`] initialization. pub(crate) fn boot( mut self: Pin<&mut Self>, pdev: &pci::Device<device::Bound>, @@ -134,7 +143,7 @@ pub(crate) fn boot( chipset: Chipset, gsp_falcon: &Falcon<Gsp>, sec2_falcon: &Falcon<Sec2>, - ) -> Result { + ) -> Result<(GetGspStaticInfoReply, FbLayout)> { let dev = pdev.as_ref(); let bios = Vbios::new(dev, bar)?; @@ -243,6 +252,6 @@ pub(crate) fn boot( Err(e) => dev_warn!(pdev.as_ref(), "GPU name unavailable: {:?}\n", e), } - Ok(()) + Ok((info, fb_layout)) } } -- 2.34.1
