linux-next/drivers/iommu
Lu Baolu dda2b8c3c6 iommu/vt-d: Avoid draining PRQ in sva mm release path
When a PASID is used for SVA by a device, it's possible that the PASID
entry is cleared before the device flushes all ongoing DMA requests and
removes the SVA domain. This can occur when an exception happens and the
process terminates before the device driver stops DMA and calls the
iommu driver to unbind the PASID.

There's no need to drain the PRQ in the mm release path. Instead, the PRQ
will be drained in the SVA unbind path.

Unfortunately, commit c43e1ccdeb ("iommu/vt-d: Drain PRQs when domain
removed from RID") changed this behavior by unconditionally draining the
PRQ in intel_pasid_tear_down_entry(). This can lead to a potential
sleeping-in-atomic-context issue.

Smatch static checker warning:

	drivers/iommu/intel/prq.c:95 intel_iommu_drain_pasid_prq()
	warn: sleeping in atomic context

To avoid this issue, prevent draining the PRQ in the SVA mm release path
and restore the previous behavior.

Fixes: c43e1ccdeb ("iommu/vt-d: Drain PRQs when domain removed from RID")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/linux-iommu/c5187676-2fa2-4e29-94e0-4a279dc88b49@stanley.mountain/
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20241212021529.1104745-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-12-13 15:54:27 +01:00
..
amd iommu/amd: Add lockdep asserts for domain->dev_list 2024-12-10 10:12:06 +01:00
arm iommu/tegra241-cmdqv: do not use smp_processor_id in preemptible context 2024-12-09 23:38:30 +00:00
intel iommu/vt-d: Avoid draining PRQ in sva mm release path 2024-12-13 15:54:27 +01:00
iommufd iommufd 6.13 first rc pull 2024-12-05 15:02:20 -08:00
riscv Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
apple-dart.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
dma-iommu.c dma-mapping: fix vmap and mmap of noncontiougs allocations 2024-09-22 18:47:51 +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 iommu: Use of_property_present() 2024-09-04 11:31:01 +02:00
fsl_pamu_domain.h iommu/fsl_pamu: remove the snoop_id field 2021-04-07 10:56:52 +02:00
fsl_pamu.c iommu/fsl: fix all kernel-doc warnings in fsl_pamu.c 2023-03-22 14:50:15 +01:00
fsl_pamu.h iommu/fsl_pamu: hardcode the window address and size in pamu_config_ppaace 2021-04-07 10:56:52 +02:00
hyperv-iommu.c x86/vector: Rename send_cleanup_vector() to vector_schedule_cleanup() 2023-08-06 14:15:09 +02:00
io-pgfault.c iommu: Handle iommu faults for a bad iopf setup 2024-08-23 11:16:39 +02:00
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Remove split on unmap behavior 2024-11-06 15:42:36 +00:00
io-pgtable-arm.c IOMMU Updates for Linux v6.13: 2024-11-22 19:55:10 -08:00
io-pgtable-arm.h iommu/io-pgtable-arm: Move some definitions to a header 2020-09-28 23:48:06 +01:00
io-pgtable-dart.c iommu: Do not return 0 from map_pages if it doesn't do anything 2024-08-26 09:16:13 +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: Fix IOMMU debugfs fallout 2019-02-26 11:15:58 +01:00
iommu-pages.h iommu: account IOMMU allocated memory 2024-04-15 14:31:48 +02:00
iommu-priv.h Merge branch 'iommu/iommufd/attach-handles' into iommu/next 2024-07-12 16:57:42 +01:00
iommu-sva.c Merge branch 'iommu/iommufd/attach-handles' into iommu/next 2024-07-12 16:57:42 +01:00
iommu-sysfs.c iommu/sysfs: constify the class struct 2024-10-29 09:50:24 +01:00
iommu-traces.c iommu: Remove detach_dev callback 2023-01-13 16:39:18 +01:00
iommu.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
iova.c - The series "zram: optimal post-processing target selection" from 2024-11-23 09:58:07 -08:00
ipmmu-vmsa.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08: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 Merge branches 'intel/vt-d', 'amd/amd-vi' and 'iommufd/arm-smmuv3-nested' into next 2024-11-15 09:27:43 +01:00
Makefile iommu/riscv: Add RISC-V IOMMU platform device driver 2024-10-29 09:46:23 +01:00
msm_iommu_hw-8xxx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 267 2019-06-05 17:30:29 +02:00
msm_iommu.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
msm_iommu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 267 2019-06-05 17:30:29 +02:00
mtk_iommu_v1.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
mtk_iommu.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
of_iommu.c iommu: Use of_property_present() 2024-09-04 11:31:01 +02:00
omap-iommu-debug.c iommu/omap: Fix buffer overflow in debugfs 2022-09-07 10:42:28 +02:00
omap-iommu.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
omap-iommu.h iommu/omap: Convert to generic_single_device_group() 2023-09-25 11:52:08 +02:00
omap-iopgtable.h iommu/omap: Fix -Woverflow warnings when compiling on 64-bit architectures 2020-03-04 16:24:46 +01:00
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/s390: Implement blocking domain 2024-10-15 10:19:07 +02:00
sprd-iommu.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
sun50i-iommu.c iommu: sun50i: Add H616 compatible string 2024-06-25 14:02:47 +02:00
tegra-smmu.c Merge branch 'iommu/fwspec-ops-removal' into iommu/next 2024-07-12 16:55:43 +01:00
virtio-iommu.c virtio: rename virtio_find_vqs_info() to virtio_find_vqs() 2024-07-17 05:20:58 -04:00