<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Got it. Thanks.
<div class="">Reviewed-by: Kenneth Feng <<a href="mailto:kenneth.feng@amd.com" class="">kenneth.feng@amd.com</a></div>
<div class=""><br class="">
<div style="">
<blockquote type="cite" class="">
<div class="">在 2019年12月4日,下午6:23,Quan, Evan <<a href="mailto:Evan.Quan@amd.com" class="">Evan.Quan@amd.com</a>> 写道:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">The abort operation is added in smu_v11_0_send_msg_with_param.<br class="">
And for smu_v11_0_wait_for_response, yes, it's only code factoring.<br class="">
<br class="">
<blockquote type="cite" class="">-----Original Message-----<br class="">
From: Feng, Kenneth <<a href="mailto:Kenneth.Feng@amd.com" class="">Kenneth.Feng@amd.com</a>><br class="">
Sent: Wednesday, December 4, 2019 6:14 PM<br class="">
To: Quan, Evan <<a href="mailto:Evan.Quan@amd.com" class="">Evan.Quan@amd.com</a>><br class="">
Cc: <a href="mailto:amd-gfx@lists.freedesktop.org" class="">amd-gfx@lists.freedesktop.org</a><br class="">
Subject: Re: [PATCH 2/2] drm/amd/powerplay: pre-check the SMU state before<br class="">
issuing message<br class="">
<br class="">
Hi Evan,<br class="">
The original design is also aborting sending the message because of a ‘break’<br class="">
there.<br class="">
Your patch is for code factoring?<br class="">
Thanks.<br class="">
<br class="">
<blockquote type="cite" class="">在 2019年12月4日,下午5:53,Evan Quan <<a href="mailto:Evan.Quan@amd.com" class="">Evan.Quan@amd.com</a>> 写<br class="">
</blockquote>
道:<br class="">
<blockquote type="cite" class=""><br class="">
[CAUTION: External Email]<br class="">
<br class="">
Abort the message issuing if the SMU was not in the right state.<br class="">
<br class="">
Change-Id: Ida9f911e051f6e78de4f475956c78637e56e6ea3<br class="">
Signed-off-by: Evan Quan <<a href="mailto:evan.quan@amd.com" class="">evan.quan@amd.com</a>><br class="">
---<br class="">
drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 ++++++++--------<br class="">
drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 16 ++++++++--------<br class="">
2 files changed, 16 insertions(+), 16 deletions(-)<br class="">
<br class="">
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br class="">
b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br class="">
index 325ec4864f90..d84c7f5fb01a 100644<br class="">
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br class="">
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br class="">
@@ -68,15 +68,13 @@ static int smu_v11_0_wait_for_response(struct<br class="">
</blockquote>
smu_context *smu)<br class="">
<blockquote type="cite" class="">      for (i = 0; i < timeout; i++) {<br class="">
              cur_value = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90);<br class="">
              if ((cur_value & MP1_C2PMSG_90__CONTENT_MASK) != 0)<br class="">
-                       break;<br class="">
+                       return cur_value == 0x1 ? 0 : -EIO;<br class="">
+<br class="">
              udelay(1);<br class="">
      }<br class="">
<br class="">
      /* timeout means wrong logic */<br class="">
-       if (i == timeout)<br class="">
-               return -ETIME;<br class="">
-<br class="">
-       return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90) == 0x1 ? 0 :<br class="">
</blockquote>
-EIO;<br class="">
<blockquote type="cite" class="">+       return -ETIME;<br class="">
}<br class="">
<br class="">
int<br class="">
@@ -92,9 +90,11 @@ smu_v11_0_send_msg_with_param(struct<br class="">
</blockquote>
smu_context *smu,<br class="">
<blockquote type="cite" class="">              return index;<br class="">
<br class="">
      ret = smu_v11_0_wait_for_response(smu);<br class="">
-       if (ret)<br class="">
-               pr_err("failed send message: %10s (%d) \tparam: 0x%08x<br class="">
</blockquote>
response %#x\n",<br class="">
<blockquote type="cite" class="">-                      smu_get_message_name(smu, msg), index, param, ret);<br class="">
+       if (ret) {<br class="">
+               pr_err("Msg issuing pre-check failed and "<br class="">
+                      "SMU may be not in the right state!\n");<br class="">
+               return ret;<br class="">
+       }<br class="">
<br class="">
      WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);<br class="">
<br class="">
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br class="">
b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br class="">
index 7f5f7e12a41e..a638326ba1b7 100644<br class="">
--- a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br class="">
+++ b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br class="">
@@ -56,15 +56,13 @@ int smu_v12_0_wait_for_response(struct<br class="">
</blockquote>
smu_context *smu)<br class="">
<blockquote type="cite" class="">      for (i = 0; i < adev->usec_timeout; i++) {<br class="">
              cur_value = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90);<br class="">
              if ((cur_value & MP1_C2PMSG_90__CONTENT_MASK) != 0)<br class="">
-                       break;<br class="">
+                       return cur_value == 0x1 ? 0 : -EIO;<br class="">
+<br class="">
              udelay(1);<br class="">
      }<br class="">
<br class="">
      /* timeout means wrong logic */<br class="">
-       if (i == adev->usec_timeout)<br class="">
-               return -ETIME;<br class="">
-<br class="">
-       return RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90) == 0x1 ? 0 :<br class="">
</blockquote>
-EIO;<br class="">
<blockquote type="cite" class="">+       return -ETIME;<br class="">
}<br class="">
<br class="">
int<br class="">
@@ -80,9 +78,11 @@ smu_v12_0_send_msg_with_param(struct<br class="">
</blockquote>
smu_context *smu,<br class="">
<blockquote type="cite" class="">              return index;<br class="">
<br class="">
      ret = smu_v12_0_wait_for_response(smu);<br class="">
-       if (ret)<br class="">
-               pr_err("Failed to send message 0x%x, response 0x%x, param<br class="">
</blockquote>
0x%x\n",<br class="">
<blockquote type="cite" class="">-                      index, ret, param);<br class="">
+       if (ret) {<br class="">
+               pr_err("Msg issuing pre-check failed and "<br class="">
+                      "SMU may be not in the right state!\n");<br class="">
+               return ret;<br class="">
+       }<br class="">
<br class="">
      WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_90, 0);<br class="">
<br class="">
--<br class="">
2.24.0<br class="">
<br class="">
_______________________________________________<br class="">
amd-gfx mailing list<br class="">
<a href="mailto:amd-gfx@lists.freedesktop.org" class="">amd-gfx@lists.freedesktop.org</a><br class="">
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist<br class="">
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-<br class="">
</blockquote>
gfx&amp;data=02%7C01%7CKe<br class="">
<blockquote type="cite" class=""><br class="">
</blockquote>
nneth.Feng%<a href="http://40amd.com" class="">40amd.com</a>%7C1383f2661b584e04edf908d7789feaf5%7C3dd8961<br class="">
fe488<br class="">
<blockquote type="cite" class=""><br class="">
</blockquote>
4e608e11a82d994e183d%7C0%7C0%7C637110500551036438&amp;sdata=QQ<br class="">
RY8dsiT%<br class="">
<blockquote type="cite" class="">2BPio5I%2B%2F3ErqLnYQLxt6hcyXHedU79muTI%3D&amp;reserved=0<br class="">
</blockquote>
</blockquote>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>