Re: [GIT PULL] IOMMU fix for 5.10 (-final)

From: Jerry Snitselaar
Date: Wed Dec 09 2020 - 14:26:22 EST


On Wed, Dec 9, 2020 at 12:18 PM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Wed, Dec 9, 2020 at 11:12 AM Jerry Snitselaar <jsnitsel@xxxxxxxxxx> wrote:
> >
> > Since the field in the device table entry format expects it to be n
> > where there are 2^n entries in the table I guess it should be:
> >
> > #define DTE_IRQ_TABLE_LEN 9
> > #define MAX_IRQS_PER_TABLE (1 << DTE_IRQ_TABLE_LEN)
>
> No, that "DTE_IRQ_TABLE_LEN" is not the size shift - it's the size
> shift value in that DTE field, which is shifted up by 1.
>
> That's why the current code does that
>
> #define DTE_IRQ_TABLE_LEN (9ULL << 1)
>
> there..
>
> Which was why I suggested that new #define that is the *actual* shift
> value, and then the DTE thing and the MAX_IRQS_PER_TABLE values would
> depend on that.
>
> Linus
>

Yes, when I read it my head was translating it as setting them both to
512 and then
I forgot that it gets shifted over 1. Which considering I was the once
who noticed the
original problem of it still being 8 was a nice brain fart. This
should be fixed like you suggest.