> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Saturday, May 20, 2023 2:42 AM > > Remove the race where a hotplug of a device into an existing group will > have the device installed in the group->devices, but not yet attached to > the group's current domain. > > Move the group attachment logic from iommu_probe_device() and put it > under > the same mutex that updates the group->devices list so everything is > atomic under the lock. > > We retain the two step setup of the default domain for the > bus_iommu_probe() case solely so that we have a more complete view of > the > group when creating the default domain for boot time devices. This is not > generally necessary with the current code structure but seems to be > supporting some odd corner cases like alias RID's and IOMMU_RESV_DIRECT > or > driver bugs returning different default_domain types for the same group. > > During bus_iommu_probe() the group will have a device list but both > group->default_domain and group->domain will be NULL. > > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>