lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ldt2c6lz.fsf@intel.com>
Date: Wed, 19 Mar 2025 00:32:40 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Yury Norov <yury.norov@...il.com>, mailhol.vincent@...adoo.fr
Cc: Lucas De Marchi <lucas.demarchi@...el.com>, Rasmus Villemoes
 <linux@...musvillemoes.dk>, Joonas Lahtinen
 <joonas.lahtinen@...ux.intel.com>, Rodrigo Vivi <rodrigo.vivi@...el.com>,
 Tvrtko Ursulin <tursulin@...ulin.net>, David Airlie <airlied@...il.com>,
 Simona Vetter <simona@...ll.ch>, Andrew Morton
 <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
 intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org, Andi
 Shyti <andi.shyti@...ux.intel.com>, David Laight
 <David.Laight@...lab.com>, Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
 Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v6 4/7] drm/i915: Convert REG_GENMASK*() to fixed-width
 GENMASK_U*()

On Tue, 18 Mar 2025, Yury Norov <yury.norov@...il.com> wrote:
> On Sat, Mar 08, 2025 at 01:48:51AM +0900, Vincent Mailhol via B4 Relay wrote:
>> From: Lucas De Marchi <lucas.demarchi@...el.com>
>> 
>> Now that include/linux/bits.h implements fixed-width GENMASK_U*(), use
>> them to implement the i915/xe specific macros. Converting each driver
>> to use the generic macros are left for later, when/if other
>> driver-specific macros are also generalized.
>> 
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@...el.com>
>> Acked-by: Jani Nikula <jani.nikula@...el.com>
>> Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
>> ---
>> Changelog:
>> 
>>   v5 -> v6:
>> 
>>     - No changes.
>> 
>>   v4 -> v5:
>> 
>>     - Add braket to macro names in patch description,
>>       e.g. 'REG_GENMASK*' -> 'REG_GENMASK*()'
>> 
>>   v3 -> v4:
>> 
>>     - Remove the prefixes in macro parameters,
>>       e.g. 'REG_GENMASK(__high, __low)' -> 'REG_GENMASK(high, low)'
>> ---
>>  drivers/gpu/drm/i915/i915_reg_defs.h | 108 ++++-------------------------------
>>  1 file changed, 11 insertions(+), 97 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/i915_reg_defs.h b/drivers/gpu/drm/i915/i915_reg_defs.h
>> index e251bcc0c89f5710125bc70f07851b2cb978c89c..39e5ed9511174b8757b9201bff735fa362651b34 100644
>> --- a/drivers/gpu/drm/i915/i915_reg_defs.h
>> +++ b/drivers/gpu/drm/i915/i915_reg_defs.h
>> @@ -9,76 +9,19 @@
>>  #include <linux/bitfield.h>
>>  #include <linux/bits.h>
>>  
>> -/**
>> - * REG_BIT() - Prepare a u32 bit value
>> - * @__n: 0-based bit number
>> - *
>> - * Local wrapper for BIT() to force u32, with compile time checks.
>> - *
>> - * @return: Value with bit @__n set.
>> +/*
>> + * Wrappers over the generic BIT_* and GENMASK_* implementations,
>> + * for compatibility reasons with previous implementation
>>   */
>> -#define REG_BIT(__n)							\
>> -	((u32)(BIT(__n) +						\
>> -	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&		\
>> -				 ((__n) < 0 || (__n) > 31))))
>> +#define REG_GENMASK(high, low)		GENMASK_U32(high, low)
>> +#define REG_GENMASK64(high, low)	GENMASK_U64(high, low)
>> +#define REG_GENMASK16(high, low)	GENMASK_U16(high, low)
>> +#define REG_GENMASK8(high, low)		GENMASK_U8(high, low)
>
> Nit. Maybe just
>
>  #define REG_GENMASK		GENMASK_U32

Please just keep it as it is for clarity.

BR,
Jani.


-- 
Jani Nikula, Intel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