Re: [PATCH v1 2/2] swiotlb: Fix slot alignment checks

From: Petr Tesařík
Date: Wed Apr 05 2023 - 02:07:13 EST


On Wed, 5 Apr 2023 06:00:13 +0000
Dexuan Cui <decui@xxxxxxxxxxxxx> wrote:

> > From: Petr Tesařík <petr@xxxxxxxxxxx>
> > Sent: Tuesday, April 4, 2023 10:51 PM
> > > ...
> > > Argh, you're right. This is a braino. The alignment mask is in fact an
> > > INVERTED mask, i.e. it masks off bits that are not relevant for the
> > > alignment. The more strict alignment needed the more bits must be set,
> > > so the individual alignment constraints must be combined with an OR
> > > instead of an AND.
> > >
> > > Can you apply the following change and check if it fixes the issue?
> >
> > Actually, this will not work either. The mask is used to mask off both
> It works for me.

Yes, as long as the original (non-bounced) address is aligned at least
to a 2K boundary, it appears to work. ;-)

> > high address bits and low address bits (below swiotlb slot granularity).
> >
> > What should help is this:
> > ...
> This also works for me.
>
> Thanks, *either* version can resolve the issue for me :-)

Thank you for testing! I will write a proper commit message and submit
a fix. Embarassing... *sigh*

Can I add your Tested-by?

Petr T