RE: [PATCH 7/7] drm/amdgpu: correct mca debugfs dump reg list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - General]

Series is

Reviewed-by: Hawking Zhang <Hawking.Zhang@xxxxxxx>

Regards,
Hawking
-----Original Message-----
From: Wang, Yang(Kevin) <KevinYang.Wang@xxxxxxx>
Sent: Wednesday, November 8, 2023 20:58
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: Zhang, Hawking <Hawking.Zhang@xxxxxxx>; Wang, Yang(Kevin) <KevinYang.Wang@xxxxxxx>
Subject: [PATCH 7/7] drm/amdgpu: correct mca debugfs dump reg list

avoid driver to touch invalid mca reg.

Signed-off-by: Yang Wang <kevinyang.wang@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c
index 65926f3c708a..cf33eb219e25 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mca.c
@@ -389,14 +389,21 @@ static int amdgpu_mca_smu_debug_mode_set(void *data, u64 val)  static void mca_dump_entry(struct seq_file *m, struct mca_bank_entry *entry)  {
        int i, idx = entry->idx;
+       int reg_idx_array[] = {
+               MCA_REG_IDX_STATUS,
+               MCA_REG_IDX_ADDR,
+               MCA_REG_IDX_MISC0,
+               MCA_REG_IDX_IPID,
+               MCA_REG_IDX_SYND,
+       };

        seq_printf(m, "mca entry[%d].type: %s\n", idx, entry->type == AMDGPU_MCA_ERROR_TYPE_UE ? "UE" : "CE");
        seq_printf(m, "mca entry[%d].ip: %d\n", idx, entry->ip);
        seq_printf(m, "mca entry[%d].info: socketid:%d aid:%d hwid:0x%03x mcatype:0x%04x\n",
                   idx, entry->info.socket_id, entry->info.aid, entry->info.hwid, entry->info.mcatype);

-       for (i = 0; i < ARRAY_SIZE(entry->regs); i++)
-               seq_printf(m, "mca entry[%d].regs[%d]: 0x%016llx\n", idx, i, entry->regs[i]);
+       for (i = 0; i < ARRAY_SIZE(reg_idx_array); i++)
+               seq_printf(m, "mca entry[%d].regs[%d]: 0x%016llx\n", idx,
+reg_idx_array[i], entry->regs[reg_idx_array[i]]);
 }

 static int mca_dump_show(struct seq_file *m, enum amdgpu_mca_error_type type)
--
2.34.1





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux