msm: iommu: Support the secure domains

Add an option for clients to specify the domain is secure when
registering. If the domain is secure, the secure bus type should
be used to allocate the domain.

Change-Id: I9779353cd6705e90fc40142957b8d68c890288ff
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/arch/arm/mach-msm/include/mach/iommu_domains.h b/arch/arm/mach-msm/include/mach/iommu_domains.h
index 1d538f2..01bc479 100644
--- a/arch/arm/mach-msm/include/mach/iommu_domains.h
+++ b/arch/arm/mach-msm/include/mach/iommu_domains.h
@@ -15,6 +15,8 @@
 
 #include <linux/memory_alloc.h>
 
+#define MSM_IOMMU_DOMAIN_SECURE	0x1
+
 enum {
 	VIDEO_DOMAIN,
 	CAMERA_DOMAIN,
@@ -69,6 +71,7 @@
 	int npartitions;
 	const char *client_name;
 	unsigned int domain_flags;
+	unsigned int is_secure;
 };
 
 #if defined(CONFIG_MSM_IOMMU)
diff --git a/arch/arm/mach-msm/iommu_domains.c b/arch/arm/mach-msm/iommu_domains.c
index 3acb6d8..b56a291 100644
--- a/arch/arm/mach-msm/iommu_domains.c
+++ b/arch/arm/mach-msm/iommu_domains.c
@@ -344,6 +344,7 @@
 	int i;
 	struct msm_iova_data *data;
 	struct mem_pool *pools;
+	struct bus_type *bus;
 
 	if (!layout)
 		return -EINVAL;
@@ -389,11 +390,14 @@
 		}
 	}
 
+	bus = layout->is_secure == MSM_IOMMU_DOMAIN_SECURE ?
+					&msm_iommu_sec_bus_type :
+					&platform_bus_type;
+
 	data->pools = pools;
 	data->npools = layout->npartitions;
 	data->domain_num = atomic_inc_return(&domain_nums);
-	data->domain = iommu_domain_alloc(&platform_bus_type,
-					  layout->domain_flags);
+	data->domain = iommu_domain_alloc(bus, layout->domain_flags);
 
 	add_domain(data);