Skip to contentSkip to conversation

Rework Van Gogh RLC handling

PATCH In review Mario Limonciello 3 participants 6 messages Oct 24, 2025 – Oct 27, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Rework Van Gogh RLC handling

Alex introduced a patch [1] for s0ix support for Van Gogh which Antheas tested works on an Xbox Ally X, but when I was reviewing it I noticed that the RLC callback is very similar to an set_mp1_state callback.

This series reworks Alex's patch to put the RLC callback into a set_mp1_state instead.

This series should be tested both on a Steam Deck, Steam Deck OLED and Xbox Ally X.

Alex Deucher (1):
drm/amd: only send the SMU RLC notification on S3

Mario Limonciello (1):
drm/amd: Move Van Gogh specific suspend code into common

    `set_mp1_state`
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  4 ---
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  1 -
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c           | 18 -------------
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 --
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 16 +++++-------
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 ----
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 25 ++++++++++++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |  1 -
 8 files changed, 30 insertions(+), 42 deletions(-)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/2 drm/amd: Move Van Gogh specific suspend code into common `set_mp1_state`

[Why]
An .notify_rlc_state callback and wrappers for it were introduced to support notifying the PMFW that the system is about to suspend.

There are already callbacks for set_mp1_state which get called at suspend though from amdgpu_device_ip_suspend_phase2.

[How]
Tear out all the notify_rlc_state callbacks and instead move the Van Gogh specific code to a set_mp1_state callback.

Cc Robert Beckett <[email protected]>
Cc Antheas Kapenekakis <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  4 ----
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  1 -
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c           | 18 ------------------
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 --
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 10 ----------
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 -----
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19 ++++++++++++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |  1 -
 8 files changed, 18 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -4
index 3ffb9bb1ec0b..4dbdcb7b11e9 100644
@@ -5281,10 +5281,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
 	if (amdgpu_sriov_vf(adev))
 		amdgpu_virt_release_full_gpu(adev, false);
 
-	r = amdgpu_dpm_notify_rlc_state(adev, false);
-	if (r)
-		return r;
-
 	return 0;
 }
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -1
index 87814c2b526e..48846a3e4b7b 100644
@@ -523,7 +523,6 @@ struct amd_pm_funcs {
 				   struct dpm_clocks *clock_table);
 	int (*get_smu_prv_buf_details)(void *handle, void **addr, size_t *size);
 	void (*pm_compute_clocks)(void *handle);
-	int (*notify_rlc_state)(void *handle, bool en);
 };
 
 struct metrics_table_header {
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +0 -18
index 5d08dc3b7110..5c4d0eb198c4 100644
@@ -195,24 +195,6 @@ int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
 	return ret;
 }
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en)
-{
-	int ret = 0;
-	const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
-
-	if (pp_funcs && pp_funcs->notify_rlc_state) {
-		mutex_lock(&adev->pm.mutex);
-
-		ret = pp_funcs->notify_rlc_state(
-				adev->powerplay.pp_handle,
-				en);
-
-		mutex_unlock(&adev->pm.mutex);
-	}
-
-	return ret;
-}
-
 int amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev)
 {
 	const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +0 -2
index 3bce74f8bb0a..c7ea29385682 100644
@@ -424,8 +424,6 @@ int amdgpu_dpm_mode1_reset(struct amdgpu_device *adev);
 int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
 			     enum pp_mp1_state mp1_state);
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en);
-
 int amdgpu_dpm_set_gfx_power_up_by_imu(struct amdgpu_device *adev);
 
 int amdgpu_dpm_baco_exit(struct amdgpu_device *adev);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -10
index 4317da6f7c38..10d42267085b 100644
@@ -2072,16 +2072,6 @@ static int smu_disable_dpms(struct smu_context *smu)
 		}
 	}
 
-	/* Notify SMU RLC is going to be off, stop RLC and SMU interaction.
-	 * otherwise SMU will hang while interacting with RLC if RLC is halted
-	 * this is a WA for Vangogh asic which fix the SMU hang issue.
-	 */
-	ret = smu_notify_rlc_state(smu, false);
-	if (ret) {
-		dev_err(adev->dev, "Fail to notify rlc status!\n");
-		return ret;
-	}
-
 	if (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 4, 2) &&
 	    !((adev->flags & AMD_IS_APU) && adev->gfx.imu.funcs) &&
 	    !amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs->stop)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -5
