On Tue, Feb 16, 2016 at 03:40:31PM +0100, Marek Szyprowski wrote:
This patch ensures that devices attached to the default_domain will be first detached from it before attaching to new domain. To avoid forward declaration, __iommu_attach_group() function has been moved to new place in the source code.
Actually it was intentional to not invoke the detach_device call-back in the attach_device path.
The reason is that detaching first and than attaching again leaves the device without a domain for a short period of time, until it is attached to the new domain.
The attach_device call-back is supposed to handle this situation and just silently overwrite any other domain->device binding it finds for the device.
This allows to do re-attachment with less iommu flushes and to get rid of the detach_device call-back at some point.
Joerg