From e1bfaf8253465ad72fc9fb028e0eb4e88e5533c7 Mon Sep 17 00:00:00 2001 From: Janghyuck Kim Date: Tue, 26 Apr 2016 14:00:47 +0900 Subject: [PATCH] [COMMON] iommu/exynos: add iommu group for each domain iommu group is not important for exynos iommu driver, however, without iommu group, getting domain from master device is failed. This patch added one to one relationship for iommu group and domain. Change-Id: Ia31bd028226e228c14091cd8ec5ee0412155228d Signed-off-by: Janghyuck Kim --- drivers/iommu/exynos-iommu.c | 9 +++++++++ drivers/iommu/exynos-iommu.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index ce66ac41f5e6..29c27a4ab91a 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -886,6 +886,9 @@ static int exynos_iommu_of_xlate(struct device *master, } } + /* HACK: Make relationship between group and master */ + master->iommu_group = owner->vmm_data->group; + if (!sysmmu_owner_list) { sysmmu_owner_list = owner; } else { @@ -944,6 +947,7 @@ static int __init exynos_iommu_create_domain(void) for_each_compatible_node(domain_np, NULL, "samsung,exynos-iommu-bus") { struct device_node *np; struct exynos_iovmm *vmm = NULL; + struct exynos_iommu_domain *domain; int i = 0; while ((np = of_parse_phandle(domain_np, "domain-clients", i++))) { @@ -957,6 +961,11 @@ static int __init exynos_iommu_create_domain(void) of_node_put(domain_np); return -ENOMEM; } + + /* HACK: Make one group for one domain */ + domain = to_exynos_domain(vmm->domain); + vmm->group = iommu_group_alloc(); + iommu_attach_group(vmm->domain, vmm->group); } /* Relationship between domain and client is added. */ ret = exynos_client_add(np, vmm); diff --git a/drivers/iommu/exynos-iommu.h b/drivers/iommu/exynos-iommu.h index c32f8160ec38..37bd63c2f00e 100644 --- a/drivers/iommu/exynos-iommu.h +++ b/drivers/iommu/exynos-iommu.h @@ -189,6 +189,7 @@ struct exynos_iovmm { unsigned int num_map; unsigned int num_unmap; const char *domain_name; + struct iommu_group *group; }; void exynos_sysmmu_tlb_invalidate(struct iommu_domain *domain, dma_addr_t start, -- 2.20.1