Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-xe@lists.freedesktop.org,
	Maarten Lankhorst <maarten.lankhorst@intel.com>,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-xe] [PATCH v2 08/11] drm/xe: Remove dependency on i915_reg.h
Date: Mon, 27 Feb 2023 16:19:19 +0200	[thread overview]
Message-ID: <87edqb1994.fsf@intel.com> (raw)
In-Reply-To: <20230217222230.l7ssyylivr2c75bx@ldmartin-desk2.lan>

On Fri, 17 Feb 2023, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
> On Fri, Feb 17, 2023 at 03:27:12PM -0500, Rodrigo Vivi wrote:
>>On Thu, Feb 16, 2023 at 04:52:23PM -0800, Lucas De Marchi wrote:
>>> +#define GGC					_MMIO(0x108040)
>>> +#define   GMS_MASK				REG_GENMASK(15, 8)
>>> +#define   GGMS_MASK				REG_GENMASK(7, 6)
>>
>>one of the things that I'm always confused is with these REG_{BIT,GENMASK,FIELD_PREP}.
>>Why can't we simply use the regular "non-REG_" versions like every other driver
>>(aside of i915 of course).
>
> it was some time ago, I didn't remember exactly and was guessing it was
> because GENMASK returns a long, while our registers are 32bits.
> Indeed, commit 09b434d4f6d2 ("drm/i915: introduce REG_BIT() and
> REG_GENMASK() to define register contents"):
>
> 	We define the above as wrappers to BIT() and GENMASK() respectively to
> 	force u32 type to go with our register size, and to add compile time
> 	checks on the bit numbers.

This, plus FIELD_PREP() doesn't always generate an integer constant
expression making it hard to use in some cases. Which I believe we see
over and over again in i915 gem/gt code that uses FIELD_PREP(). It's
even compiler dependent I think.

> we may revisit that and maybe generalize GENMASK32/BIT32 that guarantees a
> u32 type is returned.

Obviously not a bad idea, but additionally forcing integer constant
expression might not be something everyone wants in generic code.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2023-02-27 14:19 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  0:52 [Intel-xe] [PATCH v2 00/11] Start register cleanup Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 01/11] drm/xe: Remove outdated build workaround Lucas De Marchi
2023-02-17 20:13   ` Rodrigo Vivi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 02/11] drm/xe: Sort includes Lucas De Marchi
2023-02-17 11:20   ` Matthew Auld
2023-02-17 15:03     ` Lucas De Marchi
2023-02-17 11:39   ` Jani Nikula
2023-02-17 15:09     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 03/11] drm/xe/guc: Remove i915_regs.h include Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 04/11] drm/xe: Remove dependency on intel_engine_regs.h Lucas De Marchi
2023-02-24 18:02   ` Matt Roper
2023-02-24 18:05     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h Lucas De Marchi
2023-02-17 20:20   ` Rodrigo Vivi
2023-02-17 22:08     ` Lucas De Marchi
2023-02-24 18:06   ` Matt Roper
2023-02-24 18:29     ` Lucas De Marchi
2023-02-24 18:34       ` Matt Roper
2023-02-24 19:47         ` Vivi, Rodrigo
2023-02-24 20:25           ` Lucas De Marchi
2023-02-24 21:22             ` Vivi, Rodrigo
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 06/11] drm/xe: Remove dependency on intel_lrc_reg.h Lucas De Marchi
2023-02-24 18:20   ` Matt Roper
2023-02-24 18:54     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 07/11] drm/xe: Remove dependency on intel_gpu_commands.h Lucas De Marchi
2023-02-24 18:26   ` Matt Roper
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 08/11] drm/xe: Remove dependency on i915_reg.h Lucas De Marchi
2023-02-17 20:27   ` Rodrigo Vivi
2023-02-17 22:22     ` Lucas De Marchi
2023-02-27 14:19       ` Jani Nikula [this message]
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 09/11] drm/xe/guc_pc: Move gt register to the proper place Lucas De Marchi
2023-02-17 20:23   ` Rodrigo Vivi
2023-02-17 22:11     ` Lucas De Marchi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 10/11] drm/xe: Remove dependency on intel_mchbar_regs.h Lucas De Marchi
2023-02-17 20:18   ` Rodrigo Vivi
2023-02-17  0:52 ` [Intel-xe] [PATCH v2 11/11] drm/xe: Use relative includes for i915_reg_defs.h Lucas De Marchi
2023-02-17 16:33   ` Lucas De Marchi
2023-02-17 20:28   ` Rodrigo Vivi
2023-02-17 22:30     ` Lucas De Marchi
2023-02-21 21:42       ` Rodrigo Vivi
2023-02-21 21:50         ` Lucas De Marchi
2023-02-17  6:19 ` [Intel-xe] [PATCH v2 00/11] Start register cleanup Lucas De Marchi

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=87edqb1994.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@intel.com \
    --cc=matthew.auld@intel.com \
    --cc=rodrigo.vivi@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox