Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/pm: add od table upload error message parsing for smu v14.0.x

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>

authored by

Yang Wang and committed by
Alex Deucher
4f2c86c6 79d47bc4

+52 -8
+52 -8
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
··· 2214 2214 od_table->OverDriveTable.UclkFmax); 2215 2215 } 2216 2216 2217 + #define OD_ERROR_MSG_MAP(msg) \ 2218 + [msg] = #msg 2219 + 2220 + static const char *od_error_message[] = { 2221 + OD_ERROR_MSG_MAP(OD_REQUEST_ADVANCED_NOT_SUPPORTED), 2222 + OD_ERROR_MSG_MAP(OD_UNSUPPORTED_FEATURE), 2223 + OD_ERROR_MSG_MAP(OD_INVALID_FEATURE_COMBO_ERROR), 2224 + OD_ERROR_MSG_MAP(OD_GFXCLK_VF_CURVE_OFFSET_ERROR), 2225 + OD_ERROR_MSG_MAP(OD_VDD_GFX_VMAX_ERROR), 2226 + OD_ERROR_MSG_MAP(OD_VDD_SOC_VMAX_ERROR), 2227 + OD_ERROR_MSG_MAP(OD_PPT_ERROR), 2228 + OD_ERROR_MSG_MAP(OD_FAN_MIN_PWM_ERROR), 2229 + OD_ERROR_MSG_MAP(OD_FAN_ACOUSTIC_TARGET_ERROR), 2230 + OD_ERROR_MSG_MAP(OD_FAN_ACOUSTIC_LIMIT_ERROR), 2231 + OD_ERROR_MSG_MAP(OD_FAN_TARGET_TEMP_ERROR), 2232 + OD_ERROR_MSG_MAP(OD_FAN_ZERO_RPM_STOP_TEMP_ERROR), 2233 + OD_ERROR_MSG_MAP(OD_FAN_CURVE_PWM_ERROR), 2234 + OD_ERROR_MSG_MAP(OD_FAN_CURVE_TEMP_ERROR), 2235 + OD_ERROR_MSG_MAP(OD_FULL_CTRL_GFXCLK_ERROR), 2236 + OD_ERROR_MSG_MAP(OD_FULL_CTRL_UCLK_ERROR), 2237 + OD_ERROR_MSG_MAP(OD_FULL_CTRL_FCLK_ERROR), 2238 + OD_ERROR_MSG_MAP(OD_FULL_CTRL_VDD_GFX_ERROR), 2239 + OD_ERROR_MSG_MAP(OD_FULL_CTRL_VDD_SOC_ERROR), 2240 + OD_ERROR_MSG_MAP(OD_TDC_ERROR), 2241 + OD_ERROR_MSG_MAP(OD_GFXCLK_ERROR), 2242 + OD_ERROR_MSG_MAP(OD_UCLK_ERROR), 2243 + OD_ERROR_MSG_MAP(OD_FCLK_ERROR), 2244 + OD_ERROR_MSG_MAP(OD_OP_TEMP_ERROR), 2245 + OD_ERROR_MSG_MAP(OD_OP_GFX_EDC_ERROR), 2246 + OD_ERROR_MSG_MAP(OD_OP_GFX_PCC_ERROR), 2247 + OD_ERROR_MSG_MAP(OD_POWER_FEATURE_CTRL_ERROR), 2248 + }; 2249 + 2217 2250 static int smu_v14_0_2_upload_overdrive_table(struct smu_context *smu, 2218 2251 OverDriveTableExternal_t *od_table) 2219 2252 { 2220 - int ret; 2221 - ret = smu_cmn_update_table(smu, 2222 - SMU_TABLE_OVERDRIVE, 2223 - 0, 2224 - (void *)od_table, 2225 - true); 2226 - if (ret) 2227 - dev_err(smu->adev->dev, "Failed to upload overdrive table!\n"); 2253 + uint32_t read_arg = 0; 2254 + int ret, od_error_type; 2255 + 2256 + ret = smu_cmn_update_table_read_arg(smu, 2257 + SMU_TABLE_OVERDRIVE, 2258 + 0, 2259 + (void *)od_table, 2260 + &read_arg, 2261 + true); 2262 + if (ret) { 2263 + dev_err(smu->adev->dev, "Failed to upload overdrive table, ret:%d\n", ret); 2264 + if ((read_arg & 0xff) == TABLE_TRANSFER_FAILED) { 2265 + od_error_type = read_arg >> 16; 2266 + dev_err(smu->adev->dev, "Invalid overdrive table content: %s (%d)\n", 2267 + od_error_type < ARRAY_SIZE(od_error_message) ? 2268 + od_error_message[od_error_type] : "unknown", 2269 + od_error_type); 2270 + } 2271 + } 2228 2272 2229 2273 return ret; 2230 2274 }