Bläddra i källkod

disp: msm: dsi: skip DSI disable operations in trusted VM

Secondary VM will do a disable commit when transferring HW
ownership back to primary. This will end up disabling the CMD
engine before releasing HW back to primary VM. Primary is
unaware that the engine has been disabled and ends up in a
bad state until it gets re-enabled.

This issue was introduced by: commit 65f3cc3 (disp: msm: dsi:
allow cmd-engine enable/disable HW op at all times).

Fix the issue by ensuring CMD engine does not get turned off
in the display disable path for trusted VM.

Change-Id: I1638a181d136e18a836c3ba08daee1c5fcaa9de3
Signed-off-by: Steve Cohen <[email protected]>
Steve Cohen 3 år sedan
förälder
incheckning
61518d4f5f
1 ändrade filer med 21 tillägg och 28 borttagningar
  1. 21 28
      msm/dsi/dsi_display.c

+ 21 - 28
msm/dsi/dsi_display.c

@@ -313,7 +313,6 @@ static int dsi_display_cmd_engine_disable(struct dsi_display *display)
 	int rc = 0;
 	int i;
 	struct dsi_display_ctrl *m_ctrl, *ctrl;
-	bool skip_op = is_skip_op_required(display);
 
 	m_ctrl = &display->ctrl[display->cmd_master_idx];
 	mutex_lock(&m_ctrl->ctrl->ctrl_lock);
@@ -326,14 +325,14 @@ static int dsi_display_cmd_engine_disable(struct dsi_display *display)
 		rc = dsi_ctrl_set_cmd_engine_state(ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
 		if (rc)
 			DSI_ERR(
-			   "[%s] disable cmd engine failed, skip_op:%d rc:%d\n",
-				display->name, skip_op, rc);
+			   "[%s] disable cmd engine failed, rc:%d\n",
+				display->name, rc);
 	}
 
 	rc = dsi_ctrl_set_cmd_engine_state(m_ctrl->ctrl, DSI_CTRL_ENGINE_OFF);
 	if (rc)
-		DSI_ERR("[%s] disable mcmd engine failed, skip_op:%d rc:%d\n",
-			display->name, skip_op, rc);
+		DSI_ERR("[%s] disable mcmd engine failed, rc:%d\n",
+			display->name, rc);
 
 	mutex_unlock(&m_ctrl->ctrl->ctrl_lock);
 	return rc;
@@ -8487,47 +8486,41 @@ int dsi_display_disable(struct dsi_display *display)
 	rc = dsi_display_wake_up(display);
 	if (rc)
 		DSI_ERR("[%s] display wake up failed, rc=%d\n",
-		       display->name, rc);
+			display->name, rc);
+
+	if (is_skip_op_required(display)) {
+		/* applicable only for trusted vm */
+		display->panel->panel_initialized = false;
+		display->panel->power_mode = SDE_MODE_DPMS_OFF;
+		goto out_unlock;
+	}
 
 	if (display->config.panel_mode == DSI_OP_VIDEO_MODE) {
 		rc = dsi_display_vid_engine_disable(display);
 		if (rc)
-			DSI_ERR("[%s]failed to disable DSI vid engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR("[%s]failed to disable DSI vid engine, rc=%d\n", display->name, rc);
 	} else if (display->config.panel_mode == DSI_OP_CMD_MODE) {
-		/**
-		 * On POMS request , disable panel TE through
-		 * delayed work queue.
-		 */
-		if (display->poms_pending &&
-				display->panel->poms_align_vsync) {
-			INIT_DELAYED_WORK(&display->poms_te_work,
-					dsi_display_handle_poms_te);
-			queue_delayed_work(system_wq,
-					&display->poms_te_work,
+		/* On POMS request , disable panel TE through delayed work queue. */
+		if (display->poms_pending && display->panel->poms_align_vsync) {
+			INIT_DELAYED_WORK(&display->poms_te_work, dsi_display_handle_poms_te);
+			queue_delayed_work(system_wq, &display->poms_te_work,
 					msecs_to_jiffies(100));
 		}
 		rc = dsi_display_cmd_engine_disable(display);
 		if (rc)
-			DSI_ERR("[%s]failed to disable DSI cmd engine, rc=%d\n",
-			       display->name, rc);
+			DSI_ERR("[%s]failed to disable DSI cmd engine, rc=%d\n", display->name, rc);
 	} else {
 		DSI_ERR("[%s] Invalid configuration\n", display->name);
 		rc = -EINVAL;
 	}
 
-	if (!display->poms_pending && !is_skip_op_required(display)) {
+	if (!display->poms_pending) {
 		rc = dsi_panel_disable(display->panel);
 		if (rc)
-			DSI_ERR("[%s] failed to disable DSI panel, rc=%d\n",
-				display->name, rc);
+			DSI_ERR("[%s] failed to disable DSI panel, rc=%d\n", display->name, rc);
 	}
 
-	if (is_skip_op_required(display)) {
-		/* applicable only for trusted vm */
-		display->panel->panel_initialized = false;
-		display->panel->power_mode = SDE_MODE_DPMS_OFF;
-	}
+out_unlock:
 	mutex_unlock(&display->display_lock);
 	SDE_EVT32(SDE_EVTLOG_FUNC_EXIT);
 	return rc;