From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Christian König" <christian.koenig@amd.com>,
intel-gfx@lists.freedesktop.org,
"Kevin Brodsky" <kevin.brodsky@arm.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Masahiro Yamada" <masahiroy@kernel.org>
Subject: Re: [Intel-gfx] [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros
Date: Thu, 15 Jun 2023 18:58:33 +0300 [thread overview]
Message-ID: <ZIs1KQOeunnBeha2@smile.fi.intel.com> (raw)
In-Reply-To: <5wfbihhliddinlvsh23dejbuffiz45ecs3wb37qcwyqd3hjfcm@wyhqnobiiu22>
On Fri, May 12, 2023 at 09:29:23AM -0700, Lucas De Marchi wrote:
> On Fri, May 12, 2023 at 02:14:19PM +0300, Andy Shevchenko wrote:
> > On Mon, May 08, 2023 at 10:14:02PM -0700, Lucas De Marchi wrote:
> > > Add GENMASK_U32(), GENMASK_U16() and GENMASK_U8() macros to create
> > > masks for fixed-width types and also the corresponding BIT_U32(),
> > > BIT_U16() and BIT_U8().
> >
> > Why?
>
> to create the masks/values for device registers that are
> of a certain width, preventing mistakes like:
>
> #define REG1 0x10
> #define REG1_ENABLE BIT(17)
> #define REG1_FOO GENMASK(16, 15);
>
> register_write(REG1_ENABLE, REG1);
>
>
> ... if REG1 is a 16bit register for example. There were mistakes in the
> past in the i915 source leading to the creation of the REG_* variants on
> top of normal GENMASK/BIT (see last patch and commit 09b434d4f6d2
> ("drm/i915: introduce REG_BIT() and REG_GENMASK() to define register
> contents")
Doesn't it look like something for bitfield.h candidate?
If your definition doesn't fit the given mask, bail out.
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Christian König" <christian.koenig@amd.com>,
intel-gfx@lists.freedesktop.org,
"Kevin Brodsky" <kevin.brodsky@arm.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Masahiro Yamada" <masahiroy@kernel.org>
Subject: Re: [Intel-xe] [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros
Date: Thu, 15 Jun 2023 18:58:33 +0300 [thread overview]
Message-ID: <ZIs1KQOeunnBeha2@smile.fi.intel.com> (raw)
In-Reply-To: <5wfbihhliddinlvsh23dejbuffiz45ecs3wb37qcwyqd3hjfcm@wyhqnobiiu22>
On Fri, May 12, 2023 at 09:29:23AM -0700, Lucas De Marchi wrote:
> On Fri, May 12, 2023 at 02:14:19PM +0300, Andy Shevchenko wrote:
> > On Mon, May 08, 2023 at 10:14:02PM -0700, Lucas De Marchi wrote:
> > > Add GENMASK_U32(), GENMASK_U16() and GENMASK_U8() macros to create
> > > masks for fixed-width types and also the corresponding BIT_U32(),
> > > BIT_U16() and BIT_U8().
> >
> > Why?
>
> to create the masks/values for device registers that are
> of a certain width, preventing mistakes like:
>
> #define REG1 0x10
> #define REG1_ENABLE BIT(17)
> #define REG1_FOO GENMASK(16, 15);
>
> register_write(REG1_ENABLE, REG1);
>
>
> ... if REG1 is a 16bit register for example. There were mistakes in the
> past in the i915 source leading to the creation of the REG_* variants on
> top of normal GENMASK/BIT (see last patch and commit 09b434d4f6d2
> ("drm/i915: introduce REG_BIT() and REG_GENMASK() to define register
> contents")
Doesn't it look like something for bitfield.h candidate?
If your definition doesn't fit the given mask, bail out.
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Christian König" <christian.koenig@amd.com>,
intel-gfx@lists.freedesktop.org,
"Kevin Brodsky" <kevin.brodsky@arm.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Masahiro Yamada" <masahiroy@kernel.org>
Subject: Re: [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros
Date: Thu, 15 Jun 2023 18:58:33 +0300 [thread overview]
Message-ID: <ZIs1KQOeunnBeha2@smile.fi.intel.com> (raw)
In-Reply-To: <5wfbihhliddinlvsh23dejbuffiz45ecs3wb37qcwyqd3hjfcm@wyhqnobiiu22>
On Fri, May 12, 2023 at 09:29:23AM -0700, Lucas De Marchi wrote:
> On Fri, May 12, 2023 at 02:14:19PM +0300, Andy Shevchenko wrote:
> > On Mon, May 08, 2023 at 10:14:02PM -0700, Lucas De Marchi wrote:
> > > Add GENMASK_U32(), GENMASK_U16() and GENMASK_U8() macros to create
> > > masks for fixed-width types and also the corresponding BIT_U32(),
> > > BIT_U16() and BIT_U8().
> >
> > Why?
>
> to create the masks/values for device registers that are
> of a certain width, preventing mistakes like:
>
> #define REG1 0x10
> #define REG1_ENABLE BIT(17)
> #define REG1_FOO GENMASK(16, 15);
>
> register_write(REG1_ENABLE, REG1);
>
>
> ... if REG1 is a 16bit register for example. There were mistakes in the
> past in the i915 source leading to the creation of the REG_* variants on
> top of normal GENMASK/BIT (see last patch and commit 09b434d4f6d2
> ("drm/i915: introduce REG_BIT() and REG_GENMASK() to define register
> contents")
Doesn't it look like something for bitfield.h candidate?
If your definition doesn't fit the given mask, bail out.
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
dri-devel@lists.freedesktop.org,
"Thomas Gleixner" <tglx@linutronix.de>,
linux-kernel@vger.kernel.org,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Kevin Brodsky" <kevin.brodsky@arm.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>
Subject: Re: [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros
Date: Thu, 15 Jun 2023 18:58:33 +0300 [thread overview]
Message-ID: <ZIs1KQOeunnBeha2@smile.fi.intel.com> (raw)
In-Reply-To: <5wfbihhliddinlvsh23dejbuffiz45ecs3wb37qcwyqd3hjfcm@wyhqnobiiu22>
On Fri, May 12, 2023 at 09:29:23AM -0700, Lucas De Marchi wrote:
> On Fri, May 12, 2023 at 02:14:19PM +0300, Andy Shevchenko wrote:
> > On Mon, May 08, 2023 at 10:14:02PM -0700, Lucas De Marchi wrote:
> > > Add GENMASK_U32(), GENMASK_U16() and GENMASK_U8() macros to create
> > > masks for fixed-width types and also the corresponding BIT_U32(),
> > > BIT_U16() and BIT_U8().
> >
> > Why?
>
> to create the masks/values for device registers that are
> of a certain width, preventing mistakes like:
>
> #define REG1 0x10
> #define REG1_ENABLE BIT(17)
> #define REG1_FOO GENMASK(16, 15);
>
> register_write(REG1_ENABLE, REG1);
>
>
> ... if REG1 is a 16bit register for example. There were mistakes in the
> past in the i915 source leading to the creation of the REG_* variants on
> top of normal GENMASK/BIT (see last patch and commit 09b434d4f6d2
> ("drm/i915: introduce REG_BIT() and REG_GENMASK() to define register
> contents")
Doesn't it look like something for bitfield.h candidate?
If your definition doesn't fit the given mask, bail out.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-06-15 15:59 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 5:14 [Intel-gfx] [PATCH 0/3] Fixed-width mask/bit helpers Lucas De Marchi
2023-05-09 5:14 ` Lucas De Marchi
2023-05-09 5:14 ` Lucas De Marchi
2023-05-09 5:14 ` [Intel-xe] " Lucas De Marchi
2023-05-09 5:14 ` [Intel-gfx] [PATCH 1/3] drm/amd: Remove wrapper macros over get_u{32, 16, 8} Lucas De Marchi
2023-05-09 5:14 ` [PATCH 1/3] drm/amd: Remove wrapper macros over get_u{32,16,8} Lucas De Marchi
2023-05-09 5:14 ` Lucas De Marchi
2023-05-09 5:14 ` [Intel-xe] [PATCH 1/3] drm/amd: Remove wrapper macros over get_u{32, 16, 8} Lucas De Marchi
2023-05-09 5:14 ` [Intel-gfx] [PATCH 2/3] linux/bits.h: Add fixed-width GENMASK and BIT macros Lucas De Marchi
2023-05-09 5:14 ` Lucas De Marchi
2023-05-09 5:14 ` Lucas De Marchi
2023-05-09 5:14 ` [Intel-xe] " Lucas De Marchi
2023-05-09 14:00 ` [Intel-gfx] " Gustavo Sousa
2023-05-09 14:00 ` Gustavo Sousa
2023-05-09 14:00 ` Gustavo Sousa
2023-05-09 21:34 ` [Intel-gfx] " Lucas De Marchi
2023-05-09 21:34 ` Lucas De Marchi
2023-05-09 21:34 ` Lucas De Marchi
2023-05-10 12:18 ` [Intel-gfx] " kernel test robot
2023-05-10 12:18 ` kernel test robot
2023-05-10 12:18 ` kernel test robot
2023-05-10 12:18 ` [Intel-xe] " kernel test robot
2023-05-12 11:14 ` [Intel-gfx] " Andy Shevchenko
2023-05-12 11:14 ` Andy Shevchenko
2023-05-12 11:14 ` Andy Shevchenko
2023-05-12 11:14 ` [Intel-xe] " Andy Shevchenko
2023-05-12 11:25 ` [Intel-gfx] " Jani Nikula
2023-05-12 11:25 ` Jani Nikula
2023-05-12 11:25 ` Jani Nikula
2023-05-12 11:25 ` [Intel-xe] " Jani Nikula
2023-05-12 11:32 ` [Intel-gfx] " Andy Shevchenko
2023-05-12 11:32 ` Andy Shevchenko
2023-05-12 11:32 ` Andy Shevchenko
2023-05-12 11:32 ` [Intel-xe] " Andy Shevchenko
2023-05-12 11:45 ` [Intel-gfx] " Jani Nikula
2023-05-12 11:45 ` Jani Nikula
2023-05-12 11:45 ` Jani Nikula
2023-05-12 11:45 ` [Intel-xe] " Jani Nikula
2023-06-15 15:53 ` [Intel-gfx] " Andy Shevchenko
2023-06-15 15:53 ` Andy Shevchenko
2023-06-15 15:53 ` Andy Shevchenko
2023-06-15 15:53 ` [Intel-xe] " Andy Shevchenko
2023-06-20 14:47 ` [Intel-gfx] " Jani Nikula
2023-06-20 14:47 ` Jani Nikula
2023-06-20 14:47 ` Jani Nikula
2023-06-20 14:47 ` [Intel-xe] " Jani Nikula
2023-06-20 14:55 ` [Intel-gfx] " Andy Shevchenko
2023-06-20 14:55 ` Andy Shevchenko
2023-06-20 14:55 ` Andy Shevchenko
2023-06-20 14:55 ` [Intel-xe] " Andy Shevchenko
2023-06-20 17:25 ` [Intel-gfx] " Lucas De Marchi
2023-06-20 17:25 ` Lucas De Marchi
2023-06-20 17:25 ` Lucas De Marchi
2023-06-20 17:41 ` [Intel-gfx] " Andy Shevchenko
2023-06-20 17:41 ` Andy Shevchenko
2023-06-20 17:41 ` Andy Shevchenko
2023-06-20 18:02 ` [Intel-gfx] " Lucas De Marchi
2023-06-20 18:02 ` Lucas De Marchi
2023-06-20 18:02 ` Lucas De Marchi
2023-06-20 18:19 ` [Intel-gfx] " Jani Nikula
2023-06-20 18:19 ` Jani Nikula
2023-06-20 18:19 ` Jani Nikula
2023-05-12 16:29 ` [Intel-gfx] " Lucas De Marchi
2023-05-12 16:29 ` Lucas De Marchi
2023-05-12 16:29 ` Lucas De Marchi
2023-05-12 16:29 ` [Intel-xe] " Lucas De Marchi
2023-06-15 15:58 ` Andy Shevchenko [this message]
2023-06-15 15:58 ` Andy Shevchenko
2023-06-15 15:58 ` Andy Shevchenko
2023-06-15 15:58 ` [Intel-xe] " Andy Shevchenko
2023-06-22 2:20 ` [Intel-gfx] " Yury Norov
2023-06-22 2:20 ` Yury Norov
2023-06-22 2:20 ` Yury Norov
2023-06-22 2:20 ` [Intel-xe] " Yury Norov
2023-06-22 6:15 ` [Intel-gfx] " Lucas De Marchi
2023-06-22 6:15 ` Lucas De Marchi
2023-06-22 6:15 ` Lucas De Marchi
2023-06-22 6:15 ` [Intel-xe] " Lucas De Marchi
2023-06-22 14:59 ` [Intel-gfx] " Yury Norov
2023-06-22 14:59 ` Yury Norov
2023-06-22 14:59 ` Yury Norov
2023-06-22 14:59 ` [Intel-xe] " Yury Norov
2024-01-18 20:42 ` Lucas De Marchi
2024-01-18 20:42 ` Lucas De Marchi
2024-01-18 21:48 ` Yury Norov
2024-01-18 21:48 ` Yury Norov
2024-01-18 23:25 ` Lucas De Marchi
2024-01-18 23:25 ` Lucas De Marchi
2024-01-19 2:01 ` Yury Norov
2024-01-19 2:01 ` Yury Norov
2024-01-19 15:07 ` Lucas De Marchi
2024-01-19 15:07 ` Lucas De Marchi
2023-05-09 5:14 ` [Intel-gfx] [PATCH 3/3] drm/i915: Temporary conversion to new GENMASK/BIT macros Lucas De Marchi
2023-05-09 5:14 ` Lucas De Marchi
2023-05-09 5:14 ` Lucas De Marchi
2023-05-09 5:14 ` [Intel-xe] " Lucas De Marchi
2023-05-09 7:57 ` [Intel-gfx] " Jani Nikula
2023-05-09 7:57 ` Jani Nikula
2023-05-09 7:57 ` Jani Nikula
2023-05-09 7:57 ` [Intel-xe] " Jani Nikula
2023-05-09 8:15 ` [Intel-gfx] " Lucas De Marchi
2023-05-09 8:15 ` Lucas De Marchi
2023-05-09 8:15 ` Lucas De Marchi
2023-05-09 8:15 ` [Intel-xe] " Lucas De Marchi
2023-05-09 5:17 ` [Intel-xe] ✓ CI.Patch_applied: success for Fixed-width mask/bit helpers Patchwork
2023-05-09 5:43 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning " Patchwork
2023-05-09 5:43 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-05-09 6:00 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-05-09 15:56 ` [Intel-xe] ✓ CI.Patch_applied: success for Fixed-width mask/bit helpers (rev2) Patchwork
2023-05-09 15:58 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-05-09 16:01 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-05-09 16:27 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-06-22 3:53 ` [Intel-xe] ✗ CI.Patch_applied: failure for Fixed-width mask/bit helpers (rev3) Patchwork
2023-06-27 20:01 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for Fixed-width mask/bit helpers (rev2) Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZIs1KQOeunnBeha2@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=alexander.deucher@amd.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=kevin.brodsky@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=masahiroy@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.