<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Reviewed-By: John Clements <john.clements@amd.com><br>
</div>
<div>
<div id="appendonsend"></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size: 11pt;" face="Calibri, sans-serif" color="#000000"><b>From:</b> Joshi, Mukul <Mukul.Joshi@amd.com><br>
<b>Sent:</b> Thursday, July 29, 2021 11:37 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Clements, John <John.Clements@amd.com>; Zhang, Hawking <Hawking.Zhang@amd.com>; Joshi, Mukul <Mukul.Joshi@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: Fix channel_index table layout for Aldebaran</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Fix the channel_index table layout to fetch the correct<br>
channel_index when calculating physical address from<br>
normalized address during page retirement.<br>
Also, fix the number of UMC instances and number of channels<br>
within each UMC instance for Aldebaran.<br>
<br>
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c |  4 ++--<br>
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.c | 16 ++++++++--------<br>
 drivers/gpu/drm/amd/amdgpu/umc_v6_7.h |  4 ++--<br>
 3 files changed, 12 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
index 7cf653f9e9a7..097230b5e946 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
@@ -1171,8 +1171,8 @@ static void gmc_v9_0_set_umc_funcs(struct amdgpu_device *adev)<br>
                 break;<br>
         case CHIP_ALDEBARAN:<br>
                 adev->umc.max_ras_err_cnt_per_query = UMC_V6_7_TOTAL_CHANNEL_NUM;<br>
-               adev->umc.channel_inst_num = UMC_V6_7_UMC_INSTANCE_NUM;<br>
-               adev->umc.umc_inst_num = UMC_V6_7_CHANNEL_INSTANCE_NUM;<br>
+               adev->umc.channel_inst_num = UMC_V6_7_CHANNEL_INSTANCE_NUM;<br>
+               adev->umc.umc_inst_num = UMC_V6_7_UMC_INSTANCE_NUM;<br>
                 adev->umc.channel_offs = UMC_V6_7_PER_CHANNEL_OFFSET;<br>
                 if (!adev->gmc.xgmi.connected_to_cpu)<br>
                         adev->umc.ras_funcs = &umc_v6_7_ras_funcs;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c b/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c<br>
index 7da12110425c..bb30336b1e8d 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v6_7.c<br>
@@ -30,17 +30,17 @@<br>
 <br>
 const uint32_t<br>
         umc_v6_7_channel_idx_tbl_second[UMC_V6_7_UMC_INSTANCE_NUM][UMC_V6_7_CHANNEL_INSTANCE_NUM] = {<br>
-               {28, 12, 6, 22},        {19, 3, 9, 25},<br>
-               {20, 4, 30, 14},        {11, 27, 1, 17},<br>
-               {24, 8, 2, 18},         {15, 31, 5, 21},<br>
-               {16, 0, 26, 10},        {7, 23, 29, 13}<br>
+               {28, 20, 24, 16, 12, 4, 8, 0},<br>
+               {6, 30, 2, 26, 22, 14, 18, 10},<br>
+               {19, 11, 15, 7, 3, 27, 31, 23},<br>
+               {9, 1, 5, 29, 25, 17, 21, 13}<br>
 };<br>
 const uint32_t<br>
         umc_v6_7_channel_idx_tbl_first[UMC_V6_7_UMC_INSTANCE_NUM][UMC_V6_7_CHANNEL_INSTANCE_NUM] = {<br>
-               {19, 3, 9, 25},         {28, 12, 6, 22},<br>
-               {11, 27, 1, 17},        {20, 4, 30, 14},<br>
-               {15, 31, 5, 21},        {24, 8, 2, 18},<br>
-               {7, 23, 29, 13},        {16, 0, 26, 10}<br>
+               {19, 11, 15, 7, 3, 27, 31, 23},<br>
+               {9, 1, 5, 29, 25, 17, 21, 13},<br>
+               {28, 20, 24, 16, 12, 4, 8, 0},<br>
+               {6, 30, 2, 26, 22, 14, 18, 10},<br>
 };<br>
 <br>
 static inline uint32_t get_umc_v6_7_reg_offset(struct amdgpu_device *adev,<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/umc_v6_7.h b/drivers/gpu/drm/amd/amdgpu/umc_v6_7.h<br>
index 81b8f1844091..57f2557e7aca 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/umc_v6_7.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/umc_v6_7.h<br>
@@ -36,9 +36,9 @@<br>
 #define UMC_V6_7_INST_DIST      0x40000<br>
 <br>
 /* number of umc channel instance with memory map register access */<br>
-#define UMC_V6_7_CHANNEL_INSTANCE_NUM          4<br>
+#define UMC_V6_7_UMC_INSTANCE_NUM              4<br>
 /* number of umc instance with memory map register access */<br>
-#define UMC_V6_7_UMC_INSTANCE_NUM              8<br>
+#define UMC_V6_7_CHANNEL_INSTANCE_NUM          8<br>
 /* total channel instances in one umc block */<br>
 #define UMC_V6_7_TOTAL_CHANNEL_NUM      (UMC_V6_7_CHANNEL_INSTANCE_NUM * UMC_V6_7_UMC_INSTANCE_NUM)<br>
 /* UMC regiser per channel offset */<br>
-- <br>
2.17.1<br>
<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>