Skip to contentSkip to conversation

Start register cleanup

PATCH Superseded Lucas De Marchi 1 participant 14 messages Feb 21, 2023

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 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.

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 below.

#!/usr/bin/python3

import sys
import clang.cindex

import helpers

FILE = sys.argv[1]
file_data = open(FILE, "r").readlines()
macros_instantiated = []
macros = dict()
macros_prereq = []

def is_used_by_xe(macro):
return helpers.git(["grep", "-q", f"\\b{macro}\\b", "--", "drivers/gpu/drm/xe/", ":(exclude)drivers/gpu/drm/xe/display/ext/"], check=False).returncode == 0

def print_source(node):
sline = node.extent.start.line
eline = node.extent.end.line
ecolumn = node.extent.end.column

line = sline
while line < eline:
print(file_data[line - 1].rstrip()) line += 1

print(file_data[line - 1][:ecolumn].rstrip())

def recurse(node):
if node.kind == clang.cindex.CursorKind.MACRO_DEFINITION and str(node.location.file) == FILE:
macros[node.spelling] = node
if is_used_by_xe(node.spelling):
print_source(node)
elif node.kind == clang.cindex.CursorKind.MACRO_INSTANTIATION and str(node.location.file) == FILE:
macros_instantiated.append(node)

for c in node.get_children():
recurse(c)

index = clang.cindex.Index.create()
root = index.parse(FILE,
options=clang.cindex.TranslationUnit.PARSE_DETAILED_PROCESSING_RECORD |
clang.cindex.TranslationUnit.PARSE_INCOMPLETE | clang.cindex.TranslationUnit.PARSE_SKIP_FUNCTION_BODIES)
recurse(root.cursor)

for node in macros_instantiated:
if node.spelling in macros:
macros_prereq.append(macros[node.spelling])

macros_prereq.sort(key=lambda x: x.location.line)

if len(macros_prereq):
print("\n\n/* move me up */\n\n")
for node in macros_prereq:
print_source(node)

Lucas De Marchi

