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: disable OD_FAN_CURVE if temp or pwm range invalid for smu v13

Forcibly disable the OD_FAN_CURVE feature when temperature or PWM range is invalid,
otherwise PMFW will reject this configuration on smu v13.0.x

example:
$ sudo cat /sys/bus/pci/devices/<BDF>/gpu_od/fan_ctrl/fan_curve

OD_FAN_CURVE:
0: 0C 0%
1: 0C 0%
2: 0C 0%
3: 0C 0%
4: 0C 0%
OD_RANGE:
FAN_CURVE(hotspot temp): 0C 0C
FAN_CURVE(fan speed): 0% 0%

$ echo "0 50 40" | sudo tee fan_curve

kernel log:
[ 756.442527] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]!
[ 777.345800] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]!

Closes: https://github.com/ROCm/amdgpu/issues/208
Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Yang Wang and committed by
Alex Deucher
47089160 896ffa98

+64 -2
+32 -1
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 59 59 60 60 #define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c)) 61 61 62 + static void smu_v13_0_0_get_od_setting_limits(struct smu_context *smu, 63 + int od_feature_bit, 64 + int32_t *min, int32_t *max); 65 + 62 66 static const struct smu_feature_bits smu_v13_0_0_dpm_features = { 63 67 .bits = { 64 68 SMU_FEATURE_BIT_INIT(FEATURE_DPM_GFXCLK_BIT), ··· 1047 1043 PPTable_t *pptable = smu->smu_table.driver_pptable; 1048 1044 const OverDriveLimits_t * const overdrive_upperlimits = 1049 1045 &pptable->SkuTable.OverDriveLimitsBasicMax; 1046 + int32_t min_value, max_value; 1047 + bool feature_enabled; 1050 1048 1051 - return overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit); 1049 + switch (od_feature_bit) { 1050 + case PP_OD_FEATURE_FAN_CURVE_BIT: 1051 + feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit)); 1052 + if (feature_enabled) { 1053 + smu_v13_0_0_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_TEMP, 1054 + &min_value, &max_value); 1055 + if (!min_value && !max_value) { 1056 + feature_enabled = false; 1057 + goto out; 1058 + } 1059 + 1060 + smu_v13_0_0_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_PWM, 1061 + &min_value, &max_value); 1062 + if (!min_value && !max_value) { 1063 + feature_enabled = false; 1064 + goto out; 1065 + } 1066 + } 1067 + break; 1068 + default: 1069 + feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit)); 1070 + break; 1071 + } 1072 + 1073 + out: 1074 + return feature_enabled; 1052 1075 } 1053 1076 1054 1077 static void smu_v13_0_0_get_od_setting_limits(struct smu_context *smu,
+32 -1
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
··· 59 59 60 60 #define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c)) 61 61 62 + static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu, 63 + int od_feature_bit, 64 + int32_t *min, int32_t *max); 65 + 62 66 static const struct smu_feature_bits smu_v13_0_7_dpm_features = { 63 67 .bits = { 64 68 SMU_FEATURE_BIT_INIT(FEATURE_DPM_GFXCLK_BIT), ··· 1057 1053 PPTable_t *pptable = smu->smu_table.driver_pptable; 1058 1054 const OverDriveLimits_t * const overdrive_upperlimits = 1059 1055 &pptable->SkuTable.OverDriveLimitsBasicMax; 1056 + int32_t min_value, max_value; 1057 + bool feature_enabled; 1060 1058 1061 - return overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit); 1059 + switch (od_feature_bit) { 1060 + case PP_OD_FEATURE_FAN_CURVE_BIT: 1061 + feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit)); 1062 + if (feature_enabled) { 1063 + smu_v13_0_7_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_TEMP, 1064 + &min_value, &max_value); 1065 + if (!min_value && !max_value) { 1066 + feature_enabled = false; 1067 + goto out; 1068 + } 1069 + 1070 + smu_v13_0_7_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_PWM, 1071 + &min_value, &max_value); 1072 + if (!min_value && !max_value) { 1073 + feature_enabled = false; 1074 + goto out; 1075 + } 1076 + } 1077 + break; 1078 + default: 1079 + feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit)); 1080 + break; 1081 + } 1082 + 1083 + out: 1084 + return feature_enabled; 1062 1085 } 1063 1086 1064 1087 static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,