Skip to content

Commit ee9414e

Browse files
johnhubbardGnurou
authored andcommitted
gpu: nova-core: Hopper/Blackwell: new location for PCI config mirror
Hopper and Blackwell GPUs moved the PCI config space mirror from 0x088000 to 0x092000. Select the correct address per architecture when building the GSP system info command. Signed-off-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Eliot Courtney <ecourtney@nvidia.com> Link: https://patch.msgid.link/20260602032111.224790-3-jhubbard@nvidia.com Co-developed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
1 parent 3411e9a commit ee9414e

7 files changed

Lines changed: 47 additions & 8 deletions

File tree

drivers/gpu/nova-core/gpu.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3+
use core::ops::Range;
4+
35
use kernel::{
46
device,
57
dma::Device,
@@ -134,6 +136,11 @@ impl Chipset {
134136
pub(crate) const fn needs_fwsec_bootloader(self) -> bool {
135137
matches!(self.arch(), Architecture::Turing) || matches!(self, Self::GA100)
136138
}
139+
140+
/// Returns the address range of the PCI config mirror space.
141+
pub(crate) fn pci_config_mirror_range(self) -> Range<u32> {
142+
hal::gpu_hal(self).pci_config_mirror_range()
143+
}
137144
}
138145

139146
// TODO

drivers/gpu/nova-core/gpu/hal.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3+
use core::ops::Range;
4+
35
use kernel::{
46
dma::DmaMask,
57
prelude::*, //
@@ -22,6 +24,9 @@ pub(crate) trait GpuHal {
2224

2325
/// Returns the DMA mask for the current architecture.
2426
fn dma_mask(&self) -> DmaMask;
27+
28+
/// Returns the address range of the PCI config mirror space.
29+
fn pci_config_mirror_range(&self) -> Range<u32>;
2530
}
2631

2732
pub(super) fn gpu_hal(chipset: Chipset) -> &'static dyn GpuHal {

drivers/gpu/nova-core/gpu/hal/gh100.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3+
use core::ops::Range;
4+
35
use kernel::{
46
dma::DmaMask,
57
prelude::*, //
@@ -19,6 +21,13 @@ impl GpuHal for Gh100 {
1921
fn dma_mask(&self) -> DmaMask {
2022
DmaMask::new::<52>()
2123
}
24+
25+
fn pci_config_mirror_range(&self) -> Range<u32> {
26+
const PCI_CONFIG_MIRROR_START: u32 = 0x092000;
27+
const PCI_CONFIG_MIRROR_SIZE: u32 = 0x001000;
28+
29+
PCI_CONFIG_MIRROR_START..PCI_CONFIG_MIRROR_START + PCI_CONFIG_MIRROR_SIZE
30+
}
2231
}
2332

2433
const GH100: Gh100 = Gh100;

drivers/gpu/nova-core/gpu/hal/tu102.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
//!
1919
//! Note that the devinit sequence also needs to run during suspend/resume.
2020
21+
use core::ops::Range;
22+
2123
use kernel::{
2224
dma::DmaMask,
2325
io::{
@@ -85,6 +87,13 @@ impl GpuHal for Tu102 {
8587
fn dma_mask(&self) -> DmaMask {
8688
DmaMask::new::<47>()
8789
}
90+
91+
fn pci_config_mirror_range(&self) -> Range<u32> {
92+
const PCI_CONFIG_MIRROR_START: u32 = 0x088000;
93+
const PCI_CONFIG_MIRROR_SIZE: u32 = 0x001000;
94+
95+
PCI_CONFIG_MIRROR_START..PCI_CONFIG_MIRROR_START + PCI_CONFIG_MIRROR_SIZE
96+
}
8897
}
8998

9099
const TU102: Tu102 = Tu102;

drivers/gpu/nova-core/gsp/boot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl super::Gsp {
144144
dev_dbg!(pdev, "RISC-V active? {}\n", gsp_falcon.is_riscv_active(bar),);
145145

146146
self.cmdq
147-
.send_command_no_wait(bar, commands::SetSystemInfo::new(pdev))?;
147+
.send_command_no_wait(bar, commands::SetSystemInfo::new(pdev, chipset))?;
148148
self.cmdq
149149
.send_command_no_wait(bar, commands::SetRegistry::new())?;
150150

drivers/gpu/nova-core/gsp/commands.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use kernel::{
1919
};
2020

2121
use crate::{
22+
gpu::Chipset,
2223
gsp::{
2324
cmdq::{
2425
Cmdq,
@@ -37,12 +38,13 @@ use crate::{
3738
/// The `GspSetSystemInfo` command.
3839
pub(crate) struct SetSystemInfo<'a> {
3940
pdev: &'a pci::Device<device::Bound>,
41+
chipset: Chipset,
4042
}
4143

4244
impl<'a> SetSystemInfo<'a> {
4345
/// Creates a new `GspSetSystemInfo` command using the parameters of `pdev`.
44-
pub(crate) fn new(pdev: &'a pci::Device<device::Bound>) -> Self {
45-
Self { pdev }
46+
pub(crate) fn new(pdev: &'a pci::Device<device::Bound>, chipset: Chipset) -> Self {
47+
Self { pdev, chipset }
4648
}
4749
}
4850

@@ -53,7 +55,7 @@ impl<'a> CommandToGsp for SetSystemInfo<'a> {
5355
type InitError = Error;
5456

5557
fn init(&self) -> impl Init<Self::Command, Self::InitError> {
56-
Self::Command::init(self.pdev)
58+
Self::Command::init(self.pdev, self.chipset)
5759
}
5860
}
5961

drivers/gpu/nova-core/gsp/fw/commands.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ use kernel::{
1111
}, //
1212
};
1313

14-
use crate::gsp::GSP_PAGE_SIZE;
14+
use crate::{
15+
gpu::Chipset,
16+
gsp::GSP_PAGE_SIZE, //
17+
};
1518

1619
use super::bindings;
1720

@@ -25,8 +28,12 @@ static_assert!(size_of::<GspSetSystemInfo>() < GSP_PAGE_SIZE);
2528
impl GspSetSystemInfo {
2629
/// Returns an in-place initializer for the `GspSetSystemInfo` command.
2730
#[allow(non_snake_case)]
28-
pub(crate) fn init<'a>(dev: &'a pci::Device<device::Bound>) -> impl Init<Self, Error> + 'a {
31+
pub(crate) fn init<'a>(
32+
dev: &'a pci::Device<device::Bound>,
33+
chipset: Chipset,
34+
) -> impl Init<Self, Error> + 'a {
2935
type InnerGspSystemInfo = bindings::GspSystemInfo;
36+
let pci_config_mirror_range = chipset.pci_config_mirror_range();
3037
let init_inner = try_init!(InnerGspSystemInfo {
3138
gpuPhysAddr: dev.resource_start(0)?,
3239
gpuPhysFbAddr: dev.resource_start(1)?,
@@ -36,8 +43,8 @@ impl GspSetSystemInfo {
3643
// Using TASK_SIZE in r535_gsp_rpc_set_system_info() seems wrong because
3744
// TASK_SIZE is per-task. That's probably a design issue in GSP-RM though.
3845
maxUserVa: (1 << 47) - 4096,
39-
pciConfigMirrorBase: 0x088000,
40-
pciConfigMirrorSize: 0x001000,
46+
pciConfigMirrorBase: pci_config_mirror_range.start,
47+
pciConfigMirrorSize: pci_config_mirror_range.end - pci_config_mirror_range.start,
4148

4249
PCIDeviceID: (u32::from(dev.device_id()) << 16) | u32::from(dev.vendor_id().as_raw()),
4350
PCISubDeviceID: (u32::from(dev.subsystem_device_id()) << 16)

0 commit comments

Comments
 (0)