Lucas De Marchi (13):
drm/xe: Remove outdated build workaround
drm/xe: Sort includes
drm/xe/guc: Remove i915_regs.h include
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
HACK: drm/xe: Undo display

 drivers/gpu/drm/i915/i915_reg_defs.h          |    2 +
 drivers/gpu/drm/xe/Kconfig                    |    8 -
 drivers/gpu/drm/xe/Makefile                   |  134 +-
 drivers/gpu/drm/xe/display/ext/i915_irq.c     | 1789 -----------------
 drivers/gpu/drm/xe/display/ext/i915_irq.h     |   97 -
 .../drm/xe/display/ext/intel_device_info.c    |  135 --
 .../drm/xe/display/ext/intel_device_info.h    |   36 -
 drivers/gpu/drm/xe/display/ext/intel_dram.c   |  495 -----
 drivers/gpu/drm/xe/display/ext/intel_dram.h   |   14 -
 drivers/gpu/drm/xe/display/ext/intel_pch.c    |  157 --
 drivers/gpu/drm/xe/display/ext/intel_pch.h    |   91 -
 drivers/gpu/drm/xe/display/ext/intel_pm.c     |  209 --
 drivers/gpu/drm/xe/display/ext/intel_pm.h     |   30 -
 .../gpu/drm/xe/display/i915_active_types.h    |    0
 drivers/gpu/drm/xe/display/i915_drv.h         |  248 ---
 drivers/gpu/drm/xe/display/i915_vma.h         |   13 -
 drivers/gpu/drm/xe/display/i915_vma_types.h   |   69 -
 drivers/gpu/drm/xe/display/intel_de.h         |  151 --
 drivers/gpu/drm/xe/display/intel_pm_types.h   |   36 -
 drivers/gpu/drm/xe/display/intel_runtime_pm.h |    8 -
 drivers/gpu/drm/xe/display/intel_wakeref.h    |    3 -
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |  287 ---
 drivers/gpu/drm/xe/display/xe_plane_initial.c |  289 ---
 drivers/gpu/drm/xe/regs/xe_engine_regs.h      |   98 +
 drivers/gpu/drm/xe/regs/xe_gpu_commands.h     |   96 +
 drivers/gpu/drm/xe/regs/xe_gt_regs.h          |  289 +++
 drivers/gpu/drm/xe/regs/xe_lrc_regs.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/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                |   39 +-
 drivers/gpu/drm/xe/xe_device.h                |    3 +-
 drivers/gpu/drm/xe/xe_device_types.h          |  124 --
 drivers/gpu/drm/xe/xe_display.c               |  323 ---
 drivers/gpu/drm/xe/xe_display.h               |   76 +-
 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            |    6 +-
 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_guc.c                   |   14 +-
 drivers/gpu/drm/xe/xe_guc_ads.c               |    9 +-
 drivers/gpu/drm/xe/xe_guc_ct.c                |    5 +-
 drivers/gpu/drm/xe/xe_guc_debugfs.c           |    3 +-
 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_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_irq.c                   |    9 +-
 drivers/gpu/drm/xe/xe_lrc.c                   |   13 +-
 drivers/gpu/drm/xe/xe_migrate.c               |   16 +-
 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                   |   90 +-
 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          |    2 -
 drivers/gpu/drm/xe/xe_reg_whitelist.c         |    7 +-
 drivers/gpu/drm/xe/xe_ring_ops.c              |   12 +-
 drivers/gpu/drm/xe/xe_rtp.h                   |    2 -
 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_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_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 +-
 96 files changed, 849 insertions(+), 5094 deletions(-)
 delete mode 100644 drivers/gpu/drm/xe/display/ext/i915_irq.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/i915_irq.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_device_info.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_device_info.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_dram.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_dram.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pch.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pch.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pm.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pm.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_active_types.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_drv.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_vma.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_vma_types.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_de.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_pm_types.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_runtime_pm.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_wakeref.h
 delete mode 100644 drivers/gpu/drm/xe/display/xe_fb_pin.c
 delete mode 100644 drivers/gpu/drm/xe/display/xe_plane_initial.c
 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_regs.h
 create mode 100644 drivers/gpu/drm/xe/regs/xe_reg_defs.h
 create mode 100644 drivers/gpu/drm/xe/regs/xe_regs.h
 delete mode 100644 drivers/gpu/drm/xe/xe_display.c
Signature · 1 line
2.39.0
#1 lore raw

PATCH v3 1/13 drm/xe: Remove outdated build workaround

Use the more common "call cc-disable-warning" way to disable warnings.

---
 drivers/gpu/drm/xe/Makefile | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/xe/Makefile +2 -8
index abd804d622e6..18257cd7227d 100644
@@ -13,14 +13,8 @@
 # will most likely get a sudden build breakage... Hopefully we will fix
 # new warnings before CI updates!
 subdir-ccflags-y := -Wall -Wextra
-# making these call cc-disable-warning breaks when trying to build xe.mod.o
-# by calling make M=drivers/gpu/drm/xe. This doesn't happen in upstream tree,
-# so it was somehow fixed by the changes in the build system. Move it back to
-# $(call cc-disable-warning, ...) after rebase.
-subdir-ccflags-y += -Wno-unused-parameter
-subdir-ccflags-y += -Wno-type-limits
-#subdir-ccflags-y += $(call cc-disable-warning, unused-parameter)
-#subdir-ccflags-y += $(call cc-disable-warning, type-limits)
+subdir-ccflags-y += $(call cc-disable-warning, unused-parameter)
+subdir-ccflags-y += $(call cc-disable-warning, type-limits)
 subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
 subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
 # clang warnings
Signature · 1 line
2.39.0
#2 lore raw

