<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">
<p style="font-family:Arial;font-size:10pt;color:#008000;margin:15pt;" align="Left">
[Public]<br>
</p>
<br>
<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> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Yifan Zhang <yifan1.zhang@amd.com><br>
<b>Sent:</b> Thursday, July 29, 2021 5:46 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhang, Yifan <Yifan1.Zhang@amd.com><br>
<b>Subject:</b> [PATCH v4] drm/amdgpu: fix the doorbell missing when in CGPG issue for renoir.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">If GC has entered CGPG, ringing doorbell > first page doesn't wakeup GC.<br>
Enlarge CP_MEC_DOORBELL_RANGE_UPPER to workaround this issue.<br>
<br>
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 21 ++++++++++++++++++++-<br>
 1 file changed, 20 insertions(+), 1 deletion(-)<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 03acc777adf7..ab79ca770dcd 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c<br>
@@ -1295,6 +1295,16 @@ static bool is_raven_kicker(struct amdgpu_device *adev)<br>
                 return false;<br>
 }<br>
 <br>
+static bool check_if_enlarge_doorbell_range(struct amdgpu_device *adev)<br>
+{<br>
+       if ((adev->asic_type == CHIP_RENOIR) &&<br>
+           (adev->gfx.me_fw_version >= 0x000000a5) &&<br>
+           (adev->gfx.me_feature_version >= 52))<br>
+               return true;<br>
+       else<br>
+               return false;<br>
+}<br>
+<br>
 static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)<br>
 {<br>
         if (gfx_v9_0_should_disable_gfxoff(adev->pdev))<br>
@@ -3675,7 +3685,16 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)<br>
         if (ring->use_doorbell) {<br>
                 WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_LOWER,<br>
                                         (adev->doorbell_index.kiq * 2) << 2);<br>
-               WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,<br>
+               /* If GC has entered CGPG, ringing doorbell > first page<br>
+                * doesn't wakeup GC. Enlarge CP_MEC_DOORBELL_RANGE_UPPER to<br>
+                * workaround this issue. And this change has to align with firmware<br>
+                * update.<br>
+                */<br>
+               if (check_if_enlarge_doorbell_range(adev))<br>
+                       WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,<br>
+                                       (adev->doorbell.size - 4));<br>
+               else<br>
+                       WREG32_SOC15(GC, 0, mmCP_MEC_DOORBELL_RANGE_UPPER,<br>
                                         (adev->doorbell_index.userqueue_end * 2) << 2);<br>
         }<br>
 <br>
-- <br>
2.25.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Calexander.deucher%40amd.com%7Cc3367e51b7f7457dd02d08d95275c11f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637631487971875543%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=SlwGsspm4%2BGSekdb%2F9Tl1rvDhaH%2BJHBDv5%2BgoazxabY%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Calexander.deucher%40amd.com%7Cc3367e51b7f7457dd02d08d95275c11f%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637631487971875543%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=SlwGsspm4%2BGSekdb%2F9Tl1rvDhaH%2BJHBDv5%2BgoazxabY%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>