linux-stable/drivers/iommu
Yi Liu 6b4f693992 iommu: Undo pasid attachment only for the devices that have succeeded
[ Upstream commit b025dea63c ]

There is no error handling now in __iommu_set_group_pasid(), it relies on
its caller to loop all the devices to undo the pasid attachment. This is
not self-contained and has drawbacks. It would result in unnecessary
remove_dev_pasid() calls on the devices that have not been attached to the
new domain. But the remove_dev_pasid() callback would get the new domain
from the group->pasid_array. So for such devices, the iommu driver won't
find the attachment under the domain, hence unable to do cleanup. This may
not be a real problem today. But it depends on the implementation of the
underlying iommu driver. e.g. the intel iommu driver would warn for such
devices. Such warnings are unnecessary.

To solve the above problem, it is necessary to handle the error within
__iommu_set_group_pasid(). It only loops the devices that have attached
to the new domain, and undo it.

Fixes: 1660370455 ("iommu: Add attach/detach_dev_pasid iommu interfaces")
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20240328122958.83332-2-yi.l.liu@intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-06-12 11:12:06 +02:00
..
amd iommu/amd: Mark interrupt as managed 2024-03-26 18:19:30 -04:00
arm iommu/arm-smmu-qcom: Add missing GMU entry to match table 2024-01-25 15:35:46 -08:00
intel iommu/vt-d: Allocate local memory for page request queue 2024-04-17 11:19:33 +02:00
iommufd iommufd: Fix iopt_access_list_id overwrite bug 2024-03-06 14:48:41 +00:00
Kconfig iommu: Fix compilation without CONFIG_IOMMU_INTEL 2024-03-26 18:19:39 -04:00
Makefile
apple-dart.c iommu/apple-dart: Handle DMA_FQ domains in attach_dev() 2023-09-25 11:37:19 +02:00
dma-iommu.c iommu/dma: Force swiotlb_max_mapping_size on an untrusted device 2024-04-03 15:28:51 +02:00
dma-iommu.h iommu: Optimise PCI SAC address trick 2023-07-14 16:14:17 +02:00
exynos-iommu.c
fsl_pamu.c
fsl_pamu.h
fsl_pamu_domain.c
fsl_pamu_domain.h
hyperv-iommu.c x86/vector: Rename send_cleanup_vector() to vector_schedule_cleanup() 2023-08-06 14:15:09 +02:00
io-pgfault.c
io-pgtable-arm-v7s.c
io-pgtable-arm.c
io-pgtable-arm.h
io-pgtable-dart.c
io-pgtable.c
iommu-debugfs.c
iommu-priv.h iommu: Move dev_iommu_ops() to private header 2023-08-18 12:52:15 -03:00
iommu-sva.c iommu: Move global PASID allocation from SVA to core 2023-08-09 17:44:36 +02:00
iommu-sva.h
iommu-sysfs.c iommu: Do not export iommu_device_link/unlink() 2023-07-14 16:14:15 +02:00
iommu-traces.c
iommu.c iommu: Undo pasid attachment only for the devices that have succeeded 2024-06-12 11:12:06 +02:00
iova.c
ipmmu-vmsa.c Merge branches 'apple/dart', 'arm/mediatek', 'arm/renesas', 'arm/rockchip', 'arm/smmu', 'unisoc', 'x86/vt-d', 'x86/amd' and 'core' into next 2023-08-21 14:18:43 +02:00
irq_remapping.c iommu: Fix compilation without CONFIG_IOMMU_INTEL 2024-03-26 18:19:39 -04:00
irq_remapping.h
msm_iommu.c
msm_iommu.h
msm_iommu_hw-8xxx.h
mtk_iommu.c iommu: mtk: fix module autoloading 2024-05-17 12:02:17 +02:00
mtk_iommu_v1.c iommu: mtk: fix module autoloading 2024-05-17 12:02:17 +02:00
of_iommu.c iommu: Don't reserve 0-length IOVA region 2024-01-25 15:35:54 -08:00
omap-iommu-debug.c
omap-iommu.c
omap-iommu.h
omap-iopgtable.h
rockchip-iommu.c iommu: rockchip: Allocate tables from all available memory for IOMMU v2 2023-07-14 16:18:04 +02:00
s390-iommu.c
sprd-iommu.c Merge branches 'apple/dart', 'arm/mediatek', 'arm/renesas', 'arm/rockchip', 'arm/smmu', 'unisoc', 'x86/vt-d', 'x86/amd' and 'core' into next 2023-08-21 14:18:43 +02:00
sun50i-iommu.c
tegra-gart.c
tegra-smmu.c iommu: Explicitly include correct DT includes 2023-08-21 14:17:59 +02:00
virtio-iommu.c iommu: Explicitly include correct DT includes 2023-08-21 14:17:59 +02:00