PATCH v3 2/13 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/*.c and ignoring all the changes after the includes. There are also some manual tweaks to split the blocks.

---
 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_display.c             | 12 ++++++------
 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_ads.c             |  6 ++++--
 drivers/gpu/drm/xe/xe_guc_ct.c              |  5 +++--
 drivers/gpu/drm/xe/xe_guc_debugfs.c         |  3 ++-
 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_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_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_whitelist.c       |  6 +++---
 drivers/gpu/drm/xe/xe_ring_ops.c            |  5 +++--
 drivers/gpu/drm/xe/xe_sa.c                  |  4 +++-
 drivers/gpu/drm/xe/xe_sync.c                |  5 +++--
 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_vm.c                  |  2 +-
 drivers/gpu/drm/xe/xe_vm_madvise.c          |  8 +++++---
 drivers/gpu/drm/xe/xe_wopcm.c               |  3 ++-
 56 files changed, 163 insertions(+), 116 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 9b7b9c8f84be..36367bda4f26 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_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_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 d2080e6fbe10..2fca53d1690c 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 20dbc08d3685..e9ad8b0d27bb 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 8e02e362ba27..e002d706d855 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 5cdfdfd0de40..bc2761569aa6 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_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_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_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_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_irq.c +4 -2
index 7b7ddd11c2b8..681a1875ae0d 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 8a953df2b468..9b56c88a8022 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 25598de3a1fc..93b57db29b96 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 44c38e670587..3189626ef70a 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 6e904e97f456..c47bd2ff45cc 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_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_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_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 b4e9c88644e4..1c3783becefd 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 3cc32e3e7a90..5f8c56baaeba 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_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 v3 3/13 drm/xe/guc: Remove i915_regs.h include

In reply to Lucas De Marchi

i915_regs.h is not needed, particularly in a header file. What is needed is i915_reg_defs.h for use of _MMIO() and similar macros.

---
 drivers/gpu/drm/xe/xe_guc_reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_guc_reg.h +1 -1
index 1e16a9b76ddc..513a7e0c8a5a 100644
@@ -9,7 +9,7 @@
 #include <linux/compiler.h>
 #include <linux/types.h>
 
-#include "i915_reg.h"
+#include "i915_reg_defs.h"
 
 /* Definitions of GuC H/W registers, bits, etc */
 
Signature · 1 line
2.39.0
#4 lore raw

PATCH v3 4/13 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          |  5 +-
 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, 109 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 +4 -1
index a4e947f0c557..49b64b9fc228 100644
@@ -5,8 +5,11 @@
 
 #include "xe_guc_ads.h"
 
+#include "xe_guc_ads.h"
+
 #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 +20,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 9b56c88a8022..8cd27ac590e7 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
#5 lore raw

PATCH v3 5/13 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.

