Hopper and Blackwell GPUs use a different PCI config mirror base address (0x092000) compared to earlier architectures (0x088000). Pass the chipset through to GspSetSystemInfo::init() so it can select the correct address.
Signed-off-by: John Hubbard <[email protected]> --- drivers/gpu/nova-core/gsp/boot.rs | 2 +- drivers/gpu/nova-core/gsp/commands.rs | 8 +++++--- drivers/gpu/nova-core/gsp/fw/commands.rs | 18 +++++++++++++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs index 5284a35dcc2c..04b6141a9c38 100644 --- a/drivers/gpu/nova-core/gsp/boot.rs +++ b/drivers/gpu/nova-core/gsp/boot.rs @@ -388,7 +388,7 @@ pub(crate) fn boot( // Now that GSP is active, send system info and registry self.cmdq - .send_command(bar, commands::SetSystemInfo::new(pdev))?; + .send_command(bar, commands::SetSystemInfo::new(pdev, chipset))?; self.cmdq.send_command(bar, commands::SetRegistry::new())?; if matches!( diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs index c8430a076269..a0ca13afda52 100644 --- a/drivers/gpu/nova-core/gsp/commands.rs +++ b/drivers/gpu/nova-core/gsp/commands.rs @@ -20,6 +20,7 @@ use crate::{ driver::Bar0, + gpu::Chipset, gsp::{ cmdq::{ Cmdq, @@ -37,12 +38,13 @@ /// The `GspSetSystemInfo` command. pub(crate) struct SetSystemInfo<'a> { pdev: &'a pci::Device<device::Bound>, + chipset: Chipset, } impl<'a> SetSystemInfo<'a> { /// Creates a new `GspSetSystemInfo` command using the parameters of `pdev`. - pub(crate) fn new(pdev: &'a pci::Device<device::Bound>) -> Self { - Self { pdev } + pub(crate) fn new(pdev: &'a pci::Device<device::Bound>, chipset: Chipset) -> Self { + Self { pdev, chipset } } } @@ -52,7 +54,7 @@ impl<'a> CommandToGsp for SetSystemInfo<'a> { type InitError = Error; fn init(&self) -> impl Init<Self::Command, Self::InitError> { - GspSetSystemInfo::init(self.pdev) + GspSetSystemInfo::init(self.pdev, self.chipset) } } diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs index 470d8edb62ff..fe8f56ba3e80 100644 --- a/drivers/gpu/nova-core/gsp/fw/commands.rs +++ b/drivers/gpu/nova-core/gsp/fw/commands.rs @@ -10,7 +10,13 @@ }, // }; -use crate::gsp::GSP_PAGE_SIZE; +use crate::{ + gpu::{ + Architecture, + Chipset, // + }, + gsp::GSP_PAGE_SIZE, // +}; use super::bindings; @@ -24,7 +30,10 @@ pub(crate) struct GspSetSystemInfo { impl GspSetSystemInfo { /// Returns an in-place initializer for the `GspSetSystemInfo` command. #[allow(non_snake_case)] - pub(crate) fn init<'a>(dev: &'a pci::Device<device::Bound>) -> impl Init<Self, Error> + 'a { + pub(crate) fn init<'a>( + dev: &'a pci::Device<device::Bound>, + chipset: Chipset, + ) -> impl Init<Self, Error> + 'a { type InnerGspSystemInfo = bindings::GspSystemInfo; let init_inner = try_init!(InnerGspSystemInfo { gpuPhysAddr: dev.resource_start(0)?, @@ -35,7 +44,10 @@ pub(crate) fn init<'a>(dev: &'a pci::Device<device::Bound>) -> impl Init<Self, E // Using TASK_SIZE in r535_gsp_rpc_set_system_info() seems wrong because // TASK_SIZE is per-task. That's probably a design issue in GSP-RM though. maxUserVa: (1 << 47) - 4096, - pciConfigMirrorBase: 0x088000, + pciConfigMirrorBase: match chipset.arch() { + Architecture::Turing | Architecture::Ampere | Architecture::Ada => 0x088000, + Architecture::Hopper | Architecture::Blackwell => 0x092000, + }, pciConfigMirrorSize: 0x001000, PCIDeviceID: (u32::from(dev.device_id()) << 16) | u32::from(dev.vendor_id().as_raw()), -- 2.52.0
