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

2024-02-26 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

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

2024-02-26 Thread Yury Norov
; > > -#define GENMASK_ULL(h, l) \ > > > > - (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) > > > > Ditto. > > problem here seems actually because of the cast to the final type. My > previous impl was avoiding that, but was too verbose compare

Re: Re: [PATCH v3 2/3] bits: Introduce fixed-type BIT

2024-02-26 Thread Yury Norov
On Mon, Feb 19, 2024 at 11:13:57PM -0600, Lucas De Marchi wrote: > On Fri, Feb 09, 2024 at 08:53:25AM -0800, Yury Norov wrote: > > On Wed, Feb 07, 2024 at 11:45:20PM -0800, Lucas De Marchi wrote: > > > Implement fixed-type BIT() to help drivers add stricter checks, like was >

Re: [PATCH v3 2/3] bits: Introduce fixed-type BIT

2024-02-12 Thread Yury Norov
On Wed, Feb 07, 2024 at 11:45:20PM -0800, Lucas De Marchi wrote: > Implement fixed-type BIT() to help drivers add stricter checks, like was > done for GENMASK. > > Signed-off-by: Lucas De Marchi > Acked-by: Jani Nikula So I get v1 from Jan.23 in my mailbox, and this one is v3. Did I miss a v2?

Re: [PATCH 2/3] bits: Introduce fixed-type BIT

2024-02-12 Thread Yury Norov
On Tue, Jan 23, 2024 at 09:02:04PM -0800, Lucas De Marchi wrote: > Implement fixed-type BIT() to help drivers add stricter checks, like was > done for GENMASK. > > Signed-off-by: Lucas De Marchi Reviewed-by: Yury Norov > --- > include/linux/bits.h | 9 + &g

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

2024-02-05 Thread Yury Norov
On Mon, Jan 29, 2024 at 08:49:35AM -0600, Lucas De Marchi wrote: > On Wed, Jan 24, 2024 at 07:27:58AM -0800, Yury Norov wrote: > > On Wed, Jan 24, 2024 at 08:03:53AM -0600, Lucas De Marchi wrote: > > > On Wed, Jan 24, 2024 at 09:58:26AM +0200, Jani Nikula wrote: > > > &

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

2024-01-29 Thread Yury Norov
On Wed, Jan 24, 2024 at 08:03:53AM -0600, Lucas De Marchi wrote: > On Wed, Jan 24, 2024 at 09:58:26AM +0200, Jani Nikula wrote: > > On Tue, 23 Jan 2024, Lucas De Marchi wrote: > > > From: Yury Norov > > > > > > Generalize __GENMASK() to support different ty

Re: Re: [Intel-xe] [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros

2024-01-22 Thread Yury Norov
On Thu, Jan 18, 2024 at 02:42:12PM -0600, Lucas De Marchi wrote: > Hi, > > Reviving this thread as now with xe driver merged we have 2 users for > a fixed-width BIT/GENMASK. Can you point where and why? > On Wed, Jun 21, 2023 at 07:20:59PM -0700, Yury Norov wrote: &g

Re: Re: Re: [Intel-xe] [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros

2024-01-22 Thread Yury Norov
On Thu, Jan 18, 2024 at 05:25:00PM -0600, Lucas De Marchi wrote: > SA2PR11MB4874 > X-OriginatorOrg: intel.com > Status: RO > Content-Length: 6257 > Lines: 150 > > On Thu, Jan 18, 2024 at 01:48:43PM -0800, Yury Norov wrote: > > On Thu, Jan 18, 2024 at 02:42:12PM -

Re: [Intel-gfx] [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros

2023-06-27 Thread Yury Norov
on the exact patch(es) that added a bug related to GENMASK() misuse? It would be easier to advocate the purpose of new API with that in mind. Regarding implementation - we should avoid copy-pasting in cases like this. Below is the patch that I boot-tested for x86_64 and compile-tested for arm64. It look

Re: [Intel-gfx] [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros

2023-06-27 Thread Yury Norov
+ Rasmus Villemoes > > -#define __GENMASK(h, l) \ > > - (((~UL(0)) - (UL(1) << (l)) + 1) & \ > > -(~UL(0) >> (BITS_PER_LONG - 1 - (h > > -#define GENMASK(h, l) \ > > - (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) > > +#define __GENMASK(t, h, l) \ > > + (GENMASK_INPUT_CHECK(h, l) +

[Intel-gfx] [PATCH 18/49] drm/i915/pmu: replace cpumask_weight with cpumask_empty where appropriate

2022-02-14 Thread Yury Norov
-by: Yury Norov Reviewed-by: Tvrtko Ursulin --- drivers/gpu/drm/i915/i915_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index cfc21042499d..7299ed9937dd 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b

Re: [Intel-gfx] [PATCH 17/54] gpu: drm: replace cpumask_weight with cpumask_empty where appropriate

2022-01-25 Thread Yury Norov
On Tue, Jan 25, 2022 at 1:28 AM Tvrtko Ursulin wrote: > > > On 23/01/2022 18:38, Yury Norov wrote: > > i915_pmu_cpu_online() calls cpumask_weight() to check if any bit of a > > given cpumask is set. We can do it more efficiently with cpumask_empty() > > because cpuma

[Intel-gfx] [PATCH 17/54] gpu: drm: replace cpumask_weight with cpumask_empty where appropriate

2022-01-24 Thread Yury Norov
-by: Yury Norov --- drivers/gpu/drm/i915/i915_pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index ea655161793e..1894c876b31d 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915