[PATCH] drm/xe: Move PTE/PDE bit definitions to proper header

Matthew Brost matthew.brost at intel.com
Fri Apr 5 16:52:21 UTC 2024


On Fri, Apr 05, 2024 at 02:35:20PM +0200, Michal Wajdeczko wrote:
> We already have dedicated header for GGTT/PPGTT definitions.
> It's also cleaner to separate them from implementation macros.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> Cc: Matt Roper <matthew.d.roper at intel.com>

Been meaning to do this for a while. Good clean up.

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/display/xe_plane_initial.c |  1 +
>  drivers/gpu/drm/xe/regs/xe_gtt_defs.h         | 21 +++++++++++++++++++
>  drivers/gpu/drm/xe/xe_bo.h                    | 21 -------------------
>  drivers/gpu/drm/xe/xe_migrate.c               |  1 +
>  drivers/gpu/drm/xe/xe_pt.c                    |  1 +
>  drivers/gpu/drm/xe/xe_vm.c                    |  1 +
>  6 files changed, 25 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/display/xe_plane_initial.c b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> index 7132cd5d9545..9693c56d386b 100644
> --- a/drivers/gpu/drm/xe/display/xe_plane_initial.c
> +++ b/drivers/gpu/drm/xe/display/xe_plane_initial.c
> @@ -6,6 +6,7 @@
>  /* for ioread64 */
>  #include <linux/io-64-nonatomic-lo-hi.h>
>  
> +#include "regs/xe_gtt_defs.h"
>  #include "xe_ggtt.h"
>  
>  #include "i915_drv.h"
> diff --git a/drivers/gpu/drm/xe/regs/xe_gtt_defs.h b/drivers/gpu/drm/xe/regs/xe_gtt_defs.h
> index 9196d71bad37..558519ce48c7 100644
> --- a/drivers/gpu/drm/xe/regs/xe_gtt_defs.h
> +++ b/drivers/gpu/drm/xe/regs/xe_gtt_defs.h
> @@ -11,4 +11,25 @@
>  
>  #define GUC_GGTT_TOP		0xFEE00000
>  
> +#define XELPG_PPGTT_PTE_PAT3		BIT_ULL(62)
> +#define XE2_PPGTT_PTE_PAT4		BIT_ULL(61)
> +#define XE_PPGTT_PDE_PDPE_PAT2		BIT_ULL(12)
> +#define XE_PPGTT_PTE_PAT2		BIT_ULL(7)
> +#define XE_PPGTT_PTE_PAT1		BIT_ULL(4)
> +#define XE_PPGTT_PTE_PAT0		BIT_ULL(3)
> +
> +#define XE_PDE_PS_2M			BIT_ULL(7)
> +#define XE_PDPE_PS_1G			BIT_ULL(7)
> +#define XE_PDE_IPS_64K			BIT_ULL(11)
> +
> +#define XE_GGTT_PTE_DM			BIT_ULL(1)
> +#define XE_USM_PPGTT_PTE_AE		BIT_ULL(10)
> +#define XE_PPGTT_PTE_DM			BIT_ULL(11)
> +#define XE_PDE_64K			BIT_ULL(6)
> +#define XE_PTE_PS64			BIT_ULL(8)
> +#define XE_PTE_NULL			BIT_ULL(9)
> +
> +#define XE_PAGE_PRESENT			BIT_ULL(0)
> +#define XE_PAGE_RW			BIT_ULL(1)
> +
>  #endif
> diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
> index bae042b35fa8..4824ab145bc4 100644
> --- a/drivers/gpu/drm/xe/xe_bo.h
> +++ b/drivers/gpu/drm/xe/xe_bo.h
> @@ -50,13 +50,6 @@
>  #define XE_BO_FLAG_INTERNAL_TEST	BIT(30)
>  #define XE_BO_FLAG_INTERNAL_64K		BIT(31)
>  
> -#define XELPG_PPGTT_PTE_PAT3		BIT_ULL(62)
> -#define XE2_PPGTT_PTE_PAT4		BIT_ULL(61)
> -#define XE_PPGTT_PDE_PDPE_PAT2		BIT_ULL(12)
> -#define XE_PPGTT_PTE_PAT2		BIT_ULL(7)
> -#define XE_PPGTT_PTE_PAT1		BIT_ULL(4)
> -#define XE_PPGTT_PTE_PAT0		BIT_ULL(3)
> -
>  #define XE_PTE_SHIFT			12
>  #define XE_PAGE_SIZE			(1 << XE_PTE_SHIFT)
>  #define XE_PTE_MASK			(XE_PAGE_SIZE - 1)
> @@ -69,20 +62,6 @@
>  #define XE_64K_PTE_MASK			(XE_64K_PAGE_SIZE - 1)
>  #define XE_64K_PDE_MASK			(XE_PDE_MASK >> 4)
>  
> -#define XE_PDE_PS_2M			BIT_ULL(7)
> -#define XE_PDPE_PS_1G			BIT_ULL(7)
> -#define XE_PDE_IPS_64K			BIT_ULL(11)
> -
> -#define XE_GGTT_PTE_DM			BIT_ULL(1)
> -#define XE_USM_PPGTT_PTE_AE		BIT_ULL(10)
> -#define XE_PPGTT_PTE_DM			BIT_ULL(11)
> -#define XE_PDE_64K			BIT_ULL(6)
> -#define XE_PTE_PS64			BIT_ULL(8)
> -#define XE_PTE_NULL			BIT_ULL(9)
> -
> -#define XE_PAGE_PRESENT			BIT_ULL(0)
> -#define XE_PAGE_RW			BIT_ULL(1)
> -
>  #define XE_PL_SYSTEM		TTM_PL_SYSTEM
>  #define XE_PL_TT		TTM_PL_TT
>  #define XE_PL_VRAM0		TTM_PL_VRAM
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index 524b0198fcae..fe713d57cbf6 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -16,6 +16,7 @@
>  
>  #include "instructions/xe_mi_commands.h"
>  #include "regs/xe_gpu_commands.h"
> +#include "regs/xe_gtt_defs.h"
>  #include "tests/xe_test.h"
>  #include "xe_assert.h"
>  #include "xe_bb.h"
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index 271f13eeb852..5b7930f46cf3 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -5,6 +5,7 @@
>  
>  #include "xe_pt.h"
>  
> +#include "regs/xe_gtt_defs.h"
>  #include "xe_bo.h"
>  #include "xe_device.h"
>  #include "xe_drm_client.h"
> diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
> index 2a431690d245..fff10e1717ff 100644
> --- a/drivers/gpu/drm/xe/xe_vm.c
> +++ b/drivers/gpu/drm/xe/xe_vm.c
> @@ -21,6 +21,7 @@
>  
>  #include <generated/xe_wa_oob.h>
>  
> +#include "regs/xe_gtt_defs.h"
>  #include "xe_assert.h"
>  #include "xe_bo.h"
>  #include "xe_device.h"
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list