]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: add od table upload error message parsing for smu v14.0.x
authorYang Wang <kevinyang.wang@amd.com>
Fri, 3 Apr 2026 03:52:46 +0000 (23:52 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 17 Apr 2026 18:53:02 +0000 (14:53 -0400)
parse and print detailed reasons for od table upload failures to
help users understand error causes.

example:
$ echo "0 30 40" | sudo tee fan_curve
$ echo "1 40 30" | sudo tee fan_curve
$ echo "c" | sudo tee fan_curve

kernel log:
[   75.040174] amdgpu 0000:0a:00.0: Failed to upload overdrive table, ret:-5
[   75.040178] amdgpu 0000:0a:00.0: Invalid overdrive table content: OD_FAN_CURVE_PWM_ERROR (13)
[   75.040181] amdgpu 0000:0a:00.0: Failed to upload overdrive table!

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

index 983bb31bb53e9fabc9a60fc920eb356371a37528..5ce4e982ca33600633b48feef22fc05f9cc36369 100644 (file)
@@ -2214,17 +2214,61 @@ static void smu_v14_0_2_dump_od_table(struct smu_context *smu,
                                                   od_table->OverDriveTable.UclkFmax);
 }
 
+#define OD_ERROR_MSG_MAP(msg) \
+       [msg] = #msg
+
+static const char *od_error_message[] = {
+       OD_ERROR_MSG_MAP(OD_REQUEST_ADVANCED_NOT_SUPPORTED),
+       OD_ERROR_MSG_MAP(OD_UNSUPPORTED_FEATURE),
+       OD_ERROR_MSG_MAP(OD_INVALID_FEATURE_COMBO_ERROR),
+       OD_ERROR_MSG_MAP(OD_GFXCLK_VF_CURVE_OFFSET_ERROR),
+       OD_ERROR_MSG_MAP(OD_VDD_GFX_VMAX_ERROR),
+       OD_ERROR_MSG_MAP(OD_VDD_SOC_VMAX_ERROR),
+       OD_ERROR_MSG_MAP(OD_PPT_ERROR),
+       OD_ERROR_MSG_MAP(OD_FAN_MIN_PWM_ERROR),
+       OD_ERROR_MSG_MAP(OD_FAN_ACOUSTIC_TARGET_ERROR),
+       OD_ERROR_MSG_MAP(OD_FAN_ACOUSTIC_LIMIT_ERROR),
+       OD_ERROR_MSG_MAP(OD_FAN_TARGET_TEMP_ERROR),
+       OD_ERROR_MSG_MAP(OD_FAN_ZERO_RPM_STOP_TEMP_ERROR),
+       OD_ERROR_MSG_MAP(OD_FAN_CURVE_PWM_ERROR),
+       OD_ERROR_MSG_MAP(OD_FAN_CURVE_TEMP_ERROR),
+       OD_ERROR_MSG_MAP(OD_FULL_CTRL_GFXCLK_ERROR),
+       OD_ERROR_MSG_MAP(OD_FULL_CTRL_UCLK_ERROR),
+       OD_ERROR_MSG_MAP(OD_FULL_CTRL_FCLK_ERROR),
+       OD_ERROR_MSG_MAP(OD_FULL_CTRL_VDD_GFX_ERROR),
+       OD_ERROR_MSG_MAP(OD_FULL_CTRL_VDD_SOC_ERROR),
+       OD_ERROR_MSG_MAP(OD_TDC_ERROR),
+       OD_ERROR_MSG_MAP(OD_GFXCLK_ERROR),
+       OD_ERROR_MSG_MAP(OD_UCLK_ERROR),
+       OD_ERROR_MSG_MAP(OD_FCLK_ERROR),
+       OD_ERROR_MSG_MAP(OD_OP_TEMP_ERROR),
+       OD_ERROR_MSG_MAP(OD_OP_GFX_EDC_ERROR),
+       OD_ERROR_MSG_MAP(OD_OP_GFX_PCC_ERROR),
+       OD_ERROR_MSG_MAP(OD_POWER_FEATURE_CTRL_ERROR),
+};
+
 static int smu_v14_0_2_upload_overdrive_table(struct smu_context *smu,
                                              OverDriveTableExternal_t *od_table)
 {
-       int ret;
-       ret = smu_cmn_update_table(smu,
-                                  SMU_TABLE_OVERDRIVE,
-                                  0,
-                                  (void *)od_table,
-                                  true);
-       if (ret)
-               dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
+       uint32_t read_arg = 0;
+       int ret, od_error_type;
+
+       ret = smu_cmn_update_table_read_arg(smu,
+                                           SMU_TABLE_OVERDRIVE,
+                                           0,
+                                           (void *)od_table,
+                                           &read_arg,
+                                           true);
+       if (ret) {
+               dev_err(smu->adev->dev, "Failed to upload overdrive table, ret:%d\n", ret);
+               if ((read_arg & 0xff) == TABLE_TRANSFER_FAILED) {
+                       od_error_type = read_arg >> 16;
+                       dev_err(smu->adev->dev, "Invalid overdrive table content: %s (%d)\n",
+                               od_error_type < ARRAY_SIZE(od_error_message) ?
+                               od_error_message[od_error_type] : "unknown",
+                               od_error_type);
+               }
+       }
 
        return ret;
 }