|
@@ -28,7 +28,7 @@ static int msm_fault_handler(struct iommu_domain *iommu, struct device *dev,
|
|
|
unsigned long iova, int flags, void *arg)
|
|
|
{
|
|
|
DBG("*** fault: iova=%08lx, flags=%d", iova, flags);
|
|
|
- return 0;
|
|
|
+ return -ENOSYS;
|
|
|
}
|
|
|
|
|
|
static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt)
|
|
@@ -40,8 +40,10 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt)
|
|
|
for (i = 0; i < cnt; i++) {
|
|
|
struct device *msm_iommu_get_ctx(const char *ctx_name);
|
|
|
struct device *ctx = msm_iommu_get_ctx(names[i]);
|
|
|
- if (IS_ERR_OR_NULL(ctx))
|
|
|
+ if (IS_ERR_OR_NULL(ctx)) {
|
|
|
+ dev_warn(dev->dev, "couldn't get %s context", names[i]);
|
|
|
continue;
|
|
|
+ }
|
|
|
ret = iommu_attach_device(iommu->domain, ctx);
|
|
|
if (ret) {
|
|
|
dev_warn(dev->dev, "could not attach iommu to %s", names[i]);
|
|
@@ -52,6 +54,20 @@ static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt)
|
|
|
+{
|
|
|
+ struct msm_iommu *iommu = to_msm_iommu(mmu);
|
|
|
+ int i;
|
|
|
+
|
|
|
+ for (i = 0; i < cnt; i++) {
|
|
|
+ struct device *msm_iommu_get_ctx(const char *ctx_name);
|
|
|
+ struct device *ctx = msm_iommu_get_ctx(names[i]);
|
|
|
+ if (IS_ERR_OR_NULL(ctx))
|
|
|
+ continue;
|
|
|
+ iommu_detach_device(iommu->domain, ctx);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
|
|
|
struct sg_table *sgt, unsigned len, int prot)
|
|
|
{
|
|
@@ -127,6 +143,7 @@ static void msm_iommu_destroy(struct msm_mmu *mmu)
|
|
|
|
|
|
static const struct msm_mmu_funcs funcs = {
|
|
|
.attach = msm_iommu_attach,
|
|
|
+ .detach = msm_iommu_detach,
|
|
|
.map = msm_iommu_map,
|
|
|
.unmap = msm_iommu_unmap,
|
|
|
.destroy = msm_iommu_destroy,
|