index c48028abc8c4..361e09f20ead 100644
@@ -1496,11 +1496,6 @@ struct pptable_funcs {
 	 */
 	int (*set_mall_enable)(struct smu_context *smu);
 
-	/**
-	 * @notify_rlc_state: Notify RLC power state to SMU.
-	 */
-	int (*notify_rlc_state)(struct smu_context *smu, bool en);
-
 	/**
 	 * @is_asic_wbrf_supported: check whether PMFW supports the wbrf feature
 	 */
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +18 -1
index 53579208cffb..3dc1919b8c64 100644
@@ -2208,6 +2208,23 @@ static int vangogh_notify_rlc_state(struct smu_context *smu, bool en)
 	return ret;
 }
 
+static int vangogh_set_mp1_state(struct smu_context *smu,
+				 enum pp_mp1_state mp1_state)
+{
+	int ret;
+
+	switch (mp1_state) {
+	case PP_MP1_STATE_UNLOAD:
+		ret = vangogh_notify_rlc_state(smu, false);
+		break;
+	default:
+		/* Ignore others */
+		ret = 0;
+	}
+
+	return ret;
+}
+
 static int vangogh_post_smu_init(struct smu_context *smu)
 {
 	struct amdgpu_device *adev = smu->adev;
@@ -2524,7 +2541,7 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
 	.print_clk_levels = vangogh_common_print_clk_levels,
 	.set_default_dpm_table = vangogh_set_default_dpm_tables,
 	.set_fine_grain_gfx_freq_parameters = vangogh_set_fine_grain_gfx_freq_parameters,
-	.notify_rlc_state = vangogh_notify_rlc_state,
+	.set_mp1_state = vangogh_set_mp1_state,
 	.feature_is_enabled = smu_cmn_feature_is_enabled,
 	.set_power_profile_mode = vangogh_set_power_profile_mode,
 	.get_power_profile_mode = vangogh_get_power_profile_mode,
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +0 -1
index c09ecf1a68a0..b9976313e741 100644
@@ -96,7 +96,6 @@
 #define smu_get_default_config_table_settings(smu, config_table)	smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
 #define smu_set_config_table(smu, config_table)				smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)					smu_ppt_funcs(init_pptable_microcode, 0, smu)
-#define smu_notify_rlc_state(smu, en)					smu_ppt_funcs(notify_rlc_state, 0, smu, en)
 #define smu_is_asic_wbrf_supported(smu)			smu_ppt_funcs(is_asic_wbrf_supported, false, smu)
 #define smu_enable_uclk_shadow(smu, enable)		smu_ppt_funcs(enable_uclk_shadow, 0, smu, enable)
 #define smu_set_wbrf_exclusion_ranges(smu, freq_band_range)		smu_ppt_funcs(set_wbrf_exclusion_ranges, -EOPNOTSUPP, smu, freq_band_range)
Signature · 1 line
2.49.0
#2 lore raw

Re: [PATCH 1/2] drm/amd: Move Van Gogh specific suspend code into common `set_mp1_state`

Quoted 7 lines · Mario Limonciello

[Why]
An .notify_rlc_state callback and wrappers for it were introduced to support notifying the PMFW that the system is about to suspend.

There are already callbacks for set_mp1_state which get called at suspend though from amdgpu_device_ip_suspend_phase2.

This won't work. PMFW needs to be notified that RLC is being turned off before the driver turns it off. I think the call in amdgpu_device_suspend() is superfluous (but someone should check S3), but the important one is in smu_disable_dpms() since that is called right before we stop rlc. I think something like the attached patches should do the trick.

Alex

Quoted 175 lines

[How]
Tear out all the notify_rlc_state callbacks and instead move the Van Gogh specific code to a set_mp1_state callback.

Cc Robert Beckett <[email protected]>
Cc Antheas Kapenekakis <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  4 ----
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  1 -
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c           | 18 ------------------
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 --
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 10 ----------
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 -----
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19 ++++++++++++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |  1 -
 8 files changed, 18 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -4
index 3ffb9bb1ec0b..4dbdcb7b11e9 100644
@@ -5281,10 +5281,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
        if (amdgpu_sriov_vf(adev))
                amdgpu_virt_release_full_gpu(adev, false);
 
-       r = amdgpu_dpm_notify_rlc_state(adev, false);
-       if (r)
-               return r;
-
        return 0;
 }
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -1
index 87814c2b526e..48846a3e4b7b 100644
@@ -523,7 +523,6 @@ struct amd_pm_funcs {
                                   struct dpm_clocks *clock_table);
        int (*get_smu_prv_buf_details)(void *handle, void **addr, size_t *size);
        void (*pm_compute_clocks)(void *handle);
