[SRU][E][PATCH 43/52] drm/i915/display: Handle lost primary_port across suspend

You-Sheng Yang vicamo.yang at canonical.com
Wed Apr 22 14:12:06 UTC 2020


From: Chris Wilson <chris at chris-wilson.co.uk>

BugLink: https://bugs.launchpad.net/bugs/1868936

icl-dsi is dying on suspend/resume at

	RIP: 0010:icl_update_active_dpll+0x2c/0xa0 [i915]

which appears due to the loss of the time primary_port across suspend.
Protect against the potential NULL dereference by assuming
ICL_PORT_DPLL_DEFAULT unless the port is actively specified otherwise.

Fixes: 24a7bfe0c2d7 ("drm/i915: Keep the TypeC port mode fixed when the port is active")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Imre Deak <imre.deak at intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190702140950.7069-1-chris@chris-wilson.co.uk
(cherry picked from commit 8e9ecb3e1e3366559cd4ed5ab698c391f8236a37)
Signed-off-by: You-Sheng Yang <vicamo.yang at canonical.com>
---
 drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
index 23ce47d03f1b..88f5fe94f619 100644
--- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
@@ -2899,21 +2899,16 @@ static void icl_update_active_dpll(struct intel_atomic_state *state,
 	struct intel_crtc_state *crtc_state =
 		intel_atomic_get_new_crtc_state(state, crtc);
 	struct intel_digital_port *primary_port;
-	enum icl_port_dpll_id port_dpll_id;
+	enum icl_port_dpll_id port_dpll_id = ICL_PORT_DPLL_DEFAULT;
 
 	primary_port = encoder->type == INTEL_OUTPUT_DP_MST ?
 		enc_to_mst(&encoder->base)->primary :
 		enc_to_dig_port(&encoder->base);
 
-	switch (primary_port->tc_mode) {
-	case TC_PORT_TBT_ALT:
-		port_dpll_id = ICL_PORT_DPLL_DEFAULT;
-		break;
-	case TC_PORT_DP_ALT:
-	case TC_PORT_LEGACY:
+	if (primary_port &&
+	    (primary_port->tc_mode == TC_PORT_DP_ALT ||
+	     primary_port->tc_mode == TC_PORT_LEGACY))
 		port_dpll_id = ICL_PORT_DPLL_MG_PHY;
-		break;
-	}
 
 	icl_set_active_port_dpll(crtc_state, port_dpll_id);
 }
-- 
2.25.1




More information about the kernel-team mailing list