Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-03-07 Thread Lucas De Marchi
On Thu, Feb 29, 2024 at 10:06:02PM -0600, Lucas De Marchi wrote: On Thu, Feb 29, 2024 at 08:27:30PM +0200, Andy Shevchenko wrote: On Thu, Feb 29, 2024 at 12:21:34PM -0600, Lucas De Marchi wrote: On Thu, Feb 29, 2024 at 12:49:57PM +0200, Andy Shevchenko wrote: On Wed, Feb 28, 2024 at

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-29 Thread Lucas De Marchi
On Thu, Feb 29, 2024 at 08:27:30PM +0200, Andy Shevchenko wrote: On Thu, Feb 29, 2024 at 12:21:34PM -0600, Lucas De Marchi wrote: On Thu, Feb 29, 2024 at 12:49:57PM +0200, Andy Shevchenko wrote: > On Wed, Feb 28, 2024 at 05:39:21PM -0600, Lucas De Marchi wrote: > > On Thu, Feb 22, 2024 at

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-29 Thread Andy Shevchenko
On Thu, Feb 29, 2024 at 12:21:34PM -0600, Lucas De Marchi wrote: > On Thu, Feb 29, 2024 at 12:49:57PM +0200, Andy Shevchenko wrote: > > On Wed, Feb 28, 2024 at 05:39:21PM -0600, Lucas De Marchi wrote: > > > On Thu, Feb 22, 2024 at 06:49:59AM -0800, Yury Norov wrote: ... > > > I build-tested this

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-29 Thread Lucas De Marchi
On Thu, Feb 29, 2024 at 12:49:57PM +0200, Andy Shevchenko wrote: On Wed, Feb 28, 2024 at 05:39:21PM -0600, Lucas De Marchi wrote: On Thu, Feb 22, 2024 at 06:49:59AM -0800, Yury Norov wrote: > On Wed, Feb 21, 2024 at 03:59:06PM -0600, Lucas De Marchi wrote: > > On Wed, Feb 21, 2024 at 11:04:22PM

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-29 Thread Andy Shevchenko
On Wed, Feb 28, 2024 at 05:39:21PM -0600, Lucas De Marchi wrote: > On Thu, Feb 22, 2024 at 06:49:59AM -0800, Yury Norov wrote: > > On Wed, Feb 21, 2024 at 03:59:06PM -0600, Lucas De Marchi wrote: > > > On Wed, Feb 21, 2024 at 11:04:22PM +0200, Andy Shevchenko wrote: > > > > On Wed, Feb 21, 2024 at

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-28 Thread Lucas De Marchi
On Thu, Feb 22, 2024 at 06:49:59AM -0800, Yury Norov wrote: On Wed, Feb 21, 2024 at 03:59:06PM -0600, Lucas De Marchi wrote: On Wed, Feb 21, 2024 at 11:04:22PM +0200, Andy Shevchenko wrote: > On Wed, Feb 21, 2024 at 10:30:02PM +0200, Dmitry Baryshkov wrote: > > On Thu, 8 Feb 2024 at 09:45,

Re: Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-22 Thread Yury Norov
On Thu, Feb 22, 2024 at 05:04:10PM +0200, Andy Shevchenko wrote: > On Thu, Feb 22, 2024 at 06:49:59AM -0800, Yury Norov wrote: > > On Wed, Feb 21, 2024 at 03:59:06PM -0600, Lucas De Marchi wrote: > > ... > > > +#define __GENMASK(t, h, l) \ > > + ((~0 - (1 << (l)) + 1) & (~0 >> (BITS_PER_LONG -

Re: Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-22 Thread Andy Shevchenko
On Thu, Feb 22, 2024 at 06:49:59AM -0800, Yury Norov wrote: > On Wed, Feb 21, 2024 at 03:59:06PM -0600, Lucas De Marchi wrote: ... > +#define __GENMASK(t, h, l) \ > + ((~0 - (1 << (l)) + 1) & (~0 >> (BITS_PER_LONG - 1 - (h What's wrong on using the UL/ULL() macros? Also it would be

