All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vidya Sagar <vidyas@nvidia.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Dan Williams <djbw@kernel.org>,
	"Dave Jiang" <dave.jiang@intel.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Joerg Roedel <joerg.roedel@amd.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"Nicolin Chen" <nicolinc@nvidia.com>,
	Kevin Tian <kevin.tian@intel.com>
Cc: <vsethi@nvidia.com>, <kthota@nvidia.com>,
	<mmaddireddy@nvidia.com>, <kumarahul@nvidia.com>,
	<sagar.tv@gmail.com>, <linux-pci@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Vidya Sagar <vidyas@nvidia.com>
Subject: [PATCH V1 2/4] PCI: Don't run IOMMU reset hooks when only probing reset methods
Date: Thu, 19 Nov 2026 15:36:26 +0530	[thread overview]
Message-ID: <20261119100628.1948990-3-vidyas@nvidia.com> (raw)
In-Reply-To: <20261119100628.1948990-1-vidyas@nvidia.com>

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@nvidia.com>
---
 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


  parent reply	other threads:[~2026-11-19 10:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 10:06 [PATCH V1 0/4] PCI: Don't list reset methods that can't reset the device Vidya Sagar
2026-11-19 10:06 ` [PATCH V1 1/4] PCI/CXL: Don't offer 'cxl_bus' reset where a bus reset can't work Vidya Sagar
2026-11-19 10:20   ` sashiko-bot
2026-11-19 10:06 ` Vidya Sagar [this message]
2026-11-19 10:14   ` [PATCH V1 2/4] PCI: Don't run IOMMU reset hooks when only probing reset methods sashiko-bot
2026-11-19 16:39   ` Nicolin Chen
2026-11-19 10:06 ` [PATCH V1 3/4] PCI/sysfs: Take the device lock when setting " Vidya Sagar
2026-11-19 10:20   ` sashiko-bot
2026-11-19 10:06 ` [PATCH V1 4/4] PCI: Re-check function 0 reset methods after scanning its slot Vidya Sagar
2026-11-19 10:32   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119100628.1948990-3-vidyas@nvidia.com \
    --to=vidyas@nvidia.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=dave.jiang@intel.com \
    --cc=djbw@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=joerg.roedel@amd.com \
    --cc=kevin.tian@intel.com \
    --cc=kthota@nvidia.com \
    --cc=kumarahul@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mmaddireddy@nvidia.com \
    --cc=nicolinc@nvidia.com \
    --cc=sagar.tv@gmail.com \
    --cc=vsethi@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.