aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSricharan R <sricharan@codeaurora.org>2015-07-23 21:05:57 +0530
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2015-07-28 15:10:14 +0100
commit2a767e14363745960962bae79599e550b2e8034f (patch)
tree1e780f9f109f001e9d548c3e5e2e4e6eb8145eaf
parentb6a8e51c0f77f811de734232e30942b80682a475 (diff)
drm/msm: temp: Add a check to be compatible against both iommuv0/v1qcomlt-v4.2-rc3
msm_iommu_get_ctx is a dummy api in iommu-v0. So check for the return value to use the correct dev to pass for iommu_attach/deattach. Signed-off-by: Sricharan R <sricharan@codeaurora.org>
-rw-r--r--drivers/gpu/drm/msm/msm_iommu.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 75193886266d..f033d48cd1f3 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -18,6 +18,8 @@
#include "msm_drv.h"
#include "msm_mmu.h"
+#define DUMMY_CONTEXT 0x1
+
struct msm_iommu {
struct msm_mmu base;
struct iommu_domain *domain;
@@ -44,7 +46,13 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt)
dev_warn(dev, "couldn't get %s context", names[i]);
continue;
}
- ret = iommu_attach_device(iommu->domain, ctx);
+
+ if (ctx == (struct device *)DUMMY_CONTEXT) {
+ return iommu_attach_device(iommu->domain, mmu->dev);
+ } else {
+ ret = iommu_attach_device(iommu->domain, ctx);
+ }
+
if (ret) {
dev_warn(dev, "could not attach iommu to %s", names[i]);
return ret;
@@ -64,7 +72,13 @@ static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt)
struct device *ctx = msm_iommu_get_ctx(names[i]);
if (IS_ERR_OR_NULL(ctx))
continue;
- iommu_detach_device(iommu->domain, ctx);
+
+ if (ctx == (struct device *)DUMMY_CONTEXT) {
+ iommu_detach_device(iommu->domain, mmu->dev);
+ break;
+ } else {
+ iommu_detach_device(iommu->domain, ctx);
+ }
}
}