-       int (*notify_rlc_state)(void *handle, bool en);
 };
 
 struct metrics_table_header {
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +0 -18
index 5d08dc3b7110..5c4d0eb198c4 100644
@@ -195,24 +195,6 @@ int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
        return ret;
 }
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en)
-{
-       int ret = 0;
-       const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
-
-       if (pp_funcs && pp_funcs->notify_rlc_state) {
-               mutex_lock(&adev->pm.mutex);
-
-               ret = pp_funcs->notify_rlc_state(
-                               adev->powerplay.pp_handle,
-                               en);
-
-               mutex_unlock(&adev->pm.mutex);
-       }
-
-       return ret;
-}
-
 int amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev)
 {
        const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +0 -2
index 3bce74f8bb0a..c7ea29385682 100644
@@ -424,8 +424,6 @@ int amdgpu_dpm_mode1_reset(struct amdgpu_device *adev);
 int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
                             enum pp_mp1_state mp1_state);
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en);
-
 int amdgpu_dpm_set_gfx_power_up_by_imu(struct amdgpu_device *adev);
 
 int amdgpu_dpm_baco_exit(struct amdgpu_device *adev);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -10
index 4317da6f7c38..10d42267085b 100644
@@ -2072,16 +2072,6 @@ static int smu_disable_dpms(struct smu_context *smu)
                }
        }
 
-       /* Notify SMU RLC is going to be off, stop RLC and SMU interaction.
-        * otherwise SMU will hang while interacting with RLC if RLC is halted
-        * this is a WA for Vangogh asic which fix the SMU hang issue.
-        */
-       ret = smu_notify_rlc_state(smu, false);
-       if (ret) {
-               dev_err(adev->dev, "Fail to notify rlc status!\n");
-               return ret;
-       }
-
        if (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 4, 2) &&
            !((adev->flags & AMD_IS_APU) && adev->gfx.imu.funcs) &&
            !amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs->stop)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -5
index c48028abc8c4..361e09f20ead 100644
@@ -1496,11 +1496,6 @@ struct pptable_funcs {
         */
        int (*set_mall_enable)(struct smu_context *smu);
 
-       /**
-        * @notify_rlc_state: Notify RLC power state to SMU.
-        */
-       int (*notify_rlc_state)(struct smu_context *smu, bool en);
-
        /**
         * @is_asic_wbrf_supported: check whether PMFW supports the wbrf feature
         */
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +18 -1
index 53579208cffb..3dc1919b8c64 100644
@@ -2208,6 +2208,23 @@ static int vangogh_notify_rlc_state(struct smu_context *smu, bool en)
        return ret;
 }
 
+static int vangogh_set_mp1_state(struct smu_context *smu,
+                                enum pp_mp1_state mp1_state)
+{
+       int ret;
+
+       switch (mp1_state) {
+       case PP_MP1_STATE_UNLOAD:
+               ret = vangogh_notify_rlc_state(smu, false);
+               break;
+       default:
+               /* Ignore others */
+               ret = 0;
+       }
+
+       return ret;
+}
+
 static int vangogh_post_smu_init(struct smu_context *smu)
 {
        struct amdgpu_device *adev = smu->adev;
@@ -2524,7 +2541,7 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
        .print_clk_levels = vangogh_common_print_clk_levels,
        .set_default_dpm_table = vangogh_set_default_dpm_tables,
        .set_fine_grain_gfx_freq_parameters = vangogh_set_fine_grain_gfx_freq_parameters,
-       .notify_rlc_state = vangogh_notify_rlc_state,
+       .set_mp1_state = vangogh_set_mp1_state,
        .feature_is_enabled = smu_cmn_feature_is_enabled,
        .set_power_profile_mode = vangogh_set_power_profile_mode,
        .get_power_profile_mode = vangogh_get_power_profile_mode,
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +0 -2
index c09ecf1a68a0..b9976313e741 100644
@@ -96,7 +96,6 @@
 #define smu_get_default_config_table_settings(smu, config_table)       smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
 #define smu_set_config_table(smu, config_table)                                smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)                                        smu_ppt_funcs(init_pptable_microcode, 0, smu)
-#define smu_notify_rlc_state(smu, en)                                  smu_ppt_funcs(notify_rlc_state, 0, smu, en)
 #define smu_is_asic_wbrf_supported(smu)                        smu_ppt_funcs(is_asic_wbrf_supported, false, smu)
 #define smu_enable_uclk_shadow(smu, enable)            smu_ppt_funcs(enable_uclk_shadow, 0, smu, enable)
 #define smu_set_wbrf_exclusion_ranges(smu, freq_band_range)            smu_ppt_funcs(set_wbrf_exclusion_ranges, -EOPNOTSUPP, smu, freq_band_range)
--
Quoted 2 lines

2.49.0

From c3f9769be6557751b35632a6dc7ea53bf303bfd7 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 24 Oct 2025 12:54:25 -0400
Subject: [PATCH 2/2] drm/amdgpu/smu: Handle S0ix for vangogh

Fix the flows for S0ix. There is no need to stop
rlc or reintialize PMFW in S0ix.

---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c        | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 3 +++
 2 files changed, 9 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index 10d42267085b0..5bee02f0ba867 100644
@@ -2054,6 +2054,12 @@ static int smu_disable_dpms(struct smu_context *smu)
 	    smu->is_apu && (amdgpu_in_reset(adev) || adev->in_s0ix))
 		return 0;
 
