Skip to contentSkip to conversation

Add checks for enabling PSR-SU

PATCH In review Mario Limonciello 2 participants 7 messages Jun 23, 2023 – Jun 26, 2023

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

v2 cover Add checks for enabling PSR-SU

There have been a number of field reports of hangs tied to PSR-SU specifically to Parade TCONs. These hangs are fixed by changes in DMCUB firmware for both Rembrandt and Phoenix. Add checks to ensure that PSR-SU is only enabled when the newer DMCUB firmware is present.

Cc Sean Wang <[email protected]>
Cc Marc Rossi <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Tsung-hua (Ryan) Lin <[email protected]>

Mario Limonciello (4):
drm/amd/display: Correct DMUB_FW_VERSION macro drm/amd/display: Set minimum requirement for using PSR-SU on Rembrandt drm/amd/display: Set minimum requirement for using PSR-SU on Phoenix Revert "drm/amd: Disable PSR-SU on Parade 0803 TCON"

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |  3 ++-
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c          |  7 +++++++
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h          |  1 +
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h           |  4 +++-
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c     |  5 +++++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h     |  2 ++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.c    |  5 +++++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.h    |  2 ++
 drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c       | 11 +++++++----
 .../gpu/drm/amd/display/modules/power/power_helpers.c |  2 --
 10 files changed, 34 insertions(+), 8 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/4 drm/amd/display: Correct `DMUB_FW_VERSION` macro

The DMUB_FW_VERSION macro has a mistake in that the revision field is off by one byte. The last byte is typically used for other purposes and not a revision.

Cc Sean Wang <[email protected]>
Cc Marc Rossi <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Tsung-hua (Ryan) Lin <[email protected]>
---
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +1 -1
index 7c9a2b34bd05..2a66a305679a 100644
@@ -492,7 +492,7 @@ struct dmub_notification {
  * of a firmware to know if feature or functionality is supported or present.
  */
 #define DMUB_FW_VERSION(major, minor, revision) \
-	((((major) & 0xFF) << 24) | (((minor) & 0xFF) << 16) | ((revision) & 0xFFFF))
+	((((major) & 0xFF) << 24) | (((minor) & 0xFF) << 16) | (((revision) & 0xFF) << 8))
 
 /**
  * dmub_srv_create() - creates the DMUB service.
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/4 drm/amd/display: Set minimum requirement for using PSR-SU on Rembrandt

In reply to Mario Limonciello

A number of parade TCONs are causing system hangs when utilized with older DMUB firmware and PSR-SU. Some changes have been introduced into DMUB firmware to add resilience against these failures.

Don't allow running PSR-SU unless on the newer firmware.

---
v1->v2:
* Fix a s/dcn314/dcn31/ mixup

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |  3 ++-
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c          |  7 +++++++
 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h          |  1 +
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h           |  2 ++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c     |  5 +++++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h     |  2 ++
 drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c       | 10 ++++++----
 7 files changed, 25 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +2 -1
index d647f68fd563..4f61d4f257cd 100644
@@ -24,6 +24,7 @@
  */
 
 #include "amdgpu_dm_psr.h"
+#include "dc_dmub_srv.h"
 #include "dc.h"
 #include "dm_helpers.h"
 #include "amdgpu_dm.h"
@@ -50,7 +51,7 @@ static bool link_supports_psrsu(struct dc_link *link)
 	    !link->dpcd_caps.psr_info.psr2_su_y_granularity_cap)
 		return false;
 
-	return true;
+	return dc_dmub_check_min_version(dc->ctx->dmub_srv->dmub);
 }
 
 /*
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +7 -0
index c52c40b16387..c753c6f30dd7 100644
@@ -1011,3 +1011,10 @@ void dc_send_update_cursor_info_to_dmu(
 		dm_execute_dmub_cmd_list(pCtx->stream->ctx, 2, cmd, DM_DMUB_WAIT_TYPE_WAIT);
 	}
 }
+
+bool dc_dmub_check_min_version(struct dmub_srv *srv)
+{
+	if (!srv->hw_funcs.is_psrsu_supported)
+		return true;
+	return srv->hw_funcs.is_psrsu_supported(srv);
+}
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h +1 -0
index a5196a9292b3..099f94b6107c 100644
@@ -86,4 +86,5 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc, struct dc_state *context, b
 void dc_dmub_srv_log_diagnostic_data(struct dc_dmub_srv *dc_dmub_srv);
 
 void dc_send_update_cursor_info_to_dmu(struct pipe_ctx *pCtx, uint8_t pipe_idx);
+bool dc_dmub_check_min_version(struct dmub_srv *srv);
 #endif /* _DMUB_DC_SRV_H_ */
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +2 -0
index 2a66a305679a..4585e0419da6 100644
@@ -367,6 +367,8 @@ struct dmub_srv_hw_funcs {
 
 	bool (*is_supported)(struct dmub_srv *dmub);
 
+	bool (*is_psrsu_supported)(struct dmub_srv *dmub);
+
 	bool (*is_hw_init)(struct dmub_srv *dmub);
 
 	void (*enable_dmub_boot_options)(struct dmub_srv *dmub,
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c +5 -0
index ebf7aeec4029..c8445d474107 100644
@@ -302,6 +302,11 @@ bool dmub_dcn31_is_supported(struct dmub_srv *dmub)
 	return supported;
 }
 
+bool dmub_dcn31_is_psrsu_supported(struct dmub_srv *dmub)
+{
+	return dmub->fw_version >= DMUB_FW_VERSION(4, 0, 58);
+}
+
 void dmub_dcn31_set_gpint(struct dmub_srv *dmub,
 			  union dmub_gpint_data_register reg)
 {
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h +2 -0
index 7d5c10ee539b..89c5a948b67d 100644
@@ -221,6 +221,8 @@ bool dmub_dcn31_is_hw_init(struct dmub_srv *dmub);
 
 bool dmub_dcn31_is_supported(struct dmub_srv *dmub);
 
+bool dmub_dcn31_is_psrsu_supported(struct dmub_srv *dmub);
+
 void dmub_dcn31_set_gpint(struct dmub_srv *dmub,
 			  union dmub_gpint_data_register reg);
 
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +6 -4
index 9e9a6a44a7ac..7a31e3e27bab 100644
@@ -226,14 +226,16 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic)
 	case DMUB_ASIC_DCN314:
 	case DMUB_ASIC_DCN315:
 	case DMUB_ASIC_DCN316:
-		if (asic == DMUB_ASIC_DCN314)
+		if (asic == DMUB_ASIC_DCN314) {
 			dmub->regs_dcn31 = &dmub_srv_dcn314_regs;
-		else if (asic == DMUB_ASIC_DCN315)
+		} else if (asic == DMUB_ASIC_DCN315) {
 			dmub->regs_dcn31 = &dmub_srv_dcn315_regs;
-		else if (asic == DMUB_ASIC_DCN316)
+		} else if (asic == DMUB_ASIC_DCN316) {
 			dmub->regs_dcn31 = &dmub_srv_dcn316_regs;
-		else
+		} else {
 			dmub->regs_dcn31 = &dmub_srv_dcn31_regs;
+			funcs->is_psrsu_supported = dmub_dcn31_is_psrsu_supported;
+		}
 		funcs->reset = dmub_dcn31_reset;
 		funcs->reset_release = dmub_dcn31_reset_release;
 		funcs->backdoor_load = dmub_dcn31_backdoor_load;
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 2/4
#3 lore raw

Re: [PATCH v2 2/4] drm/amd/display: Set minimum requirement for using PSR-SU on Rembrandt

Quoted 4 lines · Mario Limonciello

A number of parade TCONs are causing system hangs when utilized with older DMUB firmware and PSR-SU. Some changes have been introduced into DMUB firmware to add resilience against these failures.

Quoted 8 lines

Don't allow running PSR-SU unless on the newer firmware.

Quoted 126 lines

---
v1->v2:
* Fix a s/dcn314/dcn31/ mixup

---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c |  3 ++-
  drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c          |  7 +++++++
  drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h          |  1 +
  drivers/gpu/drm/amd/display/dmub/dmub_srv.h           |  2 ++
  drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c     |  5 +++++
  drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h     |  2 ++
  drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c       | 10 ++++++----
  7 files changed, 25 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_psr.c +2 -1
index d647f68fd563..4f61d4f257cd 100644
@@ -24,6 +24,7 @@
   */
 
  #include "amdgpu_dm_psr.h"
+#include "dc_dmub_srv.h"
  #include "dc.h"
  #include "dm_helpers.h"
  #include "amdgpu_dm.h"
@@ -50,7 +51,7 @@ static bool link_supports_psrsu(struct dc_link *link)
  	    !link->dpcd_caps.psr_info.psr2_su_y_granularity_cap)
  		return false;
 
