Skip to contentSkip to conversation

Start register cleanup

PATCH In review Lucas De Marchi 2 participants 21 messages Feb 25, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover Start register cleanup

Start cleaning up the register definitions used in xe. This removes dependency on the following registers:

- intel_engine_regs.h
- intel_gt_regs.h
- intel_lrc_reg.h
- intel_gpu_commands.h
- i915_reg.h
- intel_mchbar_regs.h

The includes on the display/ part are left as is since there is still some more work to do to detangle dependencies. Other than from the display/ and xe_display.c files, xe still depends on:

- i915_reg_defs.h
- display/intel_display_core.h
- display/ext/intel_device_info.h
- display/ext/intel_pch.h

In v3 (this version) I create xe_reg_defs.h to encapsulate i915_reg_defs.h include that was spread everywhere. The other includes are very unfortunate:
they are included from xe_device_types.h which means they are are included everywhere. For testing of this series, I add a new commit on top (not to be merged), removing the display integration. This is only to make sure the i915 types and functions are needed by display only. We probably need a plan how this is going to be cleaned up and maybe a short term alternative so we don't create dependencies outside of display. Hack commit to test on top: [email protected]

This series started by doing it manually with a few greps, migrated in the middle to do by "remove the include, parse the warnings from the compile and use that to generate the header" and finished with a small python script with clang. For reference, the execute-once-and-throw-away script is in the previous version:
[email protected]

v4:
- Apply some patches from v3 that had been reviewed
- Collect r-b with minor tweaks to first patches
- Move change to i915 to a separate patch, that is also submitted to i915 mailing list.
- Add one patch to rename header guards

Lucas De Marchi (12):
drm/i915: Move MCR_REG define to i915_reg_defs.h drm/xe: Sort includes
drm/xe: Remove dependency on intel_engine_regs.h drm/xe: Remove dependency on intel_gt_regs.h drm/xe: Remove dependency on intel_lrc_reg.h drm/xe: Remove dependency on intel_gpu_commands.h drm/xe: Remove dependency on i915_reg.h drm/xe/guc_pc: Move gt register to the proper place drm/xe: Remove dependency on intel_mchbar_regs.h drm/xe: Add missing includes for i915_reg_defs.h and others drm/xe: Add xe_reg_defs.h
drm/xe: Prefer single underscore for header guards

 drivers/gpu/drm/i915/gt/intel_gt_regs.h       |   1 -
 drivers/gpu/drm/i915/i915_reg_defs.h          |   2 +
 .../drm/xe/display/ext/intel_device_info.h    |   2 +
 drivers/gpu/drm/xe/regs/xe_engine_regs.h      |  98 ++++++
 drivers/gpu/drm/xe/regs/xe_gpu_commands.h     |  79 +++++
 drivers/gpu/drm/xe/regs/xe_gt_regs.h          | 290 ++++++++++++++++++
 drivers/gpu/drm/xe/regs/xe_lrc_layout.h       |  17 +
 drivers/gpu/drm/xe/regs/xe_reg_defs.h         |  11 +
 drivers/gpu/drm/xe/regs/xe_regs.h             | 111 +++++++
 drivers/gpu/drm/xe/tests/xe_bo_test.h         |   4 +-
 drivers/gpu/drm/xe/tests/xe_dma_buf_test.h    |   4 +-
 drivers/gpu/drm/xe/tests/xe_migrate_test.h    |   4 +-
 drivers/gpu/drm/xe/tests/xe_test.h            |   4 +-
 drivers/gpu/drm/xe/xe_bb.c                    |   6 +-
 drivers/gpu/drm/xe/xe_bo.c                    |   1 -
 drivers/gpu/drm/xe/xe_bo_evict.c              |   3 +-
 drivers/gpu/drm/xe/xe_debugfs.c               |   3 +-
 drivers/gpu/drm/xe/xe_device.c                |  13 +-
 drivers/gpu/drm/xe/xe_device.h                |   5 +-
 drivers/gpu/drm/xe/xe_device_types.h          |   2 +-
 drivers/gpu/drm/xe/xe_display.c               |  12 +-
 drivers/gpu/drm/xe/xe_display.h               |   5 +-
 drivers/gpu/drm/xe/xe_dma_buf.c               |   9 +-
 drivers/gpu/drm/xe/xe_engine.c                |   3 +-
 drivers/gpu/drm/xe/xe_exec.c                  |   3 +-
 drivers/gpu/drm/xe/xe_execlist.c              |  17 +-
 drivers/gpu/drm/xe/xe_force_wake.c            |   8 +-
 drivers/gpu/drm/xe/xe_ggtt.c                  |   9 +-
 drivers/gpu/drm/xe/xe_gt.c                    |   6 +-
 drivers/gpu/drm/xe/xe_gt_clock.c              |   6 +-
 drivers/gpu/drm/xe/xe_gt_debugfs.c            |   3 +-
 drivers/gpu/drm/xe/xe_gt_mcr.c                |   6 +-
 drivers/gpu/drm/xe/xe_gt_mcr.h                |   2 +-
 drivers/gpu/drm/xe/xe_gt_pagefault.c          |   4 +-
 drivers/gpu/drm/xe/xe_gt_sysfs.c              |   5 +-
 drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c   |   3 +-
 drivers/gpu/drm/xe/xe_gt_topology.c           |   4 +-
 drivers/gpu/drm/xe/xe_gt_topology.h           |   4 +-
 drivers/gpu/drm/xe/xe_guc.c                   |  14 +-
 drivers/gpu/drm/xe/xe_guc.h                   |   2 +-
 drivers/gpu/drm/xe/xe_guc_ads.c               |   7 +-
 drivers/gpu/drm/xe/xe_guc_ct.c                |   5 +-
 drivers/gpu/drm/xe/xe_guc_ct_types.h          |   2 +-
 drivers/gpu/drm/xe/xe_guc_debugfs.c           |   3 +-
 drivers/gpu/drm/xe/xe_guc_fwif.h              |   4 +-
 drivers/gpu/drm/xe/xe_guc_hwconfig.c          |   3 +-
 drivers/gpu/drm/xe/xe_guc_log.c               |   3 +-
 drivers/gpu/drm/xe/xe_guc_pc.c                |  30 +-
 drivers/gpu/drm/xe/xe_guc_pc_types.h          |   2 +-
 drivers/gpu/drm/xe/xe_guc_reg.h               |   2 +-
 drivers/gpu/drm/xe/xe_guc_submit.c            |  10 +-
 drivers/gpu/drm/xe/xe_huc.c                   |   3 +-
 drivers/gpu/drm/xe/xe_huc_debugfs.c           |   3 +-
 drivers/gpu/drm/xe/xe_hw_engine.c             |   7 +-
 drivers/gpu/drm/xe/xe_hw_fence_types.h        |   2 +-
 drivers/gpu/drm/xe/xe_irq.c                   |   9 +-
 drivers/gpu/drm/xe/xe_lrc.c                   |  13 +-
 drivers/gpu/drm/xe/xe_map.h                   |   4 +-
 drivers/gpu/drm/xe/xe_migrate.c               |  16 +-
 drivers/gpu/drm/xe/xe_migrate.h               |   4 +-
 drivers/gpu/drm/xe/xe_mmio.c                  |   7 +-
 drivers/gpu/drm/xe/xe_mocs.c                  |   8 +-
 drivers/gpu/drm/xe/xe_module.c                |   2 +
 drivers/gpu/drm/xe/xe_pci.c                   |   7 +-
 drivers/gpu/drm/xe/xe_pcode.c                 |   9 +-
 drivers/gpu/drm/xe/xe_pcode_api.h             |   2 +
 drivers/gpu/drm/xe/xe_pm.c                    |   5 +-
 drivers/gpu/drm/xe/xe_preempt_fence.c         |   3 +-
 drivers/gpu/drm/xe/xe_pt.c                    |   5 +-
 drivers/gpu/drm/xe/xe_query.c                 |  12 +-
 drivers/gpu/drm/xe/xe_reg_sr.c                |   9 +-
 drivers/gpu/drm/xe/xe_reg_sr_types.h          |   4 +-
 drivers/gpu/drm/xe/xe_reg_whitelist.c         |   7 +-
 drivers/gpu/drm/xe/xe_res_cursor.h            |   4 +-
 drivers/gpu/drm/xe/xe_ring_ops.c              |  56 ++--
 drivers/gpu/drm/xe/xe_rtp.h                   |   4 +-
 drivers/gpu/drm/xe/xe_rtp_types.h             |   2 -
 drivers/gpu/drm/xe/xe_sa.c                    |   4 +-
 drivers/gpu/drm/xe/xe_step.c                  |   1 +
 drivers/gpu/drm/xe/xe_sync.c                  |   5 +-
 drivers/gpu/drm/xe/xe_trace.h                 |   4 +-
 drivers/gpu/drm/xe/xe_ttm_gtt_mgr.c           |   2 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c        |   5 +-
 drivers/gpu/drm/xe/xe_ttm_vram_mgr.c          |   2 +-
 drivers/gpu/drm/xe/xe_tuning.c                |   5 +-
 drivers/gpu/drm/xe/xe_uc.c                    |   5 +-
 drivers/gpu/drm/xe/xe_uc_fw.h                 |   4 +-
 drivers/gpu/drm/xe/xe_uc_fw_abi.h             |   2 +-
 drivers/gpu/drm/xe/xe_vm.c                    |   2 +-
 drivers/gpu/drm/xe/xe_vm_madvise.c            |   8 +-
 drivers/gpu/drm/xe/xe_wa.c                    |   7 +-
 drivers/gpu/drm/xe/xe_wopcm.c                 |   3 +-
 92 files changed, 872 insertions(+), 250 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_engine_regs.h
 create mode 100644 drivers/gpu/drm/xe/regs/xe_gpu_commands.h
 create mode 100644 drivers/gpu/drm/xe/regs/xe_gt_regs.h
 create mode 100644 drivers/gpu/drm/xe/regs/xe_lrc_layout.h
 create mode 100644 drivers/gpu/drm/xe/regs/xe_reg_defs.h
 create mode 100644 drivers/gpu/drm/xe/regs/xe_regs.h
Signature · 1 line
2.39.0
#1 lore raw

PATCH v4 1/12 drm/i915: Move MCR_REG define to i915_reg_defs.h

Define MCR_REG() in the same header where i915_mcr_reg_t is defined, like i915_reg_t and _MMIO(). It's a more natural place for such a definition so it's not mixed with the registers for the platforms.

---
 drivers/gpu/drm/i915/gt/intel_gt_regs.h | 1 -
 drivers/gpu/drm/i915/i915_reg_defs.h    | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt_regs.h +0 -1
index 3b9e20dd6039..12c5115f7b61 100644
@@ -10,7 +10,6 @@
 #ifdef I915
 #include "display/intel_display_reg_defs.h"	/* VLV_DISPLAY_BASE */
 #endif
-#define MCR_REG(offset)	((const i915_mcr_reg_t){ .reg = (offset) })
 
 /*
  * The perf control registers are technically multicast registers, but the
drivers/gpu/drm/i915/i915_reg_defs.h +2 -0
index b5e06b6a9478..a6080c983a77 100644
@@ -136,6 +136,8 @@ typedef struct {
 	u32 reg;
 } i915_mcr_reg_t;
 
+#define MCR_REG(offset)	((const i915_mcr_reg_t){ .reg = (offset) })
+
 #define INVALID_MMIO_REG _MMIO(0)
 
 /*
Signature · 1 line
2.39.0
#2 lore raw

PATCH v4 2/12 drm/xe: Sort includes

In reply to Lucas De Marchi

Sort includes and split them in blocks:

1) .h corresponding to the .c. Example: xe_bb.c should have a "#include "xe_bb.h" first.
2) #include <linux/...>
3) #include <drm/...>
4) local includes
5) i915 includes

This is accomplished by running
clang-format --style=file -i --sort-includes drivers/gpu/drm/xe/*.[ch] and ignoring all the changes after the includes. There are also some manual tweaks to split the blocks.

v2: Also sort includes in headers

---
 drivers/gpu/drm/xe/xe_bb.c                  |  3 ++-
 drivers/gpu/drm/xe/xe_bo.c                  |  1 -
 drivers/gpu/drm/xe/xe_bo_evict.c            |  3 ++-
 drivers/gpu/drm/xe/xe_debugfs.c             |  3 ++-
 drivers/gpu/drm/xe/xe_device.c              |  8 ++++----
 drivers/gpu/drm/xe/xe_device.h              |  2 +-
 drivers/gpu/drm/xe/xe_device_types.h        |  2 +-
 drivers/gpu/drm/xe/xe_display.c             | 12 ++++++------
 drivers/gpu/drm/xe/xe_display.h             |  2 +-
 drivers/gpu/drm/xe/xe_dma_buf.c             |  9 ++++-----
 drivers/gpu/drm/xe/xe_engine.c              |  3 ++-
 drivers/gpu/drm/xe/xe_exec.c                |  3 ++-
 drivers/gpu/drm/xe/xe_execlist.c            | 10 +++++-----
 drivers/gpu/drm/xe/xe_force_wake.c          |  5 +++--
 drivers/gpu/drm/xe/xe_ggtt.c                |  6 +++---
 drivers/gpu/drm/xe/xe_gt.c                  |  3 ++-
 drivers/gpu/drm/xe/xe_gt_clock.c            |  7 ++++---
 drivers/gpu/drm/xe/xe_gt_debugfs.c          |  3 ++-
 drivers/gpu/drm/xe/xe_gt_mcr.c              |  3 ++-
 drivers/gpu/drm/xe/xe_gt_pagefault.c        |  3 ++-
 drivers/gpu/drm/xe/xe_gt_sysfs.c            |  5 ++++-
 drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c |  3 ++-
 drivers/gpu/drm/xe/xe_gt_topology.c         |  3 ++-
 drivers/gpu/drm/xe/xe_guc.c                 | 14 ++++++++------
 drivers/gpu/drm/xe/xe_guc.h                 |  2 +-
 drivers/gpu/drm/xe/xe_guc_ads.c             |  6 ++++--
 drivers/gpu/drm/xe/xe_guc_ct.c              |  5 +++--
 drivers/gpu/drm/xe/xe_guc_ct_types.h        |  2 +-
 drivers/gpu/drm/xe/xe_guc_debugfs.c         |  3 ++-
 drivers/gpu/drm/xe/xe_guc_fwif.h            |  4 ++--
 drivers/gpu/drm/xe/xe_guc_hwconfig.c        |  3 ++-
 drivers/gpu/drm/xe/xe_guc_log.c             |  3 ++-
 drivers/gpu/drm/xe/xe_guc_pc.c              | 13 ++++++++-----
 drivers/gpu/drm/xe/xe_guc_pc_types.h        |  2 +-
 drivers/gpu/drm/xe/xe_guc_submit.c          |  7 ++++---
 drivers/gpu/drm/xe/xe_huc.c                 |  3 ++-
 drivers/gpu/drm/xe/xe_huc_debugfs.c         |  3 ++-
 drivers/gpu/drm/xe/xe_hw_engine.c           |  2 +-
 drivers/gpu/drm/xe/xe_hw_fence_types.h      |  2 +-
 drivers/gpu/drm/xe/xe_irq.c                 |  6 ++++--
 drivers/gpu/drm/xe/xe_lrc.c                 |  6 +++---
 drivers/gpu/drm/xe/xe_migrate.c             | 12 +++++++-----
 drivers/gpu/drm/xe/xe_mmio.c                |  2 +-
 drivers/gpu/drm/xe/xe_mocs.c                |  5 +++--
 drivers/gpu/drm/xe/xe_module.c              |  2 ++
 drivers/gpu/drm/xe/xe_pci.c                 |  4 ++--
 drivers/gpu/drm/xe/xe_pcode.c               |  9 ++++-----
 drivers/gpu/drm/xe/xe_pm.c                  |  5 +++--
 drivers/gpu/drm/xe/xe_preempt_fence.c       |  3 ++-
 drivers/gpu/drm/xe/xe_pt.c                  |  5 +++--
 drivers/gpu/drm/xe/xe_query.c               | 12 +++++++-----
 drivers/gpu/drm/xe/xe_reg_sr.c              |  4 ++--
 drivers/gpu/drm/xe/xe_reg_sr_types.h        |  2 +-
 drivers/gpu/drm/xe/xe_reg_whitelist.c       |  6 +++---
 drivers/gpu/drm/xe/xe_ring_ops.c            |  5 +++--
 drivers/gpu/drm/xe/xe_rtp.h                 |  2 +-
 drivers/gpu/drm/xe/xe_sa.c                  |  4 +++-
 drivers/gpu/drm/xe/xe_sync.c                |  5 +++--
 drivers/gpu/drm/xe/xe_trace.h               |  4 ++--
 drivers/gpu/drm/xe/xe_ttm_gtt_mgr.c         |  2 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c      |  2 +-
 drivers/gpu/drm/xe/xe_ttm_vram_mgr.c        |  2 +-
 drivers/gpu/drm/xe/xe_tuning.c              |  2 +-
 drivers/gpu/drm/xe/xe_uc.c                  |  5 +++--
 drivers/gpu/drm/xe/xe_uc_fw.h               |  4 ++--
 drivers/gpu/drm/xe/xe_uc_fw_abi.h           |  2 +-
 drivers/gpu/drm/xe/xe_vm.c                  |  2 +-
 drivers/gpu/drm/xe/xe_vm_madvise.c          |  8 +++++---
 drivers/gpu/drm/xe/xe_wopcm.c               |  3 ++-
 69 files changed, 179 insertions(+), 132 deletions(-)
drivers/gpu/drm/xe/xe_bb.c +2 -1
index 8b9209571fd0..d10448d1b4d7 100644
@@ -4,10 +4,11 @@
  */
 
 #include "xe_bb.h"
-#include "xe_sa.h"
+
 #include "xe_device.h"
 #include "xe_engine_types.h"
 #include "xe_hw_fence.h"
+#include "xe_sa.h"
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
drivers/gpu/drm/xe/xe_bo.c +0 -1
index 4173c1418b63..da6df74e71b9 100644
@@ -3,7 +3,6 @@
  * Copyright © 2021 Intel Corporation
  */
 
-
 #include "xe_bo.h"
 
 #include <linux/dma-buf.h>
drivers/gpu/drm/xe/xe_bo_evict.c +2 -1
index 3fb3c8c77efa..bbf89a58cdf5 100644
@@ -3,8 +3,9 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include "xe_bo.h"
 #include "xe_bo_evict.h"
+
+#include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_ggtt.h"
 #include "xe_gt.h"
drivers/gpu/drm/xe/xe_debugfs.c +2 -1
index b0f8b157ffa3..7827a785b020 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_debugfs.h"
+
 #include <linux/string_helpers.h>
 
 #include <drm/drm_debugfs.h>
 
 #include "xe_bo.h"
 #include "xe_device.h"
-#include "xe_debugfs.h"
 #include "xe_gt_debugfs.h"
 #include "xe_step.h"
 
drivers/gpu/drm/xe/xe_device.c +4 -4
index a028efa8eebe..45e3c740fda2 100644
@@ -5,12 +5,12 @@
 
 #include "xe_device.h"
 
-#include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_aperture.h>
+#include <drm/drm_atomic_helper.h>
+#include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_ioctl.h>
-#include <drm/xe_drm.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_atomic_helper.h>
+#include <drm/xe_drm.h>
 
 #include "xe_bo.h"
 #include "xe_debugfs.h"
@@ -21,8 +21,8 @@
 #include "xe_exec.h"
 #include "xe_gt.h"
 #include "xe_irq.h"
-#include "xe_module.h"
 #include "xe_mmio.h"
+#include "xe_module.h"
 #include "xe_pcode.h"
 #include "xe_pm.h"
 #include "xe_query.h"
drivers/gpu/drm/xe/xe_device.h +1 -1
index 88d55671b068..ed55ef567d18 100644
@@ -12,8 +12,8 @@ struct xe_file;
 #include <drm/drm_util.h>
 
 #include "xe_device_types.h"
-#include "xe_macros.h"
 #include "xe_force_wake.h"
+#include "xe_macros.h"
 
 #include "gt/intel_gpu_commands.h"
 
drivers/gpu/drm/xe/xe_device_types.h +1 -1
index d3bfe5ed4dd9..9743987fc883 100644
@@ -17,9 +17,9 @@
 #include "xe_step_types.h"
 
 /* For display substruct */
-#include "display/intel_display_core.h"
 #include "display/ext/intel_device_info.h"
 #include "display/ext/intel_pch.h"
+#include "display/intel_display_core.h"
 
 #define XE_BO_INVALID_OFFSET	LONG_MAX
 
drivers/gpu/drm/xe/xe_display.c +6 -6
index 47a16a3f85fa..6e7b6cfce4d9 100644
@@ -6,12 +6,16 @@
 #if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 
 #include "xe_display.h"
-#include "xe_module.h"
+
+#include <linux/fb.h>
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_managed.h>
 #include <drm/xe_drm.h>
 
+#include "display/ext/i915_irq.h"
+#include "display/ext/intel_dram.h"
+#include "display/ext/intel_pm.h"
 #include "display/intel_acpi.h"
 #include "display/intel_audio.h"
 #include "display/intel_bw.h"
@@ -22,11 +26,7 @@
 #include "display/intel_hdcp.h"
 #include "display/intel_hotplug.h"
 #include "display/intel_opregion.h"
-#include "display/ext/i915_irq.h"
-#include "display/ext/intel_dram.h"
-#include "display/ext/intel_pm.h"
-
-#include <linux/fb.h>
+#include "xe_module.h"
 
 /* Xe device functions */
 
drivers/gpu/drm/xe/xe_display.h +1 -1
index 03117a7067dc..262cd5442489 100644
@@ -11,8 +11,8 @@
 
 #include "xe_device.h"
 
-#include "display/intel_opregion.h"
 #include "display/ext/i915_irq.h"
+#include "display/intel_opregion.h"
 
 int xe_display_enable(struct pci_dev *pdev, struct drm_driver *driver);
 
drivers/gpu/drm/xe/xe_dma_buf.c +4 -5
index d09ff25bd940..9b252cc782b7 100644
@@ -3,20 +3,19 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_dma_buf.h"
+
+#include <kunit/test.h>
 #include <linux/dma-buf.h>
+#include <linux/pci-p2pdma.h>
 
 #include <drm/drm_device.h>
 #include <drm/drm_prime.h>
-
 #include <drm/ttm/ttm_tt.h>
 
-#include <kunit/test.h>
-#include <linux/pci-p2pdma.h>
-
 #include "tests/xe_test.h"
 #include "xe_bo.h"
 #include "xe_device.h"
-#include "xe_dma_buf.h"
 #include "xe_ttm_vram_mgr.h"
 #include "xe_vm.h"
 
drivers/gpu/drm/xe/xe_engine.c +2 -1
index e478d0417e49..f1e0f700d96c 100644
@@ -5,10 +5,11 @@
 
 #include "xe_engine.h"
 
+#include <linux/nospec.h>
+
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
 #include <drm/xe_drm.h>
-#include <linux/nospec.h>
 
 #include "xe_device.h"
 #include "xe_gt.h"
drivers/gpu/drm/xe/xe_exec.c +2 -1
index 00f298acc436..97fd1a311f2d 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_exec.h"
+
 #include <drm/drm_device.h>
 #include <drm/drm_file.h>
 #include <drm/xe_drm.h>
@@ -10,7 +12,6 @@
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
-#include "xe_exec.h"
 #include "xe_macros.h"
 #include "xe_sched_job.h"
 #include "xe_sync.h"
