Re: [RFC PATCH v2 3/5] PCI/TSM: Derive the coherent-range IPA from CXL

From: Jason Gunthorpe

Date: Fri Nov 06 2026 - 09:31:42 EST


On Fri, Nov 06, 2026 at 12:38:35PM +0000, Ankit Agrawal wrote:
> >>> +
> >>> +                     reporting_bar_base = tsm_offset &
> >>> +                                          ~((u64)range_len(&window) - 1);
> >>
> >> Hi Ankit,
> >>
> >> HDM decoder window can have non-power-of-2 sizes, why do we assume a power-of-2 size for
> >> coherent window?
> >
> > Hi Richard, yeah the region base calculation needs to be updated
> > to correctly determine the CXL region base for the
> > non-powerof2 sizes.
>
> Just to add, IMO determining the base IPA of the CXL region using the
> interface report does not look straight forward for this case. Trying to
> figure out a proper solution. Missed to mention this as an open in the
> cover letter.

This is the same old problem, PCI SIG messed up the interface report
so it is not usable by the guest.

The pow-2 thing was a work around to avoid that, and it still works
fine for CXL.

CXL's non-pow-2 doesn't change anything. The TSM still would compute
the pow-2 starting point and use that when applying the
offset. Meaning it rounds down the CXL window start to the nearest
pow2 alignment, then uses that to set the offset bits.

Linux makes the same calculation to strip the offset bits.

The real fix was to have the interface report include the starting
offset, but that didn't happen, and it is too late now, so oh well.

Jason