AMD General Hi Christian,
The SRAT address is now read in get_mc_fb_offset(), on both the MMHUB and gfxhub helpers. Each call reads the SRAT table and returns the address. The address is not saved. get_xgmi_info() still reads SRAT once, and uses only the length. That length is node_segment_size for the single node at id 0. mc_init copies it into mc_vram_size, real_vram_size, and aper_size, and the sysvm GART placement and PDB0 use it as the VRAM span, so it stays the real VF size rather than a value that is only large enough. amdgpu_gmc_is_pdb0_enabled() is unchanged. It is already true when gmc.xgmi.connected_to_cpu is set, and gmc_v12_0_early_init() sets that from smuio_v15_0_8_is_host_gpu_xgmi_supported() before get_xgmi_info(). An SPM A+A VF takes that path, so the sysvm placement, VMID0 depth 1, block size 12, and amdgpu_gmc_pdb0_alloc() already run. Thanks, Zhigang > -----Original Message----- > From: Koenig, Christian <[email protected]> > Sent: Monday, November 16, 2026 7:05 AM > To: Luo, Zhigang <[email protected]>; [email protected] > Cc: Deucher, Alexander <[email protected]>; Zhang, Hawking > <[email protected]>; Lazar, Lijo <[email protected]> > Subject: Re: [PATCH 7/7] drm/amdgpu: keep the A+A VF VRAM base at the > SRAT address > > On 11/13/26 15:57, Zhigang Luo wrote: > > On the A+A VF the hypervisor reports each VF's VRAM address and length > > in the ACPI SRAT table. The XGMI LFB region and segment registers > > describe the physical GPU, not the VF, so the node id and segment read > > from those registers are not a valid VRAM starting address. > > > > Read the SRAT entry in mmhub_v4_2_0_get_xgmi_info() and report the VF > > as one physical node at id 0 whose segment is the SRAT length. Save > > the SRAT address as the FB offset. get_mc_fb_offset() returns that > > address, and mc_init copies it, plus the node product, into aper_base > > and sets aper_size from the segment. Node id 0 makes the product zero, > > so the PTE base stays at the SRAT address. > > > > v2: > > - Explain that the SRAT address is already the VF VRAM base and must > > not be adjusted by the XGMI node segment. > > > > v3: > > - Report the VF as XGMI node 0 of 1 instead of special-casing the > > node offset and the PDB0 size. > > > > v4: > > - Read SRAT in get_xgmi_info() and derive aper_base and aper_size from > > the FB offset and the segment size. > > - Move the 8GB GART alignment into its own patch. > > > > v5: > > - Revert the SRAT aperture commit with the other two reverts. Leave > > mc_init on the restored connected_to_cpu path. > > > > Signed-off-by: Zhigang Luo <[email protected]> > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 4 ++++ > > drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 8 +++++--- > > drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c | 4 ++++ > > drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 2 +- > > drivers/gpu/drm/amd/amdgpu/mmhub_v4_2_0.c | 25 > > +++++++++++++++++++++++ > > 5 files changed, 39 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h > > index d17055d4c50a..1772c9f5c940 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h > > @@ -231,6 +231,10 @@ struct amdgpu_gmc { > > */ > > resource_size_t aper_size; > > resource_size_t aper_base; > > + /* SPM VF framebuffer offset from SRAT. get_mc_fb_offset() returns > > + * this, and mc_init copies it into aper_base. > > + */ > > + u64 fb_offset; > > /* for some chips with <= 32MB we need to lie > > * about vram size near mc fb location */ > > u64 mc_vram_size; > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h > > index 5f36aff17e79..47092ec6dff2 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h > > @@ -79,11 +79,13 @@ struct amdgpu_xgmi { > > /* from psp */ > > u64 node_id; > > u64 hive_id; > > - /* fixed per family */ > > + /* Segment size. Fixed per family on a hive. On an SPM VF this is > > + * the SRAT length of that one VF. > > + */ > > u64 node_segment_size; > > - /* physical node (0-3) */ > > + /* Physical node, 0-3. An SPM VF is node 0. */ > > unsigned physical_node_id; > > - /* number of nodes (0-4) */ > > + /* Number of nodes, 0-4. An SPM VF reports one node. */ > > unsigned num_physical_nodes; > > /* gpu list in the same hive */ > > struct list_head head; > > diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c > > b/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c > > index b13967a1c8fb..b19f5b601d2c 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c > > +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v12_1.c > > @@ -53,6 +53,10 @@ static u64 gfxhub_v12_1_get_fb_location(struct > > amdgpu_device *adev) > > > > static u64 gfxhub_v12_1_get_mc_fb_offset(struct amdgpu_device *adev) > > { > > + /* SPM VRAM starts at the SRAT address saved as the FB offset. */ > > + if (amdgpu_virt_vram_is_spm(adev)) > > + return adev->gmc.fb_offset; > > + > > return (u64)(RREG32_SOC15(GC, GET_INST(GC, 0), > > regGCMC_VM_FB_OFFSET) << 24); > > } > > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c > > b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c > > index 7e0b83b1015f..14ef841d7036 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c > > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c > > @@ -707,7 +707,7 @@ static void gmc_v12_0_vram_gtt_location(struct > amdgpu_device *adev, > > amdgpu_gmc_agp_location(adev, mc); > > } > > /* base offset of vram pages */ > > - if (amdgpu_sriov_vf(adev)) > > + if (amdgpu_sriov_vf(adev) && !amdgpu_virt_vram_is_spm(adev)) > > adev->vm_manager.vram_base_offset = 0; > > else > > adev->vm_manager.vram_base_offset = > > adev->mmhub.funcs->get_mc_fb_offset(adev); > > diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v4_2_0.c > > b/drivers/gpu/drm/amd/amdgpu/mmhub_v4_2_0.c > > index 4495d52b4b07..8593453445e3 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v4_2_0.c > > +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v4_2_0.c > > @@ -132,6 +132,27 @@ static int mmhub_v4_2_0_get_xgmi_info(struct > amdgpu_device *adev) > > if (!adev->gmc.xgmi.connected_to_cpu) > > return 0; > > > > + /* The SRAT entry is the VF's whole VRAM. PF_LFB_REGION describes > > + * the physical GPU, not the VF, so report a single node. The > > + * length is the segment size; the address is the FB offset. > > + * aper_base is filled from those later. > > + */ > > + if (amdgpu_virt_vram_is_spm(adev)) { > > + u64 fb_offset; > > + int r; > > + > > > + r = amdgpu_acpi_find_gpu_memory_in_srat(adev, &fb_offset, > > + &seg_size); > > + if (r) > > + return r; > > That looks like this call here belongs into > mmhub_v4_2_0_get_mc_fb_offset(), but you need a size for the > xgmi.node_segment_size. > > Either call this function twice or just make adev- > >gmc.xgmi.node_segment_size big enough so that VRAM will always fit into > it. > > What I'm still missing from those patches is modifying > amdgpu_gmc_is_pdb0_enabled(). Where is that done? > > Regards, > Christian. > > > + > > + adev->gmc.fb_offset = fb_offset; > > + adev->gmc.xgmi.num_physical_nodes = 1; > > + adev->gmc.xgmi.physical_node_id = 0; > > + adev->gmc.xgmi.node_segment_size = seg_size; > > + return 0; > > + } > > + > > xgmi_lfb_cntl = RREG32_SOC15(MMHUB, GET_INST(MMHUB, 0), > > regMMMC_VM_XGMI_LFB_CNTL); > > seg_size = REG_GET_FIELD( > > @@ -177,6 +198,10 @@ static u64 mmhub_v4_2_0_get_fb_location(struct > > amdgpu_device *adev) > > > > static u64 mmhub_v4_2_0_get_mc_fb_offset(struct amdgpu_device > *adev) > > { > > + /* SPM VRAM starts at the SRAT address saved as the FB offset. */ > > + if (amdgpu_virt_vram_is_spm(adev)) > > + return adev->gmc.fb_offset; > > + > > return (u64)RREG32_SOC15(MMHUB, GET_INST(MMHUB, 0), > > regMMMC_VM_FB_OFFSET) << 24; }
