> From: Borah, Chaitanya Kumar <[email protected]>
> Sent: Wednesday, November 19, 2025 3:40 PM
>
> On 11/18/2025 9:43 PM, Jason Gunthorpe wrote:
> > Chaitanya, can you collect these two log files from the commit that
> > works please? Lets see if it uses the same IOVA and same 46 bit limit?
>
> Here are the logs with HEAD set to the parent of the bad commit.
>
> Atleast something looks different.
>
> [ 235.079208] i915 0000:00:02.0: Using 41-bit DMA addresses
>
this is an interesting part.
the caller of iommu_dma_alloc_iova() uses dev->coherent_dma_mask
or dev->dma_mask.
i915_set_dma_info() sets both to a same fixed value (except difference
on some old gen), which is 46:
i915 0000:00:02.0: [drm:i915_driver_probe [i915]] device info: dma_mask_size: 46
within iommu_dma_alloc_iova(), the mask might be adjusted in two places.
one is dev->bus_dma_limit, which is zero on x86.
the other is aperture_end:
if (domain->geometry.force_aperture)
dma_limit = min(dma_limit, (u64)domain->geometry.aperture_end);
so the likely difference before/after the commit is on calculation of the
aperture_end.
old way:
if (first_stage)
domain->domain.geometry.aperture_end =
__DOMAIN_MAX_ADDR(domain->gaw - 1);
else
domain->domain.geometry.aperture_end =
__DOMAIN_MAX_ADDR(domain->gaw);
i.e. both are initialized around domain->gaw.
but the new way has difference between first-stage and second-stage as
Jason pointed out already.
Baolu, what is the number in "Using xxx-bit DMA addresses" when
using second-stage?
my understanding of various 'gaw' fields are only about second stage, but
maybe there is something we overlooked...
Thanks
Kevin