drm/amd/powerplay: Add SMU WMTABLE Validity Check for Renoir
authorZhan Liu <zhan.liu@amd.com>
Mon, 16 Dec 2019 19:56:50 +0000 (14:56 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 18 Dec 2019 21:09:11 +0000 (16:09 -0500)
[Why]
SMU watermark table (WMTABLE) validity check is missing on Renoir.
This validity check is very useful for checking whether
WMTABLE is updated successfully.

[How]
Add SMU watermark validity check.

Signed-off-by: Zhan Liu <zhan.liu@amd.com>
Reviewed-by: Hersen Wu <hersenxs.wu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/renoir_ppt.c

index 89a54f8e08d36e856934910587679754ceeb7c2c..81520b0fca68ea088d7857dbf8be920b0135e756 100644 (file)
@@ -777,9 +777,17 @@ static int renoir_set_watermarks_table(
        }
 
        /* pass data to smu controller */
-       ret = smu_write_watermarks_table(smu);
+       if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
+                       !(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
+               ret = smu_write_watermarks_table(smu);
+               if (ret) {
+                       pr_err("Failed to update WMTABLE!");
+                       return ret;
+               }
+               smu->watermarks_bitmap |= WATERMARKS_LOADED;
+       }
 
-       return ret;
+       return 0;
 }
 
 static int renoir_get_power_profile_mode(struct smu_context *smu,