Skip to contentSkip to conversation

drm/amd/display: Disable ips before dc interrupt setting

PATCH In review [email protected] 2 participants 6 messages Jan 24, 2024

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

PATCH 1/3 drm/amd/display: Disable ips before dc interrupt setting

From: Roman Li <[email protected]>

[Why]
While in IPS2 an access to dcn registers is not allowed. If interrupt results in dc call, we should disable IPS.

[How]
Safeguard register access in IPS2 by disabling idle optimization before calling dc interrupt setting api.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +4 -1
index 58b880acb087..3390f0d8420a 100644
@@ -711,7 +711,7 @@ static inline int dm_irq_state(struct amdgpu_device *adev,
 {
 	bool st;
 	enum dc_irq_source irq_source;
-
+	struct dc *dc = adev->dm.dc;
 	struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc_id];
 
 	if (!acrtc) {
@@ -729,6 +729,9 @@ static inline int dm_irq_state(struct amdgpu_device *adev,
 
 	st = (state == AMDGPU_IRQ_STATE_ENABLE);
 
+	if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed)
+		dc_allow_idle_optimizations(dc, false);
+
 	dc_interrupt_set(adev->dm.dc, irq_source, st);
 	return 0;
 }
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 drm/amd: Add a DC debug mask for IPS

From: Roman Li <[email protected]>

For debugging IPS-related issues, expose a new debug mask that allows to disable IPS.
Usage:
amdgpu.dcdebugmask=0x800

---
 drivers/gpu/drm/amd/include/amd_shared.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
index da9b670fec86..a89d93154ddb 100644
@@ -259,6 +259,7 @@ enum DC_DEBUG_MASK {
 	DC_ENABLE_DML2 = 0x100,
 	DC_DISABLE_PSR_SU = 0x200,
 	DC_DISABLE_REPLAY = 0x400,
+	DC_DISABLE_IPS = 0x800,
 };
 
 enum amd_dpm_forced_level;
Signature · 1 line
2.34.1
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/amd: Add a DC debug mask for IPS

Quoted 9 lines · On 1/24/2024 11:09, [email protected] wrote:

From: Roman Li <[email protected]>

For debugging IPS-related issues, expose a new debug mask that allows to disable IPS.
Usage:
amdgpu.dcdebugmask=0x800

Quoted 16 lines
---
  drivers/gpu/drm/amd/include/amd_shared.h | 1 +
  1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
index da9b670fec86..a89d93154ddb 100644
@@ -259,6 +259,7 @@ enum DC_DEBUG_MASK {
  	DC_ENABLE_DML2 = 0x100,
  	DC_DISABLE_PSR_SU = 0x200,
  	DC_DISABLE_REPLAY = 0x400,
+	DC_DISABLE_IPS = 0x800,
  };
 
  enum amd_dpm_forced_level;
#3 lore raw

PATCH 3/3 drm/amd/display: "Enable IPS by default"

In reply to [email protected]

From: Roman Li <[email protected]>

[Why]
IPS was temporary disabled due to instability.
It was fixed in dmub firmware and with:
- "drm/amd/display: Add IPS checks before dcn register access"
- "drm/amd/display: Disable ips before dc interrupt setting"

[How]
Enable IPS by default.
Disable IPS if 0x800 bit set in amdgpu.dcdebugmask module params

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 41994a60e2cd..9d909c09a14f 100644
@@ -1719,7 +1719,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	init_data.nbio_reg_offsets = adev->reg_offset[NBIO_HWIP][0];
 	init_data.clk_reg_offsets = adev->reg_offset[CLK_HWIP][0];
 
-	init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL;
+        if (amdgpu_dc_debug_mask & DC_DISABLE_IPS)
+		init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL;
 
 	init_data.flags.disable_ips_in_vpb = 1;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drm/amd/display: "Enable IPS by default"

Quoted 8 lines · On 1/24/2024 11:09, [email protected] wrote:

From: Roman Li <[email protected]>

[Why]
IPS was temporary disabled due to instability.
It was fixed in dmub firmware and with:
- "drm/amd/display: Add IPS checks before dcn register access"
- "drm/amd/display: Disable ips before dc interrupt setting"

Quoted 6 lines

[How]
Enable IPS by default.
Disable IPS if 0x800 bit set in amdgpu.dcdebugmask module params

Quoted 18 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -1
index 41994a60e2cd..9d909c09a14f 100644
@@ -1719,7 +1719,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
  	init_data.nbio_reg_offsets = adev->reg_offset[NBIO_HWIP][0];
  	init_data.clk_reg_offsets = adev->reg_offset[CLK_HWIP][0];
 
-	init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL;
+        if (amdgpu_dc_debug_mask & DC_DISABLE_IPS)
+		init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL;
 
  	init_data.flags.disable_ips_in_vpb = 1;
 
Reviewed-by on v1 1/3
#5 lore raw
In reply to [email protected]
Quoted 6 lines · On 1/24/2024 11:09, [email protected] wrote:

From: Roman Li <[email protected]>

[Why]
While in IPS2 an access to dcn registers is not allowed. If interrupt results in dc call, we should disable IPS.

Quoted 6 lines

[How]
Safeguard register access in IPS2 by disabling idle optimization before calling dc interrupt setting api.

Quoted 27 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +4 -1
index 58b880acb087..3390f0d8420a 100644
@@ -711,7 +711,7 @@ static inline int dm_irq_state(struct amdgpu_device *adev,
  {
  	bool st;
  	enum dc_irq_source irq_source;
-
+	struct dc *dc = adev->dm.dc;
  	struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc_id];
 
  	if (!acrtc) {
@@ -729,6 +729,9 @@ static inline int dm_irq_state(struct amdgpu_device *adev,
 
  	st = (state == AMDGPU_IRQ_STATE_ENABLE);
 
+	if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed)
+		dc_allow_idle_optimizations(dc, false);
+
  	dc_interrupt_set(adev->dm.dc, irq_source, st);
  	return 0;
  }