From: Baolu Lu <baolu.lu@linux.intel.com>
To: David Matlack <dmatlack@google.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Cc: "Alexander Lobakin" <aleksander.lobakin@intel.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Bartosz Pawlowski" <bartosz.pawlowski@intel.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Christian König" <christian.koenig@amd.com>,
"David Woodhouse" <dwmw2@infradead.org>,
"Guchun Chen" <guchun.chen@amd.com>,
"Joerg Roedel" <jroedel@suse.de>,
"Raghavendra Rao Ananta" <rananta@google.com>,
"Pranjal Shrivastava" <praan@google.com>
Subject: Re: [PATCH v4] PCI: Ensure ATS disabled via quirk before notifying IOMMU drivers
Date: Fri, 21 Aug 2026 10:09:33 +0800 [thread overview]
Message-ID: <599aea14-4690-4f4a-9cb7-6308f7b1a9df@linux.intel.com> (raw)
In-Reply-To: <20260817202823.2172548-1-dmatlack@google.com>
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@google.com/
> Reviewed-by: Pranjal Shrivastava<praan@google.com>
> Tested-by: Pranjal Shrivastava<praan@google.com>
> Signed-off-by: David Matlack<dmatlack@google.com>
> ---
> 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@google.com/
> v2:https://lore.kernel.org/linux-pci/20260327211649.3816010-1-
> dmatlack@google.com/
> v1:https://lore.kernel.org/linux-pci/20260223184017.688212-1-
> dmatlack@google.com/
>
> Cc: Raghavendra Rao Ananta<rananta@google.com>
> Cc: David Woodhouse<dwmw2@infradead.org>
> Cc: Lu Baolu<baolu.lu@linux.intel.com>
> Cc: Andy Shevchenko<andriy.shevchenko@linux.intel.com>
>
> 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@linux.intel.com>
next prev parent reply other threads:[~2026-08-21 2:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 20:28 David Matlack
2026-08-21 2:09 ` Baolu Lu [this message]
2026-08-21 13:19 ` Deucher, Alexander
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=599aea14-4690-4f4a-9cb7-6308f7b1a9df@linux.intel.com \
--to=baolu.lu@linux.intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=alexander.deucher@amd.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bartosz.pawlowski@intel.com \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dmatlack@google.com \
--cc=dwmw2@infradead.org \
--cc=guchun.chen@amd.com \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=praan@google.com \
--cc=rananta@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®