Re: Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-22 Thread Yury Norov
On Wed, Feb 21, 2024 at 03:59:06PM -0600, Lucas De Marchi wrote: > On Wed, Feb 21, 2024 at 11:04:22PM +0200, Andy Shevchenko wrote: > > On Wed, Feb 21, 2024 at 10:30:02PM +0200, Dmitry Baryshkov wrote: > > > On Thu, 8 Feb 2024 at 09:45, Lucas De Marchi > > > wrote: > > > > ... > > > > > >

Re: Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-21 Thread Lucas De Marchi
On Wed, Feb 21, 2024 at 11:04:22PM +0200, Andy Shevchenko wrote: On Wed, Feb 21, 2024 at 10:30:02PM +0200, Dmitry Baryshkov wrote: On Thu, 8 Feb 2024 at 09:45, Lucas De Marchi wrote: ... > +#define BITS_PER_TYPE(type)(sizeof(type) * BITS_PER_BYTE) Can sizeof() be used in assembly?

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-21 Thread Andy Shevchenko
On Wed, Feb 21, 2024 at 11:06:10PM +0200, Andy Shevchenko wrote: > On Wed, Feb 21, 2024 at 10:37:30PM +0200, Dmitry Baryshkov wrote: > > On Wed, 21 Feb 2024 at 22:30, Dmitry Baryshkov > > wrote: ... > > Excuse me, it seems a c from gitlab didn't work as expected. > > No problem, it's clear

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-21 Thread Andy Shevchenko
On Wed, Feb 21, 2024 at 10:37:30PM +0200, Dmitry Baryshkov wrote: > On Wed, 21 Feb 2024 at 22:30, Dmitry Baryshkov > wrote: ... > Excuse me, it seems a c from gitlab didn't work as expected. No problem, it's clear that the patch has not been properly tested and obviously wrong. Has to be

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-21 Thread Andy Shevchenko
On Wed, Feb 21, 2024 at 10:30:02PM +0200, Dmitry Baryshkov wrote: > On Thu, 8 Feb 2024 at 09:45, Lucas De Marchi wrote: ... > > +#define BITS_PER_TYPE(type)(sizeof(type) * BITS_PER_BYTE) Can sizeof() be used in assembly? ... > > -#define __GENMASK(h, l) \ > > - (((~UL(0)) - (UL(1)

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-21 Thread Dmitry Baryshkov
On Wed, 21 Feb 2024 at 22:30, Dmitry Baryshkov wrote: > > On Thu, 8 Feb 2024 at 09:45, Lucas De Marchi wrote: > > > > From: Yury Norov > > > > Generalize __GENMASK() to support different types, and implement > > fixed-types versions of GENMASK() based on it. The fixed-type version > > allows

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-21 Thread Dmitry Baryshkov
On Thu, 8 Feb 2024 at 09:45, Lucas De Marchi wrote: > > From: Yury Norov > > Generalize __GENMASK() to support different types, and implement > fixed-types versions of GENMASK() based on it. The fixed-type version > allows more strict checks to the min/max values accepted, which is > useful for

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-09 Thread Andy Shevchenko
On Thu, Feb 08, 2024 at 08:48:59PM +0100, Andi Shyti wrote: > On Wed, Feb 07, 2024 at 11:45:19PM -0800, Lucas De Marchi wrote: ... > > Signed-off-by: Yury Norov > > Signed-off-by: Lucas De Marchi > > Acked-by: Jani Nikula > > Lucas' SoB should be at the bottom here. In any case, nice patch:

Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-08 Thread Andi Shyti
Hi Lucas and Yury, On Wed, Feb 07, 2024 at 11:45:19PM -0800, Lucas De Marchi wrote: > From: Yury Norov > > Generalize __GENMASK() to support different types, and implement > fixed-types versions of GENMASK() based on it. The fixed-type version > allows more strict checks to the min/max values

[PATCH v3 1/3] bits: introduce fixed-type genmasks

2024-02-07 Thread Lucas De Marchi
From: Yury Norov Generalize __GENMASK() to support different types, and implement fixed-types versions of GENMASK() based on it. The fixed-type version allows more strict checks to the min/max values accepted, which is useful for defining registers like implemented by i915 and xe drivers with