---
 drivers/gpu/drm/i915/i915_reg_defs.h  |   2 +
 drivers/gpu/drm/xe/regs/xe_gt_regs.h  | 287 ++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_execlist.c      |   2 +-
 drivers/gpu/drm/xe/xe_force_wake.c    |   3 +-
 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 +-
 21 files changed, 308 insertions(+), 28 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_gt_regs.h
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)
 
 /*
drivers/gpu/drm/xe/regs/xe_gt_regs.h new file +287 -0

287 lines not on this page · raw message

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 -2
index 2fca53d1690c..e2b426890d49 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 *
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 e9ad8b0d27bb..896dc653c6cc 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 bc2761569aa6..8e3069598f75 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 49b64b9fc228..0c855dd23caa 100644
@@ -10,6 +10,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"
@@ -20,9 +21,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 681a1875ae0d..f2f35a40ed54 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 8cd27ac590e7..59befa96ac0f 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 5f8c56baaeba..cda2da27f7c6 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
#6 lore raw

PATCH v3 6/13 drm/xe: Remove dependency on intel_lrc_reg.h

In reply to Lucas De Marchi

Create regs/xe_lrc_regs.h file with all the registers 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.

---
 drivers/gpu/drm/xe/regs/xe_lrc_regs.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_regs.h
drivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +17 -0
new file mode 100644
index 000000000000..e8a13fa6722b
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef _XE_LRC_REGS_H_
+#define _XE_LRC_REGS_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..84d3db9c8518 100644
@@ -8,6 +8,7 @@
 #include <drm/drm_managed.h>
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_lrc_regs.h"
 #include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.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..fb0b6a8a742a 100644
@@ -13,6 +13,7 @@
 
 #include <drm/drm_managed.h>
 
+#include "regs/xe_lrc_regs.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..a6b1453ccf9c 100644
@@ -6,6 +6,7 @@
 #include "xe_lrc.h"
 
 #include "regs/xe_engine_regs.h"
+#include "regs/xe_lrc_regs.h"
 #include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.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..663910712035 100644
@@ -5,6 +5,7 @@
 
 #include "xe_ring_ops.h"
 
+#include "regs/xe_lrc_regs.h"
 #include "regs/xe_gt_regs.h"
 #include "xe_engine_types.h"
 #include "xe_gt.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
#7 lore raw

PATCH v3 7/13 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.

---
 drivers/gpu/drm/xe/regs/xe_gpu_commands.h | 96 +++++++++++++++++++++++
 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          |  2 +-
 7 files changed, 102 insertions(+), 9 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/regs/xe_gpu_commands.h
drivers/gpu/drm/xe/regs/xe_gpu_commands.h new file +96 -0
new file mode 100644
index 000000000000..bf6dc1c8563d
@@ -0,0 +1,96 @@
+/* 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 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)
+#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)
+
+#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 88d55671b068..ee10b6c11e9f 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_macros.h"
 #include "xe_force_wake.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 84d3db9c8518..3b6d8a22ecda 100644
@@ -9,6 +9,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_lrc_regs.h"
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.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 a6b1453ccf9c..4a19a15f26b7 100644
@@ -7,6 +7,7 @@
 
 #include "regs/xe_engine_regs.h"
 #include "regs/xe_lrc_regs.h"
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "xe_bo.h"
 #include "xe_device.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 +1 -1
index 663910712035..43e4390b7cb0 100644
@@ -6,6 +6,7 @@
 #include "xe_ring_ops.h"
 
 #include "regs/xe_lrc_regs.h"
+#include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.h"
 #include "xe_engine_types.h"
 #include "xe_gt.h"
@@ -14,7 +15,6 @@
 #include "xe_sched_job.h"
 #include "xe_vm_types.h"
 
-#include "gt/intel_gpu_commands.h"
 #include "i915_reg.h"
 
 static u32 preparser_disable(bool state)
Signature · 1 line
2.39.0
#8 lore raw

PATCH v3 8/13 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       |   3 +-
 drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c |   3 +-
 drivers/gpu/drm/xe/xe_wa.c             |   3 +-
 13 files changed, 123 insertions(+), 24 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 3b6d8a22ecda..ee5b1ada6e22 100644
@@ -11,6 +11,7 @@
 #include "regs/xe_lrc_regs.h"
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.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 f2f35a40ed54..5f03bf848ec8 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 4a19a15f26b7..b5508435d161 100644
@@ -9,6 +9,7 @@
 #include "regs/xe_lrc_regs.h"
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.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 59befa96ac0f..6c8e4d4f9a20 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 93b57db29b96..c49f3541aabb 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 -2
index 43e4390b7cb0..1dbd1a9d1a23 100644
@@ -8,6 +8,7 @@
 #include "regs/xe_lrc_regs.h"
 #include "regs/xe_gpu_commands.h"
 #include "regs/xe_gt_regs.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"
-
 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 1c3783becefd..19828e003283 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
#9 lore raw

PATCH v3 9/13 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 da40133252fb..ab8c9e51f62e 100644
@@ -186,6 +186,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)
 
@@ -242,6 +243,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
#10 lore raw

PATCH v3 10/13 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/xe_guc_pc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
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
#11 lore raw

PATCH v3 11/13 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_display.h      | 5 +++++
 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 ++
 7 files changed, 19 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_display.h +5 -0
index 03117a7067dc..41fd6ca3a025 100644
@@ -44,6 +44,11 @@ void xe_display_pm_resume_early(struct xe_device *xe);
 void xe_display_pm_resume(struct xe_device *xe);
 
 #else
+
+#include <drm/drm_drv.h>
+
+#include "xe_device.h"
+
 static inline int
 xe_display_enable(struct pci_dev *pdev, struct drm_driver *driver) { return 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 e002d706d855..3f7510abfc26 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
#12 lore raw

PATCH v3 12/13 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 ab8c9e51f62e..1d4063eb3773 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 3f7510abfc26..697c1c5f6982 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 8e3069598f75..cd001181fd42 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 2fa7ff3966ba..8a317ce428a4 100644
@@ -9,8 +9,6 @@
 #include <linux/xarray.h>
 #include <linux/types.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 1ac3fd1c0734..099047af89b4 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
#13 lore raw

PATCH v3 13/13 HACK: drm/xe: Undo display

In reply to Lucas De Marchi

Remove display to make sure the rest of the driver behaves correctly without i915's includes and sources.

---
 drivers/gpu/drm/xe/Kconfig                    |    8 -
 drivers/gpu/drm/xe/Makefile                   |  124 +-
 drivers/gpu/drm/xe/display/ext/i915_irq.c     | 1789 -----------------
 drivers/gpu/drm/xe/display/ext/i915_irq.h     |   97 -
 .../drm/xe/display/ext/intel_device_info.c    |  135 --
 .../drm/xe/display/ext/intel_device_info.h    |   36 -
 drivers/gpu/drm/xe/display/ext/intel_dram.c   |  495 -----
 drivers/gpu/drm/xe/display/ext/intel_dram.h   |   14 -
 drivers/gpu/drm/xe/display/ext/intel_pch.c    |  157 --
 drivers/gpu/drm/xe/display/ext/intel_pch.h    |   91 -
 drivers/gpu/drm/xe/display/ext/intel_pm.c     |  209 --
 drivers/gpu/drm/xe/display/ext/intel_pm.h     |   30 -
 .../gpu/drm/xe/display/i915_active_types.h    |    0
 drivers/gpu/drm/xe/display/i915_drv.h         |  248 ---
 drivers/gpu/drm/xe/display/i915_vma.h         |   13 -
 drivers/gpu/drm/xe/display/i915_vma_types.h   |   69 -
 drivers/gpu/drm/xe/display/intel_de.h         |  151 --
 drivers/gpu/drm/xe/display/intel_pm_types.h   |   36 -
 drivers/gpu/drm/xe/display/intel_runtime_pm.h |    8 -
 drivers/gpu/drm/xe/display/intel_wakeref.h    |    3 -
 drivers/gpu/drm/xe/display/xe_fb_pin.c        |  287 ---
 drivers/gpu/drm/xe/display/xe_plane_initial.c |  289 ---
 drivers/gpu/drm/xe/xe_device.c                |   26 +-
 drivers/gpu/drm/xe/xe_device_types.h          |  124 --
 drivers/gpu/drm/xe/xe_display.c               |  323 ---
 drivers/gpu/drm/xe/xe_display.h               |   81 +-
 drivers/gpu/drm/xe/xe_pci.c                   |   83 -
 27 files changed, 20 insertions(+), 4906 deletions(-)
 delete mode 100644 drivers/gpu/drm/xe/display/ext/i915_irq.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/i915_irq.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_device_info.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_device_info.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_dram.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_dram.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pch.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pch.h
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pm.c
 delete mode 100644 drivers/gpu/drm/xe/display/ext/intel_pm.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_active_types.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_drv.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_vma.h
 delete mode 100644 drivers/gpu/drm/xe/display/i915_vma_types.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_de.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_pm_types.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_runtime_pm.h
 delete mode 100644 drivers/gpu/drm/xe/display/intel_wakeref.h
 delete mode 100644 drivers/gpu/drm/xe/display/xe_fb_pin.c
 delete mode 100644 drivers/gpu/drm/xe/display/xe_plane_initial.c
 delete mode 100644 drivers/gpu/drm/xe/xe_display.c
drivers/gpu/drm/xe/Kconfig +0 -8
index 4684e99549d3..22e47918bfcf 100644
@@ -40,14 +40,6 @@ config DRM_XE
 
 	  If "M" is selected, the module will be called xe.
 
-
-config DRM_XE_DISPLAY
-	bool "Enable display support"
-	depends on DRM_XE && EXPERT
-	default y
-	help
-	  Disable this option only if you want to compile out display support.
-
 config DRM_XE_FORCE_PROBE
 	string "Force probe xe for selected Intel hardware IDs"
 	depends on DRM_XE
drivers/gpu/drm/xe/Makefile +1 -123

135 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/i915_irq.c deleted +0 -1789

1,789 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/i915_irq.h deleted +0 -97

97 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/intel_device_info.c deleted +0 -135

135 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/intel_device_info.h deleted +0 -36
deleted file mode 100644
index dd05f298019e..000000000000
@@ -1,36 +0,0 @@
-/*
- * Copyright © 2014-2017 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- */
-
-#ifndef _INTEL_DEVICE_INFO_H_
-#define _INTEL_DEVICE_INFO_H_
-
-#include <linux/types.h>
-#include "xe_device_types.h"
-
-/* Minimal parts used by xe */
-#define intel_runtime_info xe_device_display_info
-
-void intel_device_info_runtime_init(struct drm_i915_private *dev_priv);
-
-#endif
drivers/gpu/drm/xe/display/ext/intel_dram.c deleted +0 -495

