Re: [PATCH v6 2/7] bits: introduce fixed-type genmasks

From: Yury Norov
Date: Wed Mar 19 2025 - 09:30:44 EST


On Wed, Mar 19, 2025 at 02:39:03PM +0900, Vincent Mailhol wrote:
> On 19/03/2025 at 01:45, Yury Norov wrote:
> > On Sat, Mar 08, 2025 at 01:48:49AM +0900, Vincent Mailhol via B4 Relay wrote:
> >> From: Yury Norov <yury.norov@xxxxxxxxx>
>
> (...)
>
> >> +#define GENMASK(h, l) GENMASK_TYPE(unsigned long, h, l)
> >> +#define GENMASK_ULL(h, l) GENMASK_TYPE(unsigned long long, h, l)
> >
> > I like everything except this part. We switch GENMASK() from a well
> > tested implementation, including an asm code, and we split uapi and
> > non-uapi users, with no functionality changes.
> >
> > Unification is a solid point, however.
> >
> > Let's make it a 2-step procedure? Adding fixed-width GENMASKs is a
> > non-questionable improvement. Switching an existing API from one
> > implementation to another should be a separate patch, and probably
> > even a separate series. And we should be very clear that __GENMASK()
> > is uapi-only thing from now.
> >
> > If we decide to switch GENMASK() in a separate series, we'll have some
> > extra time to think about unification...
>
> Ack. I started drafting the split. The two series would look like:
>
> [Series #1] bits: Fixed-type GENMASK_U*() and BIT_U*()
> - bits: introduce fixed-type GENMASK_U*()
> - bits: introduce fixed-type BIT_U*()
> - drm/i915: Convert REG_GENMASK*() to fixed-width GENMASK_U*()
> - test_bits: add tests for GENMASK_U*()
> - test_bits: add tests for BIT_U*()
>
> [Series #2] bits: Split asm and non-asm GENMASK*() and unify definitions
> - bits: split the definition of the asm and non-asm GENMASK*()
> - bits: unify the non-asm GENMASK*()
> - test_bits: add tests for __GENMASK() and __GENMASK_ULL()
>
>
> Series #1 will leave GENMASK(), GENMASK_ULL() and GENMASK_128()
> untouched. The final result after the Series #2 will be the exact same
> code as of now.
>
> I am thinking of sending the two series at the same time, and then, you
> can decide what is the good timing to merge these (and eventually, start
> a separate discussion on the second series).
>
> Does this work for you?

Yes.

> On a side note, it did a lot of modifications to your original patch
> which introduced the GENMASK_U*(). It is OK to tag myself as author and
> you as co-author or do you still prefer to stay as the main author? Let
> me know!

Yes, I'm OK.