[PATCH 0/5] Simplify vfio_iommu_type1 attach/detach routine

From: Nicolin Chen
Date: Mon Jun 06 2022 - 02:20:31 EST


This is a preparatory series for IOMMUFD v2 patches. It enforces error
code -EMEDIUMTYPE in iommu_attach_device() and iommu_attach_group() when
an IOMMU domain and a device/group are incompatible. It also moves the
domain->ops check into __iommu_attach_device(). These allow VFIO iommu
code to simplify its group attachment routine, by avoiding the extra
IOMMU domain allocations and attach/detach sequences of the old code.

Worths mentioning the exact match for enforce_cache_coherency is removed
with this series, since there's very less value in doing that since KVM
won't be able to take advantage of it -- this just wastes domain memory.
Instead, we rely on Intel IOMMU driver taking care of that internally.

This is on github: https://github.com/nicolinc/iommufd/commits/vfio_iommu_attach

Jason Gunthorpe (1):
vfio/iommu_type1: Prefer to reuse domains vs match enforced cache
coherency

Nicolin Chen (4):
iommu: Return -EMEDIUMTYPE for incompatible domain and device/group
iommu: Ensure device has the same iommu_ops as the domain
vfio/iommu_type1: Clean up update_dirty_scope in detach_group()
vfio/iommu_type1: Simplify group attachment

drivers/iommu/amd/iommu.c | 3 +-
drivers/iommu/apple-dart.c | 5 +-
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 7 +-
drivers/iommu/arm/arm-smmu/arm-smmu.c | 1 +
drivers/iommu/arm/arm-smmu/qcom_iommu.c | 3 +-
drivers/iommu/exynos-iommu.c | 1 +
drivers/iommu/fsl_pamu_domain.c | 1 +
drivers/iommu/intel/iommu.c | 5 +-
drivers/iommu/iommu.c | 26 ++
drivers/iommu/ipmmu-vmsa.c | 3 +-
drivers/iommu/msm_iommu.c | 1 +
drivers/iommu/mtk_iommu.c | 1 +
drivers/iommu/mtk_iommu_v1.c | 1 +
drivers/iommu/omap-iommu.c | 3 +-
drivers/iommu/rockchip-iommu.c | 1 +
drivers/iommu/s390-iommu.c | 1 +
drivers/iommu/sprd-iommu.c | 1 +
drivers/iommu/sun50i-iommu.c | 1 +
drivers/iommu/tegra-gart.c | 1 +
drivers/iommu/tegra-smmu.c | 1 +
drivers/iommu/virtio-iommu.c | 3 +-
drivers/vfio/vfio_iommu_type1.c | 315 ++++++++++----------
include/linux/iommu.h | 2 +
23 files changed, 223 insertions(+), 164 deletions(-)

--
2.17.1