495 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/intel_dram.h deleted +0 -14
deleted file mode 100644
index 4ba13c13162c..000000000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-/*
- * Copyright © 2020 Intel Corporation
- */
-
-#ifndef __INTEL_DRAM_H__
-#define __INTEL_DRAM_H__
-
-struct drm_i915_private;
-
-void intel_dram_edram_detect(struct drm_i915_private *i915);
-void intel_dram_detect(struct drm_i915_private *i915);
-
-#endif /* __INTEL_DRAM_H__ */
drivers/gpu/drm/xe/display/ext/intel_pch.c deleted +0 -157

157 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/intel_pch.h deleted +0 -91

91 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/intel_pm.c deleted +0 -209

37 lines not on this page · raw message

drivers/gpu/drm/xe/display/ext/intel_pm.h deleted +0 -30
deleted file mode 100644
index 5b0a2f175c61..000000000000

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/xe/display/i915_active_types.h deleted +0 -0
deleted file mode 100644
index e69de29bb2d1..000000000000
drivers/gpu/drm/xe/display/i915_drv.h deleted +0 -248

248 lines not on this page · raw message

drivers/gpu/drm/xe/display/i915_vma.h deleted +0 -13
deleted file mode 100644
index 133c60cb3a09..000000000000

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/xe/display/i915_vma_types.h deleted +0 -69

