[PATCH v2 0/2] Two enhancements to iommu_at[de]tach_device_pasid()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are minor mistakes in the iommu set_dev_pasid() and remove_dev_pasid()
paths. The set_dev_pasid() path updates the group->pasid_array first, and
then call into remove_dev_pasid() in error handling when there are devices
within the group that failed to set_dev_pasid. The remove_dev_pasid()
callbacks of the underlying iommu drivers get the domain for pasid from the
group->pasid_array. So the remove_dev_pasid() callback may get a wrong domain
in the set_dev_pasid() path. [1] Even if the group is singleton, the existing
code logic would have unnecessary warnings in the error handling of the
set_dev_pasid() path. e.g. intel iommu driver.

The above issue can be fixed by improving the error handling in the
set_dev_pasid() path. Also, this reminds that it is not reliable for the
underlying iommu driver callback to get the domain from group->pasid_array.
So, the second patch of this series passes the domain to remove_dev_pasid
op.

[1] https://lore.kernel.org/linux-iommu/20240320123803.GD159172@xxxxxxxxxx/

Change log:

v2:
 - Make clear that the patch 1/2 of v1 does not fix the problem (Kevin)
 - Swap the order of patch 1/2 and 2/2 of v1. In this new series, patch 1/2
   fixes the real issue, patch 2/2 is to avoid potential issue in the future.

v1: https://lore.kernel.org/linux-iommu/20240327125433.248946-1-yi.l.liu@xxxxxxxxx/

Regards,
	Yi Liu

Yi Liu (2):
  iommu: Undo pasid attachment only for the devices that have succeeded
  iommu: Pass domain to remove_dev_pasid() op

 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c |  9 ++-----
 drivers/iommu/intel/iommu.c                 | 11 +++-----
 drivers/iommu/iommu.c                       | 28 ++++++++++++++-------
 include/linux/iommu.h                       |  3 ++-
 4 files changed, 26 insertions(+), 25 deletions(-)

-- 
2.34.1





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux