[PATCH 2/3] drm/amd/pm: Fix incorrect power limit readback in smu11 if POWER_SOURCE_DC

Powell, Darren Darren.Powell at amd.com
Mon Oct 4 01:15:05 UTC 2021


[AMD Official Use Only]

Yup, agreed, but I rationalized that it:
 - minimizes code changes, leave existing code in place
 - reinforces the comment, which states that only 0 is supported in this bitfield at this time

Thanks
Darren
________________________________
From: Nils Wallménius <nils.wallmenius at gmail.com>
Sent: Sunday, October 3, 2021 1:31 AM
To: Powell, Darren <Darren.Powell at amd.com>
Cc: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Subject: Re: [PATCH 2/3] drm/amd/pm: Fix incorrect power limit readback in smu11 if POWER_SOURCE_DC

Hi, sorry for the drive-by comment but

limit_param |= 0 << 24;

Doesn't do anything.

Best regards
Nils

Den sön 3 okt. 2021 06:47Darren Powell <darren.powell at amd.com<mailto:darren.powell at amd.com>> skrev:
 when smu->adev->pm.ac_power == 0, message parameter with bit 16 set is saved
 to smu->current_power_limit.

 Fixes: 0cb4c62125a9 ("drm/amd/pm: correct power limit setting for SMU V11)"

Signed-off-by: Darren Powell <darren.powell at amd.com<mailto:darren.powell at amd.com>>
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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
index aedaa4bb15c2..9bb6da99d5b5 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c
@@ -984,6 +984,7 @@ int smu_v11_0_set_power_limit(struct smu_context *smu,
 {
        int power_src;
        int ret = 0;
+       uint32_t limit_param;

        if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_PPT_BIT)) {
                dev_err(smu->adev->dev, "Setting new power limit is not supported!\n");
@@ -1003,10 +1004,10 @@ int smu_v11_0_set_power_limit(struct smu_context *smu,
         * BIT 16-23: PowerSource
         * BIT 0-15: PowerLimit
         */
-       limit &= 0xFFFF;
-       limit |= 0 << 24;
-       limit |= (power_src) << 16;
-       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, limit, NULL);
+       limit_param  = (limit & 0xFFFF);
+       limit_param |= 0 << 24;
+       limit_param |= (power_src) << 16;
+       ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, limit_param, NULL);
        if (ret) {
                dev_err(smu->adev->dev, "[%s] Set power limit Failed!\n", __func__);
                return ret;
--
2.33.0

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20211004/a2bf1ecb/attachment.htm>


More information about the amd-gfx mailing list