[PATCH V1 2/4] PCI: Don't run IOMMU reset hooks when only probing reset methods

From: Vidya Sagar

Date: Thu Nov 19 2026 - 05:09:50 EST


pci_reset_bus_function() and __pci_dev_specific_reset() call
pci_dev_reset_iommu_prepare() and pci_dev_reset_iommu_done() even when
"probe" is set and no reset follows. The other reset methods that use
these hooks, pcie_flr(), pci_af_flr(), pci_pm_reset() and
pci_dev_acpi_reset(), only call them when actually resetting.

Reset methods are probed at enumeration, before the IOMMU is set up, but
also whenever "reset_method" is written in sysfs. For an ATS-capable
device behind an IOMMU, each such probe of "bus" or of a device-specific
reset attaches the blocking domain and then re-attaches the device's
domains. That blocks any DMA in the window and, on arm-smmu-v3, sends
ATC invalidations, even while a driver is bound and using the device.

Return before the IOMMU hooks when probing, as the other reset methods
do.

Fixes: f5b16b802174 ("PCI: Suspend iommu function prior to resetting a device")
Signed-off-by: Vidya Sagar <vidyas@xxxxxxxxxx>
---
drivers/pci/pci.c | 3 +++
drivers/pci/quirks.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 921d076c4c1d..918a4d95f914 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5057,6 +5057,9 @@ static int pci_reset_bus_function(struct pci_dev *dev, bool probe)
if (bridge && pcie_is_cxl(bridge) && cxl_sbr_masked(bridge))
return -ENOTTY;

+ if (probe)
+ return __pci_reset_bus_function(dev, probe);
+
rc = pci_dev_reset_iommu_prepare(dev);
if (rc) {
pci_err(dev, "failed to stop IOMMU for a PCI reset: %d\n", rc);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7f1f47ea2ee4..79c326b0e80f 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -4406,6 +4406,9 @@ static int __pci_dev_specific_reset(struct pci_dev *dev, bool probe,
{
int ret;

+ if (probe)
+ return i->reset(dev, probe);
+
ret = pci_dev_reset_iommu_prepare(dev);
if (ret) {
pci_err(dev, "failed to stop IOMMU for a PCI reset: %d\n", ret);
--
2.43.0