All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pm: disable OD_FAN_CURVE if temp or pwm range invalid
@ 2026-03-19  8:15 Yang Wang
  2026-03-19 12:57 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Wang @ 2026-03-19  8:15 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, hawking.zhang, kenneth.feng

Forcibly disable the OD_FAN_CURVE feature when temperature or PWM range is invalid,
otherwise PMFW will reject this configuration on smu v14.0.2/14.0.3.

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:
[  969.761627] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]!
[ 1010.897800] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]!

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
---
 .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 33 ++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
index 0b78e62cd3b0..8ab99a8e2790 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
@@ -56,6 +56,10 @@
 
 #define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c))
 
+static void smu_v14_0_2_get_od_setting_limits(struct smu_context *smu,
+					      int od_feature_bit,
+					      int32_t *min, int32_t *max);
+
 static const struct smu_feature_bits smu_v14_0_2_dpm_features = {
 	.bits = { SMU_FEATURE_BIT_INIT(FEATURE_DPM_GFXCLK_BIT),
 		  SMU_FEATURE_BIT_INIT(FEATURE_DPM_UCLK_BIT),
@@ -928,8 +932,35 @@ static bool smu_v14_0_2_is_od_feature_supported(struct smu_context *smu,
 	PPTable_t *pptable = smu->smu_table.driver_pptable;
 	const OverDriveLimits_t * const overdrive_upperlimits =
 				&pptable->SkuTable.OverDriveLimitsBasicMax;
+	int32_t min_value, max_value;
+	bool feature_enabled;
 
-	return overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit);
+	switch (od_feature_bit) {
+	case OD_FAN_CURVE:
+		feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit));
+		if (feature_enabled) {
+			smu_v14_0_2_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_TEMP,
+							  &min_value, &max_value);
+			if (!min_value && !max_value) {
+				feature_enabled = false;
+				goto out;
+			}
+
+			smu_v14_0_2_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_PWM,
+							  &min_value, &max_value);
+			if (!min_value && !max_value) {
+				feature_enabled = false;
+				goto out;
+			}
+		}
+		break;
+	default:
+		feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit));
+		break;
+	}
+
+out:
+	return feature_enabled;
 }
 
 static void smu_v14_0_2_get_od_setting_limits(struct smu_context *smu,
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/pm: disable OD_FAN_CURVE if temp or pwm range invalid
  2026-03-19  8:15 [PATCH] drm/amd/pm: disable OD_FAN_CURVE if temp or pwm range invalid Yang Wang
@ 2026-03-19 12:57 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2026-03-19 12:57 UTC (permalink / raw)
  To: Yang Wang; +Cc: amd-gfx, alexander.deucher, hawking.zhang, kenneth.feng

On Thu, Mar 19, 2026 at 4:24 AM Yang Wang <kevinyang.wang@amd.com> wrote:
>
> Forcibly disable the OD_FAN_CURVE feature when temperature or PWM range is invalid,
> otherwise PMFW will reject this configuration on smu v14.0.2/14.0.3.
>
> 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:
> [  969.761627] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]!
> [ 1010.897800] amdgpu 0000:03:00.0: amdgpu: Fan curve temp setting(50) must be within [0, 0]!
>
> Signed-off-by: Yang Wang <kevinyang.wang@amd.com>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  .../drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c  | 33 ++++++++++++++++++-
>  1 file changed, 32 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> index 0b78e62cd3b0..8ab99a8e2790 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
> @@ -56,6 +56,10 @@
>
>  #define to_amdgpu_device(x) (container_of(x, struct amdgpu_device, pm.smu_i2c))
>
> +static void smu_v14_0_2_get_od_setting_limits(struct smu_context *smu,
> +                                             int od_feature_bit,
> +                                             int32_t *min, int32_t *max);
> +
>  static const struct smu_feature_bits smu_v14_0_2_dpm_features = {
>         .bits = { SMU_FEATURE_BIT_INIT(FEATURE_DPM_GFXCLK_BIT),
>                   SMU_FEATURE_BIT_INIT(FEATURE_DPM_UCLK_BIT),
> @@ -928,8 +932,35 @@ static bool smu_v14_0_2_is_od_feature_supported(struct smu_context *smu,
>         PPTable_t *pptable = smu->smu_table.driver_pptable;
>         const OverDriveLimits_t * const overdrive_upperlimits =
>                                 &pptable->SkuTable.OverDriveLimitsBasicMax;
> +       int32_t min_value, max_value;
> +       bool feature_enabled;
>
> -       return overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit);
> +       switch (od_feature_bit) {
> +       case OD_FAN_CURVE:
> +               feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit));
> +               if (feature_enabled) {
> +                       smu_v14_0_2_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_TEMP,
> +                                                         &min_value, &max_value);
> +                       if (!min_value && !max_value) {
> +                               feature_enabled = false;
> +                               goto out;
> +                       }
> +
> +                       smu_v14_0_2_get_od_setting_limits(smu, PP_OD_FEATURE_FAN_CURVE_PWM,
> +                                                         &min_value, &max_value);
> +                       if (!min_value && !max_value) {
> +                               feature_enabled = false;
> +                               goto out;
> +                       }
> +               }
> +               break;
> +       default:
> +               feature_enabled = !!(overdrive_upperlimits->FeatureCtrlMask & (1U << od_feature_bit));
> +               break;
> +       }
> +
> +out:
> +       return feature_enabled;
>  }
>
>  static void smu_v14_0_2_get_od_setting_limits(struct smu_context *smu,
> --
> 2.47.3
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-19 12:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19  8:15 [PATCH] drm/amd/pm: disable OD_FAN_CURVE if temp or pwm range invalid Yang Wang
2026-03-19 12:57 ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.