+	/* vangogh s0ix */
+	if ((amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(11, 5, 0) ||
+	     amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(11, 5, 2)) &&
+	    adev->in_s0ix)
+		return 0;
+
 	/*
 	 * For gpu reset, runpm and hibernation through BACO,
 	 * BACO feature has to be kept enabled.
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +3 -0
index 53579208cffb4..9626da2dba584 100644
@@ -2219,6 +2219,9 @@ static int vangogh_post_smu_init(struct smu_context *smu)
 	uint32_t total_cu = adev->gfx.config.max_cu_per_sh *
 		adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines;
 
+	if (adev->in_s0ix)
+		return 0;
+
 	/* allow message will be sent after enable message on Vangogh*/
 	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&
 			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
Signature · 1 line
2.51.0

From cc10a53193ee6f00d795abd8be37c80f90b3e308 Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Fri, 24 Oct 2025 12:36:15 -0400
Subject: [PATCH 1/2] drm/amdgpu: move PMFW rlc notifier to where it's required

For S3 on vangogh, PMFW needs to be notified before the driver powers down RLC. Move this notification to the rlc stop function so it will always get called bfore stopping the RLC. The call in amdgpu_device_suspend() seems to be superfluous so remove that as well.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  4 ----
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c     | 12 +++++++++++-
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c  | 10 ----------
 3 files changed, 11 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -4
index 5053c5f475ba9..78c0fc3a50ae8 100644
@@ -5283,10 +5283,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
 	if (amdgpu_sriov_vf(adev))
 		amdgpu_virt_release_full_gpu(adev, false);
 
-	r = amdgpu_dpm_notify_rlc_state(adev, false);
-	if (r)
-		return r;
-
 	return 0;
 }
 
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +11 -1
index 39b8adf23a9fa..d64579f5fb1f8 100644
@@ -5470,8 +5470,18 @@ static int gfx_v10_0_init_csb(struct amdgpu_device *adev)
 
 static void gfx_v10_0_rlc_stop(struct amdgpu_device *adev)
 {
-	u32 tmp = RREG32_SOC15(GC, 0, mmRLC_CNTL);
+	u32 tmp;
+	int r;
+
+	/* Notify SMU RLC is going to be off, stop RLC and SMU interaction.
+	 * otherwise SMU will hang while interacting with RLC if RLC is halted
+	 * this is a WA for Vangogh asic which fix the SMU hang issue.
+	 */
+	r = amdgpu_dpm_notify_rlc_state(adev, false);
+	if (r)
+		dev_info(adev->dev, "failed to notify PMFW of RLC powerdown\n");
 
+	tmp = RREG32_SOC15(GC, 0, mmRLC_CNTL);
 	tmp = REG_SET_FIELD(tmp, RLC_CNTL, RLC_ENABLE_F32, 0);
 	WREG32_SOC15(GC, 0, mmRLC_CNTL, tmp);
 }
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -10
index 4317da6f7c389..10d42267085b0 100644
@@ -2072,16 +2072,6 @@ static int smu_disable_dpms(struct smu_context *smu)
 		}
 	}
 
-	/* Notify SMU RLC is going to be off, stop RLC and SMU interaction.
-	 * otherwise SMU will hang while interacting with RLC if RLC is halted
-	 * this is a WA for Vangogh asic which fix the SMU hang issue.
-	 */
-	ret = smu_notify_rlc_state(smu, false);
-	if (ret) {
-		dev_err(adev->dev, "Fail to notify rlc status!\n");
-		return ret;
-	}
-
 	if (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 4, 2) &&
 	    !((adev->flags & AMD_IS_APU) && adev->gfx.imu.funcs) &&
 	    !amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs->stop)
Signature · 1 line
2.51.0
#3 lore raw

Re: [PATCH 1/2] drm/amd: Move Van Gogh specific suspend code into common `set_mp1_state`

Quoted 7 lines · Alex Deucher
Quoted 5 lines · Mario Limonciello

[Why]
An .notify_rlc_state callback and wrappers for it were introduced to support notifying the PMFW that the system is about to suspend.

Quoted 5 lines
Quoted 2 lines

There are already callbacks for set_mp1_state which get called at suspend though from amdgpu_device_ip_suspend_phase2.

This won't work. PMFW needs to be notified that RLC is being turned off before the driver turns it off.

Ah I see.

Quoted 2 lines

I think the call in
amdgpu_device_suspend() is superfluous (but someone should check S3),

Yeah; Antheas checked this and confirmed it is.

Quoted 3 lines

but the important one is in smu_disable_dpms() since that is called right before we stop rlc. I think something like the attached patches should do the trick.

Yeah those look good. I'm respinning my unwind series for test feedback, I'll rebase on them.

Quoted 180 lines

Alex

Quoted 177 lines

[How]
Tear out all the notify_rlc_state callbacks and instead move the Van Gogh specific code to a set_mp1_state callback.

Cc Robert Beckett <[email protected]>
Cc Antheas Kapenekakis <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  4 ----
  .../gpu/drm/amd/include/kgd_pp_interface.h    |  1 -
  drivers/gpu/drm/amd/pm/amdgpu_dpm.c           | 18 ------------------
  drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 --
  drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 10 ----------
  drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 -----
  .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19 ++++++++++++++++++-
  drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |  1 -
  8 files changed, 18 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -4
index 3ffb9bb1ec0b..4dbdcb7b11e9 100644
@@ -5281,10 +5281,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
         if (amdgpu_sriov_vf(adev))
                 amdgpu_virt_release_full_gpu(adev, false);
 
-       r = amdgpu_dpm_notify_rlc_state(adev, false);
-       if (r)
-               return r;
-
         return 0;
  }
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -1
index 87814c2b526e..48846a3e4b7b 100644
@@ -523,7 +523,6 @@ struct amd_pm_funcs {
                                    struct dpm_clocks *clock_table);
         int (*get_smu_prv_buf_details)(void *handle, void **addr, size_t *size);
         void (*pm_compute_clocks)(void *handle);
-       int (*notify_rlc_state)(void *handle, bool en);
  };
 
  struct metrics_table_header {
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +0 -18
index 5d08dc3b7110..5c4d0eb198c4 100644
@@ -195,24 +195,6 @@ int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
         return ret;
  }
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en)
-{
-       int ret = 0;
-       const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
-
-       if (pp_funcs && pp_funcs->notify_rlc_state) {
-               mutex_lock(&adev->pm.mutex);
-
-               ret = pp_funcs->notify_rlc_state(
-                               adev->powerplay.pp_handle,
-                               en);
-
-               mutex_unlock(&adev->pm.mutex);
-       }
-
-       return ret;
-}
-
  int amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev)
  {
         const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +0 -2
index 3bce74f8bb0a..c7ea29385682 100644
@@ -424,8 +424,6 @@ int amdgpu_dpm_mode1_reset(struct amdgpu_device *adev);
  int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
                              enum pp_mp1_state mp1_state);
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en);
-
  int amdgpu_dpm_set_gfx_power_up_by_imu(struct amdgpu_device *adev);
 
  int amdgpu_dpm_baco_exit(struct amdgpu_device *adev);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -10
index 4317da6f7c38..10d42267085b 100644
@@ -2072,16 +2072,6 @@ static int smu_disable_dpms(struct smu_context *smu)
                 }
         }
 
