linux/drivers/iommu
Vasant Hegde c362f32a59 iommu/amd: Invalidate cache before removing device from domain list
Commit 87a6f1f22c ("iommu/amd: Introduce per-device domain ID to fix
potential TLB aliasing issue") introduced per device domain ID when
domain is configured with v2 page table. And in invalidation path, it
uses per device structure (dev_data->gcr3_info.domid) to get the domain ID.

In detach_device() path, current code tries to invalidate IOMMU cache
after removing dev_data from domain device list. This means when domain
is configured with v2 page table, amd_iommu_domain_flush_all() will not be
able to invalidate cache as device is already removed from domain device
list.

This is causing change domain tests (changing domain type from identity to DMA)
to fail with IO_PAGE_FAULT issue.

Hence invalidate cache and update DTE before updating data structures.

Reported-by: FahHean Lee <fahhean.lee@amd.com>
Reported-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Fixes: 87a6f1f22c ("iommu/amd: Introduce per-device domain ID to fix potential TLB aliasing issue")
Tested-by: Dheeraj Kumar Srivastava <dheerajkumar.srivastava@amd.com>
Tested-by: Sairaj Arun Kodilkar <sairaj.arunkodilkar@amd.com>
Tested-by: FahHean Lee <fahhean.lee@amd.com>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20240620060552.13984-1-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-06-27 12:13:48 +02:00
..
amd iommu/amd: Invalidate cache before removing device from domain list 2024-06-27 12:13:48 +02:00
arm Merge branches 'arm/renesas', 'arm/smmu', 'x86/amd', 'core' and 'x86/vt-d' into next 2024-05-13 14:06:54 +02:00
intel tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
iommufd iommufd: Add missing IOMMUFD_DRIVER kconfig for the selftest 2024-04-14 13:52:08 -03:00
apple-dart.c iommu: constify of_phandle_args in xlate 2024-03-01 13:46:57 +01:00
dma-iommu.c iommu/dma: Fix domain init 2024-06-04 13:54:09 +02:00
dma-iommu.h iommu/dma: Centralise iommu_setup_dma_ops() 2024-04-26 12:07:26 +02:00
exynos-iommu.c iommu/exynos: use page allocation function provided by iommu-pages.h 2024-04-15 14:31:45 +02:00
fsl_pamu_domain.c
fsl_pamu_domain.h
fsl_pamu.c
fsl_pamu.h
hyperv-iommu.c
io-pgfault.c iommu: Make iommu_report_device_fault() return void 2024-02-16 15:19:37 +01:00
io-pgtable-arm-v7s.c
io-pgtable-arm.c iommu/io-pgtable-arm: use page allocation function provided by iommu-pages.h 2024-04-15 14:31:44 +02:00
io-pgtable-arm.h
io-pgtable-dart.c iommu/io-pgtable-dart: use page allocation function provided by iommu-pages.h 2024-04-15 14:31:44 +02:00
io-pgtable.c iommu: Allow passing custom allocators to pgtable drivers 2023-11-27 11:10:12 +01:00
iommu-debugfs.c
iommu-pages.h iommu: account IOMMU allocated memory 2024-04-15 14:31:48 +02:00
iommu-priv.h iommu: constify pointer to bus_type 2024-03-01 13:46:57 +01:00
iommu-sva.c iommu: Add ops->domain_alloc_sva() 2024-04-26 12:16:07 +02:00
iommu-sysfs.c
iommu-traces.c
iommu.c iommu/dma: Centralise iommu_setup_dma_ops() 2024-04-26 12:07:26 +02:00
iova.c iommu/iova: use named kmem_cache for iova magazines 2024-02-09 11:45:47 +01:00
ipmmu-vmsa.c Merge branches 'arm/mediatek', 'arm/renesas', 'arm/smmu', 'x86/vt-d', 'x86/amd' and 'core' into next 2024-03-08 09:05:59 +01:00
irq_remapping.c IOMMU Updates for Linux v6.10 2024-05-18 10:55:13 -07:00
irq_remapping.h iommu/vt-d: Allocate DMAR fault interrupts locally 2024-04-26 11:57:36 +02:00
Kconfig iommu/arm-smmu-v3: Make the kunit into a module 2024-05-10 14:14:14 +02:00
Makefile iommu: Separate SVA and IOPF 2024-02-16 15:19:29 +01:00
msm_iommu_hw-8xxx.h
msm_iommu.c iommu: constify of_phandle_args in xlate 2024-03-01 13:46:57 +01:00
msm_iommu.h
mtk_iommu_v1.c iommu: mtk: fix module autoloading 2024-04-12 12:04:50 +02:00
mtk_iommu.c iommu: mtk: fix module autoloading 2024-04-12 12:04:50 +02:00
of_iommu.c iommu: re-use local fwnode variable in iommu_ops_from_fwnode() 2024-03-01 13:47:01 +01:00
omap-iommu-debug.c
omap-iommu.c iommu: Mark dev_iommu_priv_set() with a lockdep 2023-12-12 10:18:49 +01:00
omap-iommu.h
omap-iopgtable.h
rockchip-iommu.c iommu/rockchip: use page allocation function provided by iommu-pages.h 2024-04-15 14:31:45 +02:00
s390-iommu.c iommu/dma: Centralise iommu_setup_dma_ops() 2024-04-26 12:07:26 +02:00
sprd-iommu.c iommu: constify of_phandle_args in xlate 2024-03-01 13:46:57 +01:00
sun50i-iommu.c iommu/sun50i: use page allocation function provided by iommu-pages.h 2024-04-15 14:31:46 +02:00
tegra-smmu.c iommu/tegra-smmu: use page allocation function provided by iommu-pages.h 2024-04-15 14:31:46 +02:00
virtio-iommu.c virtio: features, fixes, cleanups 2024-05-23 12:04:36 -07:00