diff options
| -rw-r--r-- | drivers/iommu/iommu.c | 22 | 
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 42a4585dd76d..cfb597751f5b 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1865,7 +1865,6 @@ static int iommu_get_def_domain_type(struct iommu_group *group,  static int iommu_get_default_domain_type(struct iommu_group *group,  					 int target_type)  { -	const struct iommu_ops *ops = group_iommu_ops(group);  	struct device *untrusted = NULL;  	struct group_device *gdev;  	int driver_type = 0; @@ -1876,11 +1875,13 @@ static int iommu_get_default_domain_type(struct iommu_group *group,  	 * ARM32 drivers supporting CONFIG_ARM_DMA_USE_IOMMU can declare an  	 * identity_domain and it will automatically become their default  	 * domain. Later on ARM_DMA_USE_IOMMU will install its UNMANAGED domain. -	 * Override the selection to IDENTITY if we are sure the driver supports -	 * it. +	 * Override the selection to IDENTITY.  	 */ -	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) && ops->identity_domain) +	if (IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)) { +		static_assert(!(IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU) && +				IS_ENABLED(CONFIG_IOMMU_DMA)));  		driver_type = IOMMU_DOMAIN_IDENTITY; +	}  	for_each_group_device(group, gdev) {  		driver_type = iommu_get_def_domain_type(group, gdev->dev, @@ -3016,18 +3017,9 @@ static int iommu_setup_default_domain(struct iommu_group *group,  	if (req_type < 0)  		return -EINVAL; -	/* -	 * There are still some drivers which don't support default domains, so -	 * we ignore the failure and leave group->default_domain NULL. -	 */  	dom = iommu_group_alloc_default_domain(group, req_type); -	if (!dom) { -		/* Once in default_domain mode we never leave */ -		if (group->default_domain) -			return -ENODEV; -		group->default_domain = NULL; -		return 0; -	} +	if (!dom) +		return -ENODEV;  	if (group->default_domain == dom)  		return 0;  | 
