tmp_suning_uos_patched/drivers/iommu
Yian Chen 963c80f070 iommu/vt-d: Fix PCI bus rescan device hot add
commit 316f92a705a4c2bf4712135180d56f3cca09243a upstream.

Notifier calling chain uses priority to determine the execution
order of the notifiers or listeners registered to the chain.
PCI bus device hot add utilizes the notification mechanism.

The current code sets low priority (INT_MIN) to Intel
dmar_pci_bus_notifier and postpones DMAR decoding after adding
new device into IOMMU. The result is that struct device pointer
cannot be found in DRHD search for the new device's DMAR/IOMMU.
Subsequently, the device is put under the "catch-all" IOMMU
instead of the correct one. This could cause system hang when
device TLB invalidation is sent to the wrong IOMMU. Invalidation
timeout error and hard lockup have been observed and data
inconsistency/crush may occur as well.

This patch fixes the issue by setting a positive priority(1) for
dmar_pci_bus_notifier while the priority of IOMMU bus notifier
uses the default value(0), therefore DMAR decoding will be in
advance of DRHD search for a new device to find the correct IOMMU.

Following is a 2-step example that triggers the bug by simulating
PCI device hot add behavior in Intel Sapphire Rapids server.

echo 1 > /sys/bus/pci/devices/0000:6a:01.0/remove
echo 1 > /sys/bus/pci/rescan

Fixes: 59ce0515cd ("iommu/vt-d: Update DRHD/RMRR/ATSR device scope")
Cc: stable@vger.kernel.org # v3.15+
Reported-by: Zhang, Bernice <bernice.zhang@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Yian Chen <yian.chen@intel.com>
Link: https://lore.kernel.org/r/20220521002115.1624069-1-yian.chen@intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-12 16:32:18 +02:00
..
amd iommu/amd: Increase timeout waiting for GA log enablement 2022-06-09 10:21:20 +02:00
arm iommu/arm-smmu-v3: check return value after calling platform_get_resource() 2022-06-14 18:32:38 +02:00
intel iommu/vt-d: Fix PCI bus rescan device hot add 2022-07-12 16:32:18 +02:00
dma-iommu.c iommu/dma: Fix compile warning in 32-bit builds 2021-07-14 16:56:55 +02:00
exynos-iommu.c
fsl_pamu_domain.c
fsl_pamu_domain.h
fsl_pamu.c
fsl_pamu.h
hyperv-iommu.c
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Add error handle for page table allocation failure 2022-01-27 10:53:43 +01:00
io-pgtable-arm.c iommu/io-pgtable-arm: Fix table descriptor paddr formatting 2022-01-27 10:54:06 +01:00
io-pgtable-arm.h
io-pgtable.c
ioasid.c
iommu-debugfs.c
iommu-sysfs.c
iommu-traces.c
iommu.c iommu: Fix potential use-after-free during probe 2022-02-16 12:54:31 +01:00
iova.c iommu/iova: Improve 32-bit free space estimate 2022-04-08 14:39:48 +02:00
ipmmu-vmsa.c iommu/ipmmu-vmsa: Check for error num after setting mask 2022-04-08 14:40:15 +02:00
irq_remapping.c
irq_remapping.h
Kconfig
Makefile
msm_iommu_hw-8xxx.h
msm_iommu.c iommu/msm: Fix an incorrect NULL check on list iterator 2022-06-09 10:21:26 +02:00
msm_iommu.h
mtk_iommu_v1.c
mtk_iommu.c iommu/mediatek: Add list_del in mtk_iommu_remove 2022-06-09 10:21:18 +02:00
mtk_iommu.h
of_iommu.c
omap-iommu-debug.c
omap-iommu.c iommu/omap: Fix regression in probe for NULL pointer dereference 2022-04-13 21:01:07 +02:00
omap-iommu.h
omap-iopgtable.h
rockchip-iommu.c
s390-iommu.c
sun50i-iommu.c
tegra-gart.c
tegra-smmu.c
virtio-iommu.c