iommu: msm: Do not access halt regs. to early
Venus and MDP are secure IOMMU's. Access to the halt register
is protected until a call has been made into the secure environment.
Change the location of the halt call to ensure HLOS has access to the
halt register space.
In addition, do not halt the IOMMU before writing bfb registers
since this will cause L2 error.
Change-Id: I00505a7173d8890a10b72da3c1db1e91bbf08ace
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
diff --git a/drivers/iommu/msm_iommu-v1.c b/drivers/iommu/msm_iommu-v1.c
index c2ec1d9..88e3fea 100644
--- a/drivers/iommu/msm_iommu-v1.c
+++ b/drivers/iommu/msm_iommu-v1.c
@@ -602,11 +602,12 @@
goto fail;
}
- iommu_halt(iommu_drvdata);
if (!msm_iommu_ctx_attached(dev->parent)) {
if (!is_secure) {
+ iommu_halt(iommu_drvdata);
__program_iommu(iommu_drvdata->base);
+ iommu_resume(iommu_drvdata);
} else {
ret = msm_iommu_sec_program_iommu(
iommu_drvdata->sec_id);
@@ -620,6 +621,8 @@
iommu_drvdata->bfb_settings);
}
+ iommu_halt(iommu_drvdata);
+
__program_context(iommu_drvdata, ctx_drvdata, __pa(priv->pt.fl_table),
priv->pt.redirect, is_secure);
diff --git a/drivers/iommu/msm_iommu_sec.c b/drivers/iommu/msm_iommu_sec.c
index 4885b38..4e55bd6 100644
--- a/drivers/iommu/msm_iommu_sec.c
+++ b/drivers/iommu/msm_iommu_sec.c
@@ -365,12 +365,11 @@
goto fail;
}
- iommu_halt(iommu_drvdata);
ret = msm_iommu_sec_program_iommu(iommu_drvdata->sec_id);
+
/* bfb settings are always programmed by HLOS */
program_iommu_bfb_settings(iommu_drvdata->base,
iommu_drvdata->bfb_settings);
- iommu_resume(iommu_drvdata);
__disable_clocks(iommu_drvdata);
if (ret) {