On Tuesday, September 15, 2026 11:29 AM [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
> to consider:
> - [High] arm: loss of per-device IOVA bounds for core-owned domains in ARM32 
> IOMMU DMA
> --
> 
> commit ebe6429aeb25c05897865b7deefe9f71d234666a
> Author: Mikko Perttunen <[email protected]>
> 
> ARM: dma-mapping: Bypass the legacy path for core-owned DMA API domains
> 
> This commit updates the ARM DMA mapping logic to bypass custom IOMMU domain
> management when a core-owned DMA default domain is requested. It adds checks
> in arm_setup_iommu_dma_ops() and arm_teardown_iommu_dma_ops() to skip legacy
> initialization and teardown steps if an existing cookie indicates core
> ownership.
> 
> > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> > index e0d58778c5f54..91f12fb91509e 100644
> > --- a/arch/arm/mm/dma-mapping.c
> > +++ b/arch/arm/mm/dma-mapping.c
> > @@ -1761,9 +1761,18 @@ EXPORT_SYMBOL_GPL(arm_iommu_detach_device);
> >  
> >  static void arm_setup_iommu_dma_ops(struct device *dev)
> >  {
> > -   struct dma_iommu_mapping *mapping;
> > +   struct dma_iommu_mapping *mapping = to_dma_iommu_mapping(dev);
> >     u64 dma_base = 0, size = 1ULL << 32;
> >  
> > +   /*
> > +    * An existing cookie means the core owns the domain. Only set the
> > +    * per-binding DMA ops.
> > +    */
> > +   if (mapping) {
> > +           set_dma_ops(dev, &iommu_ops);
> > +           return;
> > +   }
> > +
> >     if (dev->dma_range_map) {
> 
> [Severity: High]
> Does this early return cause core-owned domains to bypass the legacy logic
> that extracts and applies per-device dma_range_map constraints to the IOVA
> space?
> 
> If a device specifies a dma-ranges property in DT and operates under an
> IOMMU driver that opts into the IOMMU_DOMAIN_DMA default domain, it seems
> this early return bypasses the custom mapping initialization that previously
> baked the dma_range_map constraints into mapping->base and mapping->size.
> 
> When iommu_ops.alloc is called, won't the ARM32 legacy allocator
> __alloc_iova() assign IOVAs based solely on the generic IOMMU aperture
> geometry, ignoring these device-specific constraints?

Ack, will look into this for v2. FWIW, on Tegra (and thus any device 
affected by the series) this doesn't matter.

Thanks
Mikko

> 
> -- 
> Sashiko AI review · 
> https://sashiko.dev/#/patchset/[email protected]?part=5




Reply via email to