-       /* Notify SMU RLC is going to be off, stop RLC and SMU interaction.
-        * otherwise SMU will hang while interacting with RLC if RLC is halted
-        * this is a WA for Vangogh asic which fix the SMU hang issue.
-        */
-       ret = smu_notify_rlc_state(smu, false);
-       if (ret) {
-               dev_err(adev->dev, "Fail to notify rlc status!\n");
-               return ret;
-       }
-
         if (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 4, 2) &&
             !((adev->flags & AMD_IS_APU) && adev->gfx.imu.funcs) &&
             !amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs->stop)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -5
index c48028abc8c4..361e09f20ead 100644
@@ -1496,11 +1496,6 @@ struct pptable_funcs {
          */
         int (*set_mall_enable)(struct smu_context *smu);
 
-       /**
-        * @notify_rlc_state: Notify RLC power state to SMU.
-        */
-       int (*notify_rlc_state)(struct smu_context *smu, bool en);
-
         /**
          * @is_asic_wbrf_supported: check whether PMFW supports the wbrf feature
          */
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +18 -1
index 53579208cffb..3dc1919b8c64 100644
@@ -2208,6 +2208,23 @@ static int vangogh_notify_rlc_state(struct smu_context *smu, bool en)
         return ret;
  }
 
+static int vangogh_set_mp1_state(struct smu_context *smu,
+                                enum pp_mp1_state mp1_state)
+{
+       int ret;
+
+       switch (mp1_state) {
+       case PP_MP1_STATE_UNLOAD:
+               ret = vangogh_notify_rlc_state(smu, false);
+               break;
+       default:
+               /* Ignore others */
+               ret = 0;
+       }
+
+       return ret;
+}
+
  static int vangogh_post_smu_init(struct smu_context *smu)
  {
         struct amdgpu_device *adev = smu->adev;
@@ -2524,7 +2541,7 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
         .print_clk_levels = vangogh_common_print_clk_levels,
         .set_default_dpm_table = vangogh_set_default_dpm_tables,
         .set_fine_grain_gfx_freq_parameters = vangogh_set_fine_grain_gfx_freq_parameters,
-       .notify_rlc_state = vangogh_notify_rlc_state,
+       .set_mp1_state = vangogh_set_mp1_state,
         .feature_is_enabled = smu_cmn_feature_is_enabled,
         .set_power_profile_mode = vangogh_set_power_profile_mode,
         .get_power_profile_mode = vangogh_get_power_profile_mode,
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +0 -2
index c09ecf1a68a0..b9976313e741 100644
@@ -96,7 +96,6 @@
  #define smu_get_default_config_table_settings(smu, config_table)       smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
  #define smu_set_config_table(smu, config_table)                                smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
  #define smu_init_pptable_microcode(smu)                                        smu_ppt_funcs(init_pptable_microcode, 0, smu)
-#define smu_notify_rlc_state(smu, en)                                  smu_ppt_funcs(notify_rlc_state, 0, smu, en)
  #define smu_is_asic_wbrf_supported(smu)                        smu_ppt_funcs(is_asic_wbrf_supported, false, smu)
  #define smu_enable_uclk_shadow(smu, enable)            smu_ppt_funcs(enable_uclk_shadow, 0, smu, enable)
  #define smu_set_wbrf_exclusion_ranges(smu, freq_band_range)            smu_ppt_funcs(set_wbrf_exclusion_ranges, -EOPNOTSUPP, smu, freq_band_range)
--

2.49.0

#4 lore raw

Re: [PATCH 1/2] drm/amd: Move Van Gogh specific suspend code into common `set_mp1_state`

In reply to Alex Deucher
Quoted 11 lines · Alex Deucher
Quoted 7 lines · Mario Limonciello

[Why]
An .notify_rlc_state callback and wrappers for it were introduced to support notifying the PMFW that the system is about to suspend.

There are already callbacks for set_mp1_state which get called at suspend though from amdgpu_device_ip_suspend_phase2.

Quoted 8 lines

This won't work. PMFW needs to be notified that RLC is being turned off before the driver turns it off. I think the call in amdgpu_device_suspend() is superfluous (but someone should check S3), but the important one is in smu_disable_dpms() since that is called right before we stop rlc. I think something like the attached patches should do the trick.

Alex

S3 on the OLED works with the three lines in amdgpu_device_suspend removed.

Quoted 177 lines
Quoted 177 lines

[How]
Tear out all the notify_rlc_state callbacks and instead move the Van Gogh specific code to a set_mp1_state callback.

Cc Robert Beckett <[email protected]>
Cc Antheas Kapenekakis <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    |  4 ----
 .../gpu/drm/amd/include/kgd_pp_interface.h    |  1 -
 drivers/gpu/drm/amd/pm/amdgpu_dpm.c           | 18 ------------------
 drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h       |  2 --
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 10 ----------
 drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 -----
 .../gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c  | 19 ++++++++++++++++++-
 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h   |  1 -
 8 files changed, 18 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -4
index 3ffb9bb1ec0b..4dbdcb7b11e9 100644
@@ -5281,10 +5281,6 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)
        if (amdgpu_sriov_vf(adev))
                amdgpu_virt_release_full_gpu(adev, false);
 
