Skip to contentSkip to conversation

drm/amd/pm: fix incorrect FeatureCtrlMask setting on smu v14.0.x

PATCH In review Yang Wang 2 participants 2 messages Apr 3

Subsystems (3)
lore
Share & tools
lore

Yang Wang

author
#0 lore raw

PATCH 1/1 drm/amd/pm: fix incorrect FeatureCtrlMask setting on smu v14.0.x

OverDriveTable.FanMinimumPwm and FeatureCtrlMask.PP_OD_FEATURE_FAN_LEGACY_BIT have a hard dependency.
Invalid handling of this dependency leads to disabled thermal monitoring and temperature boundary validation.

Fixes 9710b84e2a6a ("drm/amd/pm: add overdrive support on smu v14.0.2/3")
---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +7 -3
index 2be080b4cbc3..bc1bfb618aa0 100644
@@ -2390,6 +2390,7 @@ static int smu_v14_0_2_od_restore_table_single(struct smu_context *smu, long inp
 		}
 		od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+		od_table->OverDriveTable.FeatureCtrlMask &= BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
 		break;
 	case PP_OD_EDIT_FAN_ZERO_RPM_ENABLE:
 		od_table->OverDriveTable.FanZeroRpmEnable =
@@ -2418,7 +2419,8 @@ static int smu_v14_0_2_od_restore_table_single(struct smu_context *smu, long inp
 		od_table->OverDriveTable.FanMinimumPwm =
 					boot_overdrive_table->OverDriveTable.FanMinimumPwm;
 		od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
-		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
+		od_table->OverDriveTable.FeatureCtrlMask &= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
 		break;
 	default:
 		dev_info(adev->dev, "Invalid table index: %ld\n", input);
@@ -2588,6 +2590,7 @@ static int smu_v14_0_2_od_edit_dpm_table(struct smu_context *smu,
 		od_table->OverDriveTable.FanLinearPwmPoints[input[0]] = input[2];
 		od_table->OverDriveTable.FanMode = FAN_MODE_MANUAL_LINEAR;
 		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+		od_table->OverDriveTable.FeatureCtrlMask &= ~BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
 		break;
 
 	case PP_OD_EDIT_ACOUSTIC_LIMIT:
@@ -2657,7 +2660,7 @@ static int smu_v14_0_2_od_edit_dpm_table(struct smu_context *smu,
 		break;
 
 	case PP_OD_EDIT_FAN_MINIMUM_PWM:
-		if (!smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
+		if (!smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_LEGACY_BIT)) {
 			dev_warn(adev->dev, "Fan curve setting not supported!\n");
 			return -ENOTSUPP;
 		}
@@ -2675,7 +2678,8 @@ static int smu_v14_0_2_od_edit_dpm_table(struct smu_context *smu,
 
 		od_table->OverDriveTable.FanMinimumPwm = input[0];
 		od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
-		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+		od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
+		od_table->OverDriveTable.FeatureCtrlMask &= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
 		break;
 
 	case PP_OD_EDIT_FAN_ZERO_RPM_ENABLE:
Signature · 1 line
2.47.3
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Yang Wang

OverDriveTable.FanMinimumPwm and FeatureCtrlMask.PP_OD_FEATURE_FAN_LEGACY_BIT have a hard dependency.
Invalid handling of this dependency leads to disabled thermal monitoring and temperature boundary validation.

Fixes 9710b84e2a6a ("drm/amd/pm: add overdrive support on smu v14.0.2/3")
Quoted 56 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c +7 -4
index 2be080b4cbc3..bc1bfb618aa0 100644
@@ -2390,6 +2390,7 @@ static int smu_v14_0_2_od_restore_table_single(struct smu_context *smu, long inp
                }
                od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
                od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+               od_table->OverDriveTable.FeatureCtrlMask &= BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
                break;
        case PP_OD_EDIT_FAN_ZERO_RPM_ENABLE:
                od_table->OverDriveTable.FanZeroRpmEnable =
@@ -2418,7 +2419,8 @@ static int smu_v14_0_2_od_restore_table_single(struct smu_context *smu, long inp
                od_table->OverDriveTable.FanMinimumPwm =
                                        boot_overdrive_table->OverDriveTable.FanMinimumPwm;
                od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
-               od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+               od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
+               od_table->OverDriveTable.FeatureCtrlMask &= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
                break;
        default:
                dev_info(adev->dev, "Invalid table index: %ld\n", input);
@@ -2588,6 +2590,7 @@ static int smu_v14_0_2_od_edit_dpm_table(struct smu_context *smu,
                od_table->OverDriveTable.FanLinearPwmPoints[input[0]] = input[2];
                od_table->OverDriveTable.FanMode = FAN_MODE_MANUAL_LINEAR;
                od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+               od_table->OverDriveTable.FeatureCtrlMask &= ~BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
                break;
 
        case PP_OD_EDIT_ACOUSTIC_LIMIT:
@@ -2657,7 +2660,7 @@ static int smu_v14_0_2_od_edit_dpm_table(struct smu_context *smu,
                break;
 
        case PP_OD_EDIT_FAN_MINIMUM_PWM:
-               if (!smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_CURVE_BIT)) {
+               if (!smu_v14_0_2_is_od_feature_supported(smu, PP_OD_FEATURE_FAN_LEGACY_BIT)) {
                        dev_warn(adev->dev, "Fan curve setting not supported!\n");
                        return -ENOTSUPP;
                }
@@ -2675,7 +2678,8 @@ static int smu_v14_0_2_od_edit_dpm_table(struct smu_context *smu,
 
                od_table->OverDriveTable.FanMinimumPwm = input[0];
                od_table->OverDriveTable.FanMode = FAN_MODE_AUTO;
-               od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
+               od_table->OverDriveTable.FeatureCtrlMask |= BIT(PP_OD_FEATURE_FAN_LEGACY_BIT);
+               od_table->OverDriveTable.FeatureCtrlMask &= BIT(PP_OD_FEATURE_FAN_CURVE_BIT);
                break;
 
        case PP_OD_EDIT_FAN_ZERO_RPM_ENABLE:
--

2.47.3