diff options
author | Jason Gunthorpe <[email protected]> | 2023-05-11 01:42:07 -0300 |
---|---|---|
committer | Joerg Roedel <[email protected]> | 2023-05-23 08:15:54 +0200 |
commit | e7f85dfbbc9cf8660174c45c213571aaa518df85 (patch) | |
tree | 86807776e5c60f308a633711a40ffba134c69440 /drivers/misc/pci_endpoint_test.c | |
parent | 2f74198ae006c50a4188ae02c10e2c7b0b8142da (diff) |
iommu: Fix iommu_probe_device() to attach the right domain
The general invariant is that all devices in an iommu_group are attached
to group->domain. We missed some cases here where an owned group would not
get the device attached.
Rework this logic so it follows the default domain flow of the
bus_iommu_probe() - call iommu_alloc_default_domain(), then use
__iommu_group_set_domain_internal() to set up all the devices.
Finally always attach the device to the current domain if it is already
set.
This is an unlikely functional issue as iommufd uses iommu_attach_group().
It is possible to hot plug in a new group member, add a vfio driver to it
and then hot add it to an existing iommufd. In this case it is required
that the core code set the iommu_domain properly since iommufd won't call
iommu_attach_group() again.
Reviewed-by: Lu Baolu <[email protected]>
Reviewed-by: Kevin Tian <[email protected]>
Tested-by: Heiko Stuebner <[email protected]>
Tested-by: Niklas Schnelle <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
Diffstat (limited to 'drivers/misc/pci_endpoint_test.c')
0 files changed, 0 insertions, 0 deletions