69 lines not on this page · raw message

drivers/gpu/drm/xe/display/intel_de.h deleted +0 -151

151 lines not on this page · raw message

drivers/gpu/drm/xe/display/intel_pm_types.h deleted +0 -36
deleted file mode 100644
index 8bf1594a9d1b..000000000000

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/xe/display/intel_runtime_pm.h deleted +0 -8
deleted file mode 100644
index dddfc1e046b7..000000000000

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/xe/display/intel_wakeref.h deleted +0 -3
deleted file mode 100644
index 678f22c36d42..000000000000

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/xe/display/xe_fb_pin.c deleted +0 -287

287 lines not on this page · raw message

drivers/gpu/drm/xe/display/xe_plane_initial.c deleted +0 -289

289 lines not on this page · raw message

drivers/gpu/drm/xe/xe_device.c +1 -25
index 87d3d2cde665..e7e3bac99840 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/xe/xe_device_types.h +0 -124

124 lines not on this page · raw message

drivers/gpu/drm/xe/xe_display.c deleted +0 -323

323 lines not on this page · raw message

drivers/gpu/drm/xe/xe_display.h +18 -63

81 lines not on this page · raw message

drivers/gpu/drm/xe/xe_pci.c +0 -83

83 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.39.0

Part of the diff is not shown here. View the raw message.