Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14f3adcd authored by Dhaval Patel's avatar Dhaval Patel
Browse files

drm/msm: avoid sde rsc debug mode access during idle pc



SDE driver removes AHB vote during idle pc and it triggers
cnoc disconnect. Any SDE RSC register access in this state
may lead to noc error and causes panic. This patch avoids
sde rsc debug node access during idle pc.

Change-Id: I3426cfecc47c36a509cf3621937ae172991bd4dd
Signed-off-by: default avatarDhaval Patel <pdhaval@codeaurora.org>
parent 3ef19c0b
Loading
Loading
Loading
Loading
+28 −25
Original line number Diff line number Diff line
@@ -975,9 +975,6 @@ static int _sde_debugfs_status_show(struct seq_file *s, void *data)
	rsc = s->private;

	mutex_lock(&rsc->client_lock);
	ret = sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, true);
	if (ret)
		goto end;

	seq_printf(s, "rsc current state:%d\n", rsc->current_state);
	seq_printf(s, "wraper backoff time(ns):%d\n",
@@ -1003,12 +1000,17 @@ static int _sde_debugfs_status_show(struct seq_file *s, void *data)
		seq_printf(s, "\t client:%s state:%d\n",
				client->name, client->current_state);

	if (rsc->current_state == SDE_RSC_IDLE_STATE) {
		pr_debug("debug node is not supported during idle state\n");
		seq_puts(s, "hw state is not supported during idle pc\n");
		goto end;
	}

	if (rsc->hw_ops.debug_show) {
		ret = rsc->hw_ops.debug_show(s, rsc);
		if (ret)
			pr_err("sde rsc: hw debug failed ret:%d\n", ret);
	}
	sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, false);

end:
	mutex_unlock(&rsc->client_lock);
@@ -1032,21 +1034,22 @@ static ssize_t _sde_debugfs_mode_ctrl_read(struct file *file, char __user *buf,
{
	struct sde_rsc_priv *rsc = file->private_data;
	char buffer[MAX_BUFFER_SIZE];
	int blen = 0, rc;
	int blen = 0;

	if (*ppos || !rsc || !rsc->hw_ops.mode_ctrl)
		return 0;

	mutex_lock(&rsc->client_lock);
	rc = sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, true);
	if (rc)
	if (rsc->current_state == SDE_RSC_IDLE_STATE) {
		pr_debug("debug node is not supported during idle state\n");
		blen = snprintf(buffer, MAX_BUFFER_SIZE,
				"hw state is not supported during idle pc\n");
		goto end;
	}

	blen = rsc->hw_ops.mode_ctrl(rsc, MODE_READ, buffer,
							MAX_BUFFER_SIZE, 0);

	sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, false);

end:
	mutex_unlock(&rsc->client_lock);
	if (blen <= 0)
@@ -1098,14 +1101,14 @@ static ssize_t _sde_debugfs_mode_ctrl_write(struct file *file,
	}

	mutex_lock(&rsc->client_lock);
	rc = sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, true);
	if (rc)
		goto clk_enable_fail;
	if (rsc->current_state == SDE_RSC_IDLE_STATE) {
		pr_debug("debug node is not supported during idle state\n");
		goto state_check;
	}

	rsc->hw_ops.mode_ctrl(rsc, MODE_UPDATE, NULL, 0, mode_state);
	sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, false);

clk_enable_fail:
state_check:
	mutex_unlock(&rsc->client_lock);
end:
	kfree(input);
@@ -1124,21 +1127,22 @@ static ssize_t _sde_debugfs_vsync_mode_read(struct file *file, char __user *buf,
{
	struct sde_rsc_priv *rsc = file->private_data;
	char buffer[MAX_BUFFER_SIZE];
	int blen = 0, rc;
	int blen = 0;

	if (*ppos || !rsc || !rsc->hw_ops.hw_vsync)
		return 0;

	mutex_lock(&rsc->client_lock);
	rc = sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, true);
	if (rc)
	if (rsc->current_state == SDE_RSC_IDLE_STATE) {
		pr_debug("debug node is not supported during idle state\n");
		blen = snprintf(buffer, MAX_BUFFER_SIZE,
				"hw state is not supported during idle pc\n");
		goto end;
	}

	blen = rsc->hw_ops.hw_vsync(rsc, VSYNC_READ, buffer,
						MAX_BUFFER_SIZE, 0);

	sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, false);

end:
	mutex_unlock(&rsc->client_lock);
	if (blen <= 0)
@@ -1183,9 +1187,10 @@ static ssize_t _sde_debugfs_vsync_mode_write(struct file *file,
	vsync_state &= 0x7;

	mutex_lock(&rsc->client_lock);
	rc = sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, true);
	if (rc)
		goto clk_en_fail;
	if (rsc->current_state == SDE_RSC_IDLE_STATE) {
		pr_debug("debug node is not supported during idle state\n");
		goto state_check;
	}

	if (vsync_state)
		rsc->hw_ops.hw_vsync(rsc, VSYNC_ENABLE, NULL,
@@ -1193,9 +1198,7 @@ static ssize_t _sde_debugfs_vsync_mode_write(struct file *file,
	else
		rsc->hw_ops.hw_vsync(rsc, VSYNC_DISABLE, NULL, 0, 0);

	sde_rsc_clk_enable(&rsc->phandle, rsc->pclient, false);

clk_en_fail:
state_check:
	mutex_unlock(&rsc->client_lock);
end:
	kfree(input);