drivers/gpu/drm/xe/xe_execlist.c +5 -5
index d555d77cbf49..366379d3dfa8 100644
@@ -3,15 +3,15 @@
  * Copyright © 2021 Intel Corporation
  */
 
-#include <drm/drm_managed.h>
-
 #include "xe_execlist.h"
 
+#include <drm/drm_managed.h>
+
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
-#include "xe_hw_fence.h"
 #include "xe_gt.h"
+#include "xe_hw_fence.h"
 #include "xe_lrc.h"
 #include "xe_macros.h"
 #include "xe_mmio.h"
@@ -19,11 +19,11 @@
 #include "xe_ring_ops_types.h"
 #include "xe_sched_job.h"
 
-#include "i915_reg.h"
+#include "gt/intel_engine_regs.h"
 #include "gt/intel_gpu_commands.h"
 #include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
-#include "gt/intel_engine_regs.h"
+#include "i915_reg.h"
 
 #define XE_EXECLIST_HANG_LIMIT 1
 
drivers/gpu/drm/xe/xe_force_wake.c +3 -2
index 5bd87118ac73..60b7e4a3e9fe 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_force_wake.h"
+
 #include <drm/drm_util.h>
 
-#include "xe_force_wake.h"
 #include "xe_gt.h"
 #include "xe_mmio.h"
-#include "gt/intel_gt_regs.h"
 
+#include "gt/intel_gt_regs.h"
 
 #define XE_FORCE_WAKE_ACK_TIMEOUT_MS	50
 
drivers/gpu/drm/xe/xe_ggtt.c +3 -3
index d5bd9bc18c57..03880f2c9692 100644
@@ -6,20 +6,20 @@
 #include "xe_ggtt.h"
 
 #include <linux/sizes.h>
-#include <drm/i915_drm.h>
 
 #include <drm/drm_managed.h>
+#include <drm/i915_drm.h>
 
-#include "xe_device.h"
 #include "xe_bo.h"
+#include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_gt_tlb_invalidation.h"
 #include "xe_map.h"
 #include "xe_mmio.h"
 #include "xe_wopcm.h"
 
-#include "i915_reg.h"
 #include "gt/intel_gt_regs.h"
+#include "i915_reg.h"
 
 /* FIXME: Common file, preferably auto-gen */
 #define MTL_GGTT_PTE_PAT0	BIT_ULL(52)
drivers/gpu/drm/xe/xe_gt.c +2 -1
index 5a3c8fd5936a..74e9445befe4 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_gt.h"
+
 #include <linux/minmax.h>
 
 #include <drm/drm_managed.h>
@@ -14,7 +16,6 @@
 #include "xe_execlist.h"
 #include "xe_force_wake.h"
 #include "xe_ggtt.h"
-#include "xe_gt.h"
 #include "xe_gt_clock.h"
 #include "xe_gt_mcr.h"
 #include "xe_gt_pagefault.h"
drivers/gpu/drm/xe/xe_gt_clock.c +4 -3
index 575433e9718a..2d9f2aa42bad 100644
@@ -3,15 +3,16 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include "i915_reg.h"
-#include "gt/intel_gt_regs.h"
+#include "xe_gt_clock.h"
 
 #include "xe_device.h"
 #include "xe_gt.h"
-#include "xe_gt_clock.h"
 #include "xe_macros.h"
 #include "xe_mmio.h"
 
