Re: [PATCH v2 1/1] powerpc/iommu: Enable remaining IOMMU Pagesizes present in LoPAR

From: Leonardo Bras
Date: Wed Apr 14 2021 - 00:02:27 EST


On Mon, 2021-04-12 at 17:21 -0500, Segher Boessenkool wrote:
> On Fri, Apr 09, 2021 at 02:36:16PM +1000, Alexey Kardashevskiy wrote:
> > On 08/04/2021 19:04, Michael Ellerman wrote:
> > > > > > +#define QUERY_DDW_PGSIZE_4K 0x01
> > > > > > +#define QUERY_DDW_PGSIZE_64K 0x02
> > > > > > +#define QUERY_DDW_PGSIZE_16M 0x04
> > > > > > +#define QUERY_DDW_PGSIZE_32M 0x08
> > > > > > +#define QUERY_DDW_PGSIZE_64M 0x10
> > > > > > +#define QUERY_DDW_PGSIZE_128M 0x20
> > > > > > +#define QUERY_DDW_PGSIZE_256M 0x40
> > > > > > +#define QUERY_DDW_PGSIZE_16G 0x80
> > > > >
> > > > > I'm not sure the #defines really gain us much vs just putting the
> > > > > literal values in the array below?
> > > >
> > > > Then someone says "uuuuu magic values" :) I do not mind either way.
> > > > Thanks,
> > >
> > > Yeah that's true. But #defining them doesn't make them less magic, if
> > > you only use them in one place :)
> >
> > Defining them with "QUERY_DDW" in the names kinda tells where they are
> > from. Can also grep QEMU using these to see how the other side handles
> > it. Dunno.
>
> And *not* defining anything reduces the mental load a lot. You can add
> a comment at the single spot you use them, explaining what this is, in a
> much better way!
>
> Comments are *good*.
>
>
> Segher

Thanks for the feedback Alexey, Michael and Segher!

I have sent a v3 for this patch. 
http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210408201915.174217-1-leobras.c@xxxxxxxxx/

Please let me know of your feedback in it.

Best regards,
Leonardo Bras