]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu/smu13: fix profile reporting
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Oct 2024 13:13:21 +0000 (09:13 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 28 Oct 2024 20:41:43 +0000 (16:41 -0400)
The following 3 commits landed in parallel:
commit d7d2688bf4ea ("drm/amd/pm: update workload mask after the setting")
commit 7a1613e47e65 ("drm/amdgpu/smu13: always apply the powersave optimization")
commit 7c210ca5a2d7 ("drm/amdgpu: handle default profile on on devices without fullscreen 3D")
While everything is set correctly, this caused the profile to be
reported incorrectly because both the powersave and fullscreen3d bits
were set in the mask and when the driver prints the profile, it looks
for the first bit set.

Fixes: d7d2688bf4ea ("drm/amd/pm: update workload mask after the setting")
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c

index 3e2277abc75468dcba785218784637943a958d74..8d25cc1f218f10d4644393c9252fc47416e628be 100644 (file)
@@ -2473,7 +2473,7 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
        DpmActivityMonitorCoeffInt_t *activity_monitor =
                &(activity_monitor_external.DpmActivityMonitorCoeffInt);
        int workload_type, ret = 0;
-       u32 workload_mask;
+       u32 workload_mask, selected_workload_mask;
 
        smu->power_profile_mode = input[size];
 
@@ -2540,7 +2540,7 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
        if (workload_type < 0)
                return -EINVAL;
 
-       workload_mask = 1 << workload_type;
+       selected_workload_mask = workload_mask = 1 << workload_type;
 
        /* Add optimizations for SMU13.0.0/10.  Reuse the power saving profile */
        if ((amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 0) &&
@@ -2560,7 +2560,7 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
                                               workload_mask,
                                               NULL);
        if (!ret)
-               smu->workload_mask = workload_mask;
+               smu->workload_mask = selected_workload_mask;
 
        return ret;
 }