Skip to content

Commit 269c523

Browse files
committed
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/[email protected] Reviewed-by: Kevin Tian <[email protected]> Tested-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 34f327a commit 269c523

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/iommu/iommufd/device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,6 @@ int iommufd_hw_pagetable_attach(struct iommufd_hw_pagetable *hwpt,
361361
if (rc)
362362
goto err_unlock;
363363

364-
rc = iommufd_device_setup_msi(idev, hwpt, sw_msi_start);
365-
if (rc)
366-
goto err_unresv;
367-
368364
/*
369365
* Only attach to the group once for the first device that is in the
370366
* 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,
373369
* attachment.
374370
*/
375371
if (list_empty(&idev->igroup->device_list)) {
372+
rc = iommufd_device_setup_msi(idev, hwpt, sw_msi_start);
373+
if (rc)
374+
goto err_unresv;
375+
376376
rc = iommu_attach_group(hwpt->domain, idev->igroup->group);
377377
if (rc)
378378
goto err_unresv;

0 commit comments

Comments
 (0)