From e56059016a8753f26dcd6c9d826ccfdd45e8b80c Mon Sep 17 00:00:00 2001 From: Alistair Popple Date: Thu, 1 Oct 2026 10:56:15 +1000 Subject: [PATCH] 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: 7edc491f6fca ("drm: nova: Use nova-core to read VRAM_BAR_SIZE parameter") Signed-off-by: Alistair Popple Reviewed-by: Alexandre Courbot Link: https://patch.msgid.link/20261001005615.77130-1-apopple@nvidia.com [ Import the driver module. - Danilo ] Signed-off-by: Danilo Krummrich --- drivers/gpu/nova-core/api.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nova-core/api.rs b/drivers/gpu/nova-core/api.rs index f02c6c7c7e51..29207c4bb743 100644 --- a/drivers/gpu/nova-core/api.rs +++ b/drivers/gpu/nova-core/api.rs @@ -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 { - self.pdev.resource_len(1) + let bar1 = driver::bar1_resource_index(self.pdev)?; + + self.pdev.resource_len(bar1) } }