+#include "gt/intel_gt_regs.h"
+#include "i915_reg.h"
+
 static u32 read_reference_ts_freq(struct xe_gt *gt)
 {
 	u32 ts_override = xe_mmio_read32(gt, GEN9_TIMESTAMP_OVERRIDE.reg);
drivers/gpu/drm/xe/xe_gt_debugfs.c +2 -1
index c320e58810ce..78942e12e76c 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_gt_debugfs.h"
+
 #include <drm/drm_debugfs.h>
 #include <drm/drm_managed.h>
 
@@ -10,7 +12,6 @@
 #include "xe_force_wake.h"
 #include "xe_ggtt.h"
 #include "xe_gt.h"
-#include "xe_gt_debugfs.h"
 #include "xe_gt_mcr.h"
 #include "xe_gt_topology.h"
 #include "xe_hw_engine.h"
drivers/gpu/drm/xe/xe_gt_mcr.c +2 -1
index 7617f0340879..8fa59988d08e 100644
@@ -3,8 +3,9 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include "xe_gt.h"
 #include "xe_gt_mcr.h"
+
+#include "xe_gt.h"
 #include "xe_gt_topology.h"
 #include "xe_gt_types.h"
 #include "xe_mmio.h"
drivers/gpu/drm/xe/xe_gt_pagefault.c +2 -1
index ce79eb48feb8..0e7047b89a83 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_gt_pagefault.h"
+
 #include <linux/circ_buf.h>
 
 #include <drm/drm_managed.h>
@@ -10,7 +12,6 @@
 
 #include "xe_bo.h"
 #include "xe_gt.h"
-#include "xe_gt_pagefault.h"
 #include "xe_gt_tlb_invalidation.h"
 #include "xe_guc.h"
 #include "xe_guc_ct.h"
drivers/gpu/drm/xe/xe_gt_sysfs.c +4 -1
index 2d966d935b8e..c01cc689058c 100644
@@ -3,11 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_gt_sysfs.h"
+
 #include <linux/kobject.h>
 #include <linux/sysfs.h>
+
 #include <drm/drm_managed.h>
+
 #include "xe_gt.h"
-#include "xe_gt_sysfs.h"
 
 static void xe_gt_sysfs_kobj_release(struct kobject *kobj)
 {
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c +2 -1
index 2521c8a65690..f279e21300aa 100644
@@ -3,8 +3,9 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#include "xe_gt.h"
 #include "xe_gt_tlb_invalidation.h"
+
+#include "xe_gt.h"
 #include "xe_guc.h"
 #include "xe_guc_ct.h"
 #include "xe_trace.h"
drivers/gpu/drm/xe/xe_gt_topology.c +2 -1
index 3dd7cbbff071..c76aaea1887c 100644
@@ -3,10 +3,11 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_gt_topology.h"
+
 #include <linux/bitmap.h>
 
 #include "xe_gt.h"
-#include "xe_gt_topology.h"
 #include "xe_mmio.h"
 
 #define XE_MAX_DSS_FUSE_BITS (32 * XE_MAX_DSS_FUSE_REGS)
drivers/gpu/drm/xe/xe_guc.c +8 -6
index 32bcc40463e1..db3d8c947603 100644
@@ -3,24 +3,26 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc.h"
+
 #include "xe_bo.h"
 #include "xe_device.h"
-#include "xe_guc.h"
+#include "xe_force_wake.h"
+#include "xe_gt.h"
 #include "xe_guc_ads.h"
 #include "xe_guc_ct.h"
 #include "xe_guc_hwconfig.h"
 #include "xe_guc_log.h"
-#include "xe_guc_reg.h"
 #include "xe_guc_pc.h"
+#include "xe_guc_reg.h"
 #include "xe_guc_submit.h"
-#include "xe_gt.h"
+#include "xe_mmio.h"
 #include "xe_platform_types.h"
 #include "xe_uc_fw.h"
 #include "xe_wopcm.h"
-#include "xe_mmio.h"
-#include "xe_force_wake.h"
-#include "i915_reg_defs.h"
+
 #include "gt/intel_gt_regs.h"
+#include "i915_reg_defs.h"
 
 /* TODO: move to common file */
 #define GUC_PVC_MOCS_INDEX_MASK		REG_GENMASK(25, 24)
drivers/gpu/drm/xe/xe_guc.h +1 -1
index 7be33458eef6..74a74051f354 100644
@@ -6,8 +6,8 @@
 #ifndef _XE_GUC_H_
 #define _XE_GUC_H_
 
-#include "xe_hw_engine_types.h"
 #include "xe_guc_types.h"
+#include "xe_hw_engine_types.h"
 #include "xe_macros.h"
 
 struct drm_printer;
drivers/gpu/drm/xe/xe_guc_ads.c +4 -2
index 0c08cecaca40..a4e947f0c557 100644
@@ -3,20 +3,22 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc_ads.h"
+
 #include <drm/drm_managed.h>
 
 #include "xe_bo.h"
 #include "xe_gt.h"
 #include "xe_guc.h"
-#include "xe_guc_ads.h"
 #include "xe_guc_reg.h"
 #include "xe_hw_engine.h"
 #include "xe_lrc.h"
 #include "xe_map.h"
 #include "xe_mmio.h"
 #include "xe_platform_types.h"
-#include "gt/intel_gt_regs.h"
+
 #include "gt/intel_engine_regs.h"
+#include "gt/intel_gt_regs.h"
 
 /* Slack of a few additional entries per engine */
 #define ADS_REGSET_EXTRA_MAX	8
drivers/gpu/drm/xe/xe_guc_ct.c +3 -2
index 84d4302d4e72..5e00b75d3ca2 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc_ct.h"
+
 #include <linux/bitfield.h>
 #include <linux/circ_buf.h>
 #include <linux/delay.h>
@@ -12,10 +14,9 @@
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
-#include "xe_guc.h"
-#include "xe_guc_ct.h"
 #include "xe_gt_pagefault.h"
 #include "xe_gt_tlb_invalidation.h"
+#include "xe_guc.h"
 #include "xe_guc_submit.h"
 #include "xe_map.h"
 #include "xe_trace.h"
drivers/gpu/drm/xe/xe_guc_ct_types.h +1 -1
index 17b148bf3735..e0f9063e9b65 100644
@@ -6,8 +6,8 @@
 #ifndef _XE_GUC_CT_TYPES_H_
 #define _XE_GUC_CT_TYPES_H_
 
-#include <linux/iosys-map.h>
 #include <linux/interrupt.h>
+#include <linux/iosys-map.h>
 #include <linux/spinlock_types.h>
 #include <linux/wait.h>
 #include <linux/xarray.h>
drivers/gpu/drm/xe/xe_guc_debugfs.c +2 -1
index 916e9633b322..6b72db4d5bb2 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc_debugfs.h"
+
 #include <drm/drm_debugfs.h>
 #include <drm/drm_managed.h>
 
@@ -10,7 +12,6 @@
 #include "xe_gt.h"
 #include "xe_guc.h"
 #include "xe_guc_ct.h"
-#include "xe_guc_debugfs.h"
 #include "xe_guc_log.h"
 #include "xe_macros.h"
 
drivers/gpu/drm/xe/xe_guc_fwif.h +2 -2
index f562404a6cf7..20155ba4ef07 100644
@@ -10,9 +10,9 @@
 
 #include "abi/guc_actions_abi.h"
 #include "abi/guc_actions_slpc_abi.h"
-#include "abi/guc_errors_abi.h"
-#include "abi/guc_communication_mmio_abi.h"
 #include "abi/guc_communication_ctb_abi.h"
+#include "abi/guc_communication_mmio_abi.h"
+#include "abi/guc_errors_abi.h"
 #include "abi/guc_klvs_abi.h"
 #include "abi/guc_messages_abi.h"
 
drivers/gpu/drm/xe/xe_guc_hwconfig.c +2 -1
index 57640d608787..a6982f323ed1 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc_hwconfig.h"
+
 #include <drm/drm_managed.h>
 
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_guc.h"
-#include "xe_guc_hwconfig.h"
 #include "xe_map.h"
 
 static struct xe_gt *
drivers/gpu/drm/xe/xe_guc_log.c +2 -1
index 7ec1b2bb1f8e..9a7b5d5906c1 100644
@@ -3,11 +3,12 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc_log.h"
+
 #include <drm/drm_managed.h>
 
 #include "xe_bo.h"
 #include "xe_gt.h"
-#include "xe_guc_log.h"
 #include "xe_map.h"
 #include "xe_module.h"
 
drivers/gpu/drm/xe/xe_guc_pc.c +8 -5
index 3ba0c8a35109..28b86e8f3f6e 100644
@@ -3,21 +3,24 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc_pc.h"
+
+#include <linux/delay.h>
+
 #include <drm/drm_managed.h>
+
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
-#include "xe_gt_types.h"
 #include "xe_gt_sysfs.h"
+#include "xe_gt_types.h"
 #include "xe_guc_ct.h"
 #include "xe_map.h"
 #include "xe_mmio.h"
 #include "xe_pcode.h"
-#include "i915_reg_defs.h"
-#include "i915_reg.h"
-
-#include <linux/delay.h>
 
+#include "i915_reg.h"
+#include "i915_reg_defs.h"
 #include "intel_mchbar_regs.h"
 
 /* For GEN6_RP_STATE_CAP.reg to be merged when the definition moves to Xe */
drivers/gpu/drm/xe/xe_guc_pc_types.h +1 -1
index 39548e03acf4..2afd0dbc3542 100644
@@ -6,8 +6,8 @@
 #ifndef _XE_GUC_PC_TYPES_H_
 #define _XE_GUC_PC_TYPES_H_
 
-#include <linux/types.h>
 #include <linux/mutex.h>
+#include <linux/types.h>
 
 /**
  * struct xe_guc_pc - GuC Power Conservation (PC)
drivers/gpu/drm/xe/xe_guc_submit.c +4 -3
index a54f7f82d04d..aca41ecedf7d 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_guc_submit.h"
+
 #include <linux/bitfield.h>
 #include <linux/bitmap.h>
 #include <linux/circ_buf.h>
@@ -13,12 +15,11 @@
 
 #include "xe_device.h"
 #include "xe_engine.h"
+#include "xe_force_wake.h"
+#include "xe_gt.h"
 #include "xe_guc.h"
 #include "xe_guc_ct.h"
 #include "xe_guc_engine_types.h"
-#include "xe_guc_submit.h"
-#include "xe_gt.h"
-#include "xe_force_wake.h"
 #include "xe_hw_engine.h"
 #include "xe_hw_fence.h"
 #include "xe_lrc.h"
drivers/gpu/drm/xe/xe_huc.c +2 -1
index 82e7fb3a6292..a9448c6f6418 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_huc.h"
+
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
 #include "xe_guc.h"
 #include "xe_guc_reg.h"
-#include "xe_huc.h"
 #include "xe_mmio.h"
 #include "xe_uc_fw.h"
 
drivers/gpu/drm/xe/xe_huc_debugfs.c +2 -1
index 268bac36336a..ee3d8315036a 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_huc_debugfs.h"
+
 #include <drm/drm_debugfs.h>
 #include <drm/drm_managed.h>
 
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_huc.h"
-#include "xe_huc_debugfs.h"
 #include "xe_macros.h"
 
 static struct xe_gt *
drivers/gpu/drm/xe/xe_hw_engine.c +1 -1
index fd89dd90131c..1ca7a89b4fbd 100644
@@ -22,8 +22,8 @@
 #include "xe_wa.h"
 
 #include "gt/intel_engine_regs.h"
-#include "i915_reg.h"
 #include "gt/intel_gt_regs.h"
+#include "i915_reg.h"
 
 #define MAX_MMIO_BASES 3
 struct engine_info {
drivers/gpu/drm/xe/xe_hw_fence_types.h +1 -1
index a78e50eb3cb8..b33c4956e8ea 100644
@@ -6,8 +6,8 @@
 #ifndef _XE_HW_FENCE_TYPES_H_
 #define _XE_HW_FENCE_TYPES_H_
 
-#include <linux/iosys-map.h>
 #include <linux/dma-fence.h>
+#include <linux/iosys-map.h>
 #include <linux/irq_work.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
drivers/gpu/drm/xe/xe_irq.c +4 -2
index 89401c663274..1428796d87d8 100644
@@ -3,6 +3,8 @@
  * Copyright © 2021 Intel Corporation
  */
 
+#include "xe_irq.h"
+
 #include <linux/sched/clock.h>
 
 #include <drm/drm_managed.h>
@@ -10,13 +12,13 @@
 #include "xe_device.h"
 #include "xe_display.h"
 #include "xe_drv.h"
-#include "xe_guc.h"
 #include "xe_gt.h"
+#include "xe_guc.h"
 #include "xe_hw_engine.h"
 #include "xe_mmio.h"
 
-#include "i915_reg.h"
 #include "gt/intel_gt_regs.h"
+#include "i915_reg.h"
 
 static void gen3_assert_iir_is_zero(struct xe_gt *gt, i915_reg_t reg)
 {
drivers/gpu/drm/xe/xe_lrc.c +3 -3
index 347ff9b34494..ed6fcf7620e1 100644
@@ -9,15 +9,15 @@
 #include "xe_device.h"
 #include "xe_engine_types.h"
 #include "xe_gt.h"
-#include "xe_map.h"
 #include "xe_hw_fence.h"
+#include "xe_map.h"
 #include "xe_vm.h"
 
-#include "i915_reg.h"
+#include "gt/intel_engine_regs.h"
 #include "gt/intel_gpu_commands.h"
 #include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
-#include "gt/intel_engine_regs.h"
+#include "i915_reg.h"
 
 #define GEN8_CTX_VALID				(1 << 0)
 #define GEN8_CTX_L3LLC_COHERENT			(1 << 5)
drivers/gpu/drm/xe/xe_migrate.c +7 -5
index cbcc355cd391..a3f35fec1b67 100644
@@ -2,8 +2,15 @@
 /*
  * Copyright © 2020 Intel Corporation
  */
+
 #include "xe_migrate.h"
 
+#include <linux/sizes.h>
+
+#include <drm/drm_managed.h>
+#include <drm/ttm/ttm_tt.h>
+#include <drm/xe_drm.h>
+
 #include "xe_bb.h"
 #include "xe_bo.h"
 #include "xe_engine.h"
@@ -20,11 +27,6 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
-#include <linux/sizes.h>
-#include <drm/drm_managed.h>
-#include <drm/ttm/ttm_tt.h>
-#include <drm/xe_drm.h>
-
 #include "gt/intel_gpu_commands.h"
 
 /**
drivers/gpu/drm/xe/xe_mmio.c +1 -1
index c414ece6dfe3..a117437f8482 100644
@@ -14,9 +14,9 @@
 #include "xe_macros.h"
 #include "xe_module.h"
 
-#include "i915_reg.h"
 #include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
+#include "i915_reg.h"
 
 #define XEHP_MTCFG_ADDR		_MMIO(0x101800)
 #define TILE_COUNT		REG_GENMASK(15, 8)
drivers/gpu/drm/xe/xe_mocs.c +3 -2
index 86b966fffbe5..d91054c78702 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_mocs.h"
+
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
 #include "xe_gt.h"
-#include "xe_platform_types.h"
 #include "xe_mmio.h"
-#include "xe_mocs.h"
+#include "xe_platform_types.h"
 #include "xe_step_types.h"
 
 #include "gt/intel_gt_regs.h"
drivers/gpu/drm/xe/xe_module.c +2 -0
index 9cd1663f83f6..5a51a9959eff 100644
@@ -3,6 +3,8 @@
  * Copyright © 2021 Intel Corporation
  */
 
+#include "xe_module.h"
+
 #include <linux/init.h>
 #include <linux/module.h>
 
drivers/gpu/drm/xe/xe_pci.c +2 -2
index 522c71d4c674..29270cce7a46 100644
@@ -10,12 +10,12 @@
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 
-#include <drm/drm_drv.h>
 #include <drm/drm_color_mgmt.h>
+#include <drm/drm_drv.h>
 #include <drm/xe_pciids.h>
 
-#include "xe_drv.h"
 #include "xe_device.h"
+#include "xe_drv.h"
 #include "xe_macros.h"
 #include "xe_module.h"
 #include "xe_pm.h"
drivers/gpu/drm/xe/xe_pcode.c +4 -5
index 1a76fe478853..fb1ce2d49bec 100644
@@ -3,15 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include "xe_pcode_api.h"
 #include "xe_pcode.h"
 
-#include "xe_gt.h"
-#include "xe_mmio.h"
-
+#include <linux/delay.h>
 #include <linux/errno.h>
 
-#include <linux/delay.h>
+#include "xe_gt.h"
+#include "xe_mmio.h"
+#include "xe_pcode_api.h"
 
 /**
  * DOC: PCODE
drivers/gpu/drm/xe/xe_pm.c +3 -2
index 769f380cf1d4..b7b57f10ba25 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_pm.h"
+
 #include <linux/pm_runtime.h>
 
 #include <drm/ttm/ttm_placement.h>
@@ -11,9 +13,8 @@
 #include "xe_bo_evict.h"
 #include "xe_device.h"
 #include "xe_display.h"
-#include "xe_pm.h"
-#include "xe_gt.h"
 #include "xe_ggtt.h"
+#include "xe_gt.h"
 #include "xe_irq.h"
 #include "xe_pcode.h"
 
drivers/gpu/drm/xe/xe_preempt_fence.c +2 -1
index 6ab9ff442766..78ad8c209873 100644
@@ -3,10 +3,11 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_preempt_fence.h"
+
 #include <linux/slab.h>
 
 #include "xe_engine.h"
-#include "xe_preempt_fence.h"
 #include "xe_vm.h"
 
 static void preempt_fence_work_func(struct work_struct *w)
drivers/gpu/drm/xe/xe_pt.c +3 -2
index 435cc30d88c9..06fc7b206997 100644
@@ -3,6 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_pt.h"
+
 #include <drm/drm_pt_walk.h>
 
 #include "xe_bo.h"
@@ -10,12 +12,11 @@
 #include "xe_gt.h"
 #include "xe_gt_tlb_invalidation.h"
 #include "xe_migrate.h"
-#include "xe_pt.h"
 #include "xe_pt_types.h"
-#include "xe_vm.h"
 #include "xe_res_cursor.h"
 #include "xe_trace.h"
 #include "xe_ttm_stolen_mgr.h"
+#include "xe_vm.h"
 
 struct xe_pt_dir {
 	struct xe_pt pt;
drivers/gpu/drm/xe/xe_query.c +7 -5
index f9f21bd1bfd7..0f70945176f6 100644
@@ -3,17 +3,19 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#include <drm/xe_drm.h>
-#include <drm/ttm/ttm_placement.h>
+#include "xe_query.h"
+
 #include <linux/nospec.h>
 
+#include <drm/ttm/ttm_placement.h>
+#include <drm/xe_drm.h>
+
 #include "xe_bo.h"
 #include "xe_device.h"
-#include "xe_gt.h"
-#include "xe_macros.h"
-#include "xe_query.h"
 #include "xe_ggtt.h"
+#include "xe_gt.h"
 #include "xe_guc_hwconfig.h"
+#include "xe_macros.h"
 
 static const enum xe_engine_class xe_to_user_engine_class[] = {
 	[XE_ENGINE_CLASS_RENDER] = DRM_XE_ENGINE_CLASS_RENDER,
drivers/gpu/drm/xe/xe_reg_sr.c +2 -2
index f7eceb84e647..2de576c5fa74 100644
@@ -9,16 +9,16 @@
 #include <linux/string_helpers.h>
 #include <linux/xarray.h>
 
-#include <drm/drm_print.h>
 #include <drm/drm_managed.h>
+#include <drm/drm_print.h>
 
-#include "xe_rtp_types.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
 #include "xe_gt_mcr.h"
 #include "xe_macros.h"
 #include "xe_mmio.h"
+#include "xe_rtp_types.h"
 
 #include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
drivers/gpu/drm/xe/xe_reg_sr_types.h +1 -1
index 2fa7ff3966ba..b234a8673e54 100644
@@ -6,8 +6,8 @@
 #ifndef _XE_REG_SR_TYPES_
 #define _XE_REG_SR_TYPES_
 
-#include <linux/xarray.h>
 #include <linux/types.h>
+#include <linux/xarray.h>
 
 #include "i915_reg_defs.h"
 
drivers/gpu/drm/xe/xe_reg_whitelist.c +3 -3
index a34617a642ec..f6ce801215e7 100644
@@ -5,12 +5,12 @@
 
 #include "xe_reg_whitelist.h"
 
-#include "xe_platform_types.h"
 #include "xe_gt_types.h"
+#include "xe_platform_types.h"
 #include "xe_rtp.h"
 
-#include "../i915/gt/intel_engine_regs.h"
-#include "../i915/gt/intel_gt_regs.h"
+#include "gt/intel_engine_regs.h"
+#include "gt/intel_gt_regs.h"
 
 #undef _MMIO
 #undef MCR_REG
drivers/gpu/drm/xe/xe_ring_ops.c +3 -2
index 370ab1e729fa..ec58d01924cb 100644
@@ -3,18 +3,19 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_ring_ops.h"
+
 #include "xe_engine_types.h"
 #include "xe_gt.h"
 #include "xe_lrc.h"
 #include "xe_macros.h"
-#include "xe_ring_ops.h"
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
-#include "i915_reg.h"
 #include "gt/intel_gpu_commands.h"
 #include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
+#include "i915_reg.h"
 
 static u32 preparser_disable(bool state)
 {
drivers/gpu/drm/xe/xe_rtp.h +1 -1
index 1ac3fd1c0734..d6ba0b7e5042 100644
@@ -6,8 +6,8 @@
 #ifndef _XE_RTP_
 #define _XE_RTP_
 
-#include <linux/xarray.h>
 #include <linux/types.h>
+#include <linux/xarray.h>
 
 #include "xe_rtp_types.h"
 
drivers/gpu/drm/xe/xe_sa.c +3 -1
index e432f40b9bfe..79dc090433ff 100644
@@ -3,14 +3,16 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_sa.h"
+
 #include <linux/kernel.h>
+
 #include <drm/drm_managed.h>
 
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_map.h"
-#include "xe_sa.h"
 
 static void xe_sa_bo_manager_fini(struct drm_device *drm, void *arg)
 {
drivers/gpu/drm/xe/xe_sync.c +3 -2
index 0fbd8d0978cf..99f1ed87196d 100644
@@ -8,13 +8,14 @@
 #include <linux/kthread.h>
 #include <linux/sched/mm.h>
 #include <linux/uaccess.h>
-#include <drm/xe_drm.h>
+
 #include <drm/drm_print.h>
 #include <drm/drm_syncobj.h>
+#include <drm/xe_drm.h>
 
 #include "xe_device_types.h"
-#include "xe_sched_job_types.h"
 #include "xe_macros.h"
+#include "xe_sched_job_types.h"
 
 #define SYNC_FLAGS_TYPE_MASK 0x3
 #define SYNC_FLAGS_FENCE_INSTALLED	0x10000
drivers/gpu/drm/xe/xe_trace.h +2 -2
index 1774658b18b7..2f8eb7ebe9a7 100644
@@ -9,13 +9,13 @@
 #if !defined(_XE_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
 #define _XE_TRACE_H_
 
-#include <linux/types.h>
 #include <linux/tracepoint.h>
+#include <linux/types.h>
 
 #include "xe_bo_types.h"
 #include "xe_engine_types.h"
-#include "xe_gt_types.h"
 #include "xe_gt_tlb_invalidation_types.h"
+#include "xe_gt_types.h"
 #include "xe_guc_engine_types.h"
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
drivers/gpu/drm/xe/xe_ttm_gtt_mgr.c +1 -1
index a0ba8bba84d1..8075781070f2 100644
@@ -6,8 +6,8 @@
 
 #include <drm/drm_managed.h>
 
-#include <drm/ttm/ttm_range_manager.h>
 #include <drm/ttm/ttm_placement.h>
+#include <drm/ttm/ttm_range_manager.h>
 #include <drm/ttm/ttm_tt.h>
 
 #include "xe_bo.h"
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c +1 -1
index 097454f78286..fe0f707ad054 100644
@@ -8,8 +8,8 @@
 #include <drm/drm_mm.h>
 
 #include <drm/ttm/ttm_device.h>
-#include <drm/ttm/ttm_range_manager.h>
 #include <drm/ttm/ttm_placement.h>
+#include <drm/ttm/ttm_range_manager.h>
 
 #include "../i915/i915_reg.h"
 
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c +1 -1
index c7e21673b8fd..643365b18bc7 100644
@@ -6,8 +6,8 @@
 
 #include <drm/drm_managed.h>
 
-#include <drm/ttm/ttm_range_manager.h>
 #include <drm/ttm/ttm_placement.h>
+#include <drm/ttm/ttm_range_manager.h>
 
 #include "xe_bo.h"
 #include "xe_device.h"
drivers/gpu/drm/xe/xe_tuning.c +1 -1
index 595eb2de90ad..a3872f0330cb 100644
@@ -5,8 +5,8 @@
 
 #include "xe_tuning.h"
 
-#include "xe_platform_types.h"
 #include "xe_gt_types.h"
+#include "xe_platform_types.h"
 #include "xe_rtp.h"
 
 #include "gt/intel_gt_regs.h"
drivers/gpu/drm/xe/xe_uc.c +3 -2
index 7886c8b85397..4ccf2b3435e1 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_uc.h"
+
 #include "xe_device.h"
-#include "xe_huc.h"
 #include "xe_gt.h"
 #include "xe_guc.h"
 #include "xe_guc_pc.h"
 #include "xe_guc_submit.h"
-#include "xe_uc.h"
+#include "xe_huc.h"
 #include "xe_uc_fw.h"
 #include "xe_wopcm.h"
 
drivers/gpu/drm/xe/xe_uc_fw.h +2 -2
index b0df5064b27d..ca64d379bb5e 100644
@@ -8,9 +8,9 @@
 
 #include <linux/errno.h>
 
-#include "xe_uc_fw_types.h"
-#include "xe_uc_fw_abi.h"
 #include "xe_macros.h"
+#include "xe_uc_fw_abi.h"
+#include "xe_uc_fw_types.h"
 
 struct drm_printer;
 
drivers/gpu/drm/xe/xe_uc_fw_abi.h +1 -1
index fc7b1855ee90..89e994ed4e00 100644
@@ -6,8 +6,8 @@
 #ifndef _XE_UC_FW_ABI_H
 #define _XE_UC_FW_ABI_H
 
-#include <linux/types.h>
 #include <linux/build_bug.h>
+#include <linux/types.h>
 
 /**
  * DOC: Firmware Layout
drivers/gpu/drm/xe/xe_vm.c +1 -1
index 7276a375e2e0..a0e35627e45e 100644
@@ -25,8 +25,8 @@
 #include "xe_preempt_fence.h"
 #include "xe_pt.h"
 #include "xe_res_cursor.h"
-#include "xe_trace.h"
 #include "xe_sync.h"
+#include "xe_trace.h"
 
 #define TEST_VM_ASYNC_OPS_ERROR
 
drivers/gpu/drm/xe/xe_vm_madvise.c +5 -3
index 1e4e3a1b0631..29815852985a 100644
@@ -3,13 +3,15 @@
  * Copyright © 2021 Intel Corporation
  */
 
-#include <drm/xe_drm.h>
-#include <drm/ttm/ttm_tt.h>
+#include "xe_vm_madvise.h"
+
 #include <linux/nospec.h>
 
+#include <drm/ttm/ttm_tt.h>
+#include <drm/xe_drm.h>
+
 #include "xe_bo.h"
 #include "xe_vm.h"
-#include "xe_vm_madvise.h"
 
 static int madvise_preferred_mem_class(struct xe_device *xe, struct xe_vm *vm,
 				       struct xe_vma **vmas, int num_vmas,
drivers/gpu/drm/xe/xe_wopcm.c +2 -1
index 8fe182afa06c..7bb880355f6b 100644
@@ -3,13 +3,14 @@
  * Copyright © 2022 Intel Corporation
  */
 
+#include "xe_wopcm.h"
+
 #include "xe_device.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
 #include "xe_guc_reg.h"
 #include "xe_mmio.h"
 #include "xe_uc_fw.h"
-#include "xe_wopcm.h"
 
 /**
  * DOC: Write Once Protected Content Memory (WOPCM) Layout
Signature · 1 line
2.39.0
#3 lore raw

PATCH v4 3/12 drm/xe: Remove dependency on intel_engine_regs.h

In reply to Lucas De Marchi

Create regs/xe_engine_regs.h file with all the registers and bit definitions used by the xe driver. Eventually the registers may be defined in a different way and since xe doesn't supported below gen12, the number of registers touched is much smaller, so create a new header.

The definitions themselves are direct copy from the gt/intel_engine_regs.h file, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.

---
 drivers/gpu/drm/xe/regs/xe_engine_regs.h | 98 ++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c         |  2 +-
 drivers/gpu/drm/xe/xe_guc_ads.c          |  3 +-
 drivers/gpu/drm/xe/xe_hw_engine.c        |  2 +-
 drivers/gpu/drm/xe/xe_lrc.c              |  2 +-
 drivers/gpu/drm/xe/xe_mmio.c             |  2 +-
 drivers/gpu/drm/xe/xe_reg_sr.c           |  2 +-
 drivers/gpu/drm/xe/xe_reg_whitelist.c    |  2 +-
 drivers/gpu/drm/xe/xe_wa.c               |  2 +-
 9 files changed, 107 insertions(+), 8 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_engine_regs.h
drivers/gpu/drm/xe/regs/xe_engine_regs.h new file +98 -0
new file mode 100644
index 000000000000..6dfa3cf2fd43
@@ -0,0 +1,98 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_ENGINE_REGS_H_
+#define _XE_ENGINE_REGS_H_
+
+#include <asm/page.h>
+
+#include "i915_reg_defs.h"
+
+#define RING_TAIL(base)				_MMIO((base) + 0x30)
+
+#define RING_HEAD(base)				_MMIO((base) + 0x34)
+#define   HEAD_ADDR				0x001FFFFC
+
+#define RING_START(base)			_MMIO((base) + 0x38)
+
+#define RING_CTL(base)				_MMIO((base) + 0x3c)
+#define   RING_CTL_SIZE(size)			((size) - PAGE_SIZE) /* in bytes -> pages */
+#define   RING_CTL_SIZE(size)			((size) - PAGE_SIZE) /* in bytes -> pages */
+
+#define RING_PSMI_CTL(base)			_MMIO((base) + 0x50)
+#define   GEN8_RC_SEMA_IDLE_MSG_DISABLE			REG_BIT(12)
+#define   GEN12_WAIT_FOR_EVENT_POWER_DOWN_DISABLE	REG_BIT(7)
+
+#define RING_ACTHD_UDW(base)			_MMIO((base) + 0x5c)
+#define RING_DMA_FADD_UDW(base)			_MMIO((base) + 0x60)
+#define RING_IPEIR(base)			_MMIO((base) + 0x64)
+#define RING_IPEHR(base)			_MMIO((base) + 0x68)
+#define RING_ACTHD(base)			_MMIO((base) + 0x74)
+#define RING_DMA_FADD(base)			_MMIO((base) + 0x78)
+#define RING_HWS_PGA(base)			_MMIO((base) + 0x80)
+#define IPEIR(base)				_MMIO((base) + 0x88)
+#define IPEHR(base)				_MMIO((base) + 0x8c)
+#define RING_HWSTAM(base)			_MMIO((base) + 0x98)
+#define RING_MI_MODE(base)			_MMIO((base) + 0x9c)
+#define RING_NOPID(base)			_MMIO((base) + 0x94)
+
+#define RING_IMR(base)				_MMIO((base) + 0xa8)
+#define   RING_MAX_NONPRIV_SLOTS  12
+
+#define RING_EIR(base)				_MMIO((base) + 0xb0)
+#define RING_EMR(base)				_MMIO((base) + 0xb4)
+#define RING_ESR(base)				_MMIO((base) + 0xb8)
+#define RING_BBADDR(base)			_MMIO((base) + 0x140)
+#define RING_BBADDR_UDW(base)			_MMIO((base) + 0x168)
+#define RING_EXECLIST_STATUS_LO(base)		_MMIO((base) + 0x234)
+#define RING_EXECLIST_STATUS_HI(base)		_MMIO((base) + 0x234 + 4)
+
+#define RING_CONTEXT_CONTROL(base)		_MMIO((base) + 0x244)
+#define	  CTX_CTRL_INHIBIT_SYN_CTX_SWITCH	REG_BIT(3)
+#define	  CTX_CTRL_ENGINE_CTX_RESTORE_INHIBIT	REG_BIT(0)
+
+#define RING_MODE_GEN7(base)			_MMIO((base) + 0x29c)
+#define   GEN11_GFX_DISABLE_LEGACY_MODE		(1 << 3)
+
+#define RING_TIMESTAMP(base)			_MMIO((base) + 0x358)
+
+#define RING_TIMESTAMP_UDW(base)		_MMIO((base) + 0x358 + 4)
+#define   RING_VALID_MASK			0x00000001
+#define   RING_VALID				0x00000001
+#define   STOP_RING				REG_BIT(8)
+#define   TAIL_ADDR				0x001FFFF8
+
+#define RING_CTX_TIMESTAMP(base)		_MMIO((base) + 0x3a8)
+
+#define RING_FORCE_TO_NONPRIV(base, i)		_MMIO(((base) + 0x4d0) + (i) * 4)
+#define   RING_FORCE_TO_NONPRIV_DENY		REG_BIT(30)
+#define   RING_FORCE_TO_NONPRIV_ADDRESS_MASK	REG_GENMASK(25, 2)
+#define   RING_FORCE_TO_NONPRIV_ACCESS_RW	(0 << 28)
+#define   RING_FORCE_TO_NONPRIV_ACCESS_RD	(1 << 28)
+#define   RING_FORCE_TO_NONPRIV_ACCESS_WR	(2 << 28)
+#define   RING_FORCE_TO_NONPRIV_ACCESS_INVALID	(3 << 28)
+#define   RING_FORCE_TO_NONPRIV_ACCESS_MASK	(3 << 28)
+#define   RING_FORCE_TO_NONPRIV_RANGE_1		(0 << 0)
+#define   RING_FORCE_TO_NONPRIV_RANGE_4		(1 << 0)
+#define   RING_FORCE_TO_NONPRIV_RANGE_16	(2 << 0)
+#define   RING_FORCE_TO_NONPRIV_RANGE_64	(3 << 0)
+#define   RING_FORCE_TO_NONPRIV_RANGE_MASK	(3 << 0)
+#define   RING_FORCE_TO_NONPRIV_MASK_VALID	(RING_FORCE_TO_NONPRIV_RANGE_MASK | \
+						 RING_FORCE_TO_NONPRIV_ACCESS_MASK | \
+						 RING_FORCE_TO_NONPRIV_DENY)
+#define   RING_MAX_NONPRIV_SLOTS  12
+
+#define RING_EXECLIST_SQ_CONTENTS(base)		_MMIO((base) + 0x510)
+
+#define RING_EXECLIST_CONTROL(base)		_MMIO((base) + 0x550)
+#define	  EL_CTRL_LOAD				REG_BIT(0)
+
+#define VDBOX_CGCTL3F10(base)			_MMIO((base) + 0x3f10)
+#define   IECPUNIT_CLKGATE_DIS			REG_BIT(22)
+
+#define VDBOX_CGCTL3F18(base)			_MMIO((base) + 0x3f18)
+#define   ALNUNIT_CLKGATE_DIS			REG_BIT(13)
+
+#endif
drivers/gpu/drm/xe/xe_execlist.c +1 -1
index 366379d3dfa8..797f7d41fc39 100644
@@ -7,6 +7,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_engine_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
@@ -19,7 +20,6 @@
 #include "xe_ring_ops_types.h"
 #include "xe_sched_job.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gpu_commands.h"
 #include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
drivers/gpu/drm/xe/xe_guc_ads.c +2 -1
index a4e947f0c557..6cd07f51b828 100644
@@ -7,6 +7,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_engine_regs.h"
 #include "xe_bo.h"
 #include "xe_gt.h"
 #include "xe_guc.h"
@@ -17,9 +18,9 @@
 #include "xe_mmio.h"
 #include "xe_platform_types.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
 
+
 /* Slack of a few additional entries per engine */
 #define ADS_REGSET_EXTRA_MAX	8
 
drivers/gpu/drm/xe/xe_hw_engine.c +1 -1
index 1ca7a89b4fbd..749b083aea8a 100644
@@ -7,6 +7,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_engine_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_execlist.h"
@@ -21,7 +22,6 @@
 #include "xe_sched_job.h"
 #include "xe_wa.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
drivers/gpu/drm/xe/xe_lrc.c +1 -1
index ed6fcf7620e1..887d9189fcec 100644
@@ -5,6 +5,7 @@
 
 #include "xe_lrc.h"
 
+#include "regs/xe_engine_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
@@ -13,7 +14,6 @@
 #include "xe_map.h"
 #include "xe_vm.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gpu_commands.h"
 #include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
drivers/gpu/drm/xe/xe_mmio.c +1 -1
index a117437f8482..07db7912a931 100644
@@ -8,13 +8,13 @@
 #include <drm/drm_managed.h>
 #include <drm/xe_drm.h>
 
+#include "regs/xe_engine_regs.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_gt_mcr.h"
 #include "xe_macros.h"
 #include "xe_module.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
drivers/gpu/drm/xe/xe_reg_sr.c +1 -1
index 2de576c5fa74..2932729091e8 100644
@@ -12,6 +12,7 @@
 #include <drm/drm_managed.h>
 #include <drm/drm_print.h>
 
+#include "regs/xe_engine_regs.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
@@ -20,7 +21,6 @@
 #include "xe_mmio.h"
 #include "xe_rtp_types.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
 
 #define XE_REG_SR_GROW_STEP_DEFAULT	16
drivers/gpu/drm/xe/xe_reg_whitelist.c +1 -1
index f6ce801215e7..5aa73c1c4097 100644
@@ -5,11 +5,11 @@
 
 #include "xe_reg_whitelist.h"
 
+#include "regs/xe_engine_regs.h"
 #include "xe_gt_types.h"
 #include "xe_platform_types.h"
 #include "xe_rtp.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
 
 #undef _MMIO
drivers/gpu/drm/xe/xe_wa.c +1 -1
index 9d2e4555091c..92065341c001 100644
@@ -7,6 +7,7 @@
 
 #include <linux/compiler_types.h>
 
+#include "regs/xe_engine_regs.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
@@ -16,7 +17,6 @@
 #include "xe_rtp.h"
 #include "xe_step.h"
 
-#include "gt/intel_engine_regs.h"
 #include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
Signature · 1 line
2.39.0
#4 lore raw

PATCH v4 4/12 drm/xe: Remove dependency on intel_gt_regs.h

In reply to Lucas De Marchi

Create regs/xe_gt_regs.h file with all the registers and bit definitions used by the xe driver. Eventually the registers may be defined in a different way and since xe doesn't supported below gen12, the number of registers touched is much smaller, so create a new header.

The definitions themselves are direct copy from the gt/intel_gt_regs.h file, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.

v2: Make the change to MCR_REG location in a separate patch to go
through the i915 branch (Matt Roper / Rodrigo)

---
 drivers/gpu/drm/xe/regs/xe_gt_regs.h  | 288 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c      |   2 +-
 drivers/gpu/drm/xe/xe_force_wake.c    |   5 +-
 drivers/gpu/drm/xe/xe_ggtt.c          |   2 +-
 drivers/gpu/drm/xe/xe_gt.c            |   3 +-
 drivers/gpu/drm/xe/xe_gt_clock.c      |   2 +-
 drivers/gpu/drm/xe/xe_gt_mcr.c        |   3 +-
 drivers/gpu/drm/xe/xe_guc.c           |   2 +-
 drivers/gpu/drm/xe/xe_guc_ads.c       |   4 +-
 drivers/gpu/drm/xe/xe_guc_pc.c        |   2 +-
 drivers/gpu/drm/xe/xe_hw_engine.c     |   2 +-
 drivers/gpu/drm/xe/xe_irq.c           |   2 +-
 drivers/gpu/drm/xe/xe_lrc.c           |   2 +-
 drivers/gpu/drm/xe/xe_mmio.c          |   2 +-
 drivers/gpu/drm/xe/xe_mocs.c          |   3 +-
 drivers/gpu/drm/xe/xe_reg_sr.c        |   3 +-
 drivers/gpu/drm/xe/xe_reg_whitelist.c |   3 +-
 drivers/gpu/drm/xe/xe_ring_ops.c      |   2 +-
 drivers/gpu/drm/xe/xe_tuning.c        |   3 +-
 drivers/gpu/drm/xe/xe_wa.c            |   2 +-
 20 files changed, 307 insertions(+), 30 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_gt_regs.h
drivers/gpu/drm/xe/regs/xe_gt_regs.h new file +288 -0
new file mode 100644
index 000000000000..091e9cc94a2d
@@ -0,0 +1,288 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_GT_REGS_H_
+#define _XE_GT_REGS_H_
+
+#include "i915_reg_defs.h"
+
+/* RPM unit config (Gen8+) */
+#define RPM_CONFIG0				_MMIO(0xd00)
+#define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT	3
+#define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK	(0x7 << GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT)
+#define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ	0
+#define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ	1
+#define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_38_4_MHZ	2
+#define   GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_25_MHZ	3
+#define   GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT	1
+#define   GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK	(0x3 << GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT)
+
+#define FORCEWAKE_ACK_MEDIA_VDBOX_GEN11(n)	_MMIO(0xd50 + (n) * 4)
+#define FORCEWAKE_ACK_MEDIA_VEBOX_GEN11(n)	_MMIO(0xd70 + (n) * 4)
+#define FORCEWAKE_ACK_RENDER_GEN9		_MMIO(0xd84)
+#define FORCEWAKE_ACK_GT_MTL			_MMIO(0xdfc)
+
+#define GEN9_LNCFCMOCS(i)			_MMIO(0xb020 + (i) * 4)	/* L3 Cache Control */
+#define LNCFCMOCS_REG_COUNT			32
+
+#define MCFG_MCR_SELECTOR			_MMIO(0xfd0)
+#define MTL_MCR_SELECTOR			_MMIO(0xfd4)
+#define SF_MCR_SELECTOR				_MMIO(0xfd8)
+#define GEN8_MCR_SELECTOR			_MMIO(0xfdc)
+#define GAM_MCR_SELECTOR			_MMIO(0xfe0)
+#define   GEN11_MCR_MULTICAST			REG_BIT(31)
+#define   GEN11_MCR_SLICE(slice)		(((slice) & 0xf) << 27)
+#define   GEN11_MCR_SLICE_MASK			GEN11_MCR_SLICE(0xf)
+#define   GEN11_MCR_SUBSLICE(subslice)		(((subslice) & 0x7) << 24)
+#define   GEN11_MCR_SUBSLICE_MASK		GEN11_MCR_SUBSLICE(0x7)
+#define   MTL_MCR_GROUPID			REG_GENMASK(11, 8)
+#define   MTL_MCR_INSTANCEID			REG_GENMASK(3, 0)
+
+#define GEN7_FF_SLICE_CS_CHICKEN1		_MMIO(0x20e0)
+#define   GEN9_FFSC_PERCTX_PREEMPT_CTRL		(1 << 14)
+
+#define GEN9_CS_DEBUG_MODE1			_MMIO(0x20ec)
+#define   FF_DOP_CLOCK_GATE_DISABLE		REG_BIT(1)
+
+#define PS_INVOCATION_COUNT			_MMIO(0x2348)
+
+#define GEN8_CS_CHICKEN1			_MMIO(0x2580)
+#define   GEN9_PREEMPT_3D_OBJECT_LEVEL		(1 << 0)
+#define   GEN9_PREEMPT_GPGPU_LEVEL(hi, lo)	(((hi) << 2) | ((lo) << 1))
+#define   GEN9_PREEMPT_GPGPU_MID_THREAD_LEVEL	GEN9_PREEMPT_GPGPU_LEVEL(0, 0)
+#define   GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL	GEN9_PREEMPT_GPGPU_LEVEL(0, 1)
+#define   GEN9_PREEMPT_GPGPU_COMMAND_LEVEL	GEN9_PREEMPT_GPGPU_LEVEL(1, 0)
+#define   GEN9_PREEMPT_GPGPU_LEVEL_MASK		GEN9_PREEMPT_GPGPU_LEVEL(1, 1)
+
+#define GEN12_GLOBAL_MOCS(i)			_MMIO(0x4000 + (i) * 4) /* Global MOCS regs */
+#define GEN12_GFX_CCS_AUX_NV			_MMIO(0x4208)
+
+#define GEN12_VD0_AUX_NV			_MMIO(0x4218)
+#define GEN12_VE0_AUX_NV			_MMIO(0x4238)
+
+#define GEN12_VE1_AUX_NV			_MMIO(0x42b8)
+#define   AUX_INV				REG_BIT(0)
+
+#define GEN12_PAT_INDEX(index)			_MMIO(0x4800 + (index) * 4)
+#define XEHP_TILE0_ADDR_RANGE			MCR_REG(0x4900)
+#define XEHP_FLAT_CCS_BASE_ADDR			MCR_REG(0x4910)
+
+#define GEN12_FF_MODE2				_MMIO(0x6604)
+#define XEHP_FF_MODE2				MCR_REG(0x6604)
+#define   FF_MODE2_GS_TIMER_MASK		REG_GENMASK(31, 24)
+#define   FF_MODE2_GS_TIMER_224			REG_FIELD_PREP(FF_MODE2_GS_TIMER_MASK, 224)
+#define   FF_MODE2_TDS_TIMER_MASK		REG_GENMASK(23, 16)
+#define   FF_MODE2_TDS_TIMER_128		REG_FIELD_PREP(FF_MODE2_TDS_TIMER_MASK, 4)
+
+#define HIZ_CHICKEN				_MMIO(0x7018)
+#define   DG1_HZ_READ_SUPPRESSION_OPTIMIZATION_DISABLE	REG_BIT(14)
+
+/* GEN7 chicken */
+#define GEN7_COMMON_SLICE_CHICKEN1		_MMIO(0x7010)
+
+#define GEN11_COMMON_SLICE_CHICKEN3		_MMIO(0x7304)
+#define XEHP_COMMON_SLICE_CHICKEN3		MCR_REG(0x7304)
+#define   DG1_FLOAT_POINT_BLEND_OPT_STRICT_MODE_EN	REG_BIT(12)
+#define   XEHP_DUAL_SIMD8_SEQ_MERGE_DISABLE	REG_BIT(12)
+#define   GEN11_BLEND_EMB_FIX_DISABLE_IN_RCC	REG_BIT(11)
+#define   GEN12_DISABLE_CPS_AWARE_COLOR_PIPE	REG_BIT(9)
+
+#define XEHP_SQCM				MCR_REG(0x8724)
+#define   EN_32B_ACCESS				REG_BIT(30)
+
+#define	GEN10_MIRROR_FUSE3			_MMIO(0x9118)
+#define   GEN10_L3BANK_PAIR_COUNT		4
+#define   GEN10_L3BANK_MASK			0x0F
+/* on Xe_HP the same fuses indicates mslices instead of L3 banks */
+#define   GEN12_MAX_MSLICES			4
+#define   GEN12_MEML3_EN_MASK			0x0F
+
+/* Fuse readout registers for GT */
+#define XEHP_FUSE4				_MMIO(0x9114)
+#define   GT_L3_EXC_MASK			REG_GENMASK(6, 4)
+
+#define GEN11_GT_VEBOX_VDBOX_DISABLE		_MMIO(0x9140)
+#define   GEN11_GT_VDBOX_DISABLE_MASK		0xff
+#define   GEN11_GT_VEBOX_DISABLE_SHIFT		16
+#define   GEN11_GT_VEBOX_DISABLE_MASK		(0x0f << GEN11_GT_VEBOX_DISABLE_SHIFT)
+
+#define GEN6_GDRST				_MMIO(0x941c)
+#define   GEN11_GRDOM_GUC			REG_BIT(3)
+#define   GEN6_GRDOM_FULL			(1 << 0)
+#define   GEN11_GRDOM_FULL			GEN6_GRDOM_FULL
+
+#define GEN7_MISCCPCTL				_MMIO(0x9424)
+#define   GEN7_DOP_CLOCK_GATE_ENABLE		(1 << 0)
+#define   GEN12_DOP_CLOCK_GATE_RENDER_ENABLE	REG_BIT(1)
+
+#define UNSLCGCTL9430				_MMIO(0x9430)
+#define   MSQDUNIT_CLKGATE_DIS			REG_BIT(3)
+
+#define UNSLICE_UNIT_LEVEL_CLKGATE		_MMIO(0x9434)
+#define   VFUNIT_CLKGATE_DIS			REG_BIT(20)
+#define   TSGUNIT_CLKGATE_DIS			REG_BIT(17) /* XEHPSDV */
+#define   CG3DDISCFEG_CLKGATE_DIS		REG_BIT(17) /* DG2 */
+#define   GAMEDIA_CLKGATE_DIS			REG_BIT(11)
+#define   HSUNIT_CLKGATE_DIS			REG_BIT(8)
+#define   VSUNIT_CLKGATE_DIS			REG_BIT(3)
+
+#define UNSLCGCTL9440				_MMIO(0x9440)
+#define   GAMTLBOACS_CLKGATE_DIS		REG_BIT(28)
+#define   GAMTLBVDBOX5_CLKGATE_DIS		REG_BIT(27)
+#define   GAMTLBVDBOX6_CLKGATE_DIS		REG_BIT(26)
+#define   GAMTLBVDBOX3_CLKGATE_DIS		REG_BIT(24)
+#define   GAMTLBVDBOX4_CLKGATE_DIS		REG_BIT(23)
+#define   GAMTLBVDBOX7_CLKGATE_DIS		REG_BIT(22)
+#define   GAMTLBVDBOX2_CLKGATE_DIS		REG_BIT(21)
+#define   GAMTLBVDBOX0_CLKGATE_DIS		REG_BIT(17)
+#define   GAMTLBKCR_CLKGATE_DIS			REG_BIT(16)
+#define   GAMTLBGUC_CLKGATE_DIS			REG_BIT(15)
+#define   GAMTLBBLT_CLKGATE_DIS			REG_BIT(14)
+#define   GAMTLBVDBOX1_CLKGATE_DIS		REG_BIT(6)
+
+#define UNSLCGCTL9444				_MMIO(0x9444)
+#define   GAMTLBGFXA0_CLKGATE_DIS		REG_BIT(30)
+#define   GAMTLBGFXA1_CLKGATE_DIS		REG_BIT(29)
+#define   GAMTLBCOMPA0_CLKGATE_DIS		REG_BIT(28)
+#define   GAMTLBCOMPA1_CLKGATE_DIS		REG_BIT(27)
+#define   GAMTLBCOMPB0_CLKGATE_DIS		REG_BIT(26)
+#define   GAMTLBCOMPB1_CLKGATE_DIS		REG_BIT(25)
+#define   GAMTLBCOMPC0_CLKGATE_DIS		REG_BIT(24)
+#define   GAMTLBCOMPC1_CLKGATE_DIS		REG_BIT(23)
+#define   GAMTLBCOMPD0_CLKGATE_DIS		REG_BIT(22)
+#define   GAMTLBCOMPD1_CLKGATE_DIS		REG_BIT(21)
+#define   GAMTLBMERT_CLKGATE_DIS		REG_BIT(20)
+#define   GAMTLBVEBOX3_CLKGATE_DIS		REG_BIT(19)
+#define   GAMTLBVEBOX2_CLKGATE_DIS		REG_BIT(18)
+#define   GAMTLBVEBOX1_CLKGATE_DIS		REG_BIT(17)
+#define   GAMTLBVEBOX0_CLKGATE_DIS		REG_BIT(16)
+#define   LTCDD_CLKGATE_DIS			REG_BIT(10)
+
+#define GEN11_SLICE_UNIT_LEVEL_CLKGATE		_MMIO(0x94d4)
+#define XEHP_SLICE_UNIT_LEVEL_CLKGATE		MCR_REG(0x94d4)
+#define   SARBUNIT_CLKGATE_DIS			(1 << 5)
+#define   RCCUNIT_CLKGATE_DIS			(1 << 7)
+#define   MSCUNIT_CLKGATE_DIS			(1 << 10)
+#define   NODEDSS_CLKGATE_DIS			REG_BIT(12)
+#define   L3_CLKGATE_DIS			REG_BIT(16)
+#define   L3_CR2X_CLKGATE_DIS			REG_BIT(17)
+
+#define UNSLICE_UNIT_LEVEL_CLKGATE2		_MMIO(0x94e4)
+#define   VSUNIT_CLKGATE_DIS_TGL		REG_BIT(19)
+#define   PSDUNIT_CLKGATE_DIS			REG_BIT(5)
+
+#define GEN11_SUBSLICE_UNIT_LEVEL_CLKGATE	MCR_REG(0x9524)
+#define   DSS_ROUTER_CLKGATE_DIS		REG_BIT(28)
+#define   GWUNIT_CLKGATE_DIS			REG_BIT(16)
+
+#define SUBSLICE_UNIT_LEVEL_CLKGATE2		MCR_REG(0x9528)
+#define   CPSSUNIT_CLKGATE_DIS			REG_BIT(9)
+
+#define SSMCGCTL9530				MCR_REG(0x9530)
+#define   RTFUNIT_CLKGATE_DIS			REG_BIT(18)
+
+#define GEN10_DFR_RATIO_EN_AND_CHICKEN		MCR_REG(0x9550)
+#define   DFR_DISABLE				(1 << 9)
+
+#define GEN6_RPNSWREQ				_MMIO(0xa008)
+#define GEN6_RC_CONTROL				_MMIO(0xa090)
+#define GEN6_RC_STATE				_MMIO(0xa094)
+
+#define GEN6_PMINTRMSK				_MMIO(0xa168)
+#define   GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC	(1 << 31)
+#define   ARAT_EXPIRED_INTRMSK			(1 << 9)
+
+#define FORCEWAKE_GT_GEN9			_MMIO(0xa188)
+
+#define GEN9_PG_ENABLE				_MMIO(0xa210)
+
+/* GPM unit config (Gen9+) */
+#define CTC_MODE				_MMIO(0xa26c)
+#define   CTC_SOURCE_PARAMETER_MASK		1
+#define   CTC_SOURCE_CRYSTAL_CLOCK		0
+#define   CTC_SOURCE_DIVIDE_LOGIC		1
+#define   CTC_SHIFT_PARAMETER_SHIFT		1
+#define   CTC_SHIFT_PARAMETER_MASK		(0x3 << CTC_SHIFT_PARAMETER_SHIFT)
+
+#define FORCEWAKE_RENDER_GEN9			_MMIO(0xa278)
+#define FORCEWAKE_MEDIA_VDBOX_GEN11(n)		_MMIO(0xa540 + (n) * 4)
+#define FORCEWAKE_MEDIA_VEBOX_GEN11(n)		_MMIO(0xa560 + (n) * 4)
+
+#define GEN10_SAMPLER_MODE			MCR_REG(0xe18c)
+#define   ENABLE_SMALLPL			REG_BIT(15)
+#define   SC_DISABLE_POWER_OPTIMIZATION_EBB	REG_BIT(9)
+#define   GEN11_SAMPLER_ENABLE_HEADLESS_MSG	REG_BIT(5)
+
+#define GEN9_ROW_CHICKEN4			MCR_REG(0xe48c)
+#define   GEN12_DISABLE_GRF_CLEAR		REG_BIT(13)
+#define   XEHP_DIS_BBL_SYSPIPE			REG_BIT(11)
+#define   GEN12_DISABLE_TDL_PUSH		REG_BIT(9)
+#define   GEN11_DIS_PICK_2ND_EU			REG_BIT(7)
+#define   GEN12_DISABLE_HDR_PAST_PAYLOAD_HOLD_FIX	REG_BIT(4)
+#define   THREAD_EX_ARB_MODE			REG_GENMASK(3, 2)
+#define   THREAD_EX_ARB_MODE_RR_AFTER_DEP	REG_FIELD_PREP(THREAD_EX_ARB_MODE, 0x2)
+
+#define GEN7_ROW_CHICKEN2			_MMIO(0xe4f4)
+#define   GEN12_DISABLE_READ_SUPPRESSION	REG_BIT(15)
+#define   GEN12_DISABLE_EARLY_READ		REG_BIT(14)
+#define   GEN12_ENABLE_LARGE_GRF_MODE		REG_BIT(12)
+#define   GEN12_PUSH_CONST_DEREF_HOLD_DIS	REG_BIT(8)
+#define   GEN12_DISABLE_DOP_GATING              REG_BIT(0)
+
+#define SARB_CHICKEN1				MCR_REG(0xe90c)
+#define   COMP_CKN_IN				REG_GENMASK(30, 29)
+
+#define GEN12_RCU_MODE				_MMIO(0x14800)
+#define   GEN12_RCU_MODE_CCS_ENABLE		REG_BIT(0)
+
+#define FORCEWAKE_ACK_GT_GEN9			_MMIO(0x130044)
+#define   FORCEWAKE_KERNEL			BIT(0)
+#define   FORCEWAKE_USER			BIT(1)
+#define   FORCEWAKE_KERNEL_FALLBACK		BIT(15)
+
+#define GEN6_GT_CORE_STATUS			_MMIO(0x138060)
+#define   GEN6_RC0				0
+#define   GEN6_RC6				3
+
+#define GEN6_GT_GFX_RC6_LOCKED			_MMIO(0x138104)
+#define GEN6_GT_GFX_RC6				_MMIO(0x138108)
+
+#define GFX_FLSH_CNTL_GEN6			_MMIO(0x101008)
+#define   GFX_FLSH_CNTL_EN			(1 << 0)
+
+#define GEN11_GT_INTR_DW(x)			_MMIO(0x190018 + ((x) * 4))
+
+#define GEN11_GUC_SG_INTR_ENABLE		_MMIO(0x190038)
+#define   ENGINE1_MASK				REG_GENMASK(31, 16)
+#define   ENGINE0_MASK				REG_GENMASK(15, 0)
+
+#define GEN11_GPM_WGBOXPERF_INTR_ENABLE		_MMIO(0x19003c)
+
+#define GEN11_INTR_IDENTITY_REG(x)		_MMIO(0x190060 + ((x) * 4))
+#define   GEN11_INTR_DATA_VALID			(1 << 31)
+#define   GEN11_INTR_ENGINE_INSTANCE(x)		(((x) & GENMASK(25, 20)) >> 20)
+#define   GEN11_INTR_ENGINE_CLASS(x)		(((x) & GENMASK(18, 16)) >> 16)
+#define   GEN11_INTR_ENGINE_INTR(x)		((x) & 0xffff)
+#define   OTHER_GUC_INSTANCE			0
+
+#define GEN11_RENDER_COPY_INTR_ENABLE		_MMIO(0x190030)
+#define GEN11_VCS_VECS_INTR_ENABLE		_MMIO(0x190034)
+#define GEN12_CCS_RSVD_INTR_ENABLE		_MMIO(0x190048)
+#define GEN11_IIR_REG_SELECTOR(x)		_MMIO(0x190070 + ((x) * 4))
+#define GEN11_RCS0_RSVD_INTR_MASK		_MMIO(0x190090)
+#define GEN11_BCS_RSVD_INTR_MASK		_MMIO(0x1900a0)
+#define GEN11_VCS0_VCS1_INTR_MASK		_MMIO(0x1900a8)
+#define GEN11_VCS2_VCS3_INTR_MASK		_MMIO(0x1900ac)
+#define GEN11_VECS0_VECS1_INTR_MASK		_MMIO(0x1900d0)
+#define GEN11_GUC_SG_INTR_MASK			_MMIO(0x1900e8)
+#define GEN11_GPM_WGBOXPERF_INTR_MASK		_MMIO(0x1900ec)
+#define GEN12_CCS0_CCS1_INTR_MASK		_MMIO(0x190100)
+#define GEN12_CCS2_CCS3_INTR_MASK		_MMIO(0x190104)
+#define XEHPC_BCS1_BCS2_INTR_MASK		_MMIO(0x190110)
+#define XEHPC_BCS3_BCS4_INTR_MASK		_MMIO(0x190114)
+#define XEHPC_BCS5_BCS6_INTR_MASK		_MMIO(0x190118)
+#define XEHPC_BCS7_BCS8_INTR_MASK		_MMIO(0x19011c)
+
+#endif
drivers/gpu/drm/xe/xe_execlist.c +1 -1
index 797f7d41fc39..8a7e0d86fed9 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
@@ -21,7 +22,6 @@
 #include "xe_sched_job.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
drivers/gpu/drm/xe/xe_force_wake.c +1 -4
index 60b7e4a3e9fe..249ac877c1c3 100644
@@ -7,11 +7,10 @@
 
 #include <drm/drm_util.h>
 
+#include "regs/xe_gt_regs.h"
 #include "xe_gt.h"
 #include "xe_mmio.h"
 
-#include "gt/intel_gt_regs.h"
-
 #define XE_FORCE_WAKE_ACK_TIMEOUT_MS	50
 
 static struct xe_gt *
@@ -37,8 +36,6 @@ static void domain_init(struct xe_force_wake_domain *domain,
 	domain->mask = mask;
 }
 
-#define FORCEWAKE_ACK_GT_MTL                 _MMIO(0xdfc)
-
 void xe_force_wake_init_gt(struct xe_gt *gt, struct xe_force_wake *fw)
 {
 	struct xe_device *xe = gt_to_xe(gt);
drivers/gpu/drm/xe/xe_ggtt.c +1 -1
index 03880f2c9692..09637f0845a7 100644
@@ -10,6 +10,7 @@
 #include <drm/drm_managed.h>
 #include <drm/i915_drm.h>
 
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
@@ -18,7 +19,6 @@
 #include "xe_mmio.h"
 #include "xe_wopcm.h"
 
-#include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
 /* FIXME: Common file, preferably auto-gen */
drivers/gpu/drm/xe/xe_gt.c +1 -2
index 74e9445befe4..343370b44506 100644
@@ -9,6 +9,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_gt_regs.h"
 #include "xe_bb.h"
 #include "xe_bo.h"
 #include "xe_device.h"
@@ -41,8 +42,6 @@
 #include "xe_wa.h"
 #include "xe_wopcm.h"
 
-#include "gt/intel_gt_regs.h"
-
 struct xe_gt *xe_find_full_gt(struct xe_gt *gt)
 {
 	struct xe_gt *search;
drivers/gpu/drm/xe/xe_gt_clock.c +1 -1
index 2d9f2aa42bad..fd0ca33925cd 100644
@@ -5,12 +5,12 @@
 
 #include "xe_gt_clock.h"
 
+#include "regs/xe_gt_regs.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_macros.h"
 #include "xe_mmio.h"
 
-#include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
 static u32 read_reference_ts_freq(struct xe_gt *gt)
drivers/gpu/drm/xe/xe_gt_mcr.c +1 -2
index 8fa59988d08e..10eff02cc7db 100644
@@ -5,13 +5,12 @@
 
 #include "xe_gt_mcr.h"
 
+#include "regs/xe_gt_regs.h"
 #include "xe_gt.h"
 #include "xe_gt_topology.h"
 #include "xe_gt_types.h"
 #include "xe_mmio.h"
 
-#include "gt/intel_gt_regs.h"
-
 /**
  * DOC: GT Multicast/Replicated (MCR) Register Support
  *
drivers/gpu/drm/xe/xe_guc.c +1 -1
index db3d8c947603..661effa9830f 100644
@@ -5,6 +5,7 @@
 
 #include "xe_guc.h"
 
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_force_wake.h"
@@ -21,7 +22,6 @@
 #include "xe_uc_fw.h"
 #include "xe_wopcm.h"
 
-#include "gt/intel_gt_regs.h"
 #include "i915_reg_defs.h"
 
 /* TODO: move to common file */
drivers/gpu/drm/xe/xe_guc_ads.c +1 -3
index 6cd07f51b828..49725093fb47 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_gt.h"
 #include "xe_guc.h"
@@ -18,9 +19,6 @@
 #include "xe_mmio.h"
 #include "xe_platform_types.h"
 
-#include "gt/intel_gt_regs.h"
-
-
 /* Slack of a few additional entries per engine */
 #define ADS_REGSET_EXTRA_MAX	8
 
drivers/gpu/drm/xe/xe_guc_pc.c +1 -1
index 28b86e8f3f6e..f983f47cefb6 100644
@@ -9,6 +9,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
@@ -31,7 +32,6 @@
 #define GEN10_FREQ_INFO_REC	_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5ef0)
 #define   RPE_MASK		REG_GENMASK(15, 8)
 
-#include "gt/intel_gt_regs.h"
 /* For GEN6_RPNSWREQ.reg to be merged when the definition moves to Xe */
 #define   REQ_RATIO_MASK	REG_GENMASK(31, 23)
 
drivers/gpu/drm/xe/xe_hw_engine.c +1 -1
index 749b083aea8a..2cf42afd97d9 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_execlist.h"
@@ -22,7 +23,6 @@
 #include "xe_sched_job.h"
 #include "xe_wa.h"
 
-#include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
 #define MAX_MMIO_BASES 3
drivers/gpu/drm/xe/xe_irq.c +1 -1
index 1428796d87d8..17e204e74714 100644
@@ -9,6 +9,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_gt_regs.h"
 #include "xe_device.h"
 #include "xe_display.h"
 #include "xe_drv.h"
@@ -17,7 +18,6 @@
 #include "xe_hw_engine.h"
 #include "xe_mmio.h"
 
-#include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
 static void gen3_assert_iir_is_zero(struct xe_gt *gt, i915_reg_t reg)
drivers/gpu/drm/xe/xe_lrc.c +1 -1
index 887d9189fcec..bf12f71fbe72 100644
@@ -6,6 +6,7 @@
 #include "xe_lrc.h"
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
@@ -15,7 +16,6 @@
 #include "xe_vm.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
drivers/gpu/drm/xe/xe_mmio.c +1 -1
index 07db7912a931..5e6ca0d2076a 100644
@@ -9,13 +9,13 @@
 #include <drm/xe_drm.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_gt_mcr.h"
 #include "xe_macros.h"
 #include "xe_module.h"
 
-#include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
 #define XEHP_MTCFG_ADDR		_MMIO(0x101800)
drivers/gpu/drm/xe/xe_mocs.c +1 -2
index d91054c78702..7ff81041d5ce 100644
@@ -5,6 +5,7 @@
 
 #include "xe_mocs.h"
 
+#include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
@@ -13,8 +14,6 @@
 #include "xe_platform_types.h"
 #include "xe_step_types.h"
 
-#include "gt/intel_gt_regs.h"
-
 #if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
 #define mocs_dbg drm_dbg
 #else
drivers/gpu/drm/xe/xe_reg_sr.c +1 -2
index 2932729091e8..e4eb18332a9d 100644
@@ -13,6 +13,7 @@
 #include <drm/drm_print.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
@@ -21,8 +22,6 @@
 #include "xe_mmio.h"
 #include "xe_rtp_types.h"
 
-#include "gt/intel_gt_regs.h"
-
 #define XE_REG_SR_GROW_STEP_DEFAULT	16
 
 static void reg_sr_fini(struct drm_device *drm, void *arg)
drivers/gpu/drm/xe/xe_reg_whitelist.c +1 -2
index 5aa73c1c4097..2dd10e62718f 100644
@@ -6,12 +6,11 @@
 #include "xe_reg_whitelist.h"
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_gt_types.h"
 #include "xe_platform_types.h"
 #include "xe_rtp.h"
 
-#include "gt/intel_gt_regs.h"
-
 #undef _MMIO
 #undef MCR_REG
 #define _MMIO(x)	_XE_RTP_REG(x)
drivers/gpu/drm/xe/xe_ring_ops.c +1 -1
index ec58d01924cb..61f22bcec82c 100644
@@ -5,6 +5,7 @@
 
 #include "xe_ring_ops.h"
 
+#include "regs/xe_gt_regs.h"
 #include "xe_engine_types.h"
 #include "xe_gt.h"
 #include "xe_lrc.h"
@@ -13,7 +14,6 @@
 #include "xe_vm_types.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_gt_regs.h"
 #include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
drivers/gpu/drm/xe/xe_tuning.c +1 -2
index a3872f0330cb..624b257ecfbc 100644
@@ -5,12 +5,11 @@
 
 #include "xe_tuning.h"
 
+#include "regs/xe_gt_regs.h"
 #include "xe_gt_types.h"
 #include "xe_platform_types.h"
 #include "xe_rtp.h"
 
-#include "gt/intel_gt_regs.h"
-
 #undef _MMIO
 #undef MCR_REG
 #define _MMIO(x)	_XE_RTP_REG(x)
drivers/gpu/drm/xe/xe_wa.c +1 -1
index 92065341c001..155cfd1dcc50 100644
@@ -8,6 +8,7 @@
 #include <linux/compiler_types.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gt_regs.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
@@ -17,7 +18,6 @@
 #include "xe_rtp.h"
 #include "xe_step.h"
 
-#include "gt/intel_gt_regs.h"
 #include "i915_reg.h"
 
 /**
Signature · 1 line
2.39.0
#5 lore raw

PATCH v4 5/12 drm/xe: Remove dependency on intel_lrc_reg.h

In reply to Lucas De Marchi

Create regs/xe_lrc_layout.h file with all the offsets used by the xe driver. Eventually the xe driver may use a different way to define them since it doesn't supported below gen12.

v2: Rename file to intel_lrc_layout.h since it's not really about
registers (Matt Roper)

---
 drivers/gpu/drm/xe/regs/xe_lrc_layout.h | 17 +++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c        |  2 +-
 drivers/gpu/drm/xe/xe_guc_submit.c      |  3 +--
 drivers/gpu/drm/xe/xe_lrc.c             |  2 +-
 drivers/gpu/drm/xe/xe_ring_ops.c        |  2 +-
 5 files changed, 21 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_lrc_layout.h
drivers/gpu/drm/xe/regs/xe_lrc_layout.h new file +17 -0
new file mode 100644
index 000000000000..4be81abc86ad
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_LRC_LAYOUT_H_
+#define _XE_LRC_LAYOUT_H_
+
+#define CTX_CONTEXT_CONTROL		(0x02 + 1)
+#define CTX_RING_HEAD			(0x04 + 1)
+#define CTX_RING_TAIL			(0x06 + 1)
+#define CTX_RING_START			(0x08 + 1)
+#define CTX_RING_CTL			(0x0a + 1)
+#define CTX_PDP0_UDW			(0x30 + 1)
+#define CTX_PDP0_LDW			(0x32 + 1)
+
+#endif
drivers/gpu/drm/xe/xe_execlist.c +1 -1
index 8a7e0d86fed9..ba9f72694277 100644
@@ -9,6 +9,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
@@ -22,7 +23,6 @@
 #include "xe_sched_job.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
 #define XE_EXECLIST_HANG_LIMIT 1
drivers/gpu/drm/xe/xe_guc_submit.c +1 -2
index aca41ecedf7d..5eb11d56e9da 100644
@@ -13,6 +13,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_lrc_layout.h"
 #include "xe_device.h"
 #include "xe_engine.h"
 #include "xe_force_wake.h"
@@ -31,8 +32,6 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
-#include "gt/intel_lrc_reg.h"
-
 static struct xe_gt *
 guc_to_gt(struct xe_guc *guc)
 {
drivers/gpu/drm/xe/xe_lrc.c +1 -1
index bf12f71fbe72..5baa3cf53852 100644
@@ -7,6 +7,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
@@ -16,7 +17,6 @@
 #include "xe_vm.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
 #define GEN8_CTX_VALID				(1 << 0)
drivers/gpu/drm/xe/xe_ring_ops.c +1 -1
index 61f22bcec82c..276fc9691986 100644
@@ -6,6 +6,7 @@
 #include "xe_ring_ops.h"
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_lrc_layout.h"
 #include "xe_engine_types.h"
 #include "xe_gt.h"
 #include "xe_lrc.h"
@@ -14,7 +15,6 @@
 #include "xe_vm_types.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
 static u32 preparser_disable(bool state)
Signature · 1 line
2.39.0
Reviewed-by on v4 5/12
#6 lore raw

Re: [Intel-xe] [PATCH v4 05/12] drm/xe: Remove dependency on intel_lrc_reg.h

Quoted 8 lines · Lucas De Marchi

Create regs/xe_lrc_layout.h file with all the offsets used by the xe driver. Eventually the xe driver may use a different way to define them since it doesn't supported below gen12.

v2: Rename file to intel_lrc_layout.h since it's not really about
registers (Matt Roper)

Quoted 116 lines
---
 drivers/gpu/drm/xe/regs/xe_lrc_layout.h | 17 +++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c        |  2 +-
 drivers/gpu/drm/xe/xe_guc_submit.c      |  3 +--
 drivers/gpu/drm/xe/xe_lrc.c             |  2 +-
 drivers/gpu/drm/xe/xe_ring_ops.c        |  2 +-
 5 files changed, 21 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_lrc_layout.h
drivers/gpu/drm/xe/regs/xe_lrc_layout.h new file +17 -0
new file mode 100644
index 000000000000..4be81abc86ad
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_LRC_LAYOUT_H_
+#define _XE_LRC_LAYOUT_H_
+
+#define CTX_CONTEXT_CONTROL		(0x02 + 1)
+#define CTX_RING_HEAD			(0x04 + 1)
+#define CTX_RING_TAIL			(0x06 + 1)
+#define CTX_RING_START			(0x08 + 1)
+#define CTX_RING_CTL			(0x0a + 1)
+#define CTX_PDP0_UDW			(0x30 + 1)
+#define CTX_PDP0_LDW			(0x32 + 1)
+
+#endif
drivers/gpu/drm/xe/xe_execlist.c +1 -1
index 8a7e0d86fed9..ba9f72694277 100644
@@ -9,6 +9,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
@@ -22,7 +23,6 @@
 #include "xe_sched_job.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
 #define XE_EXECLIST_HANG_LIMIT 1
drivers/gpu/drm/xe/xe_guc_submit.c +1 -2
index aca41ecedf7d..5eb11d56e9da 100644
@@ -13,6 +13,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_lrc_layout.h"
 #include "xe_device.h"
 #include "xe_engine.h"
 #include "xe_force_wake.h"
@@ -31,8 +32,6 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
-#include "gt/intel_lrc_reg.h"
-
 static struct xe_gt *
 guc_to_gt(struct xe_guc *guc)
 {
drivers/gpu/drm/xe/xe_lrc.c +1 -1
index bf12f71fbe72..5baa3cf53852 100644
@@ -7,6 +7,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
@@ -16,7 +17,6 @@
 #include "xe_vm.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
 #define GEN8_CTX_VALID				(1 << 0)
drivers/gpu/drm/xe/xe_ring_ops.c +1 -1
index 61f22bcec82c..276fc9691986 100644
@@ -6,6 +6,7 @@
 #include "xe_ring_ops.h"
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_lrc_layout.h"
 #include "xe_engine_types.h"
 #include "xe_gt.h"
 #include "xe_lrc.h"
@@ -14,7 +15,6 @@
 #include "xe_vm_types.h"
 
 #include "gt/intel_gpu_commands.h"
-#include "gt/intel_lrc_reg.h"
 #include "i915_reg.h"
 
 static u32 preparser_disable(bool state)
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#7 lore raw

PATCH v4 6/12 drm/xe: Remove dependency on intel_gpu_commands.h

In reply to Lucas De Marchi

Copy the macros used by xe in intel_gpu_commands.h to regs/xe_gpu_commands.h. PIPE_CONTROL_3D_ENGINE_FLAGS and PIPE_CONTROL_3D_ARCH_FLAGS were already defined in drivers/gpu/drm/xe/xe_ring_ops.c and only used there. So let that define to be used instead of also adding to the new header.

v2: Let PIPE_CONTROL_3D_ENGINE_FLAGS/PIPE_CONTROL_3D_ARCH_FLAGS in the
only .c that uses it instead of redefining (Matt Roper)

---
 drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 79 +++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_bb.c                |  3 +-
 drivers/gpu/drm/xe/xe_device.h            |  3 +-
 drivers/gpu/drm/xe/xe_execlist.c          |  2 +-
 drivers/gpu/drm/xe/xe_lrc.c               |  2 +-
 drivers/gpu/drm/xe/xe_migrate.c           |  3 +-
 drivers/gpu/drm/xe/xe_ring_ops.c          | 49 +++++++-------
 7 files changed, 109 insertions(+), 32 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_gpu_commands.h
drivers/gpu/drm/xe/regs/xe_gpu_commands.h new file +79 -0
new file mode 100644
index 000000000000..288576035ce3
@@ -0,0 +1,79 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_GPU_COMMANDS_H_
+#define _XE_GPU_COMMANDS_H_
+
+#define INSTR_CLIENT_SHIFT      29
+#define   INSTR_MI_CLIENT       0x0
+#define __INSTR(client) ((client) << INSTR_CLIENT_SHIFT)
+
+#define MI_INSTR(opcode, flags) \
+	(__INSTR(INSTR_MI_CLIENT) | (opcode) << 23 | (flags))
+
+#define MI_NOOP			MI_INSTR(0, 0)
+#define MI_USER_INTERRUPT	MI_INSTR(0x02, 0)
+
+#define MI_ARB_ON_OFF		MI_INSTR(0x08, 0)
+#define   MI_ARB_ENABLE			(1<<0)
+#define   MI_ARB_DISABLE		(0<<0)
+
+#define MI_BATCH_BUFFER_END	MI_INSTR(0x0a, 0)
+#define MI_STORE_DATA_IMM	MI_INSTR(0x20, 0)
+
+#define MI_LOAD_REGISTER_IMM(x)	MI_INSTR(0x22, 2*(x)-1)
+#define   MI_LRI_LRM_CS_MMIO		REG_BIT(19)
+#define   MI_LRI_MMIO_REMAP_EN		REG_BIT(17)
+#define   MI_LRI_FORCE_POSTED		(1<<12)
+
+#define MI_FLUSH_DW		MI_INSTR(0x26, 1)
+#define   MI_FLUSH_DW_STORE_INDEX	(1<<21)
+#define   MI_INVALIDATE_TLB		(1<<18)
+#define   MI_FLUSH_DW_CCS		(1<<16)
+#define   MI_FLUSH_DW_OP_STOREDW	(1<<14)
+#define   MI_FLUSH_DW_USE_GTT		(1<<2)
+
+#define MI_BATCH_BUFFER_START_GEN8	MI_INSTR(0x31, 1)
+
+#define XY_CTRL_SURF_COPY_BLT		((2 << 29) | (0x48 << 22) | 3)
+#define   SRC_ACCESS_TYPE_SHIFT		21
+#define   DST_ACCESS_TYPE_SHIFT		20
+#define   CCS_SIZE_MASK			0x3FF
+#define   CCS_SIZE_SHIFT		8
+#define   XY_CTRL_SURF_MOCS_MASK	GENMASK(31, 25)
+#define   NUM_CCS_BYTES_PER_BLOCK	256
+#define   NUM_BYTES_PER_CCS_BYTE	256
+#define   NUM_CCS_BLKS_PER_XFER		1024
+
+#define XY_FAST_COLOR_BLT_CMD		(2 << 29 | 0x44 << 22)
+#define   XY_FAST_COLOR_BLT_DEPTH_32	(2 << 19)
+#define   XY_FAST_COLOR_BLT_DW		16
+#define   XY_FAST_COLOR_BLT_MOCS_MASK	GENMASK(27, 21)
+#define   XY_FAST_COLOR_BLT_MEM_TYPE_SHIFT 31
+
+#define GEN9_XY_FAST_COPY_BLT_CMD	(2 << 29 | 0x42 << 22)
+#define   BLT_DEPTH_32			(3<<24)
+
+#define GFX_OP_PIPE_CONTROL(len)	((0x3<<29)|(0x3<<27)|(0x2<<24)|((len)-2))
+#define   PIPE_CONTROL_TILE_CACHE_FLUSH			(1<<28)
+#define   PIPE_CONTROL_AMFS_FLUSH			(1<<25)
+#define   PIPE_CONTROL_GLOBAL_GTT_IVB			(1<<24)
+#define   PIPE_CONTROL_CS_STALL				(1<<20)
+#define   PIPE_CONTROL_GLOBAL_SNAPSHOT_RESET		(1<<19)
+#define   PIPE_CONTROL_PSD_SYNC				(1<<17)
+#define   PIPE_CONTROL_QW_WRITE				(1<<14)
+#define   PIPE_CONTROL_DEPTH_STALL			(1<<13)
+#define   PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH	(1<<12)
+#define   PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE		(1<<10)
+#define   PIPE_CONTROL_INDIRECT_STATE_DISABLE		(1<<9)
+#define   PIPE_CONTROL_FLUSH_ENABLE			(1<<7)
+#define   PIPE_CONTROL_DC_FLUSH_ENABLE			(1<<5)
+#define   PIPE_CONTROL_VF_CACHE_INVALIDATE		(1<<4)
+#define   PIPE_CONTROL_STALL_AT_SCOREBOARD		(1<<1)
+#define   PIPE_CONTROL_DEPTH_CACHE_FLUSH		(1<<0)
+
+#define MI_ARB_CHECK            MI_INSTR(0x05, 0)
+
+#endif
drivers/gpu/drm/xe/xe_bb.c +1 -2
index d10448d1b4d7..5b24018e2a80 100644
@@ -5,6 +5,7 @@
 
 #include "xe_bb.h"
 
+#include "regs/xe_gpu_commands.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
 #include "xe_hw_fence.h"
@@ -12,8 +13,6 @@
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
-#include "gt/intel_gpu_commands.h"
-
 struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm)
 {
 	struct xe_bb *bb = kmalloc(sizeof(*bb), GFP_KERNEL);
drivers/gpu/drm/xe/xe_device.h +1 -2
index ed55ef567d18..263620953c3b 100644
@@ -11,12 +11,11 @@ struct xe_file;
 
 #include <drm/drm_util.h>
 
+#include "regs/xe_gpu_commands.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_macros.h"
 
-#include "gt/intel_gpu_commands.h"
-
 static inline struct xe_device *to_xe_device(const struct drm_device *dev)
 {
 	return container_of(dev, struct xe_device, drm);
drivers/gpu/drm/xe/xe_execlist.c +1 -1
index ba9f72694277..59cfbeec09d1 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
@@ -22,7 +23,6 @@
 #include "xe_ring_ops_types.h"
 #include "xe_sched_job.h"
 
-#include "gt/intel_gpu_commands.h"
 #include "i915_reg.h"
 
 #define XE_EXECLIST_HANG_LIMIT 1
drivers/gpu/drm/xe/xe_lrc.c +1 -1
index 5baa3cf53852..4435ec750489 100644
@@ -6,6 +6,7 @@
 #include "xe_lrc.h"
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
@@ -16,7 +17,6 @@
 #include "xe_map.h"
 #include "xe_vm.h"
 
-#include "gt/intel_gpu_commands.h"
 #include "i915_reg.h"
 
 #define GEN8_CTX_VALID				(1 << 0)
drivers/gpu/drm/xe/xe_migrate.c +1 -2
index a3f35fec1b67..6c0033cb238f 100644
@@ -11,6 +11,7 @@
 #include <drm/ttm/ttm_tt.h>
 #include <drm/xe_drm.h>
 
+#include "regs/xe_gpu_commands.h"
 #include "xe_bb.h"
 #include "xe_bo.h"
 #include "xe_engine.h"
@@ -27,8 +28,6 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
-#include "gt/intel_gpu_commands.h"
-
 /**
  * struct xe_migrate - migrate context.
  */
drivers/gpu/drm/xe/xe_ring_ops.c +25 -24

69 lines not on this page · raw message

Signature · 1 line
2.39.0
Reviewed-by on v4 6/12
#8 lore raw

Re: [Intel-xe] [PATCH v4 06/12] drm/xe: Remove dependency on intel_gpu_commands.h

Quoted 10 lines · Lucas De Marchi

Copy the macros used by xe in intel_gpu_commands.h to regs/xe_gpu_commands.h. PIPE_CONTROL_3D_ENGINE_FLAGS and PIPE_CONTROL_3D_ARCH_FLAGS were already defined in drivers/gpu/drm/xe/xe_ring_ops.c and only used there. So let that define to be used instead of also adding to the new header.

v2: Let PIPE_CONTROL_3D_ENGINE_FLAGS/PIPE_CONTROL_3D_ARCH_FLAGS in the
only .c that uses it instead of redefining (Matt Roper)

I assume that, like the register headers, we'll eventually come back and clean this up a bit more. For now we're just copying the important definitions over from i915 as-is.

Quoted 275 lines
---
 drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 79 +++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_bb.c                |  3 +-
 drivers/gpu/drm/xe/xe_device.h            |  3 +-
 drivers/gpu/drm/xe/xe_execlist.c          |  2 +-
 drivers/gpu/drm/xe/xe_lrc.c               |  2 +-
 drivers/gpu/drm/xe/xe_migrate.c           |  3 +-
 drivers/gpu/drm/xe/xe_ring_ops.c          | 49 +++++++-------
 7 files changed, 109 insertions(+), 32 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_gpu_commands.h
drivers/gpu/drm/xe/regs/xe_gpu_commands.h new file +79 -0
new file mode 100644
index 000000000000..288576035ce3
@@ -0,0 +1,79 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_GPU_COMMANDS_H_
+#define _XE_GPU_COMMANDS_H_
+
+#define INSTR_CLIENT_SHIFT      29
+#define   INSTR_MI_CLIENT       0x0
+#define __INSTR(client) ((client) << INSTR_CLIENT_SHIFT)
+
+#define MI_INSTR(opcode, flags) \
+	(__INSTR(INSTR_MI_CLIENT) | (opcode) << 23 | (flags))
+
+#define MI_NOOP			MI_INSTR(0, 0)
+#define MI_USER_INTERRUPT	MI_INSTR(0x02, 0)
+
+#define MI_ARB_ON_OFF		MI_INSTR(0x08, 0)
+#define   MI_ARB_ENABLE			(1<<0)
+#define   MI_ARB_DISABLE		(0<<0)
+
+#define MI_BATCH_BUFFER_END	MI_INSTR(0x0a, 0)
+#define MI_STORE_DATA_IMM	MI_INSTR(0x20, 0)
+
+#define MI_LOAD_REGISTER_IMM(x)	MI_INSTR(0x22, 2*(x)-1)
+#define   MI_LRI_LRM_CS_MMIO		REG_BIT(19)
+#define   MI_LRI_MMIO_REMAP_EN		REG_BIT(17)
+#define   MI_LRI_FORCE_POSTED		(1<<12)
+
+#define MI_FLUSH_DW		MI_INSTR(0x26, 1)
+#define   MI_FLUSH_DW_STORE_INDEX	(1<<21)
+#define   MI_INVALIDATE_TLB		(1<<18)
+#define   MI_FLUSH_DW_CCS		(1<<16)
+#define   MI_FLUSH_DW_OP_STOREDW	(1<<14)
+#define   MI_FLUSH_DW_USE_GTT		(1<<2)
+
+#define MI_BATCH_BUFFER_START_GEN8	MI_INSTR(0x31, 1)
+
+#define XY_CTRL_SURF_COPY_BLT		((2 << 29) | (0x48 << 22) | 3)
+#define   SRC_ACCESS_TYPE_SHIFT		21
+#define   DST_ACCESS_TYPE_SHIFT		20
+#define   CCS_SIZE_MASK			0x3FF
+#define   CCS_SIZE_SHIFT		8
+#define   XY_CTRL_SURF_MOCS_MASK	GENMASK(31, 25)
+#define   NUM_CCS_BYTES_PER_BLOCK	256
+#define   NUM_BYTES_PER_CCS_BYTE	256
+#define   NUM_CCS_BLKS_PER_XFER		1024
+
+#define XY_FAST_COLOR_BLT_CMD		(2 << 29 | 0x44 << 22)
+#define   XY_FAST_COLOR_BLT_DEPTH_32	(2 << 19)
+#define   XY_FAST_COLOR_BLT_DW		16
+#define   XY_FAST_COLOR_BLT_MOCS_MASK	GENMASK(27, 21)
+#define   XY_FAST_COLOR_BLT_MEM_TYPE_SHIFT 31
+
+#define GEN9_XY_FAST_COPY_BLT_CMD	(2 << 29 | 0x42 << 22)
+#define   BLT_DEPTH_32			(3<<24)
+
+#define GFX_OP_PIPE_CONTROL(len)	((0x3<<29)|(0x3<<27)|(0x2<<24)|((len)-2))
+#define   PIPE_CONTROL_TILE_CACHE_FLUSH			(1<<28)
+#define   PIPE_CONTROL_AMFS_FLUSH			(1<<25)
+#define   PIPE_CONTROL_GLOBAL_GTT_IVB			(1<<24)
+#define   PIPE_CONTROL_CS_STALL				(1<<20)
+#define   PIPE_CONTROL_GLOBAL_SNAPSHOT_RESET		(1<<19)
+#define   PIPE_CONTROL_PSD_SYNC				(1<<17)
+#define   PIPE_CONTROL_QW_WRITE				(1<<14)
+#define   PIPE_CONTROL_DEPTH_STALL			(1<<13)
+#define   PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH	(1<<12)
+#define   PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE		(1<<10)
+#define   PIPE_CONTROL_INDIRECT_STATE_DISABLE		(1<<9)
+#define   PIPE_CONTROL_FLUSH_ENABLE			(1<<7)
+#define   PIPE_CONTROL_DC_FLUSH_ENABLE			(1<<5)
+#define   PIPE_CONTROL_VF_CACHE_INVALIDATE		(1<<4)
+#define   PIPE_CONTROL_STALL_AT_SCOREBOARD		(1<<1)
+#define   PIPE_CONTROL_DEPTH_CACHE_FLUSH		(1<<0)
+
+#define MI_ARB_CHECK            MI_INSTR(0x05, 0)
+
+#endif
drivers/gpu/drm/xe/xe_bb.c +1 -2
index d10448d1b4d7..5b24018e2a80 100644
@@ -5,6 +5,7 @@
 
 #include "xe_bb.h"
 
+#include "regs/xe_gpu_commands.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
 #include "xe_hw_fence.h"
@@ -12,8 +13,6 @@
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
-#include "gt/intel_gpu_commands.h"
-
 struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm)
 {
 	struct xe_bb *bb = kmalloc(sizeof(*bb), GFP_KERNEL);
drivers/gpu/drm/xe/xe_device.h +1 -2
index ed55ef567d18..263620953c3b 100644
@@ -11,12 +11,11 @@ struct xe_file;
 
 #include <drm/drm_util.h>
 
+#include "regs/xe_gpu_commands.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_macros.h"
 
-#include "gt/intel_gpu_commands.h"
-
 static inline struct xe_device *to_xe_device(const struct drm_device *dev)
 {
 	return container_of(dev, struct xe_device, drm);
drivers/gpu/drm/xe/xe_execlist.c +1 -1
index ba9f72694277..59cfbeec09d1 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
@@ -22,7 +23,6 @@
 #include "xe_ring_ops_types.h"
 #include "xe_sched_job.h"
 
-#include "gt/intel_gpu_commands.h"
 #include "i915_reg.h"
 
 #define XE_EXECLIST_HANG_LIMIT 1
drivers/gpu/drm/xe/xe_lrc.c +1 -1
index 5baa3cf53852..4435ec750489 100644
@@ -6,6 +6,7 @@
 #include "xe_lrc.h"
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
 #include "xe_bo.h"
@@ -16,7 +17,6 @@
 #include "xe_map.h"
 #include "xe_vm.h"
 
-#include "gt/intel_gpu_commands.h"
 #include "i915_reg.h"
 
 #define GEN8_CTX_VALID				(1 << 0)
drivers/gpu/drm/xe/xe_migrate.c +1 -2
index a3f35fec1b67..6c0033cb238f 100644
@@ -11,6 +11,7 @@
 #include <drm/ttm/ttm_tt.h>
 #include <drm/xe_drm.h>
 
+#include "regs/xe_gpu_commands.h"
 #include "xe_bb.h"
 #include "xe_bo.h"
 #include "xe_engine.h"
@@ -27,8 +28,6 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
-#include "gt/intel_gpu_commands.h"
-
 /**
  * struct xe_migrate - migrate context.
  */
drivers/gpu/drm/xe/xe_ring_ops.c +25 -24
index 276fc9691986..16c56d0a9bb0 100644
@@ -5,6 +5,7 @@
 
 #include "xe_ring_ops.h"
 
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
 #include "xe_engine_types.h"
@@ -14,9 +15,32 @@
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
-#include "gt/intel_gpu_commands.h"
 #include "i915_reg.h"
 
+/*
+ * 3D-related flags that can't be set on _engines_ that lack access to the 3D
+ * pipeline (i.e., CCS engines).
+ */
+#define PIPE_CONTROL_3D_ENGINE_FLAGS (\
+		PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH | \
+		PIPE_CONTROL_DEPTH_CACHE_FLUSH | \
+		PIPE_CONTROL_TILE_CACHE_FLUSH | \
+		PIPE_CONTROL_DEPTH_STALL | \
+		PIPE_CONTROL_STALL_AT_SCOREBOARD | \
+		PIPE_CONTROL_PSD_SYNC | \
+		PIPE_CONTROL_AMFS_FLUSH | \
+		PIPE_CONTROL_VF_CACHE_INVALIDATE | \
+		PIPE_CONTROL_GLOBAL_SNAPSHOT_RESET)
+
+/* 3D-related flags that can't be set on _platforms_ that lack a 3D pipeline */
+#define PIPE_CONTROL_3D_ARCH_FLAGS ( \
+		PIPE_CONTROL_3D_ENGINE_FLAGS | \
+		PIPE_CONTROL_INDIRECT_STATE_DISABLE | \
+		PIPE_CONTROL_FLUSH_ENABLE | \
+		PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | \
+		PIPE_CONTROL_DC_FLUSH_ENABLE)
+
+
 static u32 preparser_disable(bool state)
 {
 	return MI_ARB_CHECK | BIT(8) | state;
@@ -181,29 +205,6 @@ static void __emit_job_gen12_video(struct xe_sched_job *job, struct xe_lrc *lrc,
 	xe_lrc_write_ring(lrc, dw, i * sizeof(*dw));
 }
 
-/*
- * 3D-related flags that can't be set on _engines_ that lack access to the 3D
- * pipeline (i.e., CCS engines).
- */
-#define PIPE_CONTROL_3D_ENGINE_FLAGS (\
-		PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH | \
-		PIPE_CONTROL_DEPTH_CACHE_FLUSH | \
-		PIPE_CONTROL_TILE_CACHE_FLUSH | \
-		PIPE_CONTROL_DEPTH_STALL | \
-		PIPE_CONTROL_STALL_AT_SCOREBOARD | \
-		PIPE_CONTROL_PSD_SYNC | \
-		PIPE_CONTROL_AMFS_FLUSH | \
-		PIPE_CONTROL_VF_CACHE_INVALIDATE | \
-		PIPE_CONTROL_GLOBAL_SNAPSHOT_RESET)
-
-/* 3D-related flags that can't be set on _platforms_ that lack a 3D pipeline */
-#define PIPE_CONTROL_3D_ARCH_FLAGS ( \
-		PIPE_CONTROL_3D_ENGINE_FLAGS | \
-		PIPE_CONTROL_INDIRECT_STATE_DISABLE | \
-		PIPE_CONTROL_FLUSH_ENABLE | \
-		PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | \
-		PIPE_CONTROL_DC_FLUSH_ENABLE)
-
 static void __emit_job_gen12_render_compute(struct xe_sched_job *job,
 					    struct xe_lrc *lrc,
 					    u64 batch_addr, u32 seqno)
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#9 lore raw

PATCH v4 7/12 drm/xe: Remove dependency on i915_reg.h

In reply to Lucas De Marchi

Copy the macros used by xe in i915_reg.h to regs/xe_regs.h. A minimal cleanup is done while copying so they adhere minimally to the coding style. Further reordering and cleaning is left for later.

---
 drivers/gpu/drm/xe/regs/xe_regs.h      | 111 +++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c       |   3 +-
 drivers/gpu/drm/xe/xe_ggtt.c           |   3 +-
 drivers/gpu/drm/xe/xe_gt_clock.c       |   3 +-
 drivers/gpu/drm/xe/xe_guc_pc.c         |   3 +-
 drivers/gpu/drm/xe/xe_hw_engine.c      |   3 +-
 drivers/gpu/drm/xe/xe_irq.c            |   3 +-
 drivers/gpu/drm/xe/xe_lrc.c            |   3 +-
 drivers/gpu/drm/xe/xe_mmio.c           |   3 +-
 drivers/gpu/drm/xe/xe_pci.c            |   3 +-
 drivers/gpu/drm/xe/xe_ring_ops.c       |   4 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c |   3 +-
 drivers/gpu/drm/xe/xe_wa.c             |   3 +-
 13 files changed, 123 insertions(+), 25 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_regs.h
drivers/gpu/drm/xe/regs/xe_regs.h new file +111 -0
new file mode 100644
index 000000000000..53f1ed54fb1c
@@ -0,0 +1,111 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+#ifndef _XE_REGS_H_
+#define _XE_REGS_H_
+
+#include "i915_reg_defs.h"
+
+#define GU_CNTL					_MMIO(0x101010)
+#define   LMEM_INIT				REG_BIT(7)
+
+#define RENDER_RING_BASE			0x02000
+#define BSD_RING_BASE				0x04000
+#define GEN6_BSD_RING_BASE			0x12000
+#define GEN8_BSD2_RING_BASE			0x1c000
+#define GEN11_BSD_RING_BASE			0x1c0000
+#define GEN11_BSD2_RING_BASE			0x1c4000
+#define GEN11_BSD3_RING_BASE			0x1d0000
+#define GEN11_BSD4_RING_BASE			0x1d4000
+#define XEHP_BSD5_RING_BASE			0x1e0000
+#define XEHP_BSD6_RING_BASE			0x1e4000
+#define XEHP_BSD7_RING_BASE			0x1f0000
+#define XEHP_BSD8_RING_BASE			0x1f4000
+#define VEBOX_RING_BASE				0x1a000
+#define GEN11_VEBOX_RING_BASE			0x1c8000
+#define GEN11_VEBOX2_RING_BASE			0x1d8000
+#define XEHP_VEBOX3_RING_BASE			0x1e8000
+#define XEHP_VEBOX4_RING_BASE			0x1f8000
+#define GEN12_COMPUTE0_RING_BASE		0x1a000
+#define GEN12_COMPUTE1_RING_BASE		0x1c000
+#define GEN12_COMPUTE2_RING_BASE		0x1e000
+#define GEN12_COMPUTE3_RING_BASE		0x26000
+#define BLT_RING_BASE				0x22000
+#define XEHPC_BCS1_RING_BASE			0x3e0000
+#define XEHPC_BCS2_RING_BASE			0x3e2000
+#define XEHPC_BCS3_RING_BASE			0x3e4000
+#define XEHPC_BCS4_RING_BASE			0x3e6000
+#define XEHPC_BCS5_RING_BASE			0x3e8000
+#define XEHPC_BCS6_RING_BASE			0x3ea000
+#define XEHPC_BCS7_RING_BASE			0x3ec000
+#define XEHPC_BCS8_RING_BASE			0x3ee000
+#define   GT_WAIT_SEMAPHORE_INTERRUPT		REG_BIT(11)
+#define   GT_CONTEXT_SWITCH_INTERRUPT		(1 <<  8)
+#define   GT_RENDER_PIPECTL_NOTIFY_INTERRUPT	(1 <<  4)
+#define   GT_CS_MASTER_ERROR_INTERRUPT		REG_BIT(3)
+#define   GT_RENDER_USER_INTERRUPT		(1 <<  0)
+
+#define GEN7_FF_THREAD_MODE			_MMIO(0x20a0)
+#define   GEN12_FF_TESSELATION_DOP_GATE_DISABLE BIT(19)
+
+#define PVC_RP_STATE_CAP			_MMIO(0x281014)
+#define MTL_RP_STATE_CAP			_MMIO(0x138000)
+
+#define MTL_MEDIAP_STATE_CAP			_MMIO(0x138020)
+#define   MTL_RP0_CAP_MASK			REG_GENMASK(8, 0)
+#define   MTL_RPN_CAP_MASK			REG_GENMASK(24, 16)
+
+#define MTL_GT_RPE_FREQUENCY			_MMIO(0x13800c)
+#define MTL_MPE_FREQUENCY			_MMIO(0x13802c)
+#define   MTL_RPE_MASK				REG_GENMASK(8, 0)
+
+#define TRANSCODER_A_OFFSET			0x60000
+#define TRANSCODER_B_OFFSET			0x61000
+#define TRANSCODER_C_OFFSET			0x62000
+#define TRANSCODER_D_OFFSET			0x63000
+#define TRANSCODER_DSI0_OFFSET			0x6b000
+#define TRANSCODER_DSI1_OFFSET			0x6b800
+#define PIPE_A_OFFSET				0x70000
+#define PIPE_B_OFFSET				0x71000
+#define PIPE_C_OFFSET				0x72000
+#define PIPE_D_OFFSET				0x73000
+#define PIPE_DSI0_OFFSET			0x7b000
+#define PIPE_DSI1_OFFSET			0x7b800
+
+#define GEN8_PCU_ISR				_MMIO(0x444e0)
+#define GEN8_PCU_IMR				_MMIO(0x444e4)
+#define GEN8_PCU_IIR				_MMIO(0x444e8)
+#define GEN8_PCU_IER				_MMIO(0x444ec)
+
+#define GEN11_GU_MISC_ISR			_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR			_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR			_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER			_MMIO(0x444fc)
+#define   GEN11_GU_MISC_GSE			(1 << 27)
+
+#define GEN11_GFX_MSTR_IRQ			_MMIO(0x190010)
+#define   GEN11_MASTER_IRQ			(1 << 31)
+#define   GEN11_GU_MISC_IRQ			(1 << 29)
+#define   GEN11_DISPLAY_IRQ			(1 << 16)
+#define   GEN11_GT_DW_IRQ(x)			(1 << (x))
+
+#define DG1_MSTR_TILE_INTR			_MMIO(0x190008)
+#define   DG1_MSTR_IRQ				REG_BIT(31)
+#define   DG1_MSTR_TILE(t)			REG_BIT(t)
+
+#define GEN9_TIMESTAMP_OVERRIDE					_MMIO(0x44074)
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT	0
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK	0x3ff
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT	12
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK	(0xf << 12)
+
+#define GGC					_MMIO(0x108040)
+#define   GMS_MASK				REG_GENMASK(15, 8)
+#define   GGMS_MASK				REG_GENMASK(7, 6)
+
+#define GEN12_GSMBASE				_MMIO(0x108100)
+#define GEN12_DSMBASE				_MMIO(0x1080C0)
+#define   GEN12_BDSM_MASK			REG_GENMASK64(63, 20)
+
+#endif
drivers/gpu/drm/xe/xe_execlist.c +1 -2
index 59cfbeec09d1..be0a3741eff8 100644
@@ -11,6 +11,7 @@
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
@@ -23,8 +24,6 @@
 #include "xe_ring_ops_types.h"
 #include "xe_sched_job.h"
 
-#include "i915_reg.h"
-
 #define XE_EXECLIST_HANG_LIMIT 1
 
 #define GEN11_SW_CTX_ID_SHIFT 37
drivers/gpu/drm/xe/xe_ggtt.c +1 -2
index 09637f0845a7..a0d672b6afb2 100644
@@ -11,6 +11,7 @@
 #include <drm/i915_drm.h>
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
@@ -19,8 +20,6 @@
 #include "xe_mmio.h"
 #include "xe_wopcm.h"
 
-#include "i915_reg.h"
-
 /* FIXME: Common file, preferably auto-gen */
 #define MTL_GGTT_PTE_PAT0	BIT_ULL(52)
 #define MTL_GGTT_PTE_PAT1	BIT_ULL(53)
drivers/gpu/drm/xe/xe_gt_clock.c +1 -2
index fd0ca33925cd..60a2966bc1fd 100644
@@ -6,13 +6,12 @@
 #include "xe_gt_clock.h"
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_macros.h"
 #include "xe_mmio.h"
 
-#include "i915_reg.h"
-
 static u32 read_reference_ts_freq(struct xe_gt *gt)
 {
 	u32 ts_override = xe_mmio_read32(gt, GEN9_TIMESTAMP_OVERRIDE.reg);
drivers/gpu/drm/xe/xe_guc_pc.c +1 -2
index f983f47cefb6..acaba5c375e5 100644
@@ -10,6 +10,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
@@ -20,8 +21,6 @@
 #include "xe_mmio.h"
 #include "xe_pcode.h"
 
-#include "i915_reg.h"
-#include "i915_reg_defs.h"
 #include "intel_mchbar_regs.h"
 
 /* For GEN6_RP_STATE_CAP.reg to be merged when the definition moves to Xe */
drivers/gpu/drm/xe/xe_hw_engine.c +1 -2
index 2cf42afd97d9..ff6ba0d8b9a6 100644
@@ -9,6 +9,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_execlist.h"
@@ -23,8 +24,6 @@
 #include "xe_sched_job.h"
 #include "xe_wa.h"
 
-#include "i915_reg.h"
-
 #define MAX_MMIO_BASES 3
 struct engine_info {
 	const char *name;
drivers/gpu/drm/xe/xe_irq.c +1 -2
index 17e204e74714..ae2f65c00fa6 100644
@@ -10,6 +10,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_display.h"
 #include "xe_drv.h"
@@ -18,8 +19,6 @@
 #include "xe_hw_engine.h"
 #include "xe_mmio.h"
 
-#include "i915_reg.h"
-
 static void gen3_assert_iir_is_zero(struct xe_gt *gt, i915_reg_t reg)
 {
 	u32 val = xe_mmio_read32(gt, reg.reg);
drivers/gpu/drm/xe/xe_lrc.c +1 -2
index 4435ec750489..af4518a82db2 100644
@@ -9,6 +9,7 @@
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
@@ -17,8 +18,6 @@
 #include "xe_map.h"
 #include "xe_vm.h"
 
-#include "i915_reg.h"
-
 #define GEN8_CTX_VALID				(1 << 0)
 #define GEN8_CTX_L3LLC_COHERENT			(1 << 5)
 #define GEN8_CTX_PRIVILEGE			(1 << 8)
drivers/gpu/drm/xe/xe_mmio.c +1 -2
index 5e6ca0d2076a..65b0df9bb579 100644
@@ -10,14 +10,13 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_gt_mcr.h"
 #include "xe_macros.h"
 #include "xe_module.h"
 
-#include "i915_reg.h"
-
 #define XEHP_MTCFG_ADDR		_MMIO(0x101800)
 #define TILE_COUNT		REG_GENMASK(15, 8)
 #define GEN12_LMEM_BAR		2
drivers/gpu/drm/xe/xe_pci.c +1 -2
index 29270cce7a46..11dc0de66101 100644
@@ -14,6 +14,7 @@
 #include <drm/drm_drv.h>
 #include <drm/xe_pciids.h>
 
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_drv.h"
 #include "xe_macros.h"
@@ -21,8 +22,6 @@
 #include "xe_pm.h"
 #include "xe_step.h"
 
-#include "i915_reg.h"
-
 #define DEV_INFO_FOR_EACH_FLAG(func) \
 	func(require_force_probe); \
 	func(is_dgfx); \
drivers/gpu/drm/xe/xe_ring_ops.c +1 -3
index 16c56d0a9bb0..4441fe60cd00 100644
@@ -8,6 +8,7 @@
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
+#include "regs/xe_regs.h"
 #include "xe_engine_types.h"
 #include "xe_gt.h"
 #include "xe_lrc.h"
@@ -15,8 +16,6 @@
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
-#include "i915_reg.h"
-
 /*
  * 3D-related flags that can't be set on _engines_ that lack access to the 3D
  * pipeline (i.e., CCS engines).
@@ -40,7 +39,6 @@
 		PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | \
 		PIPE_CONTROL_DC_FLUSH_ENABLE)
 
-
 static u32 preparser_disable(bool state)
 {
 	return MI_ARB_CHECK | BIT(8) | state;
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c +1 -2
index fe0f707ad054..2e8d07ad42ae 100644
@@ -11,8 +11,7 @@
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_range_manager.h>
 
-#include "../i915/i915_reg.h"
-
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
drivers/gpu/drm/xe/xe_wa.c +1 -2
index 155cfd1dcc50..df72b15dfeb0 100644
@@ -9,6 +9,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
@@ -18,8 +19,6 @@
 #include "xe_rtp.h"
 #include "xe_step.h"
 
-#include "i915_reg.h"
-
 /**
  * DOC: Hardware workarounds
  *
Signature · 1 line
2.39.0
Reviewed-by on v4 7/12
#10 lore raw

Re: [Intel-xe] [PATCH v4 07/12] drm/xe: Remove dependency on i915_reg.h

Quoted 34 lines · Lucas De Marchi

Copy the macros used by xe in i915_reg.h to regs/xe_regs.h. A minimal cleanup is done while copying so they adhere minimally to the coding style. Further reordering and cleaning is left for later.

---
 drivers/gpu/drm/xe/regs/xe_regs.h      | 111 +++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c       |   3 +-
 drivers/gpu/drm/xe/xe_ggtt.c           |   3 +-
 drivers/gpu/drm/xe/xe_gt_clock.c       |   3 +-
 drivers/gpu/drm/xe/xe_guc_pc.c         |   3 +-
 drivers/gpu/drm/xe/xe_hw_engine.c      |   3 +-
 drivers/gpu/drm/xe/xe_irq.c            |   3 +-
 drivers/gpu/drm/xe/xe_lrc.c            |   3 +-
 drivers/gpu/drm/xe/xe_mmio.c           |   3 +-
 drivers/gpu/drm/xe/xe_pci.c            |   3 +-
 drivers/gpu/drm/xe/xe_ring_ops.c       |   4 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c |   3 +-
 drivers/gpu/drm/xe/xe_wa.c             |   3 +-
 13 files changed, 123 insertions(+), 25 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_regs.h
drivers/gpu/drm/xe/regs/xe_regs.h new file +6 -0
new file mode 100644
index 000000000000..53f1ed54fb1c
@@ -0,0 +1,111 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+#ifndef _XE_REGS_H_
+#define _XE_REGS_H_

drivers/gpu/drm/xe/regs/xe_regs.h line 16

Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_regs.h new file +10 -0
+
+#include "i915_reg_defs.h"
+
+#define GU_CNTL					_MMIO(0x101010)
+#define   LMEM_INIT				REG_BIT(7)
+
+#define RENDER_RING_BASE			0x02000
+#define BSD_RING_BASE				0x04000
+#define GEN6_BSD_RING_BASE			0x12000
+#define GEN8_BSD2_RING_BASE			0x1c000

The three BSD defines here (and VEBOX_RING_BASE below) should no longer be used as of f86cbd81daa9 ("drm/xe: Remove gen-based mmio offsets from hw engine init"). Not sure if you want to drop them now, or do that as part of the later cleanup; either way,

Quoted 348 lines
drivers/gpu/drm/xe/regs/xe_regs.h new file +95 -0
+#define GEN11_BSD_RING_BASE			0x1c0000
+#define GEN11_BSD2_RING_BASE			0x1c4000
+#define GEN11_BSD3_RING_BASE			0x1d0000
+#define GEN11_BSD4_RING_BASE			0x1d4000
+#define XEHP_BSD5_RING_BASE			0x1e0000
+#define XEHP_BSD6_RING_BASE			0x1e4000
+#define XEHP_BSD7_RING_BASE			0x1f0000
+#define XEHP_BSD8_RING_BASE			0x1f4000
+#define VEBOX_RING_BASE				0x1a000
+#define GEN11_VEBOX_RING_BASE			0x1c8000
+#define GEN11_VEBOX2_RING_BASE			0x1d8000
+#define XEHP_VEBOX3_RING_BASE			0x1e8000
+#define XEHP_VEBOX4_RING_BASE			0x1f8000
+#define GEN12_COMPUTE0_RING_BASE		0x1a000
+#define GEN12_COMPUTE1_RING_BASE		0x1c000
+#define GEN12_COMPUTE2_RING_BASE		0x1e000
+#define GEN12_COMPUTE3_RING_BASE		0x26000
+#define BLT_RING_BASE				0x22000
+#define XEHPC_BCS1_RING_BASE			0x3e0000
+#define XEHPC_BCS2_RING_BASE			0x3e2000
+#define XEHPC_BCS3_RING_BASE			0x3e4000
+#define XEHPC_BCS4_RING_BASE			0x3e6000
+#define XEHPC_BCS5_RING_BASE			0x3e8000
+#define XEHPC_BCS6_RING_BASE			0x3ea000
+#define XEHPC_BCS7_RING_BASE			0x3ec000
+#define XEHPC_BCS8_RING_BASE			0x3ee000
+#define   GT_WAIT_SEMAPHORE_INTERRUPT		REG_BIT(11)
+#define   GT_CONTEXT_SWITCH_INTERRUPT		(1 <<  8)
+#define   GT_RENDER_PIPECTL_NOTIFY_INTERRUPT	(1 <<  4)
+#define   GT_CS_MASTER_ERROR_INTERRUPT		REG_BIT(3)
+#define   GT_RENDER_USER_INTERRUPT		(1 <<  0)
+
+#define GEN7_FF_THREAD_MODE			_MMIO(0x20a0)
+#define   GEN12_FF_TESSELATION_DOP_GATE_DISABLE BIT(19)
+
+#define PVC_RP_STATE_CAP			_MMIO(0x281014)
+#define MTL_RP_STATE_CAP			_MMIO(0x138000)
+
+#define MTL_MEDIAP_STATE_CAP			_MMIO(0x138020)
+#define   MTL_RP0_CAP_MASK			REG_GENMASK(8, 0)
+#define   MTL_RPN_CAP_MASK			REG_GENMASK(24, 16)
+
+#define MTL_GT_RPE_FREQUENCY			_MMIO(0x13800c)
+#define MTL_MPE_FREQUENCY			_MMIO(0x13802c)
+#define   MTL_RPE_MASK				REG_GENMASK(8, 0)
+
+#define TRANSCODER_A_OFFSET			0x60000
+#define TRANSCODER_B_OFFSET			0x61000
+#define TRANSCODER_C_OFFSET			0x62000
+#define TRANSCODER_D_OFFSET			0x63000
+#define TRANSCODER_DSI0_OFFSET			0x6b000
+#define TRANSCODER_DSI1_OFFSET			0x6b800
+#define PIPE_A_OFFSET				0x70000
+#define PIPE_B_OFFSET				0x71000
+#define PIPE_C_OFFSET				0x72000
+#define PIPE_D_OFFSET				0x73000
+#define PIPE_DSI0_OFFSET			0x7b000
+#define PIPE_DSI1_OFFSET			0x7b800
+
+#define GEN8_PCU_ISR				_MMIO(0x444e0)
+#define GEN8_PCU_IMR				_MMIO(0x444e4)
+#define GEN8_PCU_IIR				_MMIO(0x444e8)
+#define GEN8_PCU_IER				_MMIO(0x444ec)
+
+#define GEN11_GU_MISC_ISR			_MMIO(0x444f0)
+#define GEN11_GU_MISC_IMR			_MMIO(0x444f4)
+#define GEN11_GU_MISC_IIR			_MMIO(0x444f8)
+#define GEN11_GU_MISC_IER			_MMIO(0x444fc)
+#define   GEN11_GU_MISC_GSE			(1 << 27)
+
+#define GEN11_GFX_MSTR_IRQ			_MMIO(0x190010)
+#define   GEN11_MASTER_IRQ			(1 << 31)
+#define   GEN11_GU_MISC_IRQ			(1 << 29)
+#define   GEN11_DISPLAY_IRQ			(1 << 16)
+#define   GEN11_GT_DW_IRQ(x)			(1 << (x))
+
+#define DG1_MSTR_TILE_INTR			_MMIO(0x190008)
+#define   DG1_MSTR_IRQ				REG_BIT(31)
+#define   DG1_MSTR_TILE(t)			REG_BIT(t)
+
+#define GEN9_TIMESTAMP_OVERRIDE					_MMIO(0x44074)
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_SHIFT	0
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DIVIDER_MASK	0x3ff
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_SHIFT	12
+#define   GEN9_TIMESTAMP_OVERRIDE_US_COUNTER_DENOMINATOR_MASK	(0xf << 12)
+
+#define GGC					_MMIO(0x108040)
+#define   GMS_MASK				REG_GENMASK(15, 8)
+#define   GGMS_MASK				REG_GENMASK(7, 6)
+
+#define GEN12_GSMBASE				_MMIO(0x108100)
+#define GEN12_DSMBASE				_MMIO(0x1080C0)
+#define   GEN12_BDSM_MASK			REG_GENMASK64(63, 20)
+
+#endif
drivers/gpu/drm/xe/xe_execlist.c +1 -2
index 59cfbeec09d1..be0a3741eff8 100644
@@ -11,6 +11,7 @@
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine.h"
@@ -23,8 +24,6 @@
 #include "xe_ring_ops_types.h"
 #include "xe_sched_job.h"
 
-#include "i915_reg.h"
-
 #define XE_EXECLIST_HANG_LIMIT 1
 
 #define GEN11_SW_CTX_ID_SHIFT 37
drivers/gpu/drm/xe/xe_ggtt.c +1 -2
index 09637f0845a7..a0d672b6afb2 100644
@@ -11,6 +11,7 @@
 #include <drm/i915_drm.h>
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
@@ -19,8 +20,6 @@
 #include "xe_mmio.h"
 #include "xe_wopcm.h"
 
-#include "i915_reg.h"
-
 /* FIXME: Common file, preferably auto-gen */
 #define MTL_GGTT_PTE_PAT0	BIT_ULL(52)
 #define MTL_GGTT_PTE_PAT1	BIT_ULL(53)
drivers/gpu/drm/xe/xe_gt_clock.c +1 -2
index fd0ca33925cd..60a2966bc1fd 100644
@@ -6,13 +6,12 @@
 #include "xe_gt_clock.h"
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_macros.h"
 #include "xe_mmio.h"
 
-#include "i915_reg.h"
-
 static u32 read_reference_ts_freq(struct xe_gt *gt)
 {
 	u32 ts_override = xe_mmio_read32(gt, GEN9_TIMESTAMP_OVERRIDE.reg);
drivers/gpu/drm/xe/xe_guc_pc.c +1 -2
index f983f47cefb6..acaba5c375e5 100644
@@ -10,6 +10,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
@@ -20,8 +21,6 @@
 #include "xe_mmio.h"
 #include "xe_pcode.h"
 
-#include "i915_reg.h"
-#include "i915_reg_defs.h"
 #include "intel_mchbar_regs.h"
 
 /* For GEN6_RP_STATE_CAP.reg to be merged when the definition moves to Xe */
drivers/gpu/drm/xe/xe_hw_engine.c +1 -2
index 2cf42afd97d9..ff6ba0d8b9a6 100644
@@ -9,6 +9,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_execlist.h"
@@ -23,8 +24,6 @@
 #include "xe_sched_job.h"
 #include "xe_wa.h"
 
-#include "i915_reg.h"
-
 #define MAX_MMIO_BASES 3
 struct engine_info {
 	const char *name;
drivers/gpu/drm/xe/xe_irq.c +1 -2
index 17e204e74714..ae2f65c00fa6 100644
@@ -10,6 +10,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_display.h"
 #include "xe_drv.h"
@@ -18,8 +19,6 @@
 #include "xe_hw_engine.h"
 #include "xe_mmio.h"
 
-#include "i915_reg.h"
-
 static void gen3_assert_iir_is_zero(struct xe_gt *gt, i915_reg_t reg)
 {
 	u32 val = xe_mmio_read32(gt, reg.reg);
drivers/gpu/drm/xe/xe_lrc.c +1 -2
index 4435ec750489..af4518a82db2 100644
@@ -9,6 +9,7 @@
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_engine_types.h"
@@ -17,8 +18,6 @@
 #include "xe_map.h"
 #include "xe_vm.h"
 
-#include "i915_reg.h"
-
 #define GEN8_CTX_VALID				(1 << 0)
 #define GEN8_CTX_L3LLC_COHERENT			(1 << 5)
 #define GEN8_CTX_PRIVILEGE			(1 << 8)
drivers/gpu/drm/xe/xe_mmio.c +1 -2
index 5e6ca0d2076a..65b0df9bb579 100644
@@ -10,14 +10,13 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_gt.h"
 #include "xe_gt_mcr.h"
 #include "xe_macros.h"
 #include "xe_module.h"
 
-#include "i915_reg.h"
-
 #define XEHP_MTCFG_ADDR		_MMIO(0x101800)
 #define TILE_COUNT		REG_GENMASK(15, 8)
 #define GEN12_LMEM_BAR		2
drivers/gpu/drm/xe/xe_pci.c +1 -2
index 29270cce7a46..11dc0de66101 100644
@@ -14,6 +14,7 @@
 #include <drm/drm_drv.h>
 #include <drm/xe_pciids.h>
 
+#include "regs/xe_regs.h"
 #include "xe_device.h"
 #include "xe_drv.h"
 #include "xe_macros.h"
@@ -21,8 +22,6 @@
 #include "xe_pm.h"
 #include "xe_step.h"
 
-#include "i915_reg.h"
-
 #define DEV_INFO_FOR_EACH_FLAG(func) \
 	func(require_force_probe); \
 	func(is_dgfx); \
drivers/gpu/drm/xe/xe_ring_ops.c +1 -3
index 16c56d0a9bb0..4441fe60cd00 100644
@@ -8,6 +8,7 @@
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "regs/xe_lrc_layout.h"
+#include "regs/xe_regs.h"
 #include "xe_engine_types.h"
 #include "xe_gt.h"
 #include "xe_lrc.h"
@@ -15,8 +16,6 @@
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
-#include "i915_reg.h"
-
 /*
  * 3D-related flags that can't be set on _engines_ that lack access to the 3D
  * pipeline (i.e., CCS engines).
@@ -40,7 +39,6 @@
 		PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | \
 		PIPE_CONTROL_DC_FLUSH_ENABLE)
 
-
 static u32 preparser_disable(bool state)
 {
 	return MI_ARB_CHECK | BIT(8) | state;
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c +1 -2
index fe0f707ad054..2e8d07ad42ae 100644
@@ -11,8 +11,7 @@
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_range_manager.h>
 
-#include "../i915/i915_reg.h"
-
+#include "regs/xe_regs.h"
 #include "xe_bo.h"
 #include "xe_device.h"
 #include "xe_gt.h"
drivers/gpu/drm/xe/xe_wa.c +1 -2
index 155cfd1dcc50..df72b15dfeb0 100644
@@ -9,6 +9,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_gt_regs.h"
+#include "regs/xe_regs.h"
 #include "xe_device_types.h"
 #include "xe_force_wake.h"
 #include "xe_gt.h"
@@ -18,8 +19,6 @@
 #include "xe_rtp.h"
 #include "xe_step.h"
 
-#include "i915_reg.h"
-
 /**
  * DOC: Hardware workarounds
  *
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#11 lore raw

Re: [Intel-xe] [PATCH v4 07/12] drm/xe: Remove dependency on i915_reg.h

Quoted 42 lines · Matt Roper
Quoted 41 lines · Lucas De Marchi

Copy the macros used by xe in i915_reg.h to regs/xe_regs.h. A minimal cleanup is done while copying so they adhere minimally to the coding style. Further reordering and cleaning is left for later.

---
 drivers/gpu/drm/xe/regs/xe_regs.h      | 111 +++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c       |   3 +-
 drivers/gpu/drm/xe/xe_ggtt.c           |   3 +-
 drivers/gpu/drm/xe/xe_gt_clock.c       |   3 +-
 drivers/gpu/drm/xe/xe_guc_pc.c         |   3 +-
 drivers/gpu/drm/xe/xe_hw_engine.c      |   3 +-
 drivers/gpu/drm/xe/xe_irq.c            |   3 +-
 drivers/gpu/drm/xe/xe_lrc.c            |   3 +-
 drivers/gpu/drm/xe/xe_mmio.c           |   3 +-
 drivers/gpu/drm/xe/xe_pci.c            |   3 +-
 drivers/gpu/drm/xe/xe_ring_ops.c       |   4 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c |   3 +-
 drivers/gpu/drm/xe/xe_wa.c             |   3 +-
 13 files changed, 123 insertions(+), 25 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_regs.h
drivers/gpu/drm/xe/regs/xe_regs.h new file +13 -0
new file mode 100644
index 000000000000..53f1ed54fb1c
@@ -0,0 +1,111 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+#ifndef _XE_REGS_H_
+#define _XE_REGS_H_
+
+#include "i915_reg_defs.h"
+
+#define GU_CNTL					_MMIO(0x101010)
+#define   LMEM_INIT				REG_BIT(7)
+
+#define RENDER_RING_BASE			0x02000
Quoted 8 lines

drivers/gpu/drm/xe/regs/xe_regs.h line 16

Quoted 3 lines
drivers/gpu/drm/xe/regs/xe_regs.h new file +3 -0
+#define BSD_RING_BASE				0x04000
+#define GEN6_BSD_RING_BASE			0x12000
+#define GEN8_BSD2_RING_BASE			0x1c000

The three BSD defines here (and VEBOX_RING_BASE below) should no longer be used as of f86cbd81daa9 ("drm/xe: Remove gen-based mmio offsets from hw engine init"). Not sure if you want to drop them now, or do that as part of the later cleanup; either way,

seems easy enough to squash while pushing with no risk of breaking something

Quoted 2 lines

thanks

Lucas De Marchi

#12 lore raw

PATCH v4 8/12 drm/xe/guc_pc: Move gt register to the proper place

In reply to Lucas De Marchi

Move a few defines from xe_guc_pc.c to the right register, now that there is one: xe_gt_regs.h.

---
 drivers/gpu/drm/xe/regs/xe_gt_regs.h | 2 ++
 drivers/gpu/drm/xe/xe_guc_pc.c       | 6 ------
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/regs/xe_gt_regs.h +2 -0
index 091e9cc94a2d..9290505d6596 100644
@@ -187,6 +187,7 @@
 #define   DFR_DISABLE				(1 << 9)
 
 #define GEN6_RPNSWREQ				_MMIO(0xa008)
+#define   REQ_RATIO_MASK			REG_GENMASK(31, 23)
 #define GEN6_RC_CONTROL				_MMIO(0xa090)
 #define GEN6_RC_STATE				_MMIO(0xa094)
 
@@ -243,6 +244,7 @@
 #define   FORCEWAKE_KERNEL_FALLBACK		BIT(15)
 
 #define GEN6_GT_CORE_STATUS			_MMIO(0x138060)
+#define   RCN_MASK				REG_GENMASK(2, 0)
 #define   GEN6_RC0				0
 #define   GEN6_RC6				3
 
drivers/gpu/drm/xe/xe_guc_pc.c +0 -6
index acaba5c375e5..d91dad8638ef 100644
@@ -31,12 +31,6 @@
 #define GEN10_FREQ_INFO_REC	_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5ef0)
 #define   RPE_MASK		REG_GENMASK(15, 8)
 
-/* For GEN6_RPNSWREQ.reg to be merged when the definition moves to Xe */
-#define   REQ_RATIO_MASK	REG_GENMASK(31, 23)
-
-/* For GEN6_GT_CORE_STATUS.reg to be merged when the definition moves to Xe */
-#define   RCN_MASK	REG_GENMASK(2, 0)
-
 #define GEN12_RPSTAT1		_MMIO(0x1381b4)
 #define   GEN12_CAGF_MASK	REG_GENMASK(19, 11)
 
Signature · 1 line
2.39.0
#13 lore raw

PATCH v4 9/12 drm/xe: Remove dependency on intel_mchbar_regs.h

In reply to Lucas De Marchi

The only thing really needed is the base offset, MCHBAR_MIRROR_BASE_SNB. Remove the include and just define it inplace.

---
 drivers/gpu/drm/xe/display/ext/intel_device_info.h |  2 ++
 drivers/gpu/drm/xe/xe_display.h                    |  5 ++---
 drivers/gpu/drm/xe/xe_guc_pc.c                     | 10 +++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/xe/display/ext/intel_device_info.h +2 -0
index dd05f298019e..959acb261007 100644
@@ -28,6 +28,8 @@
 #include <linux/types.h>
 #include "xe_device_types.h"
 
+struct drm_i915_private;
+
 /* Minimal parts used by xe */
 #define intel_runtime_info xe_device_display_info
 
drivers/gpu/drm/xe/xe_display.h +2 -3
index 262cd5442489..5c09962f4906 100644
@@ -6,13 +6,11 @@
 #ifndef _XE_DISPLAY_H_
 #define _XE_DISPLAY_H_
 
-#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 #include <drm/drm_drv.h>
 
 #include "xe_device.h"
 
-#include "display/ext/i915_irq.h"
-#include "display/intel_opregion.h"
+#if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
 
 int xe_display_enable(struct pci_dev *pdev, struct drm_driver *driver);
 
@@ -44,6 +42,7 @@ void xe_display_pm_resume_early(struct xe_device *xe);
 void xe_display_pm_resume(struct xe_device *xe);
 
 #else
+
 static inline int
 xe_display_enable(struct pci_dev *pdev, struct drm_driver *driver) { return 0; };
 
drivers/gpu/drm/xe/xe_guc_pc.c +5 -5
index d91dad8638ef..5a8d827ba770 100644
@@ -21,12 +21,12 @@
 #include "xe_mmio.h"
 #include "xe_pcode.h"
 
-#include "intel_mchbar_regs.h"
+#define MCHBAR_MIRROR_BASE_SNB	0x140000
 
-/* For GEN6_RP_STATE_CAP.reg to be merged when the definition moves to Xe */
-#define   RP0_MASK	REG_GENMASK(7, 0)
-#define   RP1_MASK	REG_GENMASK(15, 8)
-#define   RPN_MASK	REG_GENMASK(23, 16)
+#define GEN6_RP_STATE_CAP			_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5998)
+#define   RP0_MASK				REG_GENMASK(7, 0)
+#define   RP1_MASK				REG_GENMASK(15, 8)
+#define   RPN_MASK				REG_GENMASK(23, 16)
 
 #define GEN10_FREQ_INFO_REC	_MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5ef0)
 #define   RPE_MASK		REG_GENMASK(15, 8)
Signature · 1 line
2.39.0
#14 lore raw

PATCH v4 10/12 drm/xe: Add missing includes for i915_reg_defs.h and others

In reply to Lucas De Marchi

Several places were missing the i915_reg_defs.h include. Any place using the i915_reg_t typedef or macros like _MMIO(), FIELD_PREP(), etc should include the register defining them explicitly.

This has gone unnoticed due to the way the display is integrated. By including the display headers the i915_reg_defs.h is indirectly included. Also, although the Makefile tries to add more cflags for the display part, it fails in doing so: those cflags are actually added to the entire Makefile (see subdir-ccflags documentation).

This change is obtained by temporarily removing display from xe and fixing the breakages.

---
 drivers/gpu/drm/xe/xe_device.c       | 6 ++++--
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 ++
 drivers/gpu/drm/xe/xe_gt_topology.c  | 2 ++
 drivers/gpu/drm/xe/xe_migrate.c      | 2 ++
 drivers/gpu/drm/xe/xe_pcode_api.h    | 2 ++
 drivers/gpu/drm/xe/xe_step.c         | 2 ++
 6 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_device.c +4 -2
index 45e3c740fda2..8f2b2acd4024 100644
@@ -31,6 +31,10 @@
 #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)
 {
 	struct xe_file *xef;
@@ -405,8 +409,6 @@ static void device_kill_persitent_engines(struct xe_device *xe,
 	mutex_unlock(&xe->persitent_engines.lock);
 }
 
-#define SOFTWARE_FLAGS_SPR33         _MMIO(0x4F084)
-
 void xe_device_wmb(struct xe_device *xe)
 {
 	struct xe_gt *gt = xe_device_get_gt(xe, 0);
drivers/gpu/drm/xe/xe_gt_pagefault.c +2 -0
index 0e7047b89a83..19403dbea9f5 100644
@@ -20,6 +20,8 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
+#include "../i915/i915_reg_defs.h"
+
 struct pagefault {
 	u64 page_addr;
 	u32 asid;
drivers/gpu/drm/xe/xe_gt_topology.c +2 -0
index c76aaea1887c..264d6429318b 100644
@@ -10,6 +10,8 @@
 #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)
 
drivers/gpu/drm/xe/xe_migrate.c +2 -0
index 6c0033cb238f..d845f7cadbd4 100644
@@ -28,6 +28,8 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
+#include "../i915/i915_reg_defs.h"
+
 /**
  * struct xe_migrate - migrate context.
  */
drivers/gpu/drm/xe/xe_pcode_api.h +2 -0
index 0762c8a912c7..2103f684a8b5 100644
@@ -5,6 +5,8 @@
 
 /* Internal to xe_pcode */
 
+#include "../i915/i915_reg_defs.h"
+
 #define PCODE_MAILBOX			_MMIO(0x138124)
 #define   PCODE_READY			REG_BIT(31)
 #define   PCODE_MB_PARAM2		REG_GENMASK(23, 16)
drivers/gpu/drm/xe/xe_step.c +2 -0
index ca77d0971529..e5e77cb9ea09 100644
@@ -8,6 +8,8 @@
 #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.
Signature · 1 line
2.39.0
#15 lore raw

Re: [Intel-xe] [PATCH v4 10/12] drm/xe: Add missing includes for i915_reg_defs.h and others

Quoted 52 lines · Lucas De Marchi

Several places were missing the i915_reg_defs.h include. Any place using the i915_reg_t typedef or macros like _MMIO(), FIELD_PREP(), etc should include the register defining them explicitly.

This has gone unnoticed due to the way the display is integrated. By including the display headers the i915_reg_defs.h is indirectly included. Also, although the Makefile tries to add more cflags for the display part, it fails in doing so: those cflags are actually added to the entire Makefile (see subdir-ccflags documentation).

This change is obtained by temporarily removing display from xe and fixing the breakages.

---
 drivers/gpu/drm/xe/xe_device.c       | 6 ++++--
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 ++
 drivers/gpu/drm/xe/xe_gt_topology.c  | 2 ++
 drivers/gpu/drm/xe/xe_migrate.c      | 2 ++
 drivers/gpu/drm/xe/xe_pcode_api.h    | 2 ++
 drivers/gpu/drm/xe/xe_step.c         | 2 ++
 6 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_device.c +4 -2
index 45e3c740fda2..8f2b2acd4024 100644
@@ -31,6 +31,10 @@
 #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)
 {
 	struct xe_file *xef;
@@ -405,8 +409,6 @@ static void device_kill_persitent_engines(struct xe_device *xe,
 	mutex_unlock(&xe->persitent_engines.lock);
 }
 
-#define SOFTWARE_FLAGS_SPR33         _MMIO(0x4F084)
-
 void xe_device_wmb(struct xe_device *xe)
 {
 	struct xe_gt *gt = xe_device_get_gt(xe, 0);
drivers/gpu/drm/xe/xe_gt_pagefault.c +0 -0
index 0e7047b89a83..19403dbea9f5 100644

drivers/gpu/drm/xe/xe_gt_pagefault.c line 24

Quoted 5 lines
drivers/gpu/drm/xe/xe_gt_pagefault.c +2 -0
@@ -20,6 +20,8 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
+#include "../i915/i915_reg_defs.h"
+

Does this file actually use any i915/xe register stuff or is it just the generic FIELD_GET() definitions causing a problem? If the latter, then maybe

        #include <linux/bitfield.h>

would be more appropriate?

drivers/gpu/drm/xe/xe_gt_topology.c line 14

Quoted 13 lines
drivers/gpu/drm/xe/xe_gt_pagefault.c +0 -0
 struct pagefault {
 	u64 page_addr;
 	u32 asid;
drivers/gpu/drm/xe/xe_gt_topology.c +2 -0
index c76aaea1887c..264d6429318b 100644
@@ -10,6 +10,8 @@
 #include "xe_gt.h"
 #include "xe_mmio.h"
 
+#include "../i915/i915_reg_defs.h"
+

I think there are some registers defined at the top of this file from before we figured out what we were going to do about register definitions; those should probably migrate into the new register headers. And then we can just include the register header instead of the reg_defs.

drivers/gpu/drm/xe/xe_migrate.c line 31

Quoted 12 lines
drivers/gpu/drm/xe/xe_gt_topology.c +0 -0
 #define XE_MAX_DSS_FUSE_BITS (32 * XE_MAX_DSS_FUSE_REGS)
 #define XE_MAX_EU_FUSE_BITS (32 * XE_MAX_EU_FUSE_REGS)
 
drivers/gpu/drm/xe/xe_migrate.c +1 -0
index 6c0033cb238f..d845f7cadbd4 100644
@@ -28,6 +28,8 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
+#include "../i915/i915_reg_defs.h"

Maybe another candidate for linux/bitfield.h?

Quoted 22 lines
drivers/gpu/drm/xe/xe_migrate.c +1 -0
+
 /**
  * struct xe_migrate - migrate context.
  */
drivers/gpu/drm/xe/xe_pcode_api.h +2 -0
index 0762c8a912c7..2103f684a8b5 100644
@@ -5,6 +5,8 @@
 
 /* Internal to xe_pcode */
 
+#include "../i915/i915_reg_defs.h"
+
 #define PCODE_MAILBOX			_MMIO(0x138124)
 #define   PCODE_READY			REG_BIT(31)
 #define   PCODE_MB_PARAM2		REG_GENMASK(23, 16)
drivers/gpu/drm/xe/xe_step.c +0 -0
index ca77d0971529..e5e77cb9ea09 100644

drivers/gpu/drm/xe/xe_step.c line 11

Quoted 4 lines
drivers/gpu/drm/xe/xe_step.c +1 -0
@@ -8,6 +8,8 @@
 #include "xe_device.h"
 #include "xe_platform_types.h"
 
+#include "../i915/i915_reg_defs.h"

And another linux/bitfield.h here too?

Matt

Quoted 7 lines
drivers/gpu/drm/xe/xe_step.c +1 -0
+
 /*
  * Provide mapping between PCI's revision ID to the individual GMD
  * (Graphics/Media/Display) stepping values that can be compared numerically.
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#16 lore raw

Re: [Intel-xe] [PATCH v4 10/12] drm/xe: Add missing includes for i915_reg_defs.h and others

Quoted 63 lines · Matt Roper
Quoted 52 lines · Lucas De Marchi

Several places were missing the i915_reg_defs.h include. Any place using the i915_reg_t typedef or macros like _MMIO(), FIELD_PREP(), etc should include the register defining them explicitly.

This has gone unnoticed due to the way the display is integrated. By including the display headers the i915_reg_defs.h is indirectly included. Also, although the Makefile tries to add more cflags for the display part, it fails in doing so: those cflags are actually added to the entire Makefile (see subdir-ccflags documentation).

This change is obtained by temporarily removing display from xe and fixing the breakages.

---
 drivers/gpu/drm/xe/xe_device.c       | 6 ++++--
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 ++
 drivers/gpu/drm/xe/xe_gt_topology.c  | 2 ++
 drivers/gpu/drm/xe/xe_migrate.c      | 2 ++
 drivers/gpu/drm/xe/xe_pcode_api.h    | 2 ++
 drivers/gpu/drm/xe/xe_step.c         | 2 ++
 6 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_device.c +4 -2
index 45e3c740fda2..8f2b2acd4024 100644
@@ -31,6 +31,10 @@
 #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)
 {
 	struct xe_file *xef;
@@ -405,8 +409,6 @@ static void device_kill_persitent_engines(struct xe_device *xe,
 	mutex_unlock(&xe->persitent_engines.lock);
 }
 
-#define SOFTWARE_FLAGS_SPR33         _MMIO(0x4F084)
-
 void xe_device_wmb(struct xe_device *xe)
 {
 	struct xe_gt *gt = xe_device_get_gt(xe, 0);
drivers/gpu/drm/xe/xe_gt_pagefault.c +0 -0
index 0e7047b89a83..19403dbea9f5 100644

drivers/gpu/drm/xe/xe_gt_pagefault.c line 24

Quoted 5 lines
drivers/gpu/drm/xe/xe_gt_pagefault.c +2 -0
@@ -20,6 +20,8 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
+#include "../i915/i915_reg_defs.h"
+

Does this file actually use any i915/xe register stuff or is it just the generic FIELD_GET() definitions causing a problem? If the latter, then maybe

Quoted 3 lines
       #include <linux/bitfield.h>

would be more appropriate?

yep, looks like we can do with only linux/bitfield.h

Main issue in some place is the use of REG_BIT, REG_GENMASK, _MMIO and MCR_REG, that are i915ism. But here none of those are used.

For REG_BIT/REG_GENMASK, I think what we want longterm is to add a REG_BIT_U32 or GENMASK_U32 or so in a generic kernel header so we don't need to rely on the definition from i915.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/xe/xe_gt_pagefault.c +0 -0
 struct pagefault {
 	u64 page_addr;
 	u32 asid;
drivers/gpu/drm/xe/xe_gt_topology.c +0 -0
index c76aaea1887c..264d6429318b 100644
@@ -10,6 +10,8 @@
 #include "xe_gt.h"
 #include "xe_mmio.h"
 
Quoted 8 lines

drivers/gpu/drm/xe/xe_gt_topology.c line 14

Quoted 2 lines
drivers/gpu/drm/xe/xe_gt_topology.c +2 -0
+#include "../i915/i915_reg_defs.h"
+

I think there are some registers defined at the top of this file from before we figured out what we were going to do about register definitions; those should probably migrate into the new register headers. And then we can just include the register header instead of the reg_defs.

I was thinking about leaving the register definitions that are need in just one compilation unit in that unit rather than moving to the header. But that was before the i915 -> xe header transition. So, yeah... I think we can just move them to the header.

Quoted 41 lines

drivers/gpu/drm/xe/xe_migrate.c line 31

Quoted 13 lines
drivers/gpu/drm/xe/xe_gt_topology.c +0 -0
 #define XE_MAX_DSS_FUSE_BITS (32 * XE_MAX_DSS_FUSE_REGS)
 #define XE_MAX_EU_FUSE_BITS (32 * XE_MAX_EU_FUSE_REGS)
 
drivers/gpu/drm/xe/xe_migrate.c +1 -0
index 6c0033cb238f..d845f7cadbd4 100644
@@ -28,6 +28,8 @@
 #include "xe_trace.h"
 #include "xe_vm.h"
 
+#include "../i915/i915_reg_defs.h"

Maybe another candidate for linux/bitfield.h?

Quoted 25 lines
drivers/gpu/drm/xe/xe_migrate.c +1 -0
+
 /**
  * struct xe_migrate - migrate context.
  */
drivers/gpu/drm/xe/xe_pcode_api.h +2 -0
index 0762c8a912c7..2103f684a8b5 100644
@@ -5,6 +5,8 @@
 
 /* Internal to xe_pcode */
 
+#include "../i915/i915_reg_defs.h"
+
 #define PCODE_MAILBOX			_MMIO(0x138124)
 #define   PCODE_READY			REG_BIT(31)
 #define   PCODE_MB_PARAM2		REG_GENMASK(23, 16)
drivers/gpu/drm/xe/xe_step.c +0 -0
index ca77d0971529..e5e77cb9ea09 100644
@@ -8,6 +8,8 @@
 #include "xe_device.h"
 #include "xe_platform_types.h"
 
Quoted 3 lines

drivers/gpu/drm/xe/xe_step.c line 11

Quoted 1 line
drivers/gpu/drm/xe/xe_step.c +1 -0
+#include "../i915/i915_reg_defs.h"

And another linux/bitfield.h here too?

yeah, I will move those to use linux/bitfield.h

thanks
Lucas De Marchi

Quoted 17 lines

Matt

Quoted 7 lines
drivers/gpu/drm/xe/xe_step.c +1 -1
+
 /*
  * Provide mapping between PCI's revision ID to the individual GMD
  * (Graphics/Media/Display) stepping values that can be compared numerically.
--

2.39.0

Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#17 lore raw

PATCH v4 11/12 drm/xe: Add xe_reg_defs.h

In reply to Lucas De Marchi

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.

---
 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
drivers/gpu/drm/xe/regs/xe_engine_regs.h +1 -1
index 6dfa3cf2fd43..2aa67d001c34 100644
@@ -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)
 
drivers/gpu/drm/xe/regs/xe_gt_regs.h +1 -1
index 9290505d6596..3bf2fc3f80d8 100644
@@ -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)
drivers/gpu/drm/xe/regs/xe_reg_defs.h new file +11 -0
new file mode 100644
index 000000000000..5f6735697d9c
@@ -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
drivers/gpu/drm/xe/regs/xe_regs.h +1 -1
index 53f1ed54fb1c..74588d42a339 100644
@@ -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)
drivers/gpu/drm/xe/xe_device.c +1 -2
index 8f2b2acd4024..87d3d2cde665 100644
@@ -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)
drivers/gpu/drm/xe/xe_gt_mcr.h +1 -1
index c31987d2177c..2a6cd38c8cb7 100644
@@ -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;
drivers/gpu/drm/xe/xe_gt_pagefault.c +1 -2
index 19403dbea9f5..062430394a33 100644
@@ -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;
drivers/gpu/drm/xe/xe_gt_topology.c +1 -2
index 264d6429318b..c03aa10b4c21 100644
@@ -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)
 
drivers/gpu/drm/xe/xe_guc.c +0 -2
index 661effa9830f..a8b0171ed7c2 100644
@@ -22,8 +22,6 @@
 #include "xe_uc_fw.h"
 #include "xe_wopcm.h"
 
-#include "i915_reg_defs.h"
-
 /* TODO: move to common file */
 #define GUC_PVC_MOCS_INDEX_MASK		REG_GENMASK(25, 24)
 #define PVC_MOCS_UC_INDEX		1
drivers/gpu/drm/xe/xe_guc_reg.h +1 -1
index 513a7e0c8a5a..b5ebec30140d 100644
@@ -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 */
 
drivers/gpu/drm/xe/xe_migrate.c +1 -2
index d845f7cadbd4..4872adadeb8e 100644
@@ -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.
  */
drivers/gpu/drm/xe/xe_pcode_api.h +1 -1
index 2103f684a8b5..4e689cd4b23b 100644
@@ -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)
drivers/gpu/drm/xe/xe_reg_sr_types.h +0 -2
index b234a8673e54..0e6d542ff1b4 100644
@@ -9,8 +9,6 @@
 #include <linux/types.h>
 #include <linux/xarray.h>
 
-#include "i915_reg_defs.h"
-
 struct xe_reg_sr_entry {
 	u32		clr_bits;
 	u32		set_bits;
drivers/gpu/drm/xe/xe_rtp.h +0 -2
index d6ba0b7e5042..bd44fd8bbe05 100644
@@ -11,8 +11,6 @@
 
 #include "xe_rtp_types.h"
 
-#include "i915_reg_defs.h"
-
 /*
  * Register table poke infrastructure
  */
drivers/gpu/drm/xe/xe_rtp_types.h +0 -2
index fac0bd6d5b1e..e87f1b280d96 100644
@@ -8,8 +8,6 @@
 
 #include <linux/types.h>
 
-#include "i915_reg_defs.h"
-
 struct xe_hw_engine;
 struct xe_gt;
 
drivers/gpu/drm/xe/xe_step.c +1 -2
index e5e77cb9ea09..f78a7dc3049f 100644
@@ -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.
Signature · 1 line
2.39.0
#18 lore raw

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

Quoted 157 lines · Lucas De Marchi

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.

---
 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
drivers/gpu/drm/xe/regs/xe_engine_regs.h +1 -1
index 6dfa3cf2fd43..2aa67d001c34 100644
@@ -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)
 
drivers/gpu/drm/xe/regs/xe_gt_regs.h +1 -1
index 9290505d6596..3bf2fc3f80d8 100644
@@ -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)
drivers/gpu/drm/xe/regs/xe_reg_defs.h new file +11 -0
new file mode 100644
index 000000000000..5f6735697d9c
@@ -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
drivers/gpu/drm/xe/regs/xe_regs.h +1 -1
index 53f1ed54fb1c..74588d42a339 100644
@@ -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)
drivers/gpu/drm/xe/xe_device.c +1 -2
index 8f2b2acd4024..87d3d2cde665 100644
@@ -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)
drivers/gpu/drm/xe/xe_gt_mcr.h +1 -1
index c31987d2177c..2a6cd38c8cb7 100644
@@ -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;
drivers/gpu/drm/xe/xe_gt_pagefault.c +1 -2
index 19403dbea9f5..062430394a33 100644
@@ -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;
drivers/gpu/drm/xe/xe_gt_topology.c +1 -2
index 264d6429318b..c03aa10b4c21 100644
@@ -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)
 
drivers/gpu/drm/xe/xe_guc.c +0 -0
index 661effa9830f..a8b0171ed7c2 100644

drivers/gpu/drm/xe/xe_guc.c line 26

Quoted 5 lines
drivers/gpu/drm/xe/xe_guc.c +0 -2
@@ -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?

Quoted 55 lines
drivers/gpu/drm/xe/xe_guc.c +0 -0
 /* TODO: move to common file */
 #define GUC_PVC_MOCS_INDEX_MASK		REG_GENMASK(25, 24)
 #define PVC_MOCS_UC_INDEX		1
drivers/gpu/drm/xe/xe_guc_reg.h +1 -1
index 513a7e0c8a5a..b5ebec30140d 100644
@@ -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 */
 
drivers/gpu/drm/xe/xe_migrate.c +1 -2
index d845f7cadbd4..4872adadeb8e 100644
@@ -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.
  */
drivers/gpu/drm/xe/xe_pcode_api.h +1 -1
index 2103f684a8b5..4e689cd4b23b 100644
@@ -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)
drivers/gpu/drm/xe/xe_reg_sr_types.h +0 -0
index b234a8673e54..0e6d542ff1b4 100644

drivers/gpu/drm/xe/xe_reg_sr_types.h line 13

Quoted 5 lines
drivers/gpu/drm/xe/xe_reg_sr_types.h +0 -2
@@ -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.

drivers/gpu/drm/xe/xe_rtp.h line 15

Quoted 13 lines
drivers/gpu/drm/xe/xe_reg_sr_types.h +0 -0
 struct xe_reg_sr_entry {
 	u32		clr_bits;
 	u32		set_bits;
drivers/gpu/drm/xe/xe_rtp.h +0 -2
index d6ba0b7e5042..bd44fd8bbe05 100644
@@ -11,8 +11,6 @@
 
 #include "xe_rtp_types.h"
 
-#include "i915_reg_defs.h"
-

This one with no replacement looks fine too.

drivers/gpu/drm/xe/xe_rtp_types.h line 12

Quoted 13 lines
drivers/gpu/drm/xe/xe_rtp.h +0 -0
 /*
  * Register table poke infrastructure
  */
drivers/gpu/drm/xe/xe_rtp_types.h +0 -2
index fac0bd6d5b1e..e87f1b280d96 100644
@@ -8,8 +8,6 @@
 
 #include <linux/types.h>
 
-#include "i915_reg_defs.h"
-

Ditto.

Matt

Quoted 23 lines
drivers/gpu/drm/xe/xe_rtp_types.h +0 -0
 struct xe_hw_engine;
 struct xe_gt;
 
drivers/gpu/drm/xe/xe_step.c +1 -2
index e5e77cb9ea09..f78a7dc3049f 100644
@@ -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.
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
#19 lore raw

PATCH v4 12/12 drm/xe: Prefer single underscore for header guards

In reply to Lucas De Marchi

Keep header guards consistent with regard to ifdef used. Prefer the more commonly used in the driver.

	$ git grep  "ifndef __XE_" -- drivers/gpu/drm/xe | wc -l
	8
	$ git grep  "ifndef _XE_" -- drivers/gpu/drm/xe | wc -l
	112
---
 drivers/gpu/drm/xe/tests/xe_bo_test.h      | 4 ++--
 drivers/gpu/drm/xe/tests/xe_dma_buf_test.h | 4 ++--
 drivers/gpu/drm/xe/tests/xe_migrate_test.h | 4 ++--
 drivers/gpu/drm/xe/tests/xe_test.h         | 4 ++--
 drivers/gpu/drm/xe/xe_gt_topology.h        | 4 ++--
 drivers/gpu/drm/xe/xe_map.h                | 4 ++--
 drivers/gpu/drm/xe/xe_migrate.h            | 4 ++--
 drivers/gpu/drm/xe/xe_res_cursor.h         | 4 ++--
 8 files changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/xe/tests/xe_bo_test.h +2 -2
index d751a618c0c8..0113ab45066a 100644
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef __XE_BO_TEST_H__
-#define __XE_BO_TEST_H__
+#ifndef _XE_BO_TEST_H_
+#define _XE_BO_TEST_H_
 
 struct kunit;
 
drivers/gpu/drm/xe/tests/xe_dma_buf_test.h +2 -2
index 4e9a8bef5751..e6b464ddd526 100644
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef __XE_DMA_BUF_TEST_H__
-#define __XE_DMA_BUF_TEST_H__
+#ifndef _XE_DMA_BUF_TEST_H_
+#define _XE_DMA_BUF_TEST_H_
 
 struct kunit;
 
drivers/gpu/drm/xe/tests/xe_migrate_test.h +2 -2
index db1f8ef035bb..7c645c66824f 100644
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef __XE_MIGRATE_TEST_H__
-#define __XE_MIGRATE_TEST_H__
+#ifndef _XE_MIGRATE_TEST_H_
+#define _XE_MIGRATE_TEST_H_
 
 struct kunit;
 
drivers/gpu/drm/xe/tests/xe_test.h +2 -2
index 1ec502b5acf3..00c8a3f9af81 100644
@@ -3,8 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#ifndef __XE_TEST_H__
-#define __XE_TEST_H__
+#ifndef _XE_TEST_H_
+#define _XE_TEST_H_
 
 #include <linux/types.h>
 
drivers/gpu/drm/xe/xe_gt_topology.h +2 -2
index 7a0abc64084f..70a86538f742 100644
@@ -3,8 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#ifndef __XE_GT_TOPOLOGY_H__
-#define __XE_GT_TOPOLOGY_H__
+#ifndef _XE_GT_TOPOLOGY_H_
+#define _XE_GT_TOPOLOGY_H_
 
 #include "xe_gt_types.h"
 
drivers/gpu/drm/xe/xe_map.h +2 -2
index 0bac1f73a80d..032c2e8b5438 100644
@@ -3,8 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#ifndef __XE_MAP_H__
-#define __XE_MAP_H__
+#ifndef _XE_MAP_H_
+#define _XE_MAP_H_
 
 #include <linux/iosys-map.h>
 
drivers/gpu/drm/xe/xe_migrate.h +2 -2
index b2d55283252f..a569851db6f7 100644
@@ -3,8 +3,8 @@
  * Copyright © 2020 Intel Corporation
  */
 
-#ifndef __XE_MIGRATE__
-#define __XE_MIGRATE__
+#ifndef _XE_MIGRATE_
+#define _XE_MIGRATE_
 
 #include <drm/drm_mm.h>
 
drivers/gpu/drm/xe/xe_res_cursor.h +2 -2
index 365c8ad7aeb8..4e99fae26b4c 100644
@@ -21,8 +21,8 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifndef __XE_RES_CURSOR_H__
-#define __XE_RES_CURSOR_H__
+#ifndef _XE_RES_CURSOR_H_
+#define _XE_RES_CURSOR_H_
 
 #include <linux/scatterlist.h>
 
Signature · 1 line
2.39.0
Reviewed-by on v4 12/12
#20 lore raw

Re: [Intel-xe] [PATCH v4 12/12] drm/xe: Prefer single underscore for header guards

Quoted 85 lines · Lucas De Marchi

Keep header guards consistent with regard to ifdef used. Prefer the more commonly used in the driver.

	$ git grep  "ifndef __XE_" -- drivers/gpu/drm/xe | wc -l
	8
	$ git grep  "ifndef _XE_" -- drivers/gpu/drm/xe | wc -l
	112
---
 drivers/gpu/drm/xe/tests/xe_bo_test.h      | 4 ++--
 drivers/gpu/drm/xe/tests/xe_dma_buf_test.h | 4 ++--
 drivers/gpu/drm/xe/tests/xe_migrate_test.h | 4 ++--
 drivers/gpu/drm/xe/tests/xe_test.h         | 4 ++--
 drivers/gpu/drm/xe/xe_gt_topology.h        | 4 ++--
 drivers/gpu/drm/xe/xe_map.h                | 4 ++--
 drivers/gpu/drm/xe/xe_migrate.h            | 4 ++--
 drivers/gpu/drm/xe/xe_res_cursor.h         | 4 ++--
 8 files changed, 16 insertions(+), 16 deletions(-)
drivers/gpu/drm/xe/tests/xe_bo_test.h +2 -2
index d751a618c0c8..0113ab45066a 100644
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef __XE_BO_TEST_H__
-#define __XE_BO_TEST_H__
+#ifndef _XE_BO_TEST_H_
+#define _XE_BO_TEST_H_
 
 struct kunit;
 
drivers/gpu/drm/xe/tests/xe_dma_buf_test.h +2 -2
index 4e9a8bef5751..e6b464ddd526 100644
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef __XE_DMA_BUF_TEST_H__
-#define __XE_DMA_BUF_TEST_H__
+#ifndef _XE_DMA_BUF_TEST_H_
+#define _XE_DMA_BUF_TEST_H_
 
 struct kunit;
 
drivers/gpu/drm/xe/tests/xe_migrate_test.h +2 -2
index db1f8ef035bb..7c645c66824f 100644
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef __XE_MIGRATE_TEST_H__
-#define __XE_MIGRATE_TEST_H__
+#ifndef _XE_MIGRATE_TEST_H_
+#define _XE_MIGRATE_TEST_H_
 
 struct kunit;
 
drivers/gpu/drm/xe/tests/xe_test.h +2 -2
index 1ec502b5acf3..00c8a3f9af81 100644
@@ -3,8 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#ifndef __XE_TEST_H__
-#define __XE_TEST_H__
+#ifndef _XE_TEST_H_
+#define _XE_TEST_H_
 
 #include <linux/types.h>
 
drivers/gpu/drm/xe/xe_gt_topology.h +0 -0
index 7a0abc64084f..70a86538f742 100644

drivers/gpu/drm/xe/xe_gt_topology.h line 8

Quoted 8 lines
drivers/gpu/drm/xe/xe_gt_topology.h +2 -2
@@ -3,8 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#ifndef __XE_GT_TOPOLOGY_H__
-#define __XE_GT_TOPOLOGY_H__
+#ifndef _XE_GT_TOPOLOGY_H_
+#define _XE_GT_TOPOLOGY_H_
 

There's also a matching:

        #endif /* __XE_GT_TOPOLOGY_H__ */

that should have the comment updated.

Aside from that,

Quoted 50 lines
drivers/gpu/drm/xe/xe_gt_topology.h +0 -0
 #include "xe_gt_types.h"
 
drivers/gpu/drm/xe/xe_map.h +2 -2
index 0bac1f73a80d..032c2e8b5438 100644
@@ -3,8 +3,8 @@
  * Copyright © 2022 Intel Corporation
  */
 
-#ifndef __XE_MAP_H__
-#define __XE_MAP_H__
+#ifndef _XE_MAP_H_
+#define _XE_MAP_H_
 
 #include <linux/iosys-map.h>
 
drivers/gpu/drm/xe/xe_migrate.h +2 -2
index b2d55283252f..a569851db6f7 100644
@@ -3,8 +3,8 @@
  * Copyright © 2020 Intel Corporation
  */
 
-#ifndef __XE_MIGRATE__
-#define __XE_MIGRATE__
+#ifndef _XE_MIGRATE_
+#define _XE_MIGRATE_
 
 #include <drm/drm_mm.h>
 
drivers/gpu/drm/xe/xe_res_cursor.h +2 -2
index 365c8ad7aeb8..4e99fae26b4c 100644
@@ -21,8 +21,8 @@
  * OTHER DEALINGS IN THE SOFTWARE.
  */
 
-#ifndef __XE_RES_CURSOR_H__
-#define __XE_RES_CURSOR_H__
+#ifndef _XE_RES_CURSOR_H_
+#define _XE_RES_CURSOR_H_
 
 #include <linux/scatterlist.h>
 
Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation