[COMMON] iommu/exynos: add iommu group for each domain
authorJanghyuck Kim <janghyuck.kim@samsung.com>
Tue, 26 Apr 2016 05:00:47 +0000 (14:00 +0900)
committerSangwook Ju <sw.ju@samsung.com>
Mon, 14 May 2018 10:45:18 +0000 (19:45 +0900)
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 <janghyuck.kim@samsung.com>
drivers/iommu/exynos-iommu.c
drivers/iommu/exynos-iommu.h

index ce66ac41f5e6c529e57e6b7bd8485905e6b53f59..29c27a4ab91aade5fb3af8248bedfd463b982746 100644 (file)
@@ -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);
index c32f8160ec388d3ebb47e6bb45c817ba2ff3f160..37bd63c2f00e811c2a756f3b706f69f9e1ce10b1 100644 (file)
@@ -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,