<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Series is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dennis Li <Dennis.Li@amd.com><br>
<b>Sent:</b> Wednesday, November 20, 2019 5:49 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com>; Zhou1, Tao <Tao.Zhou1@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Chen, Guchun <Guchun.Chen@amd.com><br>
<b>Cc:</b> Li, Dennis <Dennis.Li@amd.com>; Li, Dennis <Dennis.Li@amd.com><br>
<b>Subject:</b> [PATCH v2 1/3] drm/amdgpu: define soc15_ras_field_entry for reuse</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The struct soc15_ras_field_entry will be reused by<br>
other IPs, such as mmhub and gc<br>
<br>
v2: rename ras_subblock_regs to gc_ras_fields_vg20,<br>
because the future asic maybe have a different table.<br>
<br>
Change-Id: I6c3388a09b5fbf927ad90fcd626baa448d1681a6<br>
Signed-off-by: Dennis Li <dennis.li@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 34 +++++++++------------------<br>
 drivers/gpu/drm/amd/amdgpu/soc15.h    | 12 ++++++++++<br>
 2 files changed, 23 insertions(+), 23 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
index c7ae685d6f74..8073fcd4720e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
@@ -131,18 +131,6 @@ MODULE_FIRMWARE("amdgpu/renoir_rlc.bin");<br>
 #define mmTCP_CHAN_STEER_5_ARCT                                                         0x0b0c<br>
 #define mmTCP_CHAN_STEER_5_ARCT_BASE_IDX                                                        0<br>
 <br>
-struct ras_gfx_subblock_reg {<br>
-       const char *name;<br>
-       uint32_t hwip;<br>
-       uint32_t inst;<br>
-       uint32_t seg;<br>
-       uint32_t reg_offset;<br>
-       uint32_t sec_count_mask;<br>
-       uint32_t sec_count_shift;<br>
-       uint32_t ded_count_mask;<br>
-       uint32_t ded_count_shift;<br>
-};<br>
-<br>
 enum ta_ras_gfx_subblock {<br>
         /*CPC*/<br>
         TA_RAS_BLOCK__GFX_CPC_INDEX_START = 0,<br>
@@ -5487,7 +5475,7 @@ static int gfx_v9_0_priv_inst_irq(struct amdgpu_device *adev,<br>
 }<br>
 <br>
 <br>
-static const struct ras_gfx_subblock_reg ras_subblock_regs[] = {<br>
+static const struct soc15_ras_field_entry gc_ras_fields_vg20[] = {<br>
         { "CPC_SCRATCH", SOC15_REG_ENTRY(GC, 0, mmCPC_EDC_SCRATCH_CNT),<br>
           SOC15_REG_FIELD(CPC_EDC_SCRATCH_CNT, SEC_COUNT),<br>
           SOC15_REG_FIELD(CPC_EDC_SCRATCH_CNT, DED_COUNT)<br>
@@ -6146,29 +6134,29 @@ static int __get_ras_error_count(const struct soc15_reg_entry *reg,<br>
         uint32_t i;<br>
         uint32_t sec_cnt, ded_cnt;<br>
 <br>
-       for (i = 0; i < ARRAY_SIZE(ras_subblock_regs); i++) {<br>
-               if(ras_subblock_regs[i].reg_offset != reg->reg_offset ||<br>
-                       ras_subblock_regs[i].seg != reg->seg ||<br>
-                       ras_subblock_regs[i].inst != reg->inst)<br>
+       for (i = 0; i < ARRAY_SIZE(gc_ras_fields_vg20); i++) {<br>
+               if(gc_ras_fields_vg20[i].reg_offset != reg->reg_offset ||<br>
+                       gc_ras_fields_vg20[i].seg != reg->seg ||<br>
+                       gc_ras_fields_vg20[i].inst != reg->inst)<br>
                         continue;<br>
 <br>
                 sec_cnt = (value &<br>
-                               ras_subblock_regs[i].sec_count_mask) >><br>
-                               ras_subblock_regs[i].sec_count_shift;<br>
+                               gc_ras_fields_vg20[i].sec_count_mask) >><br>
+                               gc_ras_fields_vg20[i].sec_count_shift;<br>
                 if (sec_cnt) {<br>
                         DRM_INFO("GFX SubBlock %s, Instance[%d][%d], SEC %d\n",<br>
-                               ras_subblock_regs[i].name,<br>
+                               gc_ras_fields_vg20[i].name,<br>
                                 se_id, inst_id,<br>
                                 sec_cnt);<br>
                         *sec_count += sec_cnt;<br>
                 }<br>
 <br>
                 ded_cnt = (value &<br>
-                               ras_subblock_regs[i].ded_count_mask) >><br>
-                               ras_subblock_regs[i].ded_count_shift;<br>
+                               gc_ras_fields_vg20[i].ded_count_mask) >><br>
+                               gc_ras_fields_vg20[i].ded_count_shift;<br>
                 if (ded_cnt) {<br>
                         DRM_INFO("GFX SubBlock %s, Instance[%d][%d], DED %d\n",<br>
-                               ras_subblock_regs[i].name,<br>
+                               gc_ras_fields_vg20[i].name,<br>
                                 se_id, inst_id,<br>
                                 ded_cnt);<br>
                         *ded_count += ded_cnt;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.h b/drivers/gpu/drm/amd/amdgpu/soc15.h<br>
index 9af6c6ffbfa2..344280b869c4 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/soc15.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.h<br>
@@ -60,6 +60,18 @@ struct soc15_allowed_register_entry {<br>
         bool grbm_indexed;<br>
 };<br>
 <br>
+struct soc15_ras_field_entry {<br>
+       const char *name;<br>
+       uint32_t hwip;<br>
+       uint32_t inst;<br>
+       uint32_t seg;<br>
+       uint32_t reg_offset;<br>
+       uint32_t sec_count_mask;<br>
+       uint32_t sec_count_shift;<br>
+       uint32_t ded_count_mask;<br>
+       uint32_t ded_count_shift;<br>
+};<br>
+<br>
 #define SOC15_REG_ENTRY(ip, inst, reg)  ip##_HWIP, inst, reg##_BASE_IDX, reg<br>
 <br>
 #define SOC15_REG_ENTRY_OFFSET(entry)   (adev->reg_offset[entry.hwip][entry.inst][entry.seg] + entry.reg_offset)<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</body>
</html>