<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:15pt;" align="Left">
[AMD Official Use Only]<br>
</p>
<br>
<div>
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Thanks. I will fix that check.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Rohit<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Deucher, Alexander <Alexander.Deucher@amd.com>
<br>
<b>Sent:</b> June 4, 2021 10:56 AM<br>
<b>To:</b> Khaire, Rohit <Rohit.Khaire@amd.com>; amd-gfx@lists.freedesktop.org; Zhang, Hawking <Hawking.Zhang@amd.com>; Deng, Emily <Emily.Deng@amd.com>; Liu, Monk <Monk.Liu@amd.com>; Zhou, Peng Ju <PengJu.Zhou@amd.com>; Chen, Horace <Horace.Chen@amd.com><br>
<b>Cc:</b> Ming, Davis <Davis.Ming@amd.com>; Koenig, Christian <Christian.Koenig@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: Fix incorrect register offsets for Sienna Cichlid<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="margin:15.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:blue">[AMD Official Use Only]<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">checks should be </span>
<span style="color:black">adev->asic_type >= CHIP_SIENNA_CICHLID so we cover other gfx10.3 asics as well.  With that fixed:</span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Reviewed-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com">alexander.deucher@amd.com</a>></span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Khaire, Rohit <<a href="mailto:Rohit.Khaire@amd.com">Rohit.Khaire@amd.com</a>><br>
<b>Sent:</b> Friday, June 4, 2021 10:49 AM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>>; Deucher, Alexander <<a href="mailto:Alexander.Deucher@amd.com">Alexander.Deucher@amd.com</a>>;
 Zhang, Hawking <<a href="mailto:Hawking.Zhang@amd.com">Hawking.Zhang@amd.com</a>>; Deng, Emily <<a href="mailto:Emily.Deng@amd.com">Emily.Deng@amd.com</a>>; Liu, Monk <<a href="mailto:Monk.Liu@amd.com">Monk.Liu@amd.com</a>>; Zhou, Peng Ju <<a href="mailto:PengJu.Zhou@amd.com">PengJu.Zhou@amd.com</a>>;
 Chen, Horace <<a href="mailto:Horace.Chen@amd.com">Horace.Chen@amd.com</a>><br>
<b>Cc:</b> Ming, Davis <<a href="mailto:Davis.Ming@amd.com">Davis.Ming@amd.com</a>>; Khaire, Rohit <<a href="mailto:Rohit.Khaire@amd.com">Rohit.Khaire@amd.com</a>>; Koenig, Christian <<a href="mailto:Christian.Koenig@amd.com">Christian.Koenig@amd.com</a>>;
 Khaire, Rohit <<a href="mailto:Rohit.Khaire@amd.com">Rohit.Khaire@amd.com</a>><br>
<b>Subject:</b> [PATCH] drm/amdgpu: Fix incorrect register offsets for Sienna Cichlid</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">RLC_CP_SCHEDULERS and RLC_SPARE_INT0 have different<br>
offsets for Sienna Cichlid<br>
<br>
Signed-off-by: Rohit Khaire <<a href="mailto:rohit.khaire@amd.com">rohit.khaire@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 26 +++++++++++++++++++++-----<br>
 1 file changed, 21 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
index 11a64ca8a5ec..1e1ce1e49c70 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c<br>
@@ -177,6 +177,9 @@<br>
 #define mmGC_THROTTLE_CTRL_Sienna_Cichlid              0x2030<br>
 #define mmGC_THROTTLE_CTRL_Sienna_Cichlid_BASE_IDX     0<br>
 <br>
+#define mmRLC_SPARE_INT_0_Sienna_Cichlid               0x4ca5<br>
+#define mmRLC_SPARE_INT_0_Sienna_Cichlid_BASE_IDX      1<br>
+<br>
 #define GFX_RLCG_GC_WRITE_OLD   (0x8 << 28)<br>
 #define GFX_RLCG_GC_WRITE       (0x0 << 28)<br>
 #define GFX_RLCG_GC_READ        (0x1 << 28)<br>
@@ -1489,8 +1492,15 @@ static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32<br>
                        (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG2) * 4;<br>
         scratch_reg3 = adev->rmmio +<br>
                        (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG3) * 4;<br>
-       spare_int = adev->rmmio +<br>
-                   (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT) * 4;<br>
+<br>
+       if (adev->asic_type == CHIP_SIENNA_CICHLID) {<br>
+               spare_int = adev->rmmio +<br>
+                           (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_0_Sienna_Cichlid_BASE_IDX]<br>
+                            + mmRLC_SPARE_INT_0_Sienna_Cichlid) * 4;<br>
+       } else {<br>
+               spare_int = adev->rmmio +<br>
+                           (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT) * 4;<br>
+       }<br>
 <br>
         grbm_cntl = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_CNTL_BASE_IDX] + mmGRBM_GFX_CNTL;<br>
         grbm_idx = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_INDEX_BASE_IDX] + mmGRBM_GFX_INDEX;<br>
@@ -7410,9 +7420,15 @@ static int gfx_v10_0_hw_fini(void *handle)<br>
         if (amdgpu_sriov_vf(adev)) {<br>
                 gfx_v10_0_cp_gfx_enable(adev, false);<br>
                 /* Program KIQ position of RLC_CP_SCHEDULERS during destroy */<br>
-               tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS);<br>
-               tmp &= 0xffffff00;<br>
-               WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS, tmp);<br>
+               if (adev->asic_type == CHIP_SIENNA_CICHLID) {<br>
+                       tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid);<br>
+                       tmp &= 0xffffff00;<br>
+                       WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid, tmp);<br>
+               } else {<br>
+                       tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS);<br>
+                       tmp &= 0xffffff00;<br>
+                       WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS, tmp);<br>
+               }<br>
 <br>
                 return 0;<br>
         }<br>
-- <br>
2.17.1<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>