Re: [PATCH] PCI/ATS: Disable ATS when ACS TB is set upstream

From: Nicolin Chen

Date: Thu Nov 05 2026 - 18:16:16 EST


On Thu, Nov 05, 2026 at 05:04:12PM -0600, Bjorn Helgaas wrote:
> * pci_dev_reset_iommu_prepare() vs pci_dev_reset_iommu_done()
>
> Different values will make gdev->reset_depth, group->recovery_cnt,
> group->domain, and gdev->blocked get out of sync.
>
> I think it would be better if _iommu_prepare() and _iommu_done()
> themselves tracked what _iommu_done() needs to do, for example
> they could do something like this:
>
> int pci_dev_reset_iommu_prepare(struct pci_dev *pdev, bool *restore)
> {
> if (!pci_ats_supported(pdev) || !dev_has_iommu(&pdev->dev)) {
> *restore = false;
> return 0;
> }
>
> *restore = true;
> ...
> }
>
> Then pci_dev_reset_iommu_done() wouldn't need to call
> pci_ats_supported() or dev_has_iommu(), and users would look like
> this:
>
> int pcie_flr(...)
> {
> bool restore;
>
> ret = pci_dev_reset_iommu_prepare(dev, &restore);
> ...
> if (restore)
> pci_dev_reset_iommu_done(dev);
> }
>
> Or I guess we could call pci_dev_reset_iommu_done()
> unconditionally and pass it 'restore' and it could test it

If the condition here is "an upstream bridge becomes inaccessible
during a reset", then the reset/flr itself fails?

The patch that you acked yesterday handles such a case:
https://lore.kernel.org/linux-iommu/20261105001312.GA1479227@bhelgaas/

Nicolin