iommu: msm: Move location of local iommu halt

During iommu detach we do a local iommu halt to ensure certain
registers are atomically updated. However, the local iommu halt
is taken at a larger scope than needed. Reduce the scope of this
halt. This will help with performance when detaching a context bank
from an iommu that has another context bank in use.

Change-Id: Id7630bd73a71d38ee987bd0f19cc8e06c725a7c1
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 d047f9e..50581f8 100644
--- a/drivers/iommu/msm_iommu-v1.c
+++ b/drivers/iommu/msm_iommu-v1.c
@@ -818,16 +818,15 @@
 	iommu_drvdata->asid[ctx_drvdata->asid - 1]--;
 	ctx_drvdata->asid = -1;
 
-	iommu_halt(iommu_drvdata);
-
 	__reset_context(iommu_drvdata->base, ctx_drvdata->num);
 
 	/*
 	 * Only reset the M2V tables on the very last detach */
-	if (!is_secure && iommu_drvdata->ctx_attach_count == 1)
+	if (!is_secure && iommu_drvdata->ctx_attach_count == 1) {
+		iommu_halt(iommu_drvdata);
 		__release_smg(iommu_drvdata->base);
-
-	iommu_resume(iommu_drvdata);
+		iommu_resume(iommu_drvdata);
+	}
 
 	__disable_clocks(iommu_drvdata);