gpu: nova-core: Use bar1_resource_index() in NovaCoreApi::bar1_size()

bar1_size() reports the length of PCI resource 1 as the size of BAR1.
That is only correct when BAR0 is a 32-bit BAR. On Blackwell, and on some
Ampere GA100 and Hopper SKUs, BAR0 is 64-bit and takes resource slots 0
and 1, pushing BAR1 to slot 2. Slot 1 is then the upper half of BAR0
rather than a BAR of its own, so NOVA_GETPARAM_VRAM_BAR_SIZE reports the
wrong size on those GPUs.

Probe handles this with the new bar1_resource_index(), which it uses to
map BAR1, so use the same lookup here.

Fixes: 7edc491f6f ("drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter")
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Link: https://patch.msgid.link/20261001005615.77130-1-apopple@nvidia.com
[ Import the driver module. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
Alistair Popple 2026-10-01 10:56:15 +10:00 committed by Danilo Krummrich
parent 04476103b7
commit e56059016a

View File

@ -15,8 +15,11 @@
pub use crate::gpu::Spec;
use crate::gpu::Gpu;
use crate::gsp::commands::GetGspStaticInfoReply;
use crate::{
driver,
gpu::Gpu,
gsp::commands::GetGspStaticInfoReply, //
};
/// API handle for the auxiliary bus child drivers to interact with nova-core.
pub struct NovaCoreApi<'bound> {
@ -44,7 +47,9 @@ pub fn spec(&self) -> &Spec {
/// Returns the size of the PCIe BAR used for accessing VRAM, typically
/// BAR1.
pub fn bar1_size(&self) -> Result<u64> {
self.pdev.resource_len(1)
let bar1 = driver::bar1_resource_index(self.pdev)?;
self.pdev.resource_len(bar1)
}
}