-       r = amdgpu_dpm_notify_rlc_state(adev, false);
-       if (r)
-               return r;
-
        return 0;
 }
 
drivers/gpu/drm/amd/include/kgd_pp_interface.h +0 -1
index 87814c2b526e..48846a3e4b7b 100644
@@ -523,7 +523,6 @@ struct amd_pm_funcs {
                                   struct dpm_clocks *clock_table);
        int (*get_smu_prv_buf_details)(void *handle, void **addr, size_t *size);
        void (*pm_compute_clocks)(void *handle);
-       int (*notify_rlc_state)(void *handle, bool en);
 };
 
 struct metrics_table_header {
drivers/gpu/drm/amd/pm/amdgpu_dpm.c +0 -18
index 5d08dc3b7110..5c4d0eb198c4 100644
@@ -195,24 +195,6 @@ int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
        return ret;
 }
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en)
-{
-       int ret = 0;
-       const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
-
-       if (pp_funcs && pp_funcs->notify_rlc_state) {
-               mutex_lock(&adev->pm.mutex);
-
-               ret = pp_funcs->notify_rlc_state(
-                               adev->powerplay.pp_handle,
-                               en);
-
-               mutex_unlock(&adev->pm.mutex);
-       }
-
-       return ret;
-}
-
 int amdgpu_dpm_is_baco_supported(struct amdgpu_device *adev)
 {
        const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +0 -2
index 3bce74f8bb0a..c7ea29385682 100644
@@ -424,8 +424,6 @@ int amdgpu_dpm_mode1_reset(struct amdgpu_device *adev);
 int amdgpu_dpm_set_mp1_state(struct amdgpu_device *adev,
                             enum pp_mp1_state mp1_state);
 
-int amdgpu_dpm_notify_rlc_state(struct amdgpu_device *adev, bool en);
-
 int amdgpu_dpm_set_gfx_power_up_by_imu(struct amdgpu_device *adev);
 
 int amdgpu_dpm_baco_exit(struct amdgpu_device *adev);
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0 -10
index 4317da6f7c38..10d42267085b 100644
@@ -2072,16 +2072,6 @@ static int smu_disable_dpms(struct smu_context *smu)
                }
        }
 
-       /* Notify SMU RLC is going to be off, stop RLC and SMU interaction.
-        * otherwise SMU will hang while interacting with RLC if RLC is halted
-        * this is a WA for Vangogh asic which fix the SMU hang issue.
-        */
-       ret = smu_notify_rlc_state(smu, false);
-       if (ret) {
-               dev_err(adev->dev, "Fail to notify rlc status!\n");
-               return ret;
-       }
-
        if (amdgpu_ip_version(adev, GC_HWIP, 0) >= IP_VERSION(9, 4, 2) &&
            !((adev->flags & AMD_IS_APU) && adev->gfx.imu.funcs) &&
            !amdgpu_sriov_vf(adev) && adev->gfx.rlc.funcs->stop)
drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +0 -5
index c48028abc8c4..361e09f20ead 100644
@@ -1496,11 +1496,6 @@ struct pptable_funcs {
         */
        int (*set_mall_enable)(struct smu_context *smu);
 
-       /**
-        * @notify_rlc_state: Notify RLC power state to SMU.
-        */
-       int (*notify_rlc_state)(struct smu_context *smu, bool en);
-
        /**
         * @is_asic_wbrf_supported: check whether PMFW supports the wbrf feature
         */
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +18 -1
index 53579208cffb..3dc1919b8c64 100644
@@ -2208,6 +2208,23 @@ static int vangogh_notify_rlc_state(struct smu_context *smu, bool en)
        return ret;
 }
 
