[Intel-xe] [PATCH v4 11/12] drm/xe: Add xe_reg_defs.h

Matt Roper matthew.d.roper at intel.com
Sat Feb 25 00:54:50 UTC 2023


On Fri, Feb 24, 2023 at 04:15:47PM -0800, Lucas De Marchi wrote:
> Wrap the include of i915_reg_defs.h into an xe-only header so the i915
> include doesn't need to be spread across the driver.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
>  drivers/gpu/drm/xe/regs/xe_engine_regs.h |  2 +-
>  drivers/gpu/drm/xe/regs/xe_gt_regs.h     |  2 +-
>  drivers/gpu/drm/xe/regs/xe_reg_defs.h    | 11 +++++++++++
>  drivers/gpu/drm/xe/regs/xe_regs.h        |  2 +-
>  drivers/gpu/drm/xe/xe_device.c           |  3 +--
>  drivers/gpu/drm/xe/xe_gt_mcr.h           |  2 +-
>  drivers/gpu/drm/xe/xe_gt_pagefault.c     |  3 +--
>  drivers/gpu/drm/xe/xe_gt_topology.c      |  3 +--
>  drivers/gpu/drm/xe/xe_guc.c              |  2 --
>  drivers/gpu/drm/xe/xe_guc_reg.h          |  2 +-
>  drivers/gpu/drm/xe/xe_migrate.c          |  3 +--
>  drivers/gpu/drm/xe/xe_pcode_api.h        |  2 +-
>  drivers/gpu/drm/xe/xe_reg_sr_types.h     |  2 --
>  drivers/gpu/drm/xe/xe_rtp.h              |  2 --
>  drivers/gpu/drm/xe/xe_rtp_types.h        |  2 --
>  drivers/gpu/drm/xe/xe_step.c             |  3 +--
>  16 files changed, 22 insertions(+), 24 deletions(-)
>  create mode 100644 drivers/gpu/drm/xe/regs/xe_reg_defs.h
> 
> diff --git a/drivers/gpu/drm/xe/regs/xe_engine_regs.h b/drivers/gpu/drm/xe/regs/xe_engine_regs.h
> index 6dfa3cf2fd43..2aa67d001c34 100644
> --- a/drivers/gpu/drm/xe/regs/xe_engine_regs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_engine_regs.h
> @@ -8,7 +8,7 @@
>  
>  #include <asm/page.h>
>  
> -#include "i915_reg_defs.h"
> +#include "regs/xe_reg_defs.h"
>  
>  #define RING_TAIL(base)				_MMIO((base) + 0x30)
>  
> diff --git a/drivers/gpu/drm/xe/regs/xe_gt_regs.h b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> index 9290505d6596..3bf2fc3f80d8 100644
> --- a/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> @@ -6,7 +6,7 @@
>  #ifndef _XE_GT_REGS_H_
>  #define _XE_GT_REGS_H_
>  
> -#include "i915_reg_defs.h"
> +#include "regs/xe_reg_defs.h"
>  
>  /* RPM unit config (Gen8+) */
>  #define RPM_CONFIG0				_MMIO(0xd00)
> diff --git a/drivers/gpu/drm/xe/regs/xe_reg_defs.h b/drivers/gpu/drm/xe/regs/xe_reg_defs.h
> new file mode 100644
> index 000000000000..5f6735697d9c
> --- /dev/null
> +++ b/drivers/gpu/drm/xe/regs/xe_reg_defs.h
> @@ -0,0 +1,11 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2023 Intel Corporation
> + */
> +
> +#ifndef _XE_REG_DEFS_H_
> +#define _XE_REG_DEFS_H_
> +
> +#include "../../i915/i915_reg_defs.h"
> +
> +#endif
> diff --git a/drivers/gpu/drm/xe/regs/xe_regs.h b/drivers/gpu/drm/xe/regs/xe_regs.h
> index 53f1ed54fb1c..74588d42a339 100644
> --- a/drivers/gpu/drm/xe/regs/xe_regs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_regs.h
> @@ -5,7 +5,7 @@
>  #ifndef _XE_REGS_H_
>  #define _XE_REGS_H_
>  
> -#include "i915_reg_defs.h"
> +#include "regs/xe_reg_defs.h"
>  
>  #define GU_CNTL					_MMIO(0x101010)
>  #define   LMEM_INIT				REG_BIT(7)
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 8f2b2acd4024..87d3d2cde665 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -12,6 +12,7 @@
>  #include <drm/drm_managed.h>
>  #include <drm/xe_drm.h>
>  
> +#include "regs/xe_reg_defs.h"
>  #include "xe_bo.h"
>  #include "xe_debugfs.h"
>  #include "xe_display.h"
> @@ -31,8 +32,6 @@
>  #include "xe_vm_madvise.h"
>  #include "xe_wait_user_fence.h"
>  
> -#include "../i915/i915_reg_defs.h"
> -
>  #define SOFTWARE_FLAGS_SPR33         _MMIO(0x4F084)
>  
>  static int xe_file_open(struct drm_device *dev, struct drm_file *file)
> diff --git a/drivers/gpu/drm/xe/xe_gt_mcr.h b/drivers/gpu/drm/xe/xe_gt_mcr.h
> index c31987d2177c..2a6cd38c8cb7 100644
> --- a/drivers/gpu/drm/xe/xe_gt_mcr.h
> +++ b/drivers/gpu/drm/xe/xe_gt_mcr.h
> @@ -6,7 +6,7 @@
>  #ifndef _XE_GT_MCR_H_
>  #define _XE_GT_MCR_H_
>  
> -#include "i915_reg_defs.h"
> +#include "regs/xe_reg_defs.h"
>  
>  struct drm_printer;
>  struct xe_gt;
> diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> index 19403dbea9f5..062430394a33 100644
> --- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
> +++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
> @@ -10,6 +10,7 @@
>  #include <drm/drm_managed.h>
>  #include <drm/ttm/ttm_execbuf_util.h>
>  
> +#include "regs/xe_reg_defs.h"
>  #include "xe_bo.h"
>  #include "xe_gt.h"
>  #include "xe_gt_tlb_invalidation.h"
> @@ -20,8 +21,6 @@
>  #include "xe_trace.h"
>  #include "xe_vm.h"
>  
> -#include "../i915/i915_reg_defs.h"
> -
>  struct pagefault {
>  	u64 page_addr;
>  	u32 asid;
> diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
> index 264d6429318b..c03aa10b4c21 100644
> --- a/drivers/gpu/drm/xe/xe_gt_topology.c
> +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
> @@ -7,11 +7,10 @@
>  
>  #include <linux/bitmap.h>
>  
> +#include "regs/xe_reg_defs.h"
>  #include "xe_gt.h"
>  #include "xe_mmio.h"
>  
> -#include "../i915/i915_reg_defs.h"
> -
>  #define XE_MAX_DSS_FUSE_BITS (32 * XE_MAX_DSS_FUSE_REGS)
>  #define XE_MAX_EU_FUSE_BITS (32 * XE_MAX_EU_FUSE_REGS)
>  
> diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
> index 661effa9830f..a8b0171ed7c2 100644
> --- a/drivers/gpu/drm/xe/xe_guc.c
> +++ b/drivers/gpu/drm/xe/xe_guc.c
> @@ -22,8 +22,6 @@
>  #include "xe_uc_fw.h"
>  #include "xe_wopcm.h"
>  
> -#include "i915_reg_defs.h"
> -

Was this one supposed to be replaced by the new Xe header?  There are
REG_FIELD_GET and REG_GENMASK uses in this file, so we probably want the
new header included I think?


>  /* TODO: move to common file */
>  #define GUC_PVC_MOCS_INDEX_MASK		REG_GENMASK(25, 24)
>  #define PVC_MOCS_UC_INDEX		1
> diff --git a/drivers/gpu/drm/xe/xe_guc_reg.h b/drivers/gpu/drm/xe/xe_guc_reg.h
> index 513a7e0c8a5a..b5ebec30140d 100644
> --- a/drivers/gpu/drm/xe/xe_guc_reg.h
> +++ b/drivers/gpu/drm/xe/xe_guc_reg.h
> @@ -9,7 +9,7 @@
>  #include <linux/compiler.h>
>  #include <linux/types.h>
>  
> -#include "i915_reg_defs.h"
> +#include "regs/xe_reg_defs.h"
>  
>  /* Definitions of GuC H/W registers, bits, etc */
>  
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index d845f7cadbd4..4872adadeb8e 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -11,6 +11,7 @@
>  #include <drm/ttm/ttm_tt.h>
>  #include <drm/xe_drm.h>
>  
> +#include "regs/xe_reg_defs.h"
>  #include "regs/xe_gpu_commands.h"
>  #include "xe_bb.h"
>  #include "xe_bo.h"
> @@ -28,8 +29,6 @@
>  #include "xe_trace.h"
>  #include "xe_vm.h"
>  
> -#include "../i915/i915_reg_defs.h"
> -
>  /**
>   * struct xe_migrate - migrate context.
>   */
> diff --git a/drivers/gpu/drm/xe/xe_pcode_api.h b/drivers/gpu/drm/xe/xe_pcode_api.h
> index 2103f684a8b5..4e689cd4b23b 100644
> --- a/drivers/gpu/drm/xe/xe_pcode_api.h
> +++ b/drivers/gpu/drm/xe/xe_pcode_api.h
> @@ -5,7 +5,7 @@
>  
>  /* Internal to xe_pcode */
>  
> -#include "../i915/i915_reg_defs.h"
> +#include "regs/xe_reg_defs.h"
>  
>  #define PCODE_MAILBOX			_MMIO(0x138124)
>  #define   PCODE_READY			REG_BIT(31)
> diff --git a/drivers/gpu/drm/xe/xe_reg_sr_types.h b/drivers/gpu/drm/xe/xe_reg_sr_types.h
> index b234a8673e54..0e6d542ff1b4 100644
> --- a/drivers/gpu/drm/xe/xe_reg_sr_types.h
> +++ b/drivers/gpu/drm/xe/xe_reg_sr_types.h
> @@ -9,8 +9,6 @@
>  #include <linux/types.h>
>  #include <linux/xarray.h>
>  
> -#include "i915_reg_defs.h"
> -

Looks like just removing this one (without replacing) should be fine.

>  struct xe_reg_sr_entry {
>  	u32		clr_bits;
>  	u32		set_bits;
> diff --git a/drivers/gpu/drm/xe/xe_rtp.h b/drivers/gpu/drm/xe/xe_rtp.h
> index d6ba0b7e5042..bd44fd8bbe05 100644
> --- a/drivers/gpu/drm/xe/xe_rtp.h
> +++ b/drivers/gpu/drm/xe/xe_rtp.h
> @@ -11,8 +11,6 @@
>  
>  #include "xe_rtp_types.h"
>  
> -#include "i915_reg_defs.h"
> -

This one with no replacement looks fine too.

>  /*
>   * Register table poke infrastructure
>   */
> diff --git a/drivers/gpu/drm/xe/xe_rtp_types.h b/drivers/gpu/drm/xe/xe_rtp_types.h
> index fac0bd6d5b1e..e87f1b280d96 100644
> --- a/drivers/gpu/drm/xe/xe_rtp_types.h
> +++ b/drivers/gpu/drm/xe/xe_rtp_types.h
> @@ -8,8 +8,6 @@
>  
>  #include <linux/types.h>
>  
> -#include "i915_reg_defs.h"
> -

Ditto.


Matt

>  struct xe_hw_engine;
>  struct xe_gt;
>  
> diff --git a/drivers/gpu/drm/xe/xe_step.c b/drivers/gpu/drm/xe/xe_step.c
> index e5e77cb9ea09..f78a7dc3049f 100644
> --- a/drivers/gpu/drm/xe/xe_step.c
> +++ b/drivers/gpu/drm/xe/xe_step.c
> @@ -5,11 +5,10 @@
>  
>  #include "xe_step.h"
>  
> +#include "regs/xe_reg_defs.h"
>  #include "xe_device.h"
>  #include "xe_platform_types.h"
>  
> -#include "../i915/i915_reg_defs.h"
> -
>  /*
>   * Provide mapping between PCI's revision ID to the individual GMD
>   * (Graphics/Media/Display) stepping values that can be compared numerically.
> -- 
> 2.39.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list