[PATCH 0/3] Fixed-width mask/bit helpers

Lucas De Marchi lucas.demarchi at intel.com
Tue May 9 05:14:00 UTC 2023


Generalize the REG_GENMASK*() and REG_BIT*() macros so they can be used
by other drivers. The intention is to migrate i915 to the generic
helpers and also make use of them on the upcoming xe driver. There are
possibly other users in the kernel that need u32/u16/u8 bit handling.

First patch is one of the possible alternatives in radeon/amdgpu drivers
so they use the U32() that is planned to be used here. Other
alternatives would be to use a amd/radeon prefix or use a _Generic().

Last patch is a temporary one to demonstrate what would be changed on
the i915 side. However instead of replacing the implementation of the
REG_* macros, the goal is to replace the callers as well.

Patches here are currently based on drm-tip branch.

Lucas De Marchi (3):
  drm/amd: Remove wrapper macros over get_u{32,16,8}
  linux/bits.h: Add fixed-width GENMASK and BIT macros
  drm/i915: Temporary conversion to new GENMASK/BIT macros

 drivers/gpu/drm/amd/amdgpu/atom.c       | 212 ++++++++++++------------
 drivers/gpu/drm/amd/include/atom-bits.h |   9 +-
 drivers/gpu/drm/i915/i915_reg_defs.h    |  28 +---
 drivers/gpu/drm/radeon/atom-bits.h      |   9 +-
 drivers/gpu/drm/radeon/atom.c           | 209 +++++++++++------------
 include/linux/bits.h                    |  22 +++
 include/uapi/linux/const.h              |   2 +
 include/vdso/const.h                    |   1 +
 8 files changed, 249 insertions(+), 243 deletions(-)

-- 
2.40.1



More information about the dri-devel mailing list