+static int vangogh_set_mp1_state(struct smu_context *smu,
+                                enum pp_mp1_state mp1_state)
+{
+       int ret;
+
+       switch (mp1_state) {
+       case PP_MP1_STATE_UNLOAD:
+               ret = vangogh_notify_rlc_state(smu, false);
+               break;
+       default:
+               /* Ignore others */
+               ret = 0;
+       }
+
+       return ret;
+}
+
 static int vangogh_post_smu_init(struct smu_context *smu)
 {
        struct amdgpu_device *adev = smu->adev;
@@ -2524,7 +2541,7 @@ static const struct pptable_funcs vangogh_ppt_funcs = {
        .print_clk_levels = vangogh_common_print_clk_levels,
        .set_default_dpm_table = vangogh_set_default_dpm_tables,
        .set_fine_grain_gfx_freq_parameters = vangogh_set_fine_grain_gfx_freq_parameters,
-       .notify_rlc_state = vangogh_notify_rlc_state,
+       .set_mp1_state = vangogh_set_mp1_state,
        .feature_is_enabled = smu_cmn_feature_is_enabled,
        .set_power_profile_mode = vangogh_set_power_profile_mode,
        .get_power_profile_mode = vangogh_get_power_profile_mode,
drivers/gpu/drm/amd/pm/swsmu/smu_internal.h +0 -2
index c09ecf1a68a0..b9976313e741 100644
@@ -96,7 +96,6 @@
 #define smu_get_default_config_table_settings(smu, config_table)       smu_ppt_funcs(get_default_config_table_settings, -EOPNOTSUPP, smu, config_table)
 #define smu_set_config_table(smu, config_table)                                smu_ppt_funcs(set_config_table, -EOPNOTSUPP, smu, config_table)
 #define smu_init_pptable_microcode(smu)                                        smu_ppt_funcs(init_pptable_microcode, 0, smu)
-#define smu_notify_rlc_state(smu, en)                                  smu_ppt_funcs(notify_rlc_state, 0, smu, en)
 #define smu_is_asic_wbrf_supported(smu)                        smu_ppt_funcs(is_asic_wbrf_supported, false, smu)
 #define smu_enable_uclk_shadow(smu, enable)            smu_ppt_funcs(enable_uclk_shadow, 0, smu, enable)
 #define smu_set_wbrf_exclusion_ranges(smu, freq_band_range)            smu_ppt_funcs(set_wbrf_exclusion_ranges, -EOPNOTSUPP, smu, freq_band_range)
--

2.49.0

#5 lore raw

PATCH 2/2 drm/amd: only send the SMU RLC notification on S3

In reply to Mario Limonciello

From: Alex Deucher <[email protected]>

For S0ix, the RLC is not powered down. Rework the Van Gogh logic to skip powering it down and skip part of post-init.

Cc Robert Beckett <[email protected]>
Fixes 8c4e9105b2a8 ("drm/amdgpu: optimize RLC powerdown notification on Vangogh")
---
 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c        | 6 ++++++
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 6 ++++++
 2 files changed, 12 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +6 -0
index 10d42267085b..5bee02f0ba86 100644
@@ -2054,6 +2054,12 @@ static int smu_disable_dpms(struct smu_context *smu)
 	    smu->is_apu && (amdgpu_in_reset(adev) || adev->in_s0ix))
 		return 0;
 
+	/* vangogh s0ix */
+	if ((amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(11, 5, 0) ||
+	     amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(11, 5, 2)) &&
+	    adev->in_s0ix)
+		return 0;
+
 	/*
 	 * For gpu reset, runpm and hibernation through BACO,
 	 * BACO feature has to be kept enabled.
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
index 3dc1919b8c64..e67fd972fc28 100644
@@ -2201,6 +2201,9 @@ static int vangogh_notify_rlc_state(struct smu_context *smu, bool en)
 	struct amdgpu_device *adev = smu->adev;
 	int ret = 0;
 
+	if (adev->in_s0ix)
+		return 0;
+
 	if (adev->pm.fw_version >= 0x43f1700 && !en)
 		ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_RlcPowerNotify,
 						      RLC_STATUS_OFF, NULL);
@@ -2236,6 +2239,9 @@ static int vangogh_post_smu_init(struct smu_context *smu)
 	uint32_t total_cu = adev->gfx.config.max_cu_per_sh *
 		adev->gfx.config.max_sh_per_se * adev->gfx.config.max_shader_engines;
 
+	if (adev->in_s0ix)
+		return 0;
+
 	/* allow message will be sent after enable message on Vangogh*/
 	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_DPM_GFXCLK_BIT) &&
 			(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)) {
Signature · 1 line
2.49.0