-	return true;
+	return dc_dmub_check_min_version(dc->ctx->dmub_srv->dmub);
  }
 
  /*
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +7 -0
index c52c40b16387..c753c6f30dd7 100644
@@ -1011,3 +1011,10 @@ void dc_send_update_cursor_info_to_dmu(
  		dm_execute_dmub_cmd_list(pCtx->stream->ctx, 2, cmd, DM_DMUB_WAIT_TYPE_WAIT);
  	}
  }
+
+bool dc_dmub_check_min_version(struct dmub_srv *srv)
+{
+	if (!srv->hw_funcs.is_psrsu_supported)
+		return true;
+	return srv->hw_funcs.is_psrsu_supported(srv);
+}
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h +1 -0
index a5196a9292b3..099f94b6107c 100644
@@ -86,4 +86,5 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc, struct dc_state *context, b
  void dc_dmub_srv_log_diagnostic_data(struct dc_dmub_srv *dc_dmub_srv);
 
  void dc_send_update_cursor_info_to_dmu(struct pipe_ctx *pCtx, uint8_t pipe_idx);
+bool dc_dmub_check_min_version(struct dmub_srv *srv);
  #endif /* _DMUB_DC_SRV_H_ */
drivers/gpu/drm/amd/display/dmub/dmub_srv.h +2 -0
index 2a66a305679a..4585e0419da6 100644
@@ -367,6 +367,8 @@ struct dmub_srv_hw_funcs {
 
  	bool (*is_supported)(struct dmub_srv *dmub);
 
+	bool (*is_psrsu_supported)(struct dmub_srv *dmub);
+
  	bool (*is_hw_init)(struct dmub_srv *dmub);
 
  	void (*enable_dmub_boot_options)(struct dmub_srv *dmub,
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c +5 -0
index ebf7aeec4029..c8445d474107 100644
@@ -302,6 +302,11 @@ bool dmub_dcn31_is_supported(struct dmub_srv *dmub)
  	return supported;
  }
 
+bool dmub_dcn31_is_psrsu_supported(struct dmub_srv *dmub)
+{
+	return dmub->fw_version >= DMUB_FW_VERSION(4, 0, 58);
+}
+
  void dmub_dcn31_set_gpint(struct dmub_srv *dmub,
  			  union dmub_gpint_data_register reg)
  {
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h +2 -0
index 7d5c10ee539b..89c5a948b67d 100644
@@ -221,6 +221,8 @@ bool dmub_dcn31_is_hw_init(struct dmub_srv *dmub);
 
  bool dmub_dcn31_is_supported(struct dmub_srv *dmub);
 
+bool dmub_dcn31_is_psrsu_supported(struct dmub_srv *dmub);
+
  void dmub_dcn31_set_gpint(struct dmub_srv *dmub,
  			  union dmub_gpint_data_register reg);
 
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +6 -4
index 9e9a6a44a7ac..7a31e3e27bab 100644
@@ -226,14 +226,16 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic)
  	case DMUB_ASIC_DCN314:
  	case DMUB_ASIC_DCN315:
  	case DMUB_ASIC_DCN316:
-		if (asic == DMUB_ASIC_DCN314)
+		if (asic == DMUB_ASIC_DCN314) {
  			dmub->regs_dcn31 = &dmub_srv_dcn314_regs;
-		else if (asic == DMUB_ASIC_DCN315)
+		} else if (asic == DMUB_ASIC_DCN315) {
  			dmub->regs_dcn31 = &dmub_srv_dcn315_regs;
-		else if (asic == DMUB_ASIC_DCN316)
+		} else if (asic == DMUB_ASIC_DCN316) {
  			dmub->regs_dcn31 = &dmub_srv_dcn316_regs;
-		else
+		} else {
  			dmub->regs_dcn31 = &dmub_srv_dcn31_regs;
+			funcs->is_psrsu_supported = dmub_dcn31_is_psrsu_supported;
+		}
  		funcs->reset = dmub_dcn31_reset;
  		funcs->reset_release = dmub_dcn31_reset_release;
  		funcs->backdoor_load = dmub_dcn31_backdoor_load;
#4 lore raw

PATCH v2 3/4 drm/amd/display: Set minimum requirement for using PSR-SU on Phoenix

In reply to Mario Limonciello

The same parade TCON issue can potentially happen on Phoenix, and the same PSR resilience changes have been ported into the DMUB firmware.

Don't allow running PSR-SU unless on the newer firmware.

Cc Sean Wang <[email protected]>
Cc Marc Rossi <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Tsung-hua (Ryan) Lin <[email protected]>

---
v1->v2:
* Fix a s/dcn31/dcn314/ mixup

---
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.c | 5 +++++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.h | 2 ++
 drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c    | 1 +
 3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.c +5 -0
index 48a06dbd9be7..f161aeb7e7c4 100644
@@ -60,3 +60,8 @@ const struct dmub_srv_dcn31_regs dmub_srv_dcn314_regs = {
 	{ DMUB_DCN31_FIELDS() },
 #undef DMUB_SF
 };
+
+bool dmub_dcn314_is_psrsu_supported(struct dmub_srv *dmub)
+{
+	return dmub->fw_version >= DMUB_FW_VERSION(8, 0, 16);
+}
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.h +2 -0
index 674267a2940e..f213bd82c911 100644
@@ -30,4 +30,6 @@
 
 extern const struct dmub_srv_dcn31_regs dmub_srv_dcn314_regs;
 
+bool dmub_dcn314_is_psrsu_supported(struct dmub_srv *dmub);
+
 #endif /* _DMUB_DCN314_H_ */
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +1 -0
index 7a31e3e27bab..bdaf43892f47 100644
@@ -228,6 +228,7 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic)
 	case DMUB_ASIC_DCN316:
 		if (asic == DMUB_ASIC_DCN314) {
 			dmub->regs_dcn31 = &dmub_srv_dcn314_regs;
+			funcs->is_psrsu_supported = dmub_dcn314_is_psrsu_supported;
 		} else if (asic == DMUB_ASIC_DCN315) {
 			dmub->regs_dcn31 = &dmub_srv_dcn315_regs;
 		} else if (asic == DMUB_ASIC_DCN316) {
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 3/4
#5 lore raw

Re: [PATCH v2 3/4] drm/amd/display: Set minimum requirement for using PSR-SU on Phoenix

Quoted 10 lines · Mario Limonciello

The same parade TCON issue can potentially happen on Phoenix, and the same PSR resilience changes have been ported into the DMUB firmware.

Don't allow running PSR-SU unless on the newer firmware.

Cc Sean Wang <[email protected]>
Cc Marc Rossi <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Tsung-hua (Ryan) Lin <[email protected]>
Quoted 45 lines

---
v1->v2:
* Fix a s/dcn31/dcn314/ mixup

---
  drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.c | 5 +++++
  drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.h | 2 ++
  drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c    | 1 +
  3 files changed, 8 insertions(+)
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.c +5 -0
index 48a06dbd9be7..f161aeb7e7c4 100644
@@ -60,3 +60,8 @@ const struct dmub_srv_dcn31_regs dmub_srv_dcn314_regs = {
  	{ DMUB_DCN31_FIELDS() },
  #undef DMUB_SF
  };
+
+bool dmub_dcn314_is_psrsu_supported(struct dmub_srv *dmub)
+{
+	return dmub->fw_version >= DMUB_FW_VERSION(8, 0, 16);
+}
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn314.h +2 -0
index 674267a2940e..f213bd82c911 100644
@@ -30,4 +30,6 @@
 
  extern const struct dmub_srv_dcn31_regs dmub_srv_dcn314_regs;
 
+bool dmub_dcn314_is_psrsu_supported(struct dmub_srv *dmub);
+
  #endif /* _DMUB_DCN314_H_ */
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c +1 -0
index 7a31e3e27bab..bdaf43892f47 100644
@@ -228,6 +228,7 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic)
  	case DMUB_ASIC_DCN316:
  		if (asic == DMUB_ASIC_DCN314) {
  			dmub->regs_dcn31 = &dmub_srv_dcn314_regs;
+			funcs->is_psrsu_supported = dmub_dcn314_is_psrsu_supported;
  		} else if (asic == DMUB_ASIC_DCN315) {
  			dmub->regs_dcn31 = &dmub_srv_dcn315_regs;
  		} else if (asic == DMUB_ASIC_DCN316) {
#6 lore raw

PATCH v2 4/4 Revert "drm/amd: Disable PSR-SU on Parade 0803 TCON"

In reply to Mario Limonciello

This reverts commit 33eec907ce0eb50a56dca621aa7310f7fa904b93. This is no longer necessary when using newer DMUB F/W.

Cc Sean Wang <[email protected]>
Cc Marc Rossi <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Cc Tsung-hua (Ryan) Lin <[email protected]>
---
 drivers/gpu/drm/amd/display/modules/power/power_helpers.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/display/modules/power/power_helpers.c +0 -2
index b9e78451a3d5..30349881a283 100644
@@ -839,8 +839,6 @@ bool is_psr_su_specific_panel(struct dc_link *link)
 				((dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x08) ||
 				(dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x07)))
 				isPSRSUSupported = false;
-			else if (dpcd_caps->sink_dev_id_str[1] == 0x08 && dpcd_caps->sink_dev_id_str[0] == 0x03)
-				isPSRSUSupported = false;
 			else if (dpcd_caps->psr_info.force_psrsu_cap == 0x1)
 				isPSRSUSupported = true;
 		}
Signature · 1 line
2.34.1