<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:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
</div>
<span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Indeed, that's not necessary.</span>
<div>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
thanks.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,<br>
Kevin</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 face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Chen, Jiansong (Simon) <Jiansong.Chen@amd.com><br>
<b>Sent:</b> Monday, August 24, 2020 7:59 PM<br>
<b>To:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amd/pm: fix is_dpm_running() run error on 32bit system</font>
<div> </div>
</div>
<div class="BodyFragment"><font face="Times New Roman" size="3"><span style="font-size:12pt"><a name="BM_BEGIN"></a>
<div><font size="2"><span style="font-size:11pt">[AMD Official Use Only - Internal Distribution Only]<br>
<br>
Good point, but I wonder whether the outmost uint64_t cast is necessary?<br>
<br>
Regards,<br>
Jiansong<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Kevin<br>
Sent: Monday, August 24, 2020 4:59 PM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Ray <Ray.Huang@amd.com>; Wang, Kevin(Yang) <Kevin1.Wang@amd.com><br>
Subject: [PATCH] drm/amd/pm: fix is_dpm_running() run error on 32bit system<br>
<br>
From: Kevin Wang <kevin1.wang@amd.com><br>
<br>
the C type "unsigned long" size is 32bit on 32bit system, it will cause code logic error, so replace it with "uint64_t".<br>
<br>
Signed-off-by: Kevin <kevin1.wang@amd.com><br>
---<br>
drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 9 +++++++--<br>
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 9 +++++++--<br>
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 9 +++++++--<br>
3 files changed, 21 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c<br>
index 8347b1f2509f..e619315b0f5c 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c<br>
@@ -1844,10 +1844,15 @@ static bool arcturus_is_dpm_running(struct smu_context *smu) {<br>
int ret = 0;<br>
uint32_t feature_mask[2];<br>
-unsigned long feature_enabled;<br>
+uint64_t feature_enabled;<br>
+<br>
ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);<br>
-feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |<br>
+if (ret)<br>
+return false;<br>
+<br>
+feature_enabled = (uint64_t)((uint64_t)feature_mask[0] |<br>
((uint64_t)feature_mask[1] << 32));<br>
+<br>
return !!(feature_enabled & SMC_DPM_FEATURE); }<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c<br>
index 72f3d68691d8..d95b370adaf4 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c<br>
@@ -1345,10 +1345,15 @@ static bool navi10_is_dpm_running(struct smu_context *smu) {<br>
int ret = 0;<br>
uint32_t feature_mask[2];<br>
-unsigned long feature_enabled;<br>
+uint64_t feature_enabled;<br>
+<br>
ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);<br>
-feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |<br>
+if (ret)<br>
+return false;<br>
+<br>
+feature_enabled = (uint64_t)((uint64_t)feature_mask[0] |<br>
((uint64_t)feature_mask[1] << 32));<br>
+<br>
return !!(feature_enabled & SMC_DPM_FEATURE); }<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c<br>
index 66d655958a78..f8df6448ab4d 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c<br>
@@ -1150,10 +1150,15 @@ static bool sienna_cichlid_is_dpm_running(struct smu_context *smu) {<br>
int ret = 0;<br>
uint32_t feature_mask[2];<br>
-unsigned long feature_enabled;<br>
+uint64_t feature_enabled;<br>
+<br>
ret = smu_cmn_get_enabled_mask(smu, feature_mask, 2);<br>
-feature_enabled = (unsigned long)((uint64_t)feature_mask[0] |<br>
+if (ret)<br>
+return false;<br>
+<br>
+feature_enabled = (uint64_t)((uint64_t)feature_mask[0] |<br>
((uint64_t)feature_mask[1] << 32));<br>
+<br>
return !!(feature_enabled & SMC_DPM_FEATURE); }<br>
<br>
--<br>
2.27.0<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&data=02%7C01%7CJiansong.Chen%40amd.com%7Cffe808387ca14e51bab408d8480bc717%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637338562729795065&sdata=U2xw6nM06S0Am3TFYfyLhCHob2k3UH%2BYgMX1hYFKKHE%3D&reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7CJiansong.Chen%40amd.com%7Cffe808387ca14e51bab408d8480bc717%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637338562729795065&sdata=U2xw6nM06S0Am3TFYfyLhCHob2k3UH%2BYgMX1hYFKKHE%3D&reserved=0</a><br>
</span></font></div>
</span></font></div>
</div>
</div>
</div>
</body>
</html>