linux-stable/drivers/iommu
Jon Derrick 8038bdb855 iommu/vt-d: Only clear real DMA device's context entries
Domain context mapping can encounter issues with sub-devices of a real
DMA device. A sub-device cannot have a valid context entry due to it
potentially aliasing another device's 16-bit ID. It's expected that
sub-devices of the real DMA device uses the real DMA device's requester
when context mapping.

This is an issue when a sub-device is removed where the context entry is
cleared for all aliases. Other sub-devices are still valid, resulting in
those sub-devices being stranded without valid context entries.

The correct approach is to use the real DMA device when programming the
context entries. The insertion path is correct because device_to_iommu()
will return the bus and devfn of the real DMA device. The removal path
needs to only operate on the real DMA device, otherwise the entire
context entry would be cleared for all sub-devices of the real DMA
device.

This patch also adds a helper to determine if a struct device is a
sub-device of a real DMA device.

Fixes: 2b0140c696 ("iommu/vt-d: Use pci_real_dma_dev() for mapping")
Cc: stable@vger.kernel.org # v5.6+
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20200527165617.297470-2-jonathan.derrick@intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2020-05-29 15:11:14 +02:00
..
amd_iommu.c iommu/amd: Fix variable "iommu" set but not used 2020-05-13 10:39:43 +02:00
amd_iommu.h iommu/amd: Override wrong IVRS IOAPIC on Raven Ridge systems 2019-08-23 10:26:48 +02:00
amd_iommu_debugfs.c
amd_iommu_init.c iommu/amd: Fix legacy interrupt remapping for x2APIC-enabled system 2020-05-01 13:21:18 +02:00
amd_iommu_proto.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
amd_iommu_quirks.c iommu/amd: Apply the same IVRS IOAPIC workaround to Acer Aspire A315-41 2019-10-30 10:24:03 +01:00
amd_iommu_types.h iommu/amd: Remove dev_data->passthrough 2020-05-05 14:36:13 +02:00
amd_iommu_v2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
arm-smmu-impl.c iommu/arm-smmu: Rename public #defines under ARM_SMMU_ namespace 2020-01-10 15:52:25 +00:00
arm-smmu-qcom.c iommu: arm-smmu-impl: Add sdm845 implementation hook 2019-11-04 17:48:37 +00:00
arm-smmu-v3.c iommu/arm-smmu: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
arm-smmu.c iommu/arm-smmu: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
arm-smmu.h iommu/io-pgtable-arm: Rationalise VTCR handling 2020-01-10 15:52:25 +00:00
dma-iommu.c iommu/dma: Fix MSI reservation allocation 2020-03-04 16:27:56 +01:00
dmar.c iommu/vt-d: Multiple descriptors per qi_submit_sync() 2020-05-18 15:37:26 +02:00
exynos-iommu.c iommu/exynos: Convert to probe/release_device() call-backs 2020-05-05 14:36:14 +02:00
fsl_pamu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
fsl_pamu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
fsl_pamu_domain.c iommu/pamu: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
fsl_pamu_domain.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
hyperv-iommu.c
intel-iommu-debugfs.c iommu/vt-d: debugfs: Add support to show inv queue internals 2020-05-18 15:37:26 +02:00
intel-iommu.c iommu/vt-d: Only clear real DMA device's context entries 2020-05-29 15:11:14 +02:00
intel-pasid.c iommu/vt-d: Fix pointer cast warnings on 32 bit 2020-05-25 13:54:32 +02:00
intel-pasid.h iommu/vt-d: Disable non-recoverable fault processing before unbind 2020-05-18 15:37:26 +02:00
intel-svm.c iommu/vt-d: Fix pointer cast warnings on 32 bit 2020-05-25 13:54:32 +02:00
intel-trace.c iommu/vt-d: Add trace events for device dma map/unmap 2019-09-11 12:34:30 +02:00
intel_irq_remapping.c iommu/vt-d: Multiple descriptors per qi_submit_sync() 2020-05-18 15:37:26 +02:00
io-pgtable-arm-v7s.c iommu/io-pgtable-arm: Rationalise TCR handling 2020-01-10 15:52:24 +00:00
io-pgtable-arm.c iommu/io-pgtable-arm: Fix IOVA validation for 32-bit 2020-03-02 17:17:26 +01:00
io-pgtable.c iommu/io-pgtable-arm: Rationalise TCR handling 2020-01-10 15:52:24 +00:00
ioasid.c iommu/ioasid: Add custom allocators 2019-10-15 13:34:25 +02:00
iommu-debugfs.c
iommu-sysfs.c drivers/iommu: Export core IOMMU API symbols to permit modular drivers 2019-12-23 14:06:05 +01:00
iommu-traces.c
iommu.c iommu: Remove functions that support private domain 2020-05-15 12:00:36 +02:00
iova.c iommu/iova: Unify format of the printed messages 2020-05-13 10:54:51 +02:00
ipmmu-vmsa.c iommu/renesas: Fix unused-function warning 2020-05-13 10:46:56 +02:00
irq_remapping.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
irq_remapping.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
Kconfig iommu: spapr_tce: Disable compile testing to fix build on book3s_32 config 2020-04-29 13:55:40 +02:00
Makefile iommu/arm-smmu: Restore naming of driver parameter prefix 2020-02-19 12:03:21 +01:00
msm_iommu.c iommu/msm: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
msm_iommu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 267 2019-06-05 17:30:29 +02:00
msm_iommu_hw-8xxx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 267 2019-06-05 17:30:29 +02:00
mtk_iommu.c iommu/mediatek: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
mtk_iommu.h iommu/mediatek: Move the tlb_sync into tlb_flush 2019-11-11 15:02:34 +01:00
mtk_iommu_v1.c iommu/mediatek-v1 Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
of_iommu.c iommu/arm-smmu-v3: Parse PASID devicetree property of platform devices 2020-01-15 16:00:57 +00:00
omap-iommu-debug.c Merge branches 'x86/vt-d', 'x86/amd', 'arm/smmu', 'arm/omap', 'generic-dma-ops' and 'core' into next 2019-07-04 17:26:48 +02:00
omap-iommu.c iommu/omap: Convert to probe/release_device() call-backs 2020-05-05 14:36:14 +02:00
omap-iommu.h iommu/omap: add support for late attachment of iommu devices 2019-08-09 17:37:10 +02:00
omap-iopgtable.h iommu/omap: Fix -Woverflow warnings when compiling on 64-bit architectures 2020-03-04 16:24:46 +01:00
qcom_iommu.c Linux 5.7-rc4 2020-05-13 12:01:33 +02:00
rockchip-iommu.c iommu/rockchip: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
s390-iommu.c iommu/s390: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00
tegra-gart.c iommu/tegra: Convert to probe/release_device() call-backs 2020-05-05 14:36:14 +02:00
tegra-smmu.c iommu/tegra: Convert to probe/release_device() call-backs 2020-05-05 14:36:14 +02:00
virtio-iommu.c iommu/virtio: Convert to probe/release_device() call-backs 2020-05-05 14:36:13 +02:00