Commit dfddd54d authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Joerg Roedel
Browse files

iommu: Remove the assignment of group->domain during default domain alloc



group->domain should only be set once all the device's drivers have
had their ops->attach_dev() called. iommu_group_alloc_default_domain()
doesn't do this, so it shouldn't set the value.

The previous patches organized things so that each caller of
iommu_group_alloc_default_domain() follows up with calling
__iommu_group_set_domain_internal() that does set the group->domain.

Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Reviewed-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Tested-by: default avatarHeiko Stuebner <heiko@sntech.de>
Tested-by: default avatarNiklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/11-v5-1b99ae392328+44574-iommu_err_unwind_jgg@nvidia.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 152431e4
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -435,7 +435,6 @@ int iommu_probe_device(struct device *dev)
		 * checked.
		 */
		iommu_alloc_default_domain(group, dev);
		group->domain = NULL;
		if (group->default_domain) {
			iommu_create_device_direct_mappings(group, dev);
			ret = __iommu_group_set_domain(group,
@@ -1664,8 +1663,6 @@ static int iommu_group_alloc_default_domain(const struct bus_type *bus,
		return -ENOMEM;

	group->default_domain = dom;
	if (!group->domain)
		group->domain = dom;
	return 0;
}

@@ -1869,7 +1866,6 @@ int bus_iommu_probe(const struct bus_type *bus)

		iommu_group_create_direct_mappings(group);

		group->domain = NULL;
		ret = __iommu_group_set_domain(group, group->default_domain);

		mutex_unlock(&group->mutex);