From: Philip Yang <[email protected]>

Output IH cookie node_id and translate it to the corresponding AID id
and XCC id, to help debug the GPU page fault.

Signed-off-by: Philip Yang <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index d819b544b043..016adcfe8c49 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -555,7 +555,9 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device 
*adev,
        const char *mmhub_cid;
        const char *hub_name;
        u64 addr;
-       uint32_t node_id = 0;
+       uint32_t node_id;
+
+       node_id = (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) ? 
entry->node_id : 0;
 
        addr = (u64)entry->src_data[0] << 12;
        addr |= ((u64)entry->src_data[1] & 0xf) << 44;
@@ -568,8 +570,6 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device 
*adev,
                hub = &adev->vmhub[AMDGPU_MMHUB1(0)];
        } else {
                hub_name = "gfxhub0";
-               node_id = (adev->ip_versions[GC_HWIP][0] ==
-                          IP_VERSION(9, 4, 3)) ? entry->node_id : 0;
                hub = &adev->vmhub[node_id/2];
        }
 
@@ -616,6 +616,11 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device 
*adev,
                addr, entry->client_id,
                soc15_ih_clientid_name[entry->client_id]);
 
+       if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3))
+               dev_err(adev->dev, "  cookie node_id %d fault from die 
%s%d%s\n",
+                       node_id, node_id % 4 == 3 ? "RSV" : "AID", node_id / 4,
+                       node_id % 4 == 1 ? ".XCD0" : node_id % 4 == 2 ? ".XCD1" 
: "");
+
        if (amdgpu_sriov_vf(adev))
                return 0;
 
-- 
2.39.2

Reply via email to