[PATCH v3 0/5] iommu/amd: Refactors for ATS robustness

Pranjal Shrivastava posted 5 patches 1 month ago
There is a newer version of this series
drivers/iommu/amd/iommu.c | 199 +++++++++++++++++++++++---------------
drivers/pci/ats.c         |   6 +-
2 files changed, 126 insertions(+), 79 deletions(-)
[PATCH v3 0/5] iommu/amd: Refactors for ATS robustness
Posted by Pranjal Shrivastava 1 month ago
This series forms the second half of the subsystem-wide ATS robustness
updates. The first part (focusing on the core subsystem, Intel, and ARM
SMMUv3) has already been merged upstream [1]. This half addresses the
AMD IOMMU driver and standardizes the PCI ATS API.

In v2, the series has been significantly restructured based on feedback
on v1. 

[v3]
 - Collected Reviewed-by tags from Vasant.
 - Added a comment explaining why devices without DMA translation support
   are not ignored (to preserve interrupt remapping) per Vasant's feedback.
 - Renamed iommu_disable_device_dma() to iommu_disable_device() to accurately
   reflect that it disables both DMA and interrupt remapping.

[v2]
 - https://lore.kernel.org/all/20260814015647.3370124-1-praan@google.com/
 - Patch 1 Refctors the probe path, isolating capabilities into 
   iommu_init_device_caps().
 - Patch 2 renames iommu_ignore_device() to iommu_disable_device_dma().
   Following Jason's suggestion, it invalidates the hardware DTE by
   clearing the Valid bit (lower 128 bits) followed by the upper
   128 bits.  
 - Patch 3 splits the probe error paths to ensure that devices with
   config failures (like PD_MODE_NONE or ATS mismatches) can preserve
   their rlookup_table entries, successfully keeping IRQ remapping 
   functional for bypassed devices.
 - Patch 4 implements the "Fail Hard" pattern for ATS in the AMD driver,
   failing the probe and throwing a WARN_ON() upon ATS configuration or
   enablement failures.
 - Patch 5 enforces the checking of pci_ats_supported() prior to calling
   pci_prepare_ats() across the entire kernel PCI subsystem.

[v1]
 - https://lore.kernel.org/all/20260601134204.2150602-1-praan@google.com/

Thanks,
Praan

[1] https://lore.kernel.org/all/20260615235037.259909-1-praan@google.com/

Pranjal Shrivastava (5):
  iommu/amd: Refactor device probe and capability initialization
  iommu/amd: Fix DTE clearing and rename iommu_ignore_device()
  iommu/amd: Split probe error paths to preserve IRQ remapping
  iommu/amd: Fail probe on ATS configuration failure
  PCI/ATS: Mandate checking pci_ats_supported() before pci_prepare_ats()

 drivers/iommu/amd/iommu.c | 199 +++++++++++++++++++++++---------------
 drivers/pci/ats.c         |   6 +-
 2 files changed, 126 insertions(+), 79 deletions(-)

-- 
2.55.0.766.g2966f0265a-goog
Re: [PATCH v3 0/5] iommu/amd: Refactors for ATS robustness
Posted by Jason Gunthorpe 1 month ago
> [ ... 41 lines skipped ... ]
> Pranjal Shrivastava (5):
>   iommu/amd: Refactor device probe and capability initialization
>   iommu/amd: Fix DTE clearing and rename iommu_ignore_device()
>   iommu/amd: Split probe error paths to preserve IRQ remapping
>   iommu/amd: Fail probe on ATS configuration failure
>   PCI/ATS: Mandate checking pci_ats_supported() before pci_prepare_ats()
> 
>  drivers/iommu/amd/iommu.c | 199 +++++++++++++++++++++++---------------
>  drivers/pci/ats.c         |   6 +-
>  2 files changed, 126 insertions(+), 79 deletions(-)

FWIW something about this series is mangled, the first patch was
changed before it made it to lore. Maybe whitespace damage..

-- 
Jason
Re: [PATCH v3 0/5] iommu/amd: Refactors for ATS robustness
Posted by Pranjal Shrivastava 1 month ago
On Mon, Aug 24, 2026 at 03:13:21PM -0300, Jason Gunthorpe wrote:
> > [ ... 41 lines skipped ... ]
> > Pranjal Shrivastava (5):
> >   iommu/amd: Refactor device probe and capability initialization
> >   iommu/amd: Fix DTE clearing and rename iommu_ignore_device()
> >   iommu/amd: Split probe error paths to preserve IRQ remapping
> >   iommu/amd: Fail probe on ATS configuration failure
> >   PCI/ATS: Mandate checking pci_ats_supported() before pci_prepare_ats()
> > 
> >  drivers/iommu/amd/iommu.c | 199 +++++++++++++++++++++++---------------
> >  drivers/pci/ats.c         |   6 +-
> >  2 files changed, 126 insertions(+), 79 deletions(-)
> 
> FWIW something about this series is mangled, the first patch was
> changed before it made it to lore. Maybe whitespace damage..
> 

I see. I generally use checkpatch with --fix-inplace before sending and
it seems like it tried fixing something. I'd drop that arg now on.

Thanks,
Praan
Re: [PATCH v3 0/5] iommu/amd: Refactors for ATS robustness
Posted by Jason Gunthorpe 1 month ago
On Tue, Aug 25, 2026 at 10:39:21AM +0000, Pranjal Shrivastava wrote:
> On Mon, Aug 24, 2026 at 03:13:21PM -0300, Jason Gunthorpe wrote:
> > > [ ... 41 lines skipped ... ]
> > > Pranjal Shrivastava (5):
> > >   iommu/amd: Refactor device probe and capability initialization
> > >   iommu/amd: Fix DTE clearing and rename iommu_ignore_device()
> > >   iommu/amd: Split probe error paths to preserve IRQ remapping
> > >   iommu/amd: Fail probe on ATS configuration failure
> > >   PCI/ATS: Mandate checking pci_ats_supported() before pci_prepare_ats()
> > > 
> > >  drivers/iommu/amd/iommu.c | 199 +++++++++++++++++++++++---------------
> > >  drivers/pci/ats.c         |   6 +-
> > >  2 files changed, 126 insertions(+), 79 deletions(-)
> > 
> > FWIW something about this series is mangled, the first patch was
> > changed before it made it to lore. Maybe whitespace damage..
> > 
> 
> I see. I generally use checkpatch with --fix-inplace before sending and
> it seems like it tried fixing something. I'd drop that arg now on.

Never edit patches after git prepares them, it messes up the hashes
git puts the headers and desyncs the context lines in later patches.

Jason
Re: [PATCH v3 0/5] iommu/amd: Refactors for ATS robustness
Posted by Vasant Hegde 1 month ago
Pranjal,


On 8/24/2026 5:53 PM, Pranjal Shrivastava wrote:
> This series forms the second half of the subsystem-wide ATS robustness
> updates. The first part (focusing on the core subsystem, Intel, and ARM
> SMMUv3) has already been merged upstream [1]. This half addresses the
> AMD IOMMU driver and standardizes the PCI ATS API.
> 
> In v2, the series has been significantly restructured based on feedback
> on v1. 

Overall this looks good to me. We did run our CI w/ v2 and no regression found.


-Vasant
Re: [PATCH v3 0/5] iommu/amd: Refactors for ATS robustness
Posted by Pranjal Shrivastava 1 month ago
On Tue, Aug 25, 2026 at 12:36:18PM +0530, Vasant Hegde wrote:
> Pranjal,
> 
> 
> On 8/24/2026 5:53 PM, Pranjal Shrivastava wrote:
> > This series forms the second half of the subsystem-wide ATS robustness
> > updates. The first part (focusing on the core subsystem, Intel, and ARM
> > SMMUv3) has already been merged upstream [1]. This half addresses the
> > AMD IOMMU driver and standardizes the PCI ATS API.
> > 
> > In v2, the series has been significantly restructured based on feedback
> > on v1. 
> 
> Overall this looks good to me. We did run our CI w/ v2 and no regression found.
> 

Ack. v3 Just addressed a few comments. I'll send out a v4 based on the
feedback on this one soon.

Thanks,
Praan