Re: [v2 05/19] drm/{i915, xe}: Extract pcode definitions to common header

Jani Nikula
2026-01-22T11:46:16Z

On Thu, 22 Jan 2026, Uma Shankar <uma.shankar@intel.com> wrote:
> There are certain register definitions which are commonly shared
> by i915, xe and display. Extract the same to a common header to
> avoid duplication.
>
> Move GEN6_PCODE_MAILBOX to common header to make intel_cdclk.c
> free from including i915_reg.h
>
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_cdclk.c | 2 +-
> drivers/gpu/drm/i915/i915_reg.h | 101 +------------------
> include/drm/intel/intel_gmd_common_regs.h | 108 +++++++++++++++++++++
> 3 files changed, 110 insertions(+), 101 deletions(-)
> create mode 100644 include/drm/intel/intel_gmd_common_regs.h
>
> diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
> index 9bfbfbf34dc0..531db1b452d1 100644
> --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
> +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
> @@ -27,9 +27,9 @@
>
> #include <drm/drm_fixed.h>
> #include <drm/drm_print.h>
> +#include <drm/intel/intel_gmd_common_regs.h>
>
> #include "hsw_ips.h"
> -#include "i915_reg.h"
> #include "intel_atomic.h"
> #include "intel_audio.h"
> #include "intel_cdclk.h"
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index dc13f9eb4cd7..35122c997b8a 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -25,6 +25,7 @@
> #ifndef _I915_REG_H_
> #define _I915_REG_H_
>
> +#include <drm/intel/intel_gmd_common_regs.h>

Oh, I also dislike this, because it becomes unclear what needs them. The
benefit from more granular headers is that only the places that need
them can include them, and we can actually quickly check what includes
what instead of these indirect dependencies.

BR,
Jani.

--
Jani Nikula, Intel