<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);">
Yup, agreed, but I rationalized that it: </div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
 - minimizes code changes, leave existing code in place</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
 - reinforces the comment, which states that only 0 is supported in this bitfield at this time</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);">
Thanks</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Darren</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> Nils Wallménius <nils.wallmenius@gmail.com><br>
<b>Sent:</b> Sunday, October 3, 2021 1:31 AM<br>
<b>To:</b> Powell, Darren <Darren.Powell@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH 2/3] drm/amd/pm: Fix incorrect power limit readback in smu11 if POWER_SOURCE_DC</font>
<div> </div>
</div>
<div>
<div dir="auto">
<div>Hi, sorry for the drive-by comment but </div>
<div dir="auto"><span style="font-family:sans-serif"><br>
</span></div>
<div dir="auto"><span style="font-family:sans-serif">limit_param |= 0 << 24;</span></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">Doesn't do anything.</font></div>
<div dir="auto"><font face="sans-serif"><br>
</font></div>
<div dir="auto"><font face="sans-serif">Best regards</font></div>
<div dir="auto"><font face="sans-serif">Nils<br>
</font><br>
<div class="x_gmail_quote" dir="auto">
<div dir="ltr" class="x_gmail_attr">Den sön 3 okt. 2021 06:47Darren Powell <<a href="mailto:darren.powell@amd.com">darren.powell@amd.com</a>> skrev:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
 when smu->adev->pm.ac_power == 0, message parameter with bit 16 set is saved<br>
 to smu->current_power_limit.<br>
<br>
 Fixes: 0cb4c62125a9 ("drm/amd/pm: correct power limit setting for SMU V11)"<br>
<br>
Signed-off-by: Darren Powell <<a href="mailto:darren.powell@amd.com" target="_blank" rel="noreferrer">darren.powell@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 9 +++++----<br>
 1 file changed, 5 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c<br>
index aedaa4bb15c2..9bb6da99d5b5 100644<br>
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c<br>
@@ -984,6 +984,7 @@ int smu_v11_0_set_power_limit(struct smu_context *smu,<br>
 {<br>
        int power_src;<br>
        int ret = 0;<br>
+       uint32_t limit_param;<br>
<br>
        if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_PPT_BIT)) {<br>
                dev_err(smu->adev->dev, "Setting new power limit is not supported!\n");<br>
@@ -1003,10 +1004,10 @@ int smu_v11_0_set_power_limit(struct smu_context *smu,<br>
         * BIT 16-23: PowerSource<br>
         * BIT 0-15: PowerLimit<br>
         */<br>
-       limit &= 0xFFFF;<br>
-       limit |= 0 << 24;<br>
-       limit |= (power_src) << 16;<br>
-       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, limit, NULL);<br>
+       limit_param  = (limit & 0xFFFF);<br>
+       limit_param |= 0 << 24;<br>
+       limit_param |= (power_src) << 16;<br>
+       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, limit_param, NULL);<br>
        if (ret) {<br>
                dev_err(smu->adev->dev, "[%s] Set power limit Failed!\n", __func__);<br>
                return ret;<br>
-- <br>
2.33.0<br>
<br>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</body>
</html>