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

Commit 6e960ded authored by Peter Liu's avatar Peter Liu Committed by Shubhraprakash Das
Browse files

msm: camera: stop vfe and never restart when smmu page fault



When smmu fault happen, enforce halt and never restart.
This makes sure the HW will not be on by any chance.

Use atomic instead of spin lock to protect the race.

Change-Id: Iab3785ee7007ee6b93cc723b535f4b7bede7d852
Signed-off-by: default avatarPeter Liu <pingchie@codeaurora.org>
parent 1aa24ca3
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -483,8 +483,7 @@ struct msm_vfe_tasklet_queue_cmd {
enum msm_vfe_overflow_state {
	NO_OVERFLOW,
	OVERFLOW_DETECTED,
	HALT_REQUESTED,
	RESTART_REQUESTED,
	HALT_ENFORCED,
};

struct msm_vfe_error_info {
+3 −0
Original line number Diff line number Diff line
@@ -1680,6 +1680,9 @@ static int msm_vfe40_axi_halt(struct vfe_device *vfe_dev,
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x2C0);
		rc = wait_for_completion_interruptible_timeout(
			&vfe_dev->halt_complete, msecs_to_jiffies(500));
		if (rc <= 0)
			pr_err("%s:VFE%d halt timeout rc=%d\n", __func__,
				vfe_dev->pdev->id, rc);
	} else {
		/* Halt AXI Bus Bridge */
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x2C0);
+8 −0
Original line number Diff line number Diff line
@@ -1399,12 +1399,20 @@ static int msm_vfe44_axi_halt(struct vfe_device *vfe_dev,
	/*push clear cmd*/
	msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x24);

	if (atomic_read(&vfe_dev->error_info.overflow_state)
		== OVERFLOW_DETECTED)
		pr_err_ratelimited("%s: VFE%d halt for recovery, blocking %d\n",
			__func__, vfe_dev->pdev->id, blocking);

	if (blocking) {
		init_completion(&vfe_dev->halt_complete);
		/* Halt AXI Bus Bridge */
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x2C0);
		rc = wait_for_completion_timeout(
			&vfe_dev->halt_complete, msecs_to_jiffies(500));
		if (rc <= 0)
			pr_err("%s:VFE%d halt timeout rc=%d\n", __func__,
				vfe_dev->pdev->id, rc);
	} else {
		/* Halt AXI Bus Bridge */
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x2C0);
+8 −0
Original line number Diff line number Diff line
@@ -1463,12 +1463,20 @@ static int msm_vfe46_axi_halt(struct vfe_device *vfe_dev,
	/*push clear cmd*/
	msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x58);

	if (atomic_read(&vfe_dev->error_info.overflow_state)
		== OVERFLOW_DETECTED)
		pr_err_ratelimited("%s: VFE%d halt for recovery, blocking %d\n",
			__func__, vfe_dev->pdev->id, blocking);

	if (blocking) {
		init_completion(&vfe_dev->halt_complete);
		/* Halt AXI Bus Bridge */
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x374);
		rc = wait_for_completion_timeout(
			&vfe_dev->halt_complete, msecs_to_jiffies(500));
		if (rc <= 0)
			pr_err("%s:VFE%d halt timeout rc=%d\n", __func__,
				vfe_dev->pdev->id, rc);
	} else {
		/* Halt AXI Bus Bridge */
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x374);
+10 −5
Original line number Diff line number Diff line
@@ -1636,22 +1636,27 @@ static int msm_vfe47_axi_halt(struct vfe_device *vfe_dev,
	/*push clear cmd*/
	msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x58);


	if (atomic_read(&vfe_dev->error_info.overflow_state)
		== OVERFLOW_DETECTED)
		pr_err_ratelimited("%s: VFE%d halt for recovery, blocking %d\n",
			__func__, vfe_dev->pdev->id, blocking);

	if (blocking) {
		init_completion(&vfe_dev->halt_complete);
		/* Halt AXI Bus Bridge */
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x400);
		rc = wait_for_completion_timeout(
			&vfe_dev->halt_complete, msecs_to_jiffies(500));
		if (rc <= 0)
			pr_err("%s:VFE%d halt timeout rc=%d\n", __func__,
				vfe_dev->pdev->id, rc);

	} else {
		/* Halt AXI Bus Bridge */
		msm_camera_io_w_mb(0x1, vfe_dev->vfe_base + 0x400);
	}

	if (atomic_read(&vfe_dev->error_info.overflow_state)
		== OVERFLOW_DETECTED)
		pr_err_ratelimited("%s: VFE%d halt recovery in process, HALT AXI\n",
			__func__, vfe_dev->pdev->id);

	for (i = VFE_PIX_0; i <= VFE_RAW_2; i++) {
		/* if any stream is waiting for update, signal complete */
		if (vfe_dev->axi_data.stream_update[i]) {
Loading