From: Hawking Zhang <[email protected]>

Query mmhub MC_VM_FB_OFFSET, XGMI_LFB_CNTL|SIZE
registers to calculate gmc apeture base address
for A + A configuration

Signed-off-by: Hawking Zhang <[email protected]>
Reviewed-by: Le Ma <[email protected]>
Reviewed-by: Feifei Xu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
index 2bbd63ffe7105..ac0536be0f90c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
@@ -736,8 +736,12 @@ static int gmc_v12_0_mc_init(struct amdgpu_device *adev)
        adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
 
 #ifdef CONFIG_X86_64
-       if ((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) {
-               adev->gmc.aper_base = adev->mmhub.funcs->get_mc_fb_offset(adev);
+       if (((adev->flags & AMD_IS_APU) && !amdgpu_passthrough(adev)) ||
+           (adev->gmc.xgmi.connected_to_cpu)) {
+               adev->gmc.aper_base =
+                       adev->mmhub.funcs->get_mc_fb_offset(adev) +
+                       adev->gmc.xgmi.physical_node_id *
+                       adev->gmc.xgmi.node_segment_size;
                adev->gmc.aper_size = adev->gmc.real_vram_size;
        }
 #endif
-- 
2.53.0

Reply via email to