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

Commit 1bab4503 authored by Praneeth Paladugu's avatar Praneeth Paladugu Committed by Gerrit - the friendly Code Review server
Browse files

msm: vidc: Halt the AXI before detaching IOMMU



Before detaching IOMMU, video driver needs to make sure that
there are no pending transactions on AXI bus. Once IOMMU is
detached these pending transactions will cause unknown behavior.

CRs-Fixed: 758517
Change-Id: Ia414c4e41dff4347ca8159fbe15c74e6fb7d7d34
Signed-off-by: default avatarPraneeth Paladugu <ppaladug@codeaurora.org>
parent fd7e6316
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1505,10 +1505,6 @@ static int venus_hfi_halt_axi(struct venus_hfi_device *device)
		dprintk(VIDC_ERR, "Invalid input: %p\n", device);
		return -EINVAL;
	}
	if (venus_hfi_power_enable(device)) {
		dprintk(VIDC_ERR, "%s: Failed to enable power\n", __func__);
		return 0;
	}

	/* Halt AXI and AXI OCMEM VBIF Access */
	reg = venus_hfi_read_register(device, VENUS_VBIF_AXI_HALT_CTRL0);
@@ -1540,6 +1536,12 @@ static inline int venus_hfi_power_off(struct venus_hfi_device *device)
		return 0;
	}

	rc = venus_hfi_halt_axi(device);
	if (rc) {
		dprintk(VIDC_WARN, "Failed to halt AXI\n");
		return 0;
	}

	dprintk(VIDC_DBG, "Entering power collapse\n");
	rc = venus_hfi_tzbsp_set_video_state(TZBSP_VIDEO_STATE_SUSPEND);
	if (rc) {
@@ -4099,13 +4101,13 @@ static void venus_hfi_unload_fw(void *dev)
		flush_workqueue(device->venus_pm_workq);
		subsystem_put(device->resources.fw.cookie);
		venus_hfi_interface_queues_release(dev);
		/* IOMMU operations need to be done before AXI halt.*/
		venus_hfi_iommu_detach(device);
		/* Halt the AXI to make sure there are no pending transactions.
		 * Clocks should be unprepared after making sure axi is halted.
		 */
		if (venus_hfi_halt_axi(device))
			dprintk(VIDC_WARN, "Failed to halt AXI\n");
		/* Detach IOMMU only when AXI is halted */
		venus_hfi_iommu_detach(device);
		venus_hfi_disable_unprepare_clks(device);
		venus_hfi_disable_regulators(device);
		venus_hfi_unvote_buses(device);