[PATCH 1/1] drm/amdgpu/ras: use vram_base_offset for UMC inject address

Stanley.Yang <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
Cover both XGMI hive offset and A+A platform MC FB offset in one calculation.

Signed-off-by: Stanley.Yang <[email protected]>
Reviewed-by: Tao Zhou <[email protected]>

---
 .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_cmd.c    | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_cmd.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_cmd.c
index c28ecdb78e4f..b5fb667df5e9 100644
--- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_cmd.c
+++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_cmd.c
@@ -76,15 +76,6 @@ static int amdgpu_ras_trigger_error_end(struct ras_core_context *ras_core,
 	return 0;
 }
 
-static uint64_t local_addr_to_xgmi_global_addr(struct ras_core_context *ras_core,
-					   uint64_t addr)
-{
-	struct amdgpu_device *adev = (struct amdgpu_device *)ras_core->dev;
-	struct amdgpu_xgmi *xgmi = &adev->gmc.xgmi;
-
-	return (addr + xgmi->physical_node_id * xgmi->node_segment_size);
-}
-
 /*
  * UMC error injection is dispatched by the RAS TA using the injection method
  * carried in struct ras_cmd_inject_error_req. Only the "coherent" methods
@@ -157,9 +148,11 @@ static int amdgpu_ras_inject_error(struct ras_core_context *ras_core,
 				return RAS_CMD__ERROR_INVALID_INPUT_DATA;
 			}
 
-			/* Calculate XGMI relative offset */
-			if (adev->gmc.xgmi.num_physical_nodes > 1)
-				req->address = local_addr_to_xgmi_global_addr(ras_core, req->address);
+			/*
+			 * Calculate XGMI relative offset if in XGMI hive,
+			 * adapt to A+A platform with mc fb offset calculated.
+			 */
+			req->address += adev->vm_manager.vram_base_offset;
 		}
 	}
 
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.