Re: [PATCH v4] PCI: Ensure ATS disabled via quirk before notifying IOMMU drivers

From: Baolu Lu

Date: Thu Aug 20 2026 - 22:10:57 EST


On 8/18/26 04:28, David Matlack wrote:
Ensure that PCI devices always have ATS disable via quirk before IOMMU
drivers are notified about the device. Fix this by converting the
existing quirks from final to header fixups and changing the quirk logic
to set a new no_ats bit in struct pci_dev that prevents pci_dev.ats_cap
from ever getting set.

Use header fixups instead of early fixups since not enough of struct
pci_dev is set up in during early fixups: quirk_amd_harvest_no_ats()
needs subsystem_device and subsystem_vendor to be set.

This change ensures that pci_ats_supported() always takes quirks into
account during iommu_ops.probe_device(), when IOMMU drivers are notified
about devices, and that pci_ats_supported() returns the same value when
the device is released in iommu_ops.release_device().

The Intel IOMMU driver uses pci_ats_supported() in probe/release to
determine whether to add/remove a device from a tracking rbtree. This
strict reliance on pci_ats_supported() remaining constant between probe
and release was introduced by commit 89436f4f5412 ("iommu/vt-d: Fix
WARN_ON in iommu probe path"). Because FINAL quirks evaluate too late
(in pci_bus_add_device()), pci_ats_supported() evaluated to true during
IOMMU probe but false during release. This mismatch bypassed the rbtree
removal upon device release, leading to a later use-after-free.

Note that this fix only matters for PCI devices created after IOMMU bus
notifiers are set up (e.g. hot-plugged devices and VFs).

Fixes: a18615b1cfc0 ("PCI: Disable ATS for specific Intel IPU E2000 devices")
Fixes: 9b44b0b09dec ("PCI: Mark AMD Stoney GPU ATS as broken")
Fixes: 3f1271b54edc ("PCI: Mark all AMD Navi10 and Navi14 GPU ATS as broken")
Closes:https://lore.kernel.org/linux-iommu/aYUQ_HkDJU9kjsUl@xxxxxxxxxx/
Reviewed-by: Pranjal Shrivastava<praan@xxxxxxxxxx>
Tested-by: Pranjal Shrivastava<praan@xxxxxxxxxx>
Signed-off-by: David Matlack<dmatlack@xxxxxxxxxx>
---
v4:
- Rebase onto tip of Linus' tree
- Add Pranjal's Reviewed-by and Tested-by tags

v3:https://lore.kernel.org/linux-pci/20260403222750.1215002-1- dmatlack@xxxxxxxxxx/
v2:https://lore.kernel.org/linux-pci/20260327211649.3816010-1- dmatlack@xxxxxxxxxx/
v1:https://lore.kernel.org/linux-pci/20260223184017.688212-1- dmatlack@xxxxxxxxxx/

Cc: Raghavendra Rao Ananta<rananta@xxxxxxxxxx>
Cc: David Woodhouse<dwmw2@xxxxxxxxxxxxx>
Cc: Lu Baolu<baolu.lu@xxxxxxxxxxxxxxx>
Cc: Andy Shevchenko<andriy.shevchenko@xxxxxxxxxxxxxxx>

drivers/pci/ats.c | 2 +-
drivers/pci/quirks.c | 50 ++++++++++++++++++++++----------------------
include/linux/pci.h | 1 +
3 files changed, 27 insertions(+), 26 deletions(-)

Reviewed-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>