[PATCH 074/159] drm/amdgpu: use physical_node_id to calculate aper_base

Alex Deucher alexander.deucher at amd.com
Wed Feb 24 22:17:34 UTC 2021


From: Hawking Zhang <Hawking.Zhang at amd.com>

Similar as xgmi connected gpu nodes, physical_node_id
* segment_size should be used to calculate the offset
of aper_base.

The asic type check is redundant. once physical_node_id
and segment_size are initialized, it should be count
on.

Signed-off-by: Hawking Zhang <Hawking.Zhang at amd.com>
Reviewed-by: Kevin Wang <kevin1.wang at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 44fc85b78563..37c815094adf 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -1263,19 +1263,13 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
 	 */
 
 	/* check whether both host-gpu and gpu-gpu xgmi links exist */
-	if (adev->gmc.xgmi.supported && adev->gmc.xgmi.connected_to_cpu &&
-	    adev->asic_type == CHIP_ALDEBARAN) {
-
-		adev->gmc.aper_base = adev->gfxhub.funcs->get_mc_fb_offset(adev) +
-			adev->gmc.xgmi.node_id *
+	if ((adev->flags & AMD_IS_APU) ||
+	    (adev->gmc.xgmi.supported &&
+	     adev->gmc.xgmi.connected_to_cpu)) {
+		adev->gmc.aper_base =
+			adev->gfxhub.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;
-
-	}
-
-	if (adev->flags & AMD_IS_APU) {
-		adev->gmc.aper_base = adev->gfxhub.funcs->get_mc_fb_offset(adev);
 		adev->gmc.aper_size = adev->gmc.real_vram_size;
 	}
 
-- 
2.29.2



More information about the amd-gfx mailing list