Commit 269c5238 authored by Jason Gunthorpe's avatar Jason Gunthorpe

iommufd: Use the iommufd_group to avoid duplicate MSI setup

This only needs to be done once per group, not once per device. The once
per device was a way to make the device list work. Since we are abandoning
this we can optimize things a bit.

Link: https://lore.kernel.org/r/6-v8-6659224517ea+532-iommufd_alloc_jgg@nvidia.comReviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
Tested-by: default avatarNicolin Chen <nicolinc@nvidia.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 34f327a9
......@@ -361,10 +361,6 @@ int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt,
if (rc)
goto err_unlock;
rc = iommufd_device_setup_msi(idev, hwpt, sw_msi_start);
if (rc)
goto err_unresv;
/*
* Only attach to the group once for the first device that is in the
* group. All the other devices will follow this attachment. The user
......@@ -373,6 +369,10 @@ int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt,
* attachment.
*/
if (list_empty(&idev->igroup->device_list)) {
rc = iommufd_device_setup_msi(idev, hwpt, sw_msi_start);
if (rc)
goto err_unresv;
rc = iommu_attach_group(hwpt->domain, idev->igroup->group);
if (rc)
goto err_unresv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment