Start register cleanup
v2 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/ 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
The first one are the generic defines used for defining the registers. They probably can be split and part of them copied to include/drm to be shared across the drivers. The last 3 are expected to be cleaned up together with the rest of the 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. There may be some inconsistencies how the first patches and the last ones were done. I can clean that up on next version.
Lucas De Marchi (11):
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: Use relative includes for i915_reg_defs.h
drivers/gpu/drm/i915/i915_reg_defs.h | 2 + drivers/gpu/drm/xe/Makefile | 10 +- drivers/gpu/drm/xe/display/Makefile | 120 ++++++++ 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_regs.h | 111 ++++++++ drivers/gpu/drm/xe/xe_bb.c | 7 +- drivers/gpu/drm/xe/xe_bo.c | 2 - drivers/gpu/drm/xe/xe_bo_evict.c | 2 +- drivers/gpu/drm/xe/xe_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_device.c | 9 +- drivers/gpu/drm/xe/xe_device.h | 3 +- drivers/gpu/drm/xe/xe_display.c | 12 +- drivers/gpu/drm/xe/xe_dma_buf.c | 8 +- drivers/gpu/drm/xe/xe_engine.c | 4 +- drivers/gpu/drm/xe/xe_exec.c | 2 +- drivers/gpu/drm/xe/xe_execlist.c | 16 +- drivers/gpu/drm/xe/xe_force_wake.c | 5 +- drivers/gpu/drm/xe/xe_ggtt.c | 10 +- drivers/gpu/drm/xe/xe_gt.c | 5 +- drivers/gpu/drm/xe/xe_gt_clock.c | 7 +- drivers/gpu/drm/xe/xe_gt_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.c | 5 +- drivers/gpu/drm/xe/xe_gt_mcr.h | 2 +- drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 +- drivers/gpu/drm/xe/xe_gt_sysfs.c | 4 +- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 2 +- drivers/gpu/drm/xe/xe_gt_topology.c | 2 +- drivers/gpu/drm/xe/xe_guc.c | 13 +- drivers/gpu/drm/xe/xe_guc_ads.c | 8 +- drivers/gpu/drm/xe/xe_guc_ct.c | 4 +- drivers/gpu/drm/xe/xe_guc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_guc_hwconfig.c | 2 +- drivers/gpu/drm/xe/xe_guc_log.c | 2 +- drivers/gpu/drm/xe/xe_guc_pc.c | 29 +- drivers/gpu/drm/xe/xe_guc_reg.h | 2 +- drivers/gpu/drm/xe/xe_guc_submit.c | 9 +- drivers/gpu/drm/xe/xe_huc.c | 2 +- drivers/gpu/drm/xe/xe_huc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_hw_engine.c | 8 +- drivers/gpu/drm/xe/xe_hw_fence.c | 1 - drivers/gpu/drm/xe/xe_irq.c | 8 +- drivers/gpu/drm/xe/xe_lrc.c | 14 +- drivers/gpu/drm/xe/xe_migrate.c | 14 +- drivers/gpu/drm/xe/xe_mmio.c | 8 +- drivers/gpu/drm/xe/xe_mocs.c | 7 +- drivers/gpu/drm/xe/xe_module.c | 1 + drivers/gpu/drm/xe/xe_pci.c | 8 +- drivers/gpu/drm/xe/xe_pcode.c | 10 +- drivers/gpu/drm/xe/xe_pm.c | 4 +- drivers/gpu/drm/xe/xe_preempt_fence.c | 2 +- drivers/gpu/drm/xe/xe_pt.c | 4 +- drivers/gpu/drm/xe/xe_query.c | 11 +- drivers/gpu/drm/xe/xe_reg_sr.c | 10 +- drivers/gpu/drm/xe/xe_reg_sr_types.h | 2 - drivers/gpu/drm/xe/xe_reg_whitelist.c | 8 +- drivers/gpu/drm/xe/xe_ring_ops.c | 11 +- drivers/gpu/drm/xe/xe_rtp.c | 1 - drivers/gpu/drm/xe/xe_rtp.h | 2 - drivers/gpu/drm/xe/xe_rtp_types.h | 2 - drivers/gpu/drm/xe/xe_sa.c | 3 +- drivers/gpu/drm/xe/xe_sched_job.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 | 4 +- 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 | 2 +- 74 files changed, 900 insertions(+), 213 deletions(-) create mode 100644 drivers/gpu/drm/xe/display/Makefile 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_regs.h
Signature · 1 line
2.39.0
PATCH v2 1/11 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
@@ -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
Re: [Intel-xe] [PATCH v2 01/11] drm/xe: Remove outdated build workaround
Quoted 3 lines · Lucas De Marchi
Use the more common "call cc-disable-warning" way to disable warnings.
Signed-off-by Lucas De Marchi <[email protected]>
Quoted 28 lines
--- drivers/gpu/drm/xe/Makefile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)drivers/gpu/drm/xe/Makefile +2
-8@@ -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 warningsSignature · 1 line
2.39.0
PATCH v2 2/11 drm/xe: Sort includes
In reply to Lucas De MarchiSort 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 runningclang-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 | 4 ++-- drivers/gpu/drm/xe/xe_bo.c | 2 -- drivers/gpu/drm/xe/xe_bo_evict.c | 2 +- drivers/gpu/drm/xe/xe_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_device.c | 9 ++++----- drivers/gpu/drm/xe/xe_display.c | 12 ++++++------ drivers/gpu/drm/xe/xe_dma_buf.c | 8 +++----- drivers/gpu/drm/xe/xe_engine.c | 4 ++-- drivers/gpu/drm/xe/xe_exec.c | 2 +- drivers/gpu/drm/xe/xe_execlist.c | 9 ++++----- drivers/gpu/drm/xe/xe_force_wake.c | 4 ++-- drivers/gpu/drm/xe/xe_ggtt.c | 7 +++---- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_gt_clock.c | 8 ++++---- drivers/gpu/drm/xe/xe_gt_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.c | 2 +- drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 +- drivers/gpu/drm/xe/xe_gt_sysfs.c | 4 +++- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 2 +- drivers/gpu/drm/xe/xe_gt_topology.c | 2 +- drivers/gpu/drm/xe/xe_guc.c | 13 +++++++------ drivers/gpu/drm/xe/xe_guc_ads.c | 5 +++-- drivers/gpu/drm/xe/xe_guc_ct.c | 4 ++-- drivers/gpu/drm/xe/xe_guc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_guc_hwconfig.c | 2 +- drivers/gpu/drm/xe/xe_guc_log.c | 2 +- drivers/gpu/drm/xe/xe_guc_pc.c | 12 +++++++----- drivers/gpu/drm/xe/xe_guc_submit.c | 6 +++--- drivers/gpu/drm/xe/xe_huc.c | 2 +- drivers/gpu/drm/xe/xe_huc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_hw_engine.c | 3 +-- drivers/gpu/drm/xe/xe_hw_fence.c | 1 - drivers/gpu/drm/xe/xe_irq.c | 5 +++-- drivers/gpu/drm/xe/xe_lrc.c | 7 +++---- drivers/gpu/drm/xe/xe_migrate.c | 11 ++++++----- drivers/gpu/drm/xe/xe_mmio.c | 3 +-- drivers/gpu/drm/xe/xe_mocs.c | 4 ++-- drivers/gpu/drm/xe/xe_module.c | 1 + drivers/gpu/drm/xe/xe_pci.c | 5 ++--- drivers/gpu/drm/xe/xe_pcode.c | 10 ++++------ drivers/gpu/drm/xe/xe_pm.c | 4 ++-- drivers/gpu/drm/xe/xe_preempt_fence.c | 2 +- drivers/gpu/drm/xe/xe_pt.c | 4 ++-- drivers/gpu/drm/xe/xe_query.c | 11 ++++++----- drivers/gpu/drm/xe/xe_reg_sr.c | 5 ++--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 7 +++---- drivers/gpu/drm/xe/xe_ring_ops.c | 4 ++-- drivers/gpu/drm/xe/xe_rtp.c | 1 - drivers/gpu/drm/xe/xe_sa.c | 3 ++- drivers/gpu/drm/xe/xe_sched_job.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 | 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 | 4 ++-- drivers/gpu/drm/xe/xe_vm.c | 2 +- drivers/gpu/drm/xe/xe_vm_madvise.c | 8 +++++--- drivers/gpu/drm/xe/xe_wopcm.c | 2 +- 59 files changed, 128 insertions(+), 132 deletions(-)
drivers/gpu/drm/xe/xe_bb.c +2 -2
@@ -2,12 +2,12 @@/* * Copyright © 2022 Intel Corporation */ -#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 -2
@@ -2,8 +2,6 @@/* * Copyright © 2021 Intel Corporation */ - -#include "xe_bo.h" #include <linux/dma-buf.h>
drivers/gpu/drm/xe/xe_bo_evict.c +1 -1
@@ -2,9 +2,9 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_bo_evict.h" #include "xe_bo.h" -#include "xe_bo_evict.h" #include "xe_device.h" #include "xe_ggtt.h" #include "xe_gt.h"
drivers/gpu/drm/xe/xe_debugfs.c +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_debugfs.h" #include <linux/string_helpers.h>
@@ -9,7 +10,6 @@#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 -5
@@ -2,15 +2,14 @@/* * Copyright © 2021 Intel Corporation */ -#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 +20,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
@@ -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 +3 -5
@@ -2,21 +2,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 -2
@@ -2,13 +2,13 @@/* * Copyright © 2021 Intel Corporation */ -#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 +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_exec.h" #include <drm/drm_device.h> #include <drm/drm_file.h>
@@ -10,7 +11,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 +4 -5
@@ -2,16 +2,15 @@/* * Copyright © 2021 Intel Corporation */ +#include "xe_execlist.h" #include <drm/drm_managed.h> -#include "xe_execlist.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 +18,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 +2 -2
@@ -2,14 +2,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 -4
@@ -2,24 +2,23 @@/* * Copyright © 2021 Intel Corporation */ -#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 +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_gt.h" #include <linux/minmax.h>
@@ -14,7 +15,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 -4
@@ -2,16 +2,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 +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_gt_debugfs.h" #include <drm/drm_debugfs.h> #include <drm/drm_managed.h>
@@ -10,7 +11,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 +1 -1
@@ -2,9 +2,9 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_gt_mcr.h" #include "xe_gt.h" -#include "xe_gt_mcr.h" #include "xe_gt_topology.h" #include "xe_gt_types.h" #include "xe_mmio.h"
drivers/gpu/drm/xe/xe_gt_pagefault.c +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_gt_pagefault.h" #include <linux/circ_buf.h>
@@ -10,7 +11,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 +3 -1
@@ -2,12 +2,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 +1 -1
@@ -2,9 +2,9 @@/* * Copyright © 2023 Intel Corporation */ +#include "xe_gt_tlb_invalidation.h" #include "xe_gt.h" -#include "xe_gt_tlb_invalidation.h" #include "xe_guc.h" #include "xe_guc_ct.h" #include "xe_trace.h"
drivers/gpu/drm/xe/xe_gt_topology.c +1 -1
@@ -2,11 +2,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 +7 -6
@@ -2,25 +2,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 +3 -2
@@ -2,21 +2,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 +2 -2
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_guc_ct.h" #include <linux/bitfield.h> #include <linux/circ_buf.h>
@@ -12,10 +13,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 +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_guc_debugfs.h" #include <drm/drm_debugfs.h> #include <drm/drm_managed.h>
@@ -10,7 +11,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 +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_guc_hwconfig.h" #include <drm/drm_managed.h>
@@ -9,7 +10,6 @@#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 +1 -1
@@ -2,12 +2,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 +7 -5
@@ -2,22 +2,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 +3 -3
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_guc_submit.h" #include <linux/bitfield.h> #include <linux/bitmap.h>
@@ -13,12 +14,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 +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_huc.h" #include "xe_bo.h" #include "xe_device.h"
@@ -9,7 +10,6 @@#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 +1 -1
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_huc_debugfs.h" #include <drm/drm_debugfs.h> #include <drm/drm_managed.h>
@@ -9,7 +10,6 @@#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 -2
@@ -2,7 +2,6 @@/* * Copyright © 2021 Intel Corporation */ -#include "xe_hw_engine.h" #include <drm/drm_managed.h>
@@ -22,8 +21,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 3struct engine_info {
drivers/gpu/drm/xe/xe_hw_fence.c +0 -1
@@ -2,7 +2,6 @@/* * Copyright © 2021 Intel Corporation */ -#include "xe_hw_fence.h" #include <linux/device.h>
drivers/gpu/drm/xe/xe_irq.c +3 -2
@@ -2,6 +2,7 @@/* * Copyright © 2021 Intel Corporation */ +#include "xe_irq.h" #include <linux/sched/clock.h>
@@ -10,13 +11,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 -4
@@ -2,22 +2,21 @@/* * Copyright © 2021 Intel Corporation */ -#include "xe_lrc.h" #include "xe_bo.h" #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 +6 -5
@@ -4,6 +4,12 @@*/ #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 +26,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 -2
@@ -2,7 +2,6 @@/* * Copyright © 2021 Intel Corporation */ -#include "xe_mmio.h" #include <drm/drm_managed.h>
@@ -14,9 +13,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 +2 -2
@@ -2,14 +2,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 +1 -0
@@ -2,6 +2,7 @@/* * Copyright © 2021 Intel Corporation */ +#include "xe_module.h" #include <linux/init.h> #include <linux/module.h>
drivers/gpu/drm/xe/xe_pci.c +2 -3
@@ -2,7 +2,6 @@/* * Copyright © 2021 Intel Corporation */ -#include "xe_pci.h" #include <linux/device/driver.h>
@@ -10,12 +9,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 -6
@@ -2,16 +2,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 +2 -2
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_pm.h" #include <linux/pm_runtime.h>
@@ -11,9 +12,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 +1 -1
@@ -2,11 +2,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 +2 -2
@@ -2,6 +2,7 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_pt.h" #include <drm/drm_pt_walk.h>
@@ -10,12 +11,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 +6 -5
@@ -2,18 +2,19 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_query.h" -#include <drm/xe_drm.h> -#include <drm/ttm/ttm_placement.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 -3
@@ -2,23 +2,22 @@/* * Copyright © 2022 Intel Corporation */ -#include "xe_reg_sr.h" #include <linux/align.h> #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 -4
@@ -2,15 +2,14 @@/* * Copyright © 2023 Intel Corporation */ -#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 +2 -2
@@ -2,19 +2,19 @@/* * Copyright © 2022 Intel Corporation */ +#include "xe_ring_ops.h" #include "xe_engine_types.h" #include "xe_gt.h" #include "xe_lrc.h" #include "xe_macros.h" -#include "xe_ring_ops.h" #include "xe_sched_job.h" #include "xe_vm_types.h" -#include "i915_reg.h" #include "gt/intel_gpu_commands.h" #include "gt/intel_gt_regs.h" #include "gt/intel_lrc_reg.h" +#include "i915_reg.h" static u32 preparser_disable (bool state) {
drivers/gpu/drm/xe/xe_rtp.c +0 -1
@@ -2,7 +2,6 @@/* * Copyright © 2022 Intel Corporation */ -#include "xe_rtp.h" #include <drm/xe_drm.h>
drivers/gpu/drm/xe/xe_sa.c +2 -1
@@ -2,15 +2,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_sched_job.c +0 -1
@@ -2,7 +2,6 @@/* * Copyright © 2021 Intel Corporation */ -#include "xe_sched_job.h" #include <linux/dma-fence-array.h>
drivers/gpu/drm/xe/xe_sync.c +3 -2
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 +2 -2
@@ -3,13 +3,13 @@* 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
@@ -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
@@ -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 +1 -1
@@ -3,13 +3,13 @@* 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
Re: [Intel-xe] [PATCH v2 02/11] drm/xe: Sort includes
Quoted 11 lines · Lucas De Marchi
Sort includes and split them in blocks:
1) .h corresponding to the .c. Example:
xe_bb.cshould have a "#include"xe_bb.h" first.2) #include <linux/...>
3) #include <drm/...>
4) local includes
5) i915 includesThis is accomplished by running
clang-format --style=file -i --sort-includes drivers/gpu/drm/xe/*.c
Neat.
Quoted 4 lines
and ignoring all the changes after the includes. There are also some manual tweaks to split the blocks.
Signed-off-by Lucas De Marchi <[email protected]>
<snip>
drivers/gpu/drm/xe/xe_uc.c line 6
Quoted 11 lines
#include "gt/intel_gt_regs.h"drivers/gpu/drm/xe/xe_uc.c +1
-0@@ -3,13 +3,13 @@* Copyright © 2022 Intel Corporation */ +#include "xe_uc.h"
Needs new block here?
Quoted 53 lines
drivers/gpu/drm/xe/xe_uc.c +1
-2#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@@ -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@@ -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 +0
-0
drivers/gpu/drm/xe/xe_wopcm.c line 6
Quoted 4 lines
drivers/gpu/drm/xe/xe_wopcm.c +1
-0@@ -3,13 +3,13 @@* Copyright © 2022 Intel Corporation */ +#include "xe_wopcm.h"
And here?
Quoted 10 lines
drivers/gpu/drm/xe/xe_wopcm.c +0
-1#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
Re: [Intel-xe] [PATCH v2 02/11] drm/xe: Sort includes
Quoted 22 lines · Matthew Auld
Quoted 11 lines · Lucas De Marchi
Sort includes and split them in blocks:
1) .h corresponding to the .c. Example:
xe_bb.cshould have a "#include "xe_bb.h" first.
2) #include <linux/...>
3) #include <drm/...>
4) local includes
5) i915 includesThis is accomplished by running
clang-format --style=file -i --sort-includes drivers/gpu/drm/xe/*.cNeat.
Quoted 4 lines
and ignoring all the changes after the includes. There are also some manual tweaks to split the blocks.
Signed-off-by Lucas De Marchi <[email protected]><snip>
Quoted 11 lines
drivers/gpu/drm/xe/xe_uc.c line 5
Quoted 9 lines
#include "
gt/intel_gt_regs.h"drivers/gpu/drm/xe/xe_uc.c +1
-0@@ -3,13 +3,13 @@* Copyright © 2022 Intel Corporation */ +#include "xe_uc.h" Needs new block here?
yep
Quoted 45 lines
Quoted 45 lines
drivers/gpu/drm/xe/xe_uc.c +1
-2#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@@ -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@@ -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 +0
-0
Quoted 8 lines
drivers/gpu/drm/xe/xe_wopcm.c line 5
Quoted 6 lines
drivers/gpu/drm/xe/xe_wopcm.c +1
-0@@ -3,13 +3,13 @@* Copyright © 2022 Intel Corporation */ +#include "xe_wopcm.h" And here?
yep
Quoted 2 lines
Reviewed-by Matthew Auld <[email protected]>
thanks
Lucas De Marchi
Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/xe/xe_wopcm.c +0
-1#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
Jani Nikula
maintainerRe: [Intel-xe] [PATCH v2 02/11] drm/xe: Sort includes
In reply to Lucas De MarchiQuoted 4 lines · Lucas De Marchi
Sort includes and split them in blocks:
1) .h corresponding to the .c. Example:
xe_bb.cshould have a "#include "xe_bb.h" first.
Personally, I've never liked this, because the local headers could have stuff that impacts global headers. And if there are conflicts, you kind of want to have your local one look like the culprit (although modern compilers are pretty good at showing both sites).
Note that to keep headers self-contained, this is not enough for headers not associated with a .c, which is why we have the HDRTEST rule in i915.
Quoted 9 lines
2) #include <linux/...>
3) #include <drm/...>
4) local includes
5) i915 includesThis is accomplished by running
clang-format --style=file -i --sort-includes drivers/gpu/drm/xe/*.cand ignoring all the changes after the includes. There are also some manual tweaks to split the blocks.
Do you have the style file somewhere?
Quoted 69 lines
Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_bb.c | 4 ++-- drivers/gpu/drm/xe/xe_bo.c | 2 -- drivers/gpu/drm/xe/xe_bo_evict.c | 2 +- drivers/gpu/drm/xe/xe_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_device.c | 9 ++++----- drivers/gpu/drm/xe/xe_display.c | 12 ++++++------ drivers/gpu/drm/xe/xe_dma_buf.c | 8 +++----- drivers/gpu/drm/xe/xe_engine.c | 4 ++-- drivers/gpu/drm/xe/xe_exec.c | 2 +- drivers/gpu/drm/xe/xe_execlist.c | 9 ++++----- drivers/gpu/drm/xe/xe_force_wake.c | 4 ++-- drivers/gpu/drm/xe/xe_ggtt.c | 7 +++---- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_gt_clock.c | 8 ++++---- drivers/gpu/drm/xe/xe_gt_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.c | 2 +- drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 +- drivers/gpu/drm/xe/xe_gt_sysfs.c | 4 +++- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 2 +- drivers/gpu/drm/xe/xe_gt_topology.c | 2 +- drivers/gpu/drm/xe/xe_guc.c | 13 +++++++------ drivers/gpu/drm/xe/xe_guc_ads.c | 5 +++-- drivers/gpu/drm/xe/xe_guc_ct.c | 4 ++-- drivers/gpu/drm/xe/xe_guc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_guc_hwconfig.c | 2 +- drivers/gpu/drm/xe/xe_guc_log.c | 2 +- drivers/gpu/drm/xe/xe_guc_pc.c | 12 +++++++----- drivers/gpu/drm/xe/xe_guc_submit.c | 6 +++--- drivers/gpu/drm/xe/xe_huc.c | 2 +- drivers/gpu/drm/xe/xe_huc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_hw_engine.c | 3 +-- drivers/gpu/drm/xe/xe_hw_fence.c | 1 - drivers/gpu/drm/xe/xe_irq.c | 5 +++-- drivers/gpu/drm/xe/xe_lrc.c | 7 +++---- drivers/gpu/drm/xe/xe_migrate.c | 11 ++++++----- drivers/gpu/drm/xe/xe_mmio.c | 3 +-- drivers/gpu/drm/xe/xe_mocs.c | 4 ++-- drivers/gpu/drm/xe/xe_module.c | 1 + drivers/gpu/drm/xe/xe_pci.c | 5 ++--- drivers/gpu/drm/xe/xe_pcode.c | 10 ++++------ drivers/gpu/drm/xe/xe_pm.c | 4 ++-- drivers/gpu/drm/xe/xe_preempt_fence.c | 2 +- drivers/gpu/drm/xe/xe_pt.c | 4 ++-- drivers/gpu/drm/xe/xe_query.c | 11 ++++++----- drivers/gpu/drm/xe/xe_reg_sr.c | 5 ++--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 7 +++---- drivers/gpu/drm/xe/xe_ring_ops.c | 4 ++-- drivers/gpu/drm/xe/xe_rtp.c | 1 - drivers/gpu/drm/xe/xe_sa.c | 3 ++- drivers/gpu/drm/xe/xe_sched_job.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 | 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 | 4 ++-- drivers/gpu/drm/xe/xe_vm.c | 2 +- drivers/gpu/drm/xe/xe_vm_madvise.c | 8 +++++--- drivers/gpu/drm/xe/xe_wopcm.c | 2 +- 59 files changed, 128 insertions(+), 132 deletions(-)drivers/gpu/drm/xe/xe_bb.c +0
-0
drivers/gpu/drm/xe/xe_bb.c line 5
Quoted 4 lines
drivers/gpu/drm/xe/xe_bb.c +0
-1@@ -2,12 +2,12 @@/* * Copyright © 2022 Intel Corporation */ -
Nitpick, throughout the series, I would leave a blank line after the SPDX and copyright boilerplate, regardless of whether it's an #include or header guard #ifdef that follows. They're not comments about what follows, which is what it feels like when they're directly attached to something that follows without a blank line.
Quoted 10 lines
drivers/gpu/drm/xe/xe_bb.c +2
-1#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"
...
Quoted 9 lines
drivers/gpu/drm/xe/xe_uc.c +1
-0@@ -3,13 +3,13 @@* Copyright © 2022 Intel Corporation */ +#include "xe_uc.h"
drivers/gpu/drm/xe/xe_uc.c line 14
Quoted 10 lines
drivers/gpu/drm/xe/xe_uc.c +1
-2#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"
Here, having the .h corresponding to the .c just looks like it's not properly sorted.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Re: [Intel-xe] [PATCH v2 02/11] drm/xe: Sort includes
Quoted 6 lines · Jani Nikula
Quoted 4 lines · Lucas De Marchi
Sort includes and split them in blocks:
1) .h corresponding to the .c. Example:
xe_bb.cshould have a "#include "xe_bb.h" first.
Quoted 7 lines
Personally, I've never liked this, because the local headers could have stuff that impacts global headers. And if there are conflicts, you kind of want to have your local one look like the culprit (although modern compilers are pretty good at showing both sites).
Note that to keep headers self-contained, this is not enough for headers not associated with a .c, which is why we have the HDRTEST rule in i915.
Although I like the hdrtest and wouldn't replace it, I think having a convention like this is good - it also solves most of the issues wrt selfcontained headers while not requiring any special setup on dev
side: if every .c/.h follow the same structure, it's easier to maintain the consistency.
Quoted 6 lines
Quoted 6 lines
2) #include <linux/...>
3) #include <drm/...>
4) local includes
5) i915 includes
Quoted 6 lines
Quoted 4 lines
This is accomplished by running
clang-format --style=file -i --sort-includes drivers/gpu/drm/xe/*.cand ignoring all the changes after the includes. There are also some manual tweaks to split the blocks.Do you have the style file somewhere?
.clang-format. It's in the kernel source tree, added in commit d4ef8d3ff005 ("clang-format: add configuration file")
Quoted 65 lines
Quoted 65 lines
Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_bb.c | 4 ++-- drivers/gpu/drm/xe/xe_bo.c | 2 -- drivers/gpu/drm/xe/xe_bo_evict.c | 2 +- drivers/gpu/drm/xe/xe_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_device.c | 9 ++++----- drivers/gpu/drm/xe/xe_display.c | 12 ++++++------ drivers/gpu/drm/xe/xe_dma_buf.c | 8 +++----- drivers/gpu/drm/xe/xe_engine.c | 4 ++-- drivers/gpu/drm/xe/xe_exec.c | 2 +- drivers/gpu/drm/xe/xe_execlist.c | 9 ++++----- drivers/gpu/drm/xe/xe_force_wake.c | 4 ++-- drivers/gpu/drm/xe/xe_ggtt.c | 7 +++---- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_gt_clock.c | 8 ++++---- drivers/gpu/drm/xe/xe_gt_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.c | 2 +- drivers/gpu/drm/xe/xe_gt_pagefault.c | 2 +- drivers/gpu/drm/xe/xe_gt_sysfs.c | 4 +++- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 2 +- drivers/gpu/drm/xe/xe_gt_topology.c | 2 +- drivers/gpu/drm/xe/xe_guc.c | 13 +++++++------ drivers/gpu/drm/xe/xe_guc_ads.c | 5 +++-- drivers/gpu/drm/xe/xe_guc_ct.c | 4 ++-- drivers/gpu/drm/xe/xe_guc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_guc_hwconfig.c | 2 +- drivers/gpu/drm/xe/xe_guc_log.c | 2 +- drivers/gpu/drm/xe/xe_guc_pc.c | 12 +++++++----- drivers/gpu/drm/xe/xe_guc_submit.c | 6 +++--- drivers/gpu/drm/xe/xe_huc.c | 2 +- drivers/gpu/drm/xe/xe_huc_debugfs.c | 2 +- drivers/gpu/drm/xe/xe_hw_engine.c | 3 +-- drivers/gpu/drm/xe/xe_hw_fence.c | 1 - drivers/gpu/drm/xe/xe_irq.c | 5 +++-- drivers/gpu/drm/xe/xe_lrc.c | 7 +++---- drivers/gpu/drm/xe/xe_migrate.c | 11 ++++++----- drivers/gpu/drm/xe/xe_mmio.c | 3 +-- drivers/gpu/drm/xe/xe_mocs.c | 4 ++-- drivers/gpu/drm/xe/xe_module.c | 1 + drivers/gpu/drm/xe/xe_pci.c | 5 ++--- drivers/gpu/drm/xe/xe_pcode.c | 10 ++++------ drivers/gpu/drm/xe/xe_pm.c | 4 ++-- drivers/gpu/drm/xe/xe_preempt_fence.c | 2 +- drivers/gpu/drm/xe/xe_pt.c | 4 ++-- drivers/gpu/drm/xe/xe_query.c | 11 ++++++----- drivers/gpu/drm/xe/xe_reg_sr.c | 5 ++--- drivers/gpu/drm/xe/xe_reg_whitelist.c | 7 +++---- drivers/gpu/drm/xe/xe_ring_ops.c | 4 ++-- drivers/gpu/drm/xe/xe_rtp.c | 1 - drivers/gpu/drm/xe/xe_sa.c | 3 ++- drivers/gpu/drm/xe/xe_sched_job.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 | 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 | 4 ++-- drivers/gpu/drm/xe/xe_vm.c | 2 +- drivers/gpu/drm/xe/xe_vm_madvise.c | 8 +++++--- drivers/gpu/drm/xe/xe_wopcm.c | 2 +- 59 files changed, 128 insertions(+), 132 deletions(-)
Quoted 15 lines
drivers/gpu/drm/xe/xe_bb.c line 5
Quoted 9 lines
drivers/gpu/drm/xe/xe_bb.c +0
-1@@ -2,12 +2,12 @@/* * Copyright © 2022 Intel Corporation */ -Nitpick, throughout the series, I would leave a blank line after the SPDX and copyright boilerplate, regardless of whether it's an #include or header guard #ifdef that follows. They're not comments about what follows, which is what it feels like when they're directly attached to something that follows without a blank line.
ok
Quoted 22 lines
Quoted 11 lines
drivers/gpu/drm/xe/xe_bb.c +2
-1#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" ...
Quoted 8 lines
drivers/gpu/drm/xe/xe_uc.c +0
-0@@ -3,13 +3,13 @@* Copyright © 2022 Intel Corporation */
Quoted 14 lines
drivers/gpu/drm/xe/xe_uc.c line 14
Quoted 11 lines
drivers/gpu/drm/xe/xe_uc.c +2
-2+#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" Here, having the .h corresponding to the .c just looks like it's not properly sorted.
just because I failed to split the block as Matt Auld noticed
thanks
Lucas De Marchi
Quoted 7 lines
BR,
Jani.Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
PATCH v2 3/11 drm/xe/guc: Remove i915_regs.h include
In reply to Lucas De Marchii915_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
@@ -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
PATCH v2 4/11 drm/xe: Remove dependency on intel_engine_regs.h
In reply to Lucas De MarchiCreate 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
@@ -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
@@ -6,6 +6,7 @@#include <drm/drm_managed.h> +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine.h"
@@ -18,7 +19,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
@@ -4,8 +4,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"
@@ -16,9 +19,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
@@ -6,6 +6,7 @@#include <drm/drm_managed.h> +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_execlist.h"
@@ -20,7 +21,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
@@ -4,6 +4,7 @@*/ #include "xe_lrc.h" +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine_types.h"
@@ -12,7 +13,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
@@ -7,13 +7,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
@@ -11,6 +11,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"
@@ -19,7 +20,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
@@ -4,11 +4,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
@@ -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
Re: [Intel-xe] [PATCH v2 04/11] drm/xe: Remove dependency on intel_engine_regs.h
Quoted 153 lines · Lucas De Marchi
Create
regs/xe_engine_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/xe/regs/xe_engine_regs.h new file +98
-0@@ -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@@ -6,6 +6,7 @@#include <drm/drm_managed.h> +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine.h" @@ -18,7 +19,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 +0
-0
drivers/gpu/drm/xe/xe_guc_ads.c line 8
Quoted 5 lines
drivers/gpu/drm/xe/xe_guc_ads.c +2
-0@@ -4,8 +4,11 @@*/ #include "xe_guc_ads.h" +#include "xe_guc_ads.h" +
This duplication looks like an accident?
Aside from that,
Quoted 136 lines
drivers/gpu/drm/xe/xe_guc_ads.c +2
-1#include <drm/drm_managed.h> +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_gt.h" #include "xe_guc.h" @@ -16,9 +19,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 8drivers/gpu/drm/xe/xe_hw_engine.c +1
-1@@ -6,6 +6,7 @@#include <drm/drm_managed.h> +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_execlist.h" @@ -20,7 +21,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@@ -4,6 +4,7 @@*/ #include "xe_lrc.h" +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine_types.h" @@ -12,7 +13,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@@ -7,13 +7,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@@ -11,6 +11,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" @@ -19,7 +20,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 16drivers/gpu/drm/xe/xe_reg_whitelist.c +1
-1@@ -4,11 +4,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 _MMIOdrivers/gpu/drm/xe/xe_wa.c +1
-1@@ -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
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH v2 04/11] drm/xe: Remove dependency on intel_engine_regs.h
Quoted 157 lines · Matt Roper
Quoted 156 lines · Lucas De Marchi
Create
regs/xe_engine_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/xe/regs/xe_engine_regs.h new file +98
-0@@ -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@@ -6,6 +6,7 @@#include <drm/drm_managed.h> +#include "regs/xe_engine_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine.h" @@ -18,7 +19,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 +0
-0@@ -4,8 +4,11 @@*/ #include "xe_guc_ads.h"
Quoted 4 lines
drivers/gpu/drm/xe/xe_guc_ads.c line 8
Quoted 2 lines
drivers/gpu/drm/xe/xe_guc_ads.c +2
-0+#include "xe_guc_ads.h" +This duplication looks like an accident?
yep
Quoted 4 lines
Aside from that,
Reviewed-by Matt Roper <[email protected]>
thanks
Lucas De Marchi
PATCH v2 5/11 drm/xe: Remove dependency on intel_gt_regs.h
In reply to Lucas De MarchiCreate 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
@@ -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
@@ -7,6 +7,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"
@@ -20,7 +21,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
@@ -6,11 +6,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
@@ -9,6 +9,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"
@@ -17,7 +18,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
@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_bb.h" #include "xe_bo.h" #include "xe_device.h"
@@ -40,8 +41,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
@@ -4,12 +4,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
@@ -4,13 +4,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
@@ -4,6 +4,7 @@*/ #include "xe_guc.h" +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_force_wake.h"
@@ -20,7 +21,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
@@ -9,6 +9,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"
@@ -19,9 +20,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
@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_gt.h"
@@ -30,7 +31,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
@@ -7,6 +7,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"
@@ -21,7 +22,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
@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_device.h" #include "xe_display.h" #include "xe_drv.h"
@@ -16,7 +17,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
@@ -5,6 +5,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"
@@ -14,7 +15,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
@@ -8,13 +8,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
@@ -4,6 +4,7 @@*/ #include "xe_mocs.h" +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine.h"
@@ -12,8 +13,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
@@ -12,6 +12,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"
@@ -20,8 +21,6 @@#include "xe_mmio.h" #include "xe_rtp_types.h" -#include "gt/intel_gt_regs.h" -#define XE_REG_SR_GROW_STEP_DEFAULT 16static void reg_sr_fini (struct drm_device *drm,void *arg)
drivers/gpu/drm/xe/xe_reg_whitelist.c +1 -2
@@ -5,12 +5,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
@@ -4,6 +4,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"
@@ -12,7 +13,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
@@ -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
@@ -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
Rodrigo Vivi
maintainerRe: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
Quoted 58 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/i915/i915_reg_defs.h +2
-0@@ -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 +3
-0@@ -0,0 +1,287 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation
drivers/gpu/drm/xe/regs/xe_gt_regs.h line 13
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_gt_regs.h new file +10
-0+*/ + +#ifndef _XE_GT_REGS_H_ +#define _XE_GT_REGS_H_ + +#include "i915_reg_defs.h" + +/* RPM unit config (Gen8+) */ +#define RPM_CONFIG0 _MMIO(0xd00) +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3
https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/215
https://lore.kernel.org/all/[email protected]/
Matt has asked us to get rid of the GEN stuff...
I believe this is a great opportunity, although I believe it is not a blocker and could be done later.
Quoted 651 lines
drivers/gpu/drm/xe/regs/xe_gt_regs.h new file +274
-0+#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (0x7 << GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT) +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 0 +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 1 +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_38_4_MHZ 2 +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_25_MHZ 3 +#define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT 1 +#define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK (0x3 << GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT) + +#define FORCEWAKE_ACK_MEDIA_VDBOX_GEN11 (n) _MMIO(0xd50 + (n) * 4) +#define FORCEWAKE_ACK_MEDIA_VEBOX_GEN11 (n) _MMIO(0xd70 + (n) * 4) +#define FORCEWAKE_ACK_RENDER_GEN9 _MMIO(0xd84) + +#define GEN9_LNCFCMOCS (i) _MMIO(0xb020 + (i) * 4)/* L3 Cache Control */ +#define LNCFCMOCS_REG_COUNT 32 + +#define MCFG_MCR_SELECTOR _MMIO(0xfd0) +#define MTL_MCR_SELECTOR _MMIO(0xfd4) +#define SF_MCR_SELECTOR _MMIO(0xfd8) +#define GEN8_MCR_SELECTOR _MMIO(0xfdc) +#define GAM_MCR_SELECTOR _MMIO(0xfe0) +#define GEN11_MCR_MULTICAST REG_BIT(31) +#define GEN11_MCR_SLICE (slice) (((slice) & 0xf) << 27) +#define GEN11_MCR_SLICE_MASK GEN11_MCR_SLICE(0xf) +#define GEN11_MCR_SUBSLICE (subslice) (((subslice) & 0x7) << 24) +#define GEN11_MCR_SUBSLICE_MASK GEN11_MCR_SUBSLICE(0x7) +#define MTL_MCR_GROUPID REG_GENMASK(11, 8) +#define MTL_MCR_INSTANCEID REG_GENMASK(3, 0) + +#define GEN7_FF_SLICE_CS_CHICKEN1 _MMIO(0x20e0) +#define GEN9_FFSC_PERCTX_PREEMPT_CTRL (1 << 14) + +#define GEN9_CS_DEBUG_MODE1 _MMIO(0x20ec) +#define FF_DOP_CLOCK_GATE_DISABLE REG_BIT(1) + +#define PS_INVOCATION_COUNT _MMIO(0x2348) + +#define GEN8_CS_CHICKEN1 _MMIO(0x2580) +#define GEN9_PREEMPT_3D_OBJECT_LEVEL (1 << 0) +#define GEN9_PREEMPT_GPGPU_LEVEL (hi, lo) (((hi) << 2) | ((lo) << 1)) +#define GEN9_PREEMPT_GPGPU_MID_THREAD_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 0) +#define GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 1) +#define GEN9_PREEMPT_GPGPU_COMMAND_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(1, 0) +#define GEN9_PREEMPT_GPGPU_LEVEL_MASK GEN9_PREEMPT_GPGPU_LEVEL(1, 1) + +#define GEN12_GLOBAL_MOCS (i) _MMIO(0x4000 + (i) * 4)/* Global MOCS regs */ +#define GEN12_GFX_CCS_AUX_NV _MMIO(0x4208) + +#define GEN12_VD0_AUX_NV _MMIO(0x4218) +#define GEN12_VE0_AUX_NV _MMIO(0x4238) + +#define GEN12_VE1_AUX_NV _MMIO(0x42b8) +#define AUX_INV REG_BIT(0) + +#define GEN12_PAT_INDEX (index) _MMIO(0x4800 + (index) * 4) +#define XEHP_TILE0_ADDR_RANGE MCR_REG(0x4900) +#define XEHP_FLAT_CCS_BASE_ADDR MCR_REG(0x4910) + +#define GEN12_FF_MODE2 _MMIO(0x6604) +#define XEHP_FF_MODE2 MCR_REG(0x6604) +#define FF_MODE2_GS_TIMER_MASK REG_GENMASK(31, 24) +#define FF_MODE2_GS_TIMER_224 REG_FIELD_PREP(FF_MODE2_GS_TIMER_MASK, 224) +#define FF_MODE2_TDS_TIMER_MASK REG_GENMASK(23, 16) +#define FF_MODE2_TDS_TIMER_128 REG_FIELD_PREP(FF_MODE2_TDS_TIMER_MASK, 4) + +#define HIZ_CHICKEN _MMIO(0x7018) +#define DG1_HZ_READ_SUPPRESSION_OPTIMIZATION_DISABLE REG_BIT(14) + +/* GEN7 chicken */ +#define GEN7_COMMON_SLICE_CHICKEN1 _MMIO(0x7010) + +#define GEN11_COMMON_SLICE_CHICKEN3 _MMIO(0x7304) +#define XEHP_COMMON_SLICE_CHICKEN3 MCR_REG(0x7304) +#define DG1_FLOAT_POINT_BLEND_OPT_STRICT_MODE_EN REG_BIT(12) +#define XEHP_DUAL_SIMD8_SEQ_MERGE_DISABLE REG_BIT(12) +#define GEN11_BLEND_EMB_FIX_DISABLE_IN_RCC REG_BIT(11) +#define GEN12_DISABLE_CPS_AWARE_COLOR_PIPE REG_BIT(9) + +#define XEHP_SQCM MCR_REG(0x8724) +#define EN_32B_ACCESS REG_BIT(30) + +#define GEN10_MIRROR_FUSE3 _MMIO(0x9118) +#define GEN10_L3BANK_PAIR_COUNT 4 +#define GEN10_L3BANK_MASK 0x0F +/* on Xe_HP the same fuses indicates mslices instead of L3 banks */ +#define GEN12_MAX_MSLICES 4 +#define GEN12_MEML3_EN_MASK 0x0F + +/* Fuse readout registers for GT */ +#define XEHP_FUSE4 _MMIO(0x9114) +#define GT_L3_EXC_MASK REG_GENMASK(6, 4) + +#define GEN11_GT_VEBOX_VDBOX_DISABLE _MMIO(0x9140) +#define GEN11_GT_VDBOX_DISABLE_MASK 0xff +#define GEN11_GT_VEBOX_DISABLE_SHIFT 16 +#define GEN11_GT_VEBOX_DISABLE_MASK (0x0f << GEN11_GT_VEBOX_DISABLE_SHIFT) + +#define GEN6_GDRST _MMIO(0x941c) +#define GEN11_GRDOM_GUC REG_BIT(3) +#define GEN6_GRDOM_FULL (1 << 0) +#define GEN11_GRDOM_FULL GEN6_GRDOM_FULL + +#define GEN7_MISCCPCTL _MMIO(0x9424) +#define GEN7_DOP_CLOCK_GATE_ENABLE (1 << 0) +#define GEN12_DOP_CLOCK_GATE_RENDER_ENABLE REG_BIT(1) + +#define UNSLCGCTL9430 _MMIO(0x9430) +#define MSQDUNIT_CLKGATE_DIS REG_BIT(3) + +#define UNSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9434) +#define VFUNIT_CLKGATE_DIS REG_BIT(20) +#define TSGUNIT_CLKGATE_DIS REG_BIT(17)/* XEHPSDV */ +#define CG3DDISCFEG_CLKGATE_DIS REG_BIT(17)/* DG2 */ +#define GAMEDIA_CLKGATE_DIS REG_BIT(11) +#define HSUNIT_CLKGATE_DIS REG_BIT(8) +#define VSUNIT_CLKGATE_DIS REG_BIT(3) + +#define UNSLCGCTL9440 _MMIO(0x9440) +#define GAMTLBOACS_CLKGATE_DIS REG_BIT(28) +#define GAMTLBVDBOX5_CLKGATE_DIS REG_BIT(27) +#define GAMTLBVDBOX6_CLKGATE_DIS REG_BIT(26) +#define GAMTLBVDBOX3_CLKGATE_DIS REG_BIT(24) +#define GAMTLBVDBOX4_CLKGATE_DIS REG_BIT(23) +#define GAMTLBVDBOX7_CLKGATE_DIS REG_BIT(22) +#define GAMTLBVDBOX2_CLKGATE_DIS REG_BIT(21) +#define GAMTLBVDBOX0_CLKGATE_DIS REG_BIT(17) +#define GAMTLBKCR_CLKGATE_DIS REG_BIT(16) +#define GAMTLBGUC_CLKGATE_DIS REG_BIT(15) +#define GAMTLBBLT_CLKGATE_DIS REG_BIT(14) +#define GAMTLBVDBOX1_CLKGATE_DIS REG_BIT(6) + +#define UNSLCGCTL9444 _MMIO(0x9444) +#define GAMTLBGFXA0_CLKGATE_DIS REG_BIT(30) +#define GAMTLBGFXA1_CLKGATE_DIS REG_BIT(29) +#define GAMTLBCOMPA0_CLKGATE_DIS REG_BIT(28) +#define GAMTLBCOMPA1_CLKGATE_DIS REG_BIT(27) +#define GAMTLBCOMPB0_CLKGATE_DIS REG_BIT(26) +#define GAMTLBCOMPB1_CLKGATE_DIS REG_BIT(25) +#define GAMTLBCOMPC0_CLKGATE_DIS REG_BIT(24) +#define GAMTLBCOMPC1_CLKGATE_DIS REG_BIT(23) +#define GAMTLBCOMPD0_CLKGATE_DIS REG_BIT(22) +#define GAMTLBCOMPD1_CLKGATE_DIS REG_BIT(21) +#define GAMTLBMERT_CLKGATE_DIS REG_BIT(20) +#define GAMTLBVEBOX3_CLKGATE_DIS REG_BIT(19) +#define GAMTLBVEBOX2_CLKGATE_DIS REG_BIT(18) +#define GAMTLBVEBOX1_CLKGATE_DIS REG_BIT(17) +#define GAMTLBVEBOX0_CLKGATE_DIS REG_BIT(16) +#define LTCDD_CLKGATE_DIS REG_BIT(10) + +#define GEN11_SLICE_UNIT_LEVEL_CLKGATE _MMIO(0x94d4) +#define XEHP_SLICE_UNIT_LEVEL_CLKGATE MCR_REG(0x94d4) +#define SARBUNIT_CLKGATE_DIS (1 << 5) +#define RCCUNIT_CLKGATE_DIS (1 << 7) +#define MSCUNIT_CLKGATE_DIS (1 << 10) +#define NODEDSS_CLKGATE_DIS REG_BIT(12) +#define L3_CLKGATE_DIS REG_BIT(16) +#define L3_CR2X_CLKGATE_DIS REG_BIT(17) + +#define UNSLICE_UNIT_LEVEL_CLKGATE2 _MMIO(0x94e4) +#define VSUNIT_CLKGATE_DIS_TGL REG_BIT(19) +#define PSDUNIT_CLKGATE_DIS REG_BIT(5) + +#define GEN11_SUBSLICE_UNIT_LEVEL_CLKGATE MCR_REG(0x9524) +#define DSS_ROUTER_CLKGATE_DIS REG_BIT(28) +#define GWUNIT_CLKGATE_DIS REG_BIT(16) + +#define SUBSLICE_UNIT_LEVEL_CLKGATE2 MCR_REG(0x9528) +#define CPSSUNIT_CLKGATE_DIS REG_BIT(9) + +#define SSMCGCTL9530 MCR_REG(0x9530) +#define RTFUNIT_CLKGATE_DIS REG_BIT(18) + +#define GEN10_DFR_RATIO_EN_AND_CHICKEN MCR_REG(0x9550) +#define DFR_DISABLE (1 << 9) + +#define GEN6_RPNSWREQ _MMIO(0xa008) +#define GEN6_RC_CONTROL _MMIO(0xa090) +#define GEN6_RC_STATE _MMIO(0xa094) + +#define GEN6_PMINTRMSK _MMIO(0xa168) +#define GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC (1 << 31) +#define ARAT_EXPIRED_INTRMSK (1 << 9) + +#define FORCEWAKE_GT_GEN9 _MMIO(0xa188) + +#define GEN9_PG_ENABLE _MMIO(0xa210) + +/* GPM unit config (Gen9+) */ +#define CTC_MODE _MMIO(0xa26c) +#define CTC_SOURCE_PARAMETER_MASK 1 +#define CTC_SOURCE_CRYSTAL_CLOCK 0 +#define CTC_SOURCE_DIVIDE_LOGIC 1 +#define CTC_SHIFT_PARAMETER_SHIFT 1 +#define CTC_SHIFT_PARAMETER_MASK (0x3 << CTC_SHIFT_PARAMETER_SHIFT) + +#define FORCEWAKE_RENDER_GEN9 _MMIO(0xa278) +#define FORCEWAKE_MEDIA_VDBOX_GEN11 (n) _MMIO(0xa540 + (n) * 4) +#define FORCEWAKE_MEDIA_VEBOX_GEN11 (n) _MMIO(0xa560 + (n) * 4) + +#define GEN10_SAMPLER_MODE MCR_REG(0xe18c) +#define ENABLE_SMALLPL REG_BIT(15) +#define SC_DISABLE_POWER_OPTIMIZATION_EBB REG_BIT(9) +#define GEN11_SAMPLER_ENABLE_HEADLESS_MSG REG_BIT(5) + +#define GEN9_ROW_CHICKEN4 MCR_REG(0xe48c) +#define GEN12_DISABLE_GRF_CLEAR REG_BIT(13) +#define XEHP_DIS_BBL_SYSPIPE REG_BIT(11) +#define GEN12_DISABLE_TDL_PUSH REG_BIT(9) +#define GEN11_DIS_PICK_2ND_EU REG_BIT(7) +#define GEN12_DISABLE_HDR_PAST_PAYLOAD_HOLD_FIX REG_BIT(4) +#define THREAD_EX_ARB_MODE REG_GENMASK(3, 2) +#define THREAD_EX_ARB_MODE_RR_AFTER_DEP REG_FIELD_PREP(THREAD_EX_ARB_MODE, 0x2) + +#define GEN7_ROW_CHICKEN2 _MMIO(0xe4f4) +#define GEN12_DISABLE_READ_SUPPRESSION REG_BIT(15) +#define GEN12_DISABLE_EARLY_READ REG_BIT(14) +#define GEN12_ENABLE_LARGE_GRF_MODE REG_BIT(12) +#define GEN12_PUSH_CONST_DEREF_HOLD_DIS REG_BIT(8) +#define GEN12_DISABLE_DOP_GATING REG_BIT(0) + +#define SARB_CHICKEN1 MCR_REG(0xe90c) +#define COMP_CKN_IN REG_GENMASK(30, 29) + +#define GEN12_RCU_MODE _MMIO(0x14800) +#define GEN12_RCU_MODE_CCS_ENABLE REG_BIT(0) + +#define FORCEWAKE_ACK_GT_GEN9 _MMIO(0x130044) +#define FORCEWAKE_KERNEL BIT(0) +#define FORCEWAKE_USER BIT(1) +#define FORCEWAKE_KERNEL_FALLBACK BIT(15) + +#define GEN6_GT_CORE_STATUS _MMIO(0x138060) +#define GEN6_RC0 0 +#define GEN6_RC6 3 + +#define GEN6_GT_GFX_RC6_LOCKED _MMIO(0x138104) +#define GEN6_GT_GFX_RC6 _MMIO(0x138108) + +#define GFX_FLSH_CNTL_GEN6 _MMIO(0x101008) +#define GFX_FLSH_CNTL_EN (1 << 0) + +#define GEN11_GT_INTR_DW (x) _MMIO(0x190018 + ((x) * 4)) + +#define GEN11_GUC_SG_INTR_ENABLE _MMIO(0x190038) +#define ENGINE1_MASK REG_GENMASK(31, 16) +#define ENGINE0_MASK REG_GENMASK(15, 0) + +#define GEN11_GPM_WGBOXPERF_INTR_ENABLE _MMIO(0x19003c) + +#define GEN11_INTR_IDENTITY_REG (x) _MMIO(0x190060 + ((x) * 4)) +#define GEN11_INTR_DATA_VALID (1 << 31) +#define GEN11_INTR_ENGINE_INSTANCE (x) (((x) & GENMASK(25, 20)) >> 20) +#define GEN11_INTR_ENGINE_CLASS (x) (((x) & GENMASK(18, 16)) >> 16) +#define GEN11_INTR_ENGINE_INTR (x) ((x) & 0xffff) +#define OTHER_GUC_INSTANCE 0 + +#define GEN11_RENDER_COPY_INTR_ENABLE _MMIO(0x190030) +#define GEN11_VCS_VECS_INTR_ENABLE _MMIO(0x190034) +#define GEN12_CCS_RSVD_INTR_ENABLE _MMIO(0x190048) +#define GEN11_IIR_REG_SELECTOR (x) _MMIO(0x190070 + ((x) * 4)) +#define GEN11_RCS0_RSVD_INTR_MASK _MMIO(0x190090) +#define GEN11_BCS_RSVD_INTR_MASK _MMIO(0x1900a0) +#define GEN11_VCS0_VCS1_INTR_MASK _MMIO(0x1900a8) +#define GEN11_VCS2_VCS3_INTR_MASK _MMIO(0x1900ac) +#define GEN11_VECS0_VECS1_INTR_MASK _MMIO(0x1900d0) +#define GEN11_GUC_SG_INTR_MASK _MMIO(0x1900e8) +#define GEN11_GPM_WGBOXPERF_INTR_MASK _MMIO(0x1900ec) +#define GEN12_CCS0_CCS1_INTR_MASK _MMIO(0x190100) +#define GEN12_CCS2_CCS3_INTR_MASK _MMIO(0x190104) +#define XEHPC_BCS1_BCS2_INTR_MASK _MMIO(0x190110) +#define XEHPC_BCS3_BCS4_INTR_MASK _MMIO(0x190114) +#define XEHPC_BCS5_BCS6_INTR_MASK _MMIO(0x190118) +#define XEHPC_BCS7_BCS8_INTR_MASK _MMIO(0x19011c) + +#endif drivers/gpu/drm/xe/xe_execlist.c +1
-1@@ -7,6 +7,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" @@ -20,7 +21,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@@ -6,11 +6,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@@ -9,6 +9,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" @@ -17,7 +18,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@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_bb.h" #include "xe_bo.h" #include "xe_device.h" @@ -40,8 +41,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@@ -4,12 +4,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@@ -4,13 +4,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@@ -4,6 +4,7 @@*/ #include "xe_guc.h" +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_force_wake.h" @@ -20,7 +21,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@@ -9,6 +9,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" @@ -19,9 +20,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 8drivers/gpu/drm/xe/xe_guc_pc.c +1
-1@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_gt.h" @@ -30,7 +31,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@@ -7,6 +7,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" @@ -21,7 +22,6 @@#include "xe_sched_job.h" #include "xe_wa.h" -#include "gt/intel_gt_regs.h" #include "i915_reg.h" #define MAX_MMIO_BASES 3drivers/gpu/drm/xe/xe_irq.c +1
-1@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_device.h" #include "xe_display.h" #include "xe_drv.h" @@ -16,7 +17,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@@ -5,6 +5,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" @@ -14,7 +15,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@@ -8,13 +8,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@@ -4,6 +4,7 @@*/ #include "xe_mocs.h" +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine.h" @@ -12,8 +13,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@@ -12,6 +12,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" @@ -20,8 +21,6 @@#include "xe_mmio.h" #include "xe_rtp_types.h" -#include "gt/intel_gt_regs.h" -#define XE_REG_SR_GROW_STEP_DEFAULT 16static void reg_sr_fini (struct drm_device *drm,void *arg)drivers/gpu/drm/xe/xe_reg_whitelist.c +1
-2@@ -5,12 +5,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@@ -4,6 +4,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" @@ -12,7 +13,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@@ -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@@ -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
Re: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
Quoted 73 lines · Rodrigo Vivi
Quoted 58 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/i915/i915_reg_defs.h +2
-0@@ -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 +3
-0@@ -0,0 +1,287 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation drivers/gpu/drm/xe/regs/xe_gt_regs.h line 13
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_gt_regs.h new file +10
-0+*/ + +#ifndef _XE_GT_REGS_H_ +#define _XE_GT_REGS_H_ + +#include "i915_reg_defs.h" + +/* RPM unit config (Gen8+) */ +#define RPM_CONFIG0 _MMIO(0xd00) +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/215
https://lore.kernel.org/all/[email protected]/
Quoted 3 lines
Matt has asked us to get rid of the GEN stuff...
I believe this is a great opportunity, although I believe it is not a blocker and could be done later.
I have that issue assigned to me so I don't forget. However I'd separate the rather manual movement here from any cleanup. It's too easy to land regressions because of a typo while converting coding style together with a big code move like this. From the commit message:
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.
thanks
Lucas De Marchi
Re: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
In reply to Lucas De MarchiQuoted 41 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/i915/i915_reg_defs.h +0
-0
drivers/gpu/drm/i915/i915_reg_defs.h typedef struct { · line 139
Quoted 4 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1
-0@@ -136,6 +136,8 @@ typedef struct {u32 reg; } i915_mcr_reg_t; +#define MCR_REG (offset) ((const i915_mcr_reg_t){ .reg = (offset) })
Should there be a corresponding removal of this definition from drivers/gpu/drm/i915/gt/intel_gt_regs.h ?
Aside from that,
Quoted 674 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1
-0+#define INVALID_MMIO_REG _MMIO(0)/* drivers/gpu/drm/xe/regs/xe_gt_regs.h new file +287
-0@@ -0,0 +1,287 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation +*/ + +#ifndef _XE_GT_REGS_H_ +#define _XE_GT_REGS_H_ + +#include "i915_reg_defs.h" + +/* RPM unit config (Gen8+) */ +#define RPM_CONFIG0 _MMIO(0xd00) +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT 3 +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_MASK (0x7 << GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_SHIFT) +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_24_MHZ 0 +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_19_2_MHZ 1 +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_38_4_MHZ 2 +#define GEN11_RPM_CONFIG0_CRYSTAL_CLOCK_FREQ_25_MHZ 3 +#define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT 1 +#define GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_MASK (0x3 << GEN10_RPM_CONFIG0_CTC_SHIFT_PARAMETER_SHIFT) + +#define FORCEWAKE_ACK_MEDIA_VDBOX_GEN11 (n) _MMIO(0xd50 + (n) * 4) +#define FORCEWAKE_ACK_MEDIA_VEBOX_GEN11 (n) _MMIO(0xd70 + (n) * 4) +#define FORCEWAKE_ACK_RENDER_GEN9 _MMIO(0xd84) + +#define GEN9_LNCFCMOCS (i) _MMIO(0xb020 + (i) * 4)/* L3 Cache Control */ +#define LNCFCMOCS_REG_COUNT 32 + +#define MCFG_MCR_SELECTOR _MMIO(0xfd0) +#define MTL_MCR_SELECTOR _MMIO(0xfd4) +#define SF_MCR_SELECTOR _MMIO(0xfd8) +#define GEN8_MCR_SELECTOR _MMIO(0xfdc) +#define GAM_MCR_SELECTOR _MMIO(0xfe0) +#define GEN11_MCR_MULTICAST REG_BIT(31) +#define GEN11_MCR_SLICE (slice) (((slice) & 0xf) << 27) +#define GEN11_MCR_SLICE_MASK GEN11_MCR_SLICE(0xf) +#define GEN11_MCR_SUBSLICE (subslice) (((subslice) & 0x7) << 24) +#define GEN11_MCR_SUBSLICE_MASK GEN11_MCR_SUBSLICE(0x7) +#define MTL_MCR_GROUPID REG_GENMASK(11, 8) +#define MTL_MCR_INSTANCEID REG_GENMASK(3, 0) + +#define GEN7_FF_SLICE_CS_CHICKEN1 _MMIO(0x20e0) +#define GEN9_FFSC_PERCTX_PREEMPT_CTRL (1 << 14) + +#define GEN9_CS_DEBUG_MODE1 _MMIO(0x20ec) +#define FF_DOP_CLOCK_GATE_DISABLE REG_BIT(1) + +#define PS_INVOCATION_COUNT _MMIO(0x2348) + +#define GEN8_CS_CHICKEN1 _MMIO(0x2580) +#define GEN9_PREEMPT_3D_OBJECT_LEVEL (1 << 0) +#define GEN9_PREEMPT_GPGPU_LEVEL (hi, lo) (((hi) << 2) | ((lo) << 1)) +#define GEN9_PREEMPT_GPGPU_MID_THREAD_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 0) +#define GEN9_PREEMPT_GPGPU_THREAD_GROUP_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(0, 1) +#define GEN9_PREEMPT_GPGPU_COMMAND_LEVEL GEN9_PREEMPT_GPGPU_LEVEL(1, 0) +#define GEN9_PREEMPT_GPGPU_LEVEL_MASK GEN9_PREEMPT_GPGPU_LEVEL(1, 1) + +#define GEN12_GLOBAL_MOCS (i) _MMIO(0x4000 + (i) * 4)/* Global MOCS regs */ +#define GEN12_GFX_CCS_AUX_NV _MMIO(0x4208) + +#define GEN12_VD0_AUX_NV _MMIO(0x4218) +#define GEN12_VE0_AUX_NV _MMIO(0x4238) + +#define GEN12_VE1_AUX_NV _MMIO(0x42b8) +#define AUX_INV REG_BIT(0) + +#define GEN12_PAT_INDEX (index) _MMIO(0x4800 + (index) * 4) +#define XEHP_TILE0_ADDR_RANGE MCR_REG(0x4900) +#define XEHP_FLAT_CCS_BASE_ADDR MCR_REG(0x4910) + +#define GEN12_FF_MODE2 _MMIO(0x6604) +#define XEHP_FF_MODE2 MCR_REG(0x6604) +#define FF_MODE2_GS_TIMER_MASK REG_GENMASK(31, 24) +#define FF_MODE2_GS_TIMER_224 REG_FIELD_PREP(FF_MODE2_GS_TIMER_MASK, 224) +#define FF_MODE2_TDS_TIMER_MASK REG_GENMASK(23, 16) +#define FF_MODE2_TDS_TIMER_128 REG_FIELD_PREP(FF_MODE2_TDS_TIMER_MASK, 4) + +#define HIZ_CHICKEN _MMIO(0x7018) +#define DG1_HZ_READ_SUPPRESSION_OPTIMIZATION_DISABLE REG_BIT(14) + +/* GEN7 chicken */ +#define GEN7_COMMON_SLICE_CHICKEN1 _MMIO(0x7010) + +#define GEN11_COMMON_SLICE_CHICKEN3 _MMIO(0x7304) +#define XEHP_COMMON_SLICE_CHICKEN3 MCR_REG(0x7304) +#define DG1_FLOAT_POINT_BLEND_OPT_STRICT_MODE_EN REG_BIT(12) +#define XEHP_DUAL_SIMD8_SEQ_MERGE_DISABLE REG_BIT(12) +#define GEN11_BLEND_EMB_FIX_DISABLE_IN_RCC REG_BIT(11) +#define GEN12_DISABLE_CPS_AWARE_COLOR_PIPE REG_BIT(9) + +#define XEHP_SQCM MCR_REG(0x8724) +#define EN_32B_ACCESS REG_BIT(30) + +#define GEN10_MIRROR_FUSE3 _MMIO(0x9118) +#define GEN10_L3BANK_PAIR_COUNT 4 +#define GEN10_L3BANK_MASK 0x0F +/* on Xe_HP the same fuses indicates mslices instead of L3 banks */ +#define GEN12_MAX_MSLICES 4 +#define GEN12_MEML3_EN_MASK 0x0F + +/* Fuse readout registers for GT */ +#define XEHP_FUSE4 _MMIO(0x9114) +#define GT_L3_EXC_MASK REG_GENMASK(6, 4) + +#define GEN11_GT_VEBOX_VDBOX_DISABLE _MMIO(0x9140) +#define GEN11_GT_VDBOX_DISABLE_MASK 0xff +#define GEN11_GT_VEBOX_DISABLE_SHIFT 16 +#define GEN11_GT_VEBOX_DISABLE_MASK (0x0f << GEN11_GT_VEBOX_DISABLE_SHIFT) + +#define GEN6_GDRST _MMIO(0x941c) +#define GEN11_GRDOM_GUC REG_BIT(3) +#define GEN6_GRDOM_FULL (1 << 0) +#define GEN11_GRDOM_FULL GEN6_GRDOM_FULL + +#define GEN7_MISCCPCTL _MMIO(0x9424) +#define GEN7_DOP_CLOCK_GATE_ENABLE (1 << 0) +#define GEN12_DOP_CLOCK_GATE_RENDER_ENABLE REG_BIT(1) + +#define UNSLCGCTL9430 _MMIO(0x9430) +#define MSQDUNIT_CLKGATE_DIS REG_BIT(3) + +#define UNSLICE_UNIT_LEVEL_CLKGATE _MMIO(0x9434) +#define VFUNIT_CLKGATE_DIS REG_BIT(20) +#define TSGUNIT_CLKGATE_DIS REG_BIT(17)/* XEHPSDV */ +#define CG3DDISCFEG_CLKGATE_DIS REG_BIT(17)/* DG2 */ +#define GAMEDIA_CLKGATE_DIS REG_BIT(11) +#define HSUNIT_CLKGATE_DIS REG_BIT(8) +#define VSUNIT_CLKGATE_DIS REG_BIT(3) + +#define UNSLCGCTL9440 _MMIO(0x9440) +#define GAMTLBOACS_CLKGATE_DIS REG_BIT(28) +#define GAMTLBVDBOX5_CLKGATE_DIS REG_BIT(27) +#define GAMTLBVDBOX6_CLKGATE_DIS REG_BIT(26) +#define GAMTLBVDBOX3_CLKGATE_DIS REG_BIT(24) +#define GAMTLBVDBOX4_CLKGATE_DIS REG_BIT(23) +#define GAMTLBVDBOX7_CLKGATE_DIS REG_BIT(22) +#define GAMTLBVDBOX2_CLKGATE_DIS REG_BIT(21) +#define GAMTLBVDBOX0_CLKGATE_DIS REG_BIT(17) +#define GAMTLBKCR_CLKGATE_DIS REG_BIT(16) +#define GAMTLBGUC_CLKGATE_DIS REG_BIT(15) +#define GAMTLBBLT_CLKGATE_DIS REG_BIT(14) +#define GAMTLBVDBOX1_CLKGATE_DIS REG_BIT(6) + +#define UNSLCGCTL9444 _MMIO(0x9444) +#define GAMTLBGFXA0_CLKGATE_DIS REG_BIT(30) +#define GAMTLBGFXA1_CLKGATE_DIS REG_BIT(29) +#define GAMTLBCOMPA0_CLKGATE_DIS REG_BIT(28) +#define GAMTLBCOMPA1_CLKGATE_DIS REG_BIT(27) +#define GAMTLBCOMPB0_CLKGATE_DIS REG_BIT(26) +#define GAMTLBCOMPB1_CLKGATE_DIS REG_BIT(25) +#define GAMTLBCOMPC0_CLKGATE_DIS REG_BIT(24) +#define GAMTLBCOMPC1_CLKGATE_DIS REG_BIT(23) +#define GAMTLBCOMPD0_CLKGATE_DIS REG_BIT(22) +#define GAMTLBCOMPD1_CLKGATE_DIS REG_BIT(21) +#define GAMTLBMERT_CLKGATE_DIS REG_BIT(20) +#define GAMTLBVEBOX3_CLKGATE_DIS REG_BIT(19) +#define GAMTLBVEBOX2_CLKGATE_DIS REG_BIT(18) +#define GAMTLBVEBOX1_CLKGATE_DIS REG_BIT(17) +#define GAMTLBVEBOX0_CLKGATE_DIS REG_BIT(16) +#define LTCDD_CLKGATE_DIS REG_BIT(10) + +#define GEN11_SLICE_UNIT_LEVEL_CLKGATE _MMIO(0x94d4) +#define XEHP_SLICE_UNIT_LEVEL_CLKGATE MCR_REG(0x94d4) +#define SARBUNIT_CLKGATE_DIS (1 << 5) +#define RCCUNIT_CLKGATE_DIS (1 << 7) +#define MSCUNIT_CLKGATE_DIS (1 << 10) +#define NODEDSS_CLKGATE_DIS REG_BIT(12) +#define L3_CLKGATE_DIS REG_BIT(16) +#define L3_CR2X_CLKGATE_DIS REG_BIT(17) + +#define UNSLICE_UNIT_LEVEL_CLKGATE2 _MMIO(0x94e4) +#define VSUNIT_CLKGATE_DIS_TGL REG_BIT(19) +#define PSDUNIT_CLKGATE_DIS REG_BIT(5) + +#define GEN11_SUBSLICE_UNIT_LEVEL_CLKGATE MCR_REG(0x9524) +#define DSS_ROUTER_CLKGATE_DIS REG_BIT(28) +#define GWUNIT_CLKGATE_DIS REG_BIT(16) + +#define SUBSLICE_UNIT_LEVEL_CLKGATE2 MCR_REG(0x9528) +#define CPSSUNIT_CLKGATE_DIS REG_BIT(9) + +#define SSMCGCTL9530 MCR_REG(0x9530) +#define RTFUNIT_CLKGATE_DIS REG_BIT(18) + +#define GEN10_DFR_RATIO_EN_AND_CHICKEN MCR_REG(0x9550) +#define DFR_DISABLE (1 << 9) + +#define GEN6_RPNSWREQ _MMIO(0xa008) +#define GEN6_RC_CONTROL _MMIO(0xa090) +#define GEN6_RC_STATE _MMIO(0xa094) + +#define GEN6_PMINTRMSK _MMIO(0xa168) +#define GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC (1 << 31) +#define ARAT_EXPIRED_INTRMSK (1 << 9) + +#define FORCEWAKE_GT_GEN9 _MMIO(0xa188) + +#define GEN9_PG_ENABLE _MMIO(0xa210) + +/* GPM unit config (Gen9+) */ +#define CTC_MODE _MMIO(0xa26c) +#define CTC_SOURCE_PARAMETER_MASK 1 +#define CTC_SOURCE_CRYSTAL_CLOCK 0 +#define CTC_SOURCE_DIVIDE_LOGIC 1 +#define CTC_SHIFT_PARAMETER_SHIFT 1 +#define CTC_SHIFT_PARAMETER_MASK (0x3 << CTC_SHIFT_PARAMETER_SHIFT) + +#define FORCEWAKE_RENDER_GEN9 _MMIO(0xa278) +#define FORCEWAKE_MEDIA_VDBOX_GEN11 (n) _MMIO(0xa540 + (n) * 4) +#define FORCEWAKE_MEDIA_VEBOX_GEN11 (n) _MMIO(0xa560 + (n) * 4) + +#define GEN10_SAMPLER_MODE MCR_REG(0xe18c) +#define ENABLE_SMALLPL REG_BIT(15) +#define SC_DISABLE_POWER_OPTIMIZATION_EBB REG_BIT(9) +#define GEN11_SAMPLER_ENABLE_HEADLESS_MSG REG_BIT(5) + +#define GEN9_ROW_CHICKEN4 MCR_REG(0xe48c) +#define GEN12_DISABLE_GRF_CLEAR REG_BIT(13) +#define XEHP_DIS_BBL_SYSPIPE REG_BIT(11) +#define GEN12_DISABLE_TDL_PUSH REG_BIT(9) +#define GEN11_DIS_PICK_2ND_EU REG_BIT(7) +#define GEN12_DISABLE_HDR_PAST_PAYLOAD_HOLD_FIX REG_BIT(4) +#define THREAD_EX_ARB_MODE REG_GENMASK(3, 2) +#define THREAD_EX_ARB_MODE_RR_AFTER_DEP REG_FIELD_PREP(THREAD_EX_ARB_MODE, 0x2) + +#define GEN7_ROW_CHICKEN2 _MMIO(0xe4f4) +#define GEN12_DISABLE_READ_SUPPRESSION REG_BIT(15) +#define GEN12_DISABLE_EARLY_READ REG_BIT(14) +#define GEN12_ENABLE_LARGE_GRF_MODE REG_BIT(12) +#define GEN12_PUSH_CONST_DEREF_HOLD_DIS REG_BIT(8) +#define GEN12_DISABLE_DOP_GATING REG_BIT(0) + +#define SARB_CHICKEN1 MCR_REG(0xe90c) +#define COMP_CKN_IN REG_GENMASK(30, 29) + +#define GEN12_RCU_MODE _MMIO(0x14800) +#define GEN12_RCU_MODE_CCS_ENABLE REG_BIT(0) + +#define FORCEWAKE_ACK_GT_GEN9 _MMIO(0x130044) +#define FORCEWAKE_KERNEL BIT(0) +#define FORCEWAKE_USER BIT(1) +#define FORCEWAKE_KERNEL_FALLBACK BIT(15) + +#define GEN6_GT_CORE_STATUS _MMIO(0x138060) +#define GEN6_RC0 0 +#define GEN6_RC6 3 + +#define GEN6_GT_GFX_RC6_LOCKED _MMIO(0x138104) +#define GEN6_GT_GFX_RC6 _MMIO(0x138108) + +#define GFX_FLSH_CNTL_GEN6 _MMIO(0x101008) +#define GFX_FLSH_CNTL_EN (1 << 0) + +#define GEN11_GT_INTR_DW (x) _MMIO(0x190018 + ((x) * 4)) + +#define GEN11_GUC_SG_INTR_ENABLE _MMIO(0x190038) +#define ENGINE1_MASK REG_GENMASK(31, 16) +#define ENGINE0_MASK REG_GENMASK(15, 0) + +#define GEN11_GPM_WGBOXPERF_INTR_ENABLE _MMIO(0x19003c) + +#define GEN11_INTR_IDENTITY_REG (x) _MMIO(0x190060 + ((x) * 4)) +#define GEN11_INTR_DATA_VALID (1 << 31) +#define GEN11_INTR_ENGINE_INSTANCE (x) (((x) & GENMASK(25, 20)) >> 20) +#define GEN11_INTR_ENGINE_CLASS (x) (((x) & GENMASK(18, 16)) >> 16) +#define GEN11_INTR_ENGINE_INTR (x) ((x) & 0xffff) +#define OTHER_GUC_INSTANCE 0 + +#define GEN11_RENDER_COPY_INTR_ENABLE _MMIO(0x190030) +#define GEN11_VCS_VECS_INTR_ENABLE _MMIO(0x190034) +#define GEN12_CCS_RSVD_INTR_ENABLE _MMIO(0x190048) +#define GEN11_IIR_REG_SELECTOR (x) _MMIO(0x190070 + ((x) * 4)) +#define GEN11_RCS0_RSVD_INTR_MASK _MMIO(0x190090) +#define GEN11_BCS_RSVD_INTR_MASK _MMIO(0x1900a0) +#define GEN11_VCS0_VCS1_INTR_MASK _MMIO(0x1900a8) +#define GEN11_VCS2_VCS3_INTR_MASK _MMIO(0x1900ac) +#define GEN11_VECS0_VECS1_INTR_MASK _MMIO(0x1900d0) +#define GEN11_GUC_SG_INTR_MASK _MMIO(0x1900e8) +#define GEN11_GPM_WGBOXPERF_INTR_MASK _MMIO(0x1900ec) +#define GEN12_CCS0_CCS1_INTR_MASK _MMIO(0x190100) +#define GEN12_CCS2_CCS3_INTR_MASK _MMIO(0x190104) +#define XEHPC_BCS1_BCS2_INTR_MASK _MMIO(0x190110) +#define XEHPC_BCS3_BCS4_INTR_MASK _MMIO(0x190114) +#define XEHPC_BCS5_BCS6_INTR_MASK _MMIO(0x190118) +#define XEHPC_BCS7_BCS8_INTR_MASK _MMIO(0x19011c) + +#endif drivers/gpu/drm/xe/xe_execlist.c +1
-1@@ -7,6 +7,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" @@ -20,7 +21,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@@ -6,11 +6,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@@ -9,6 +9,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" @@ -17,7 +18,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@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_bb.h" #include "xe_bo.h" #include "xe_device.h" @@ -40,8 +41,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@@ -4,12 +4,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@@ -4,13 +4,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@@ -4,6 +4,7 @@*/ #include "xe_guc.h" +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_force_wake.h" @@ -20,7 +21,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@@ -9,6 +9,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" @@ -19,9 +20,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 8drivers/gpu/drm/xe/xe_guc_pc.c +1
-1@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_gt.h" @@ -30,7 +31,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@@ -7,6 +7,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" @@ -21,7 +22,6 @@#include "xe_sched_job.h" #include "xe_wa.h" -#include "gt/intel_gt_regs.h" #include "i915_reg.h" #define MAX_MMIO_BASES 3drivers/gpu/drm/xe/xe_irq.c +1
-1@@ -8,6 +8,7 @@#include <drm/drm_managed.h> +#include "regs/xe_gt_regs.h" #include "xe_device.h" #include "xe_display.h" #include "xe_drv.h" @@ -16,7 +17,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@@ -5,6 +5,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" @@ -14,7 +15,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@@ -8,13 +8,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@@ -4,6 +4,7 @@*/ #include "xe_mocs.h" +#include "regs/xe_gt_regs.h" #include "xe_bo.h" #include "xe_device.h" #include "xe_engine.h" @@ -12,8 +13,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@@ -12,6 +12,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" @@ -20,8 +21,6 @@#include "xe_mmio.h" #include "xe_rtp_types.h" -#include "gt/intel_gt_regs.h" -#define XE_REG_SR_GROW_STEP_DEFAULT 16static void reg_sr_fini (struct drm_device *drm,void *arg)drivers/gpu/drm/xe/xe_reg_whitelist.c +1
-2@@ -5,12 +5,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@@ -4,6 +4,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" @@ -12,7 +13,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@@ -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@@ -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
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
Quoted 45 lines · Matt Roper
Quoted 44 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/i915/i915_reg_defs.h +0
-0@@ -136,6 +136,8 @@ typedef struct {u32 reg; } i915_mcr_reg_t;
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg_defs.h typedef struct { · line 139
Quoted 1 line
drivers/gpu/drm/i915/i915_reg_defs.h +1
-0+#define MCR_REG (offset) ((const i915_mcr_reg_t){ .reg = (offset) })Should there be a corresponding removal of this definition from
drivers/gpu/drm/i915/gt/intel_gt_regs.h?Aside from that,
Reviewed-by Matt Roper <[email protected]>
good catch. I was trying not to change the i915 headers, but this one went unoticed while fixing the build.
I wonder if this should be a separate patch to merge in
drm-intel-next by itself. It's harmless though and we could keep it
in the xe branch, as long as also removing from drivers/gpu/drm/i915/gt/intel_gt_regs.h
Rodrigo / Matt, are you ok with this approach?
Lucas De Marchi
Re: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
Quoted 56 lines · Lucas De Marchi
Quoted 45 lines · Matt Roper
Quoted 44 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for later.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/i915/i915_reg_defs.h +0
-0@@ -136,6 +136,8 @@ typedef struct {u32 reg; } i915_mcr_reg_t;Quoted 8 lines
drivers/gpu/drm/i915/i915_reg_defs.h typedef struct { · line 139
Quoted 1 line
drivers/gpu/drm/i915/i915_reg_defs.h +1
-0+#define MCR_REG (offset) ((const i915_mcr_reg_t){ .reg = (offset) })Should there be a corresponding removal of this definition from
drivers/gpu/drm/i915/gt/intel_gt_regs.h?Aside from that,
Reviewed-by Matt Roper <[email protected]>
Quoted 8 lines
good catch. I was trying not to change the i915 headers, but this one went unoticed while fixing the build.
I wonder if this should be a separate patch to merge in
drm-intel-next by itself. It's harmless though and we could keep it
in the xe branch, as long as also removing fromdrivers/gpu/drm/i915/gt/intel_gt_regs.hRodrigo / Matt, are you ok with this approach?
Either way sounds fine to me.
Matt
Quoted 2 lines
Lucas De Marchi
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Vivi, Rodrigo
maintainerRe: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
Quoted 67 lines · Matt Roper
Quoted 66 lines · Lucas De Marchi
Quoted 57 lines · Matt Roper
Quoted 47 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for
later.Signed-off-by Lucas De Marchi <[email protected]>---
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.hdrivers/gpu/drm/i915/i915_reg_defs.h +0
-0drivers/gpu/drm/i915/i915_reg_defs.h typedef struct { · line 140
Quoted 5 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1
-0@@ -136,6 +136,8 @@ typedef struct { u32 reg; } i915_mcr_reg_t; +#define MCR_REG (offset) ((const i915_mcr_reg_t){ .reg = (offset) })Should there be a corresponding removal of this definition from
drivers/gpu/drm/i915/gt/intel_gt_regs.h?Quoted 3 lines
Aside from that,
Reviewed-by Matt Roper <[email protected]>good catch. I was trying not to change the i915 headers, but this one went unoticed while fixing the build.
Quoted 6 lines
Quoted 6 lines
I wonder if this should be a separate patch to merge in drm-intel-next by itself. It's harmless though and we could keep it in the xe branch, as long as also removing from
drivers/gpu/drm/i915/gt/intel_gt_regs.hRodrigo / Matt, are you ok with this approach?
yeap, anything touching outside xe needs a separated patch anyway. and I believe it can already be sent do intel-gfx, right?!
Quoted 9 lines
Either way sounds fine to me.
Matt
Quoted 2 lines
Lucas De Marchi
Re: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
Quoted 73 lines · Rodrigo Vivi
Quoted 72 lines · Matt Roper
Quoted 71 lines · Lucas De Marchi
Quoted 57 lines · Matt Roper
Quoted 47 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address. Cleaning those up and adhering to a common coding style is left for
later.Signed-off-by Lucas De Marchi <[email protected]>---
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.hdrivers/gpu/drm/i915/i915_reg_defs.h +0
-0drivers/gpu/drm/i915/i915_reg_defs.h typedef struct { · line 140
Quoted 5 lines
drivers/gpu/drm/i915/i915_reg_defs.h +1
-0@@ -136,6 +136,8 @@ typedef struct { u32 reg; } i915_mcr_reg_t; +#define MCR_REG (offset) ((const i915_mcr_reg_t){ .reg = (offset) })Should there be a corresponding removal of this definition from
drivers/gpu/drm/i915/gt/intel_gt_regs.h?Quoted 3 lines
Aside from that,
Reviewed-by Matt Roper <[email protected]>good catch. I was trying not to change the i915 headers, but this one went unoticed while fixing the build.
I wonder if this should be a separate patch to merge in drm-intel-next by itself. It's harmless though and we could keep it in the xe branch, as long as also removing from
drivers/gpu/drm/i915/gt/intel_gt_regs.h
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Rodrigo / Matt, are you ok with this approach?
yeap, anything touching outside xe needs a separated patch anyway. and I believe it can already be sent do intel-gfx, right?!
the problem is to depend on that patch. If we are rebasing the drm-xe-next branch with a non-ff. Then we could simply have the patch in both places and handle the conflict. If we are not rebasing, then is it ok to have the patch in both places and deal with a possible conflict in a merge (or backmerge if we are not yet in drm-next)?
Lucas De Marchi
Vivi, Rodrigo
maintainerRe: [Intel-xe] [PATCH v2 05/11] drm/xe: Remove dependency on intel_gt_regs.h
Quoted 87 lines · Lucas De Marchi
Quoted 86 lines · Rodrigo Vivi
Quoted 84 lines · Matt Roper
Quoted 83 lines · Lucas De Marchi
Quoted 66 lines · Matt Roper
Quoted 57 lines · Lucas De Marchi
Create
regs/xe_gt_regs.hfile 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.hfile, just sorting the registers by address.
Cleaning those up and adhering to a common coding style is left
for
later.Signed-off-by Lucas De Marchi <[email protected]>---
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.hdrivers/gpu/drm/i915/i915_reg_defs.h +1
-0@@ -136,6 +136,8 @@ typedef struct { u32 reg; } i915_mcr_reg_t; +#define MCR_REG (offset) ((const i915_mcr_reg_t){Quoted 2 lines
.reg =
(offset) })Should there be a corresponding removal of this definition from
drivers/gpu/drm/i915/gt/intel_gt_regs.h?Quoted 3 lines
Aside from that,
Reviewed-by Matt Roper <[email protected]>good catch. I was trying not to change the i915 headers, but this
one went unoticed while fixing the build.I wonder if this should be a separate patch to merge in drm-intel-next by itself. It's harmless though and we could keep it
in the xe branch, as long as also removing fromdrivers/gpu/drm/i915/gt/intel_gt_regs.hRodrigo / Matt, are you ok with this approach?
Quoted 8 lines
Quoted 2 lines
yeap, anything touching outside xe needs a separated patch anyway. and I believe it can already be sent do intel-gfx, right?!
the problem is to depend on that patch. If we are rebasing the drm-xe-next branch with a non-ff. Then we could simply have the patch in both places and handle the conflict. If we are not rebasing, then is it ok to have the patch in both places and deal with a possible conflict in a merge (or backmerge if we are not yet in drm-next)?
we will have to rebase, so let's add the patch in both places and deal with the conflicts.
Quoted 2 lines
Lucas De Marchi
PATCH v2 6/11 drm/xe: Remove dependency on intel_lrc_reg.h
In reply to Lucas De MarchiCreate 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
@@ -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
@@ -7,6 +7,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"
@@ -21,7 +22,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
@@ -12,6 +12,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"
@@ -30,8 +31,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
@@ -5,6 +5,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"
@@ -15,7 +16,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
@@ -4,6 +4,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"
@@ -13,7 +14,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
Re: [Intel-xe] [PATCH v2 06/11] drm/xe: Remove dependency on intel_lrc_reg.h
drivers/gpu/drm/xe/regs/xe_lrc_regs.h
Quoted 20 lines · Lucas De Marchi
Create
regs/xe_lrc_regs.hfile 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.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +0
-0
This file isn't so much about "register definitions" as it is about "register offsets in the context image." Maybe we should name this a bit differently to make that clear? E.g., xe_lrc_offsets.h or xe_lrc_layout.h or something.
Quoted 6 lines
drivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +5
-0@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation +*/ +
drivers/gpu/drm/xe/regs/xe_lrc_regs.h line 15
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +10
-0+#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)
I'm wondering if it would be more clear/obvious if we laid this out as a C structure rather than using defines?
struct tgl_lrc_layout {
u8 _lri1;
u16 CONTEXT_CONTROL;
u16 RING_TAIL;
u16 RING_START;
...
};and then later just use code like
offsetof(struct tgl_lrc_layout, RING_TAIL);
to find the offsets when needed. This could cover not just the simple/common subset of registers here, but also stuff like per-platform stuff like MI_MODE, BB_OFFSET, GPR0, etc. that we have lookup helpers for in i915.
Anyway, that's something we can think about in the future; no need to handle it as part of this series.
Matt
Quoted 86 lines
drivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +2
-0+ +#endif drivers/gpu/drm/xe/xe_execlist.c +1
-1@@ -7,6 +7,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" @@ -21,7 +22,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 1drivers/gpu/drm/xe/xe_guc_submit.c +1
-2@@ -12,6 +12,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" @@ -30,8 +31,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@@ -5,6 +5,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" @@ -15,7 +16,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@@ -4,6 +4,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" @@ -13,7 +14,6 @@#include "xe_vm_types.h" #include "gt/intel_gpu_commands.h" -#include "gt/intel_lrc_reg.h" #include "i915_reg.h" static u32 preparser_disable (bool state)Signature · 1 line
2.39.0
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
Re: [Intel-xe] [PATCH v2 06/11] drm/xe: Remove dependency on intel_lrc_reg.h
Quoted 16 lines · Matt Roper
Quoted 15 lines · Lucas De Marchi
Create
regs/xe_lrc_regs.hfile 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.Signed-off-by Lucas De Marchi <[email protected]>--- 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
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_lrc_regs.h
Quoted 5 lines
drivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +0
-0This file isn't so much about "register definitions" as it is about "register offsets in the context image." Maybe we should name this a bit differently to make that clear? E.g.,
xe_lrc_offsets.horxe_lrc_layout.hor something.
yeah, I like xe_lrc_layout.h. I will change to use it.
Quoted 33 lines
Quoted 7 lines
drivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +5
-0@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2023 Intel Corporation +*/ +drivers/gpu/drm/xe/regs/xe_lrc_regs.h line 15
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_lrc_regs.h new file +10
-0+#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)I'm wondering if it would be more clear/obvious if we laid this out as a C structure rather than using defines?
struct tgl_lrc_layout { u8 _lri1; u16 CONTEXT_CONTROL; u16 RING_TAIL; u16 RING_START; ... };and then later just use code like
offsetof(struct tgl_lrc_layout, RING_TAIL);
Quoted 7 lines
to find the offsets when needed. This could cover not just the simple/common subset of registers here, but also stuff like per-platform stuff like
MI_MODE,BB_OFFSET, GPR0, etc. that we have lookup helpers for in i915.Anyway, that's something we can think about in the future; no need to handle it as part of this series.
yeah... sounds good. I will keep it as is for now since this series is a prerequisite fro the WAs I'm working on. But changing to a struct layout IMO would be a very good improvement. Let me also add an issue in gitlab with that so we don't forget.
thanks
Lucas De Marchi
PATCH v2 7/11 drm/xe: Remove dependency on intel_gpu_commands.h
In reply to Lucas De MarchiCopy 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
@@ -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
@@ -4,6 +4,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"
@@ -11,8 +12,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
@@ -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
@@ -8,6 +8,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"
@@ -21,7 +22,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
@@ -6,6 +6,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"
@@ -15,7 +16,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
@@ -10,6 +10,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"
@@ -26,8 +27,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
@@ -5,6 +5,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"
@@ -13,7 +14,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
Re: [Intel-xe] [PATCH v2 07/11] drm/xe: Remove dependency on intel_gpu_commands.h
Quoted 103 lines · Lucas De Marchi
Copy the macros used by xe in
intel_gpu_commands.htoregs/xe_gpu_commands.h.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/xe/regs/xe_gpu_commands.h new file +82
-0@@ -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 | \
drivers/gpu/drm/xe/regs/xe_gpu_commands.h line 92
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h new file +10
-0+ 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)
These two flag collections are also defined in drivers/gpu/drm/xe/xe_ring_ops.c right now. Should we either drop them here or drop them there?
Matt
Quoted 127 lines
drivers/gpu/drm/xe/regs/xe_gpu_commands.h new file +4
-0+ +#define MI_ARB_CHECK MI_INSTR(0x05, 0) + +#endif drivers/gpu/drm/xe/xe_bb.c +1
-2@@ -4,6 +4,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" @@ -11,8 +12,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@@ -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@@ -8,6 +8,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" @@ -21,7 +22,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 1drivers/gpu/drm/xe/xe_lrc.c +1
-1@@ -6,6 +6,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" @@ -15,7 +16,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@@ -10,6 +10,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" @@ -26,8 +27,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@@ -5,6 +5,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" @@ -13,7 +14,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
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
PATCH v2 8/11 drm/xe: Remove dependency on i915_reg.h
In reply to Lucas De MarchiCopy 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
@@ -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
@@ -10,6 +10,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"
@@ -22,8 +23,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
@@ -10,6 +10,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"
@@ -18,8 +19,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
@@ -5,13 +5,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
@@ -9,6 +9,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"
@@ -19,8 +20,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
@@ -8,6 +8,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"
@@ -22,8 +23,6 @@#include "xe_sched_job.h" #include "xe_wa.h" -#include "i915_reg.h" -#define MAX_MMIO_BASES 3struct engine_info {const char *name;
drivers/gpu/drm/xe/xe_irq.c +1 -2
@@ -9,6 +9,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"
@@ -17,8 +18,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
@@ -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_bo.h" #include "xe_device.h" #include "xe_engine_types.h"
@@ -16,8 +17,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
@@ -9,14 +9,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
@@ -13,6 +13,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"
@@ -20,8 +21,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
@@ -7,6 +7,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"
@@ -14,8 +15,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
@@ -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
@@ -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
Rodrigo Vivi
maintainerRe: [Intel-xe] [PATCH v2 08/11] drm/xe: Remove dependency on i915_reg.h
Quoted 123 lines · Lucas De Marchi
Copy the macros used by xe in
i915_reg.htoregs/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.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/xe/regs/xe_regs.h new file +95
-0@@ -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)
drivers/gpu/drm/xe/regs/xe_regs.h line 105
Quoted 10 lines
drivers/gpu/drm/xe/regs/xe_regs.h new file +10
-0+ +#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)
one of the things that I'm always confused is with these REG_{BIT,GENMASK,FIELD_PREP}. Why can't we simply use the regular "non-REG_" versions like every other driver (aside of i915 of course).
Quoted 251 lines
drivers/gpu/drm/xe/regs/xe_regs.h new file +6
-0+ +#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@@ -10,6 +10,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" @@ -22,8 +23,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 37drivers/gpu/drm/xe/xe_ggtt.c +1
-2@@ -10,6 +10,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" @@ -18,8 +19,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@@ -5,13 +5,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@@ -9,6 +9,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" @@ -19,8 +20,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@@ -8,6 +8,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" @@ -22,8 +23,6 @@#include "xe_sched_job.h" #include "xe_wa.h" -#include "i915_reg.h" -#define MAX_MMIO_BASES 3struct engine_info {const char *name;drivers/gpu/drm/xe/xe_irq.c +1
-2@@ -9,6 +9,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" @@ -17,8 +18,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@@ -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_bo.h" #include "xe_device.h" #include "xe_engine_types.h" @@ -16,8 +17,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@@ -9,14 +9,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 2drivers/gpu/drm/xe/xe_pci.c +1
-2@@ -13,6 +13,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" @@ -20,8 +21,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@@ -7,6 +7,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" @@ -14,8 +15,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@@ -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@@ -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
Re: [Intel-xe] [PATCH v2 08/11] drm/xe: Remove dependency on i915_reg.h
Quoted 130 lines · Rodrigo Vivi
Quoted 129 lines · Lucas De Marchi
Copy the macros used by xe in
i915_reg.htoregs/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.Signed-off-by Lucas De Marchi <[email protected]>--- 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.hdrivers/gpu/drm/xe/regs/xe_regs.h new file +101
-0@@ -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)
Quoted 8 lines
drivers/gpu/drm/xe/regs/xe_regs.h line 105
Quoted 4 lines
drivers/gpu/drm/xe/regs/xe_regs.h new file +4
-0+ +#define GGC _MMIO(0x108040) +#define GMS_MASK REG_GENMASK(15, 8) +#define GGMS_MASK REG_GENMASK(7, 6)one of the things that I'm always confused is with these REG_{BIT,GENMASK,FIELD_PREP}. Why can't we simply use the regular "non-REG_" versions like every other driver (aside of i915 of course).
it was some time ago, I didn't remember exactly and was guessing it was because GENMASK returns a long, while our registers are 32bits. Indeed, commit 09b434d4f6d2 ("drm/i915: introduce REG_BIT() and REG_GENMASK() to define register contents"):
We define the above as wrappers to BIT() and GENMASK() respectively to force u32 type to go with our register size, and to add compile time checks on the bit numbers.
we may revisit that and maybe generalize GENMASK32/BIT32 that guarantees a u32 type is returned.
Lucas De Marchi
Quoted 252 lines
Quoted 252 lines
drivers/gpu/drm/xe/regs/xe_regs.h new file +6
-0+ +#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@@ -10,6 +10,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" @@ -22,8 +23,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 37drivers/gpu/drm/xe/xe_ggtt.c +1
-2@@ -10,6 +10,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" @@ -18,8 +19,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@@ -5,13 +5,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@@ -9,6 +9,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" @@ -19,8 +20,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@@ -8,6 +8,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" @@ -22,8 +23,6 @@#include "xe_sched_job.h" #include "xe_wa.h" -#include "i915_reg.h" -#define MAX_MMIO_BASES 3struct engine_info {const char *name;drivers/gpu/drm/xe/xe_irq.c +1
-2@@ -9,6 +9,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" @@ -17,8 +18,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@@ -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_bo.h" #include "xe_device.h" #include "xe_engine_types.h" @@ -16,8 +17,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@@ -9,14 +9,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 2drivers/gpu/drm/xe/xe_pci.c +1
-2@@ -13,6 +13,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" @@ -20,8 +21,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@@ -7,6 +7,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" @@ -14,8 +15,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@@ -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
-3@@ -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 * -- 2.39.0
Jani Nikula
maintainerRe: [Intel-xe] [PATCH v2 08/11] drm/xe: Remove dependency on i915_reg.h
Quoted 10 lines · Lucas De Marchi
Quoted 8 lines · Rodrigo Vivi
drivers/gpu/drm/xe/regs/xe_regs.h line 105
Quoted 3 lines · Lucas De Marchi
drivers/gpu/drm/xe/regs/xe_regs.h new file +3
-0+#define GGC _MMIO(0x108040) +#define GMS_MASK REG_GENMASK(15, 8) +#define GGMS_MASK REG_GENMASK(7, 6)one of the things that I'm always confused is with these REG_{BIT,GENMASK,FIELD_PREP}. Why can't we simply use the regular "non-REG_" versions like every other driver (aside of i915 of course).
Quoted 8 lines
it was some time ago, I didn't remember exactly and was guessing it was because GENMASK returns a long, while our registers are 32bits. Indeed, commit
09b434d4f6d2("drm/i915: introduceREG_BIT()andREG_GENMASK()to define register contents"):We define the above as wrappers to
BIT()andGENMASK()respectively to force u32 type to go with our register size, and to add compile time checks on the bit numbers.
This, plus FIELD_PREP() doesn't always generate an integer constant expression making it hard to use in some cases. Which I believe we see over and over again in i915 gem/gt code that uses FIELD_PREP(). It's even compiler dependent I think.
Quoted 2 lines
we may revisit that and maybe generalize GENMASK32/BIT32 that guarantees a u32 type is returned.
Obviously not a bad idea, but additionally forcing integer constant expression might not be something everyone wants in generic code.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
PATCH v2 9/11 drm/xe/guc_pc: Move gt register to the proper place
In reply to Lucas De MarchiMove 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
@@ -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
@@ -30,12 +30,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
Re: [Intel-xe] [PATCH v2 09/11] drm/xe/guc_pc: Move gt register to the proper place
Quoted 34 lines · Lucas De Marchi
Move a few defines from
xe_guc_pc.cto the right register, now that there is one:xe_gt_regs.h.Signed-off-by Lucas De Marchi <[email protected]>--- 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@@ -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 3drivers/gpu/drm/xe/xe_guc_pc.c +0
-0
drivers/gpu/drm/xe/xe_guc_pc.c line 31
Quoted 2 lines
drivers/gpu/drm/xe/xe_guc_pc.c +0
-0@@ -30,12 +30,6 @@#define GEN10_FREQ_INFO_REC _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5ef0)#define RPE_MASK REG_GENMASK(15, 8)
I don't like this getting split from the rest... but I don't have any quick better recommendation and the movement below at least is correct by itself. So,
Quoted 13 lines
drivers/gpu/drm/xe/xe_guc_pc.c +0
-6-/* 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
Re: [Intel-xe] [PATCH v2 09/11] drm/xe/guc_pc: Move gt register to the proper place
Quoted 30 lines · Rodrigo Vivi
Quoted 29 lines · Lucas De Marchi
Move a few defines from
xe_guc_pc.cto the right register, now that there is one:xe_gt_regs.h.Signed-off-by Lucas De Marchi <[email protected]>--- 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@@ -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
Quoted 12 lines
drivers/gpu/drm/xe/xe_guc_pc.c line 31
Quoted 7 lines
drivers/gpu/drm/xe/xe_guc_pc.c +0
-0@@ -30,12 +30,6 @@#define GEN10_FREQ_INFO_REC _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5ef0)#define RPE_MASK REG_GENMASK(15, 8)I don't like this getting split from the rest... but I don't have any quick better recommendation and the movement below at least is correct by itself. So,
we could add regs/xe_mchbar_regs.h and move these there. Although if there is single compilation unit that needs that, we may as well leave it there. Eventually if we agree on autogenerating the headers, then we'd have everything unders regs/
Quoted 2 lines
Reviewed-by Rodrigo Vivi <[email protected]>
thanks
Lucas De Marchi
PATCH v2 10/11 drm/xe: Remove dependency on intel_mchbar_regs.h
In reply to Lucas De MarchiThe 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
@@ -20,12 +20,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
Re: [Intel-xe] [PATCH v2 10/11] drm/xe: Remove dependency on intel_mchbar_regs.h
Quoted 17 lines · Lucas De Marchi
The only thing really needed is the base offset,
MCHBAR_MIRROR_BASE_SNB. Remove the include and just define it inplace.Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/xe_guc_pc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/xe/xe_guc_pc.c +0
-1@@ -20,12 +20,12 @@#include "xe_mmio.h" #include "xe_pcode.h" -#include "intel_mchbar_regs.h"
drivers/gpu/drm/xe/xe_guc_pc.c line 28
Quoted 10 lines
drivers/gpu/drm/xe/xe_guc_pc.c +5
-4+#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)
Quoted 6 lines
drivers/gpu/drm/xe/xe_guc_pc.c +0
-0#define GEN10_FREQ_INFO_REC _MMIO(MCHBAR_MIRROR_BASE_SNB + 0x5ef0)#define RPE_MASK REG_GENMASK(15, 8)Signature · 1 line
2.39.0
PATCH v2 11/11 drm/xe: Use relative includes for i915_reg_defs.h
In reply to Lucas De MarchiWith the goal of eliminating i915 includes from xe outside of the display area, it's better to use relative includes for the only shared header, i915_reg_defs.h. With this the build system can be changed to stop adding i915 as an include dir.
--- drivers/gpu/drm/xe/display/Makefile | 120 +++++++++++++++++++++++ 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_regs.h | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.h | 2 +- drivers/gpu/drm/xe/xe_guc.c | 2 - drivers/gpu/drm/xe/xe_guc_reg.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 - 10 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/xe/display/Makefile
drivers/gpu/drm/xe/display/Makefile new file +120 -0
@@ -0,0 +1,120 @@ +# SPDX-License-Identifier: GPL-2.0 + +subdir-ccflags-y += -I$(srctree)/$(src) + +# i915 Display compat #defines and #includes +subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += -I$(srctree)/$(src)/display/ext \ + -I$(srctree)/drivers/gpu/drm/xe/display/ \ + -I$(srctree)/drivers/gpu/drm/i915/display/ \ + -I$(srctree)/drivers/gpu/drm/i915/ \ + -DBUILD_FOR_XE=1 \ + -Ddrm_i915_gem_object=xe_bo \ + -Ddrm_i915_private=xe_device + +CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init) + +$(obj)/display/i915_%.o: $(srctree)/drivers/gpu/drm/i915/display/i915_%.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +$(obj)/display/skl_%.o: $(srctree)/drivers/gpu/drm/i915/display/skl_%.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +$(obj)/display/icl_dsi.o: $(srctree)/drivers/gpu/drm/i915/display/icl_dsi.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +$(obj)/display/intel_%.o: $(srctree)/drivers/gpu/drm/i915/display/intel_%.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +# Display.. +xe-$(CONFIG_DRM_XE_DISPLAY) += \ + xe_display.o \ + display/icl_dsi.o \ + display/intel_atomic.o \ + display/intel_atomic_plane.o \ + display/intel_audio.o \ + display/intel_backlight.o \ + display/intel_bios.o \ + display/intel_bw.o \ + display/intel_cdclk.o \ + display/intel_color.o \ + display/intel_combo_phy.o \ + display/intel_connector.o \ + display/intel_crtc_state_dump.o \ + display/intel_crtc.o \ + display/intel_cursor.o \ + display/intel_ddi_buf_trans.o \ + display/intel_ddi.o \ + display/intel_display.o \ + display/intel_display_debugfs.o \ + display/intel_display_power.o \ + display/intel_display_power_map.o \ + display/intel_display_power_well.o \ + display/intel_display_trace.o \ + display/intel_dkl_phy.o \ + display/intel_dmc.o \ + display/intel_dp_aux_backlight.o \ + display/intel_dp_aux.o \ + display/intel_dp.o \ + display/intel_dp_hdcp.o \ + display/intel_dp_link_training.o \ + display/intel_dpll.o \ + display/intel_dpll_mgr.o \ + display/intel_dp_mst.o \ + display/intel_drrs.o \ + display/intel_dsb.o \ + display/intel_dsi.o \ + display/intel_dsi_dcs_backlight.o \ + display/intel_dsi_vbt.o \ + display/intel_fb.o \ + display/intel_fbc.o \ + display/intel_fdi.o \ + display/intel_fifo_underrun.o \ + display/intel_frontbuffer.o \ + display/intel_global_state.o \ + display/intel_gmbus.o \ + display/intel_hdcp.o \ + display/intel_hdmi.o \ + display/intel_hotplug.o \ + display/intel_hti.o \ + display/intel_lspcon.o \ + display/intel_lvds.o \ + display/intel_modeset_setup.o \ + display/intel_modeset_verify.o \ + display/intel_panel.o \ + display/intel_pipe_crc.o \ + display/intel_pps.o \ + display/intel_psr.o \ + display/intel_qp_tables.o \ + display/intel_quirks.o \ + display/intel_snps_phy.o \ + display/intel_sprite.o \ + display/intel_tc.o \ + display/intel_vdsc.o \ + display/intel_vga.o \ + display/intel_vrr.o \ + display/xe_fb_pin.o \ + display/xe_plane_initial.o \ + display/skl_scaler.o \ + display/skl_universal_plane.o \ + display/skl_watermark.o \ + display/ext/i915_irq.o \ + display/ext/intel_device_info.o \ + display/ext/intel_dram.o \ + display/ext/intel_pch.o \ + display/ext/intel_pm.o + +ifeq ($(CONFIG_ACPI),y) + xe-$(CONFIG_DRM_XE_DISPLAY) += \ + display/intel_acpi.o \ + display/intel_opregion.o +endif + +ifeq ($(CONFIG_DRM_FBDEV_EMULATION),y) + xe-$(CONFIG_DRM_XE_DISPLAY) += display/intel_fbdev.o +endif + +
drivers/gpu/drm/xe/regs/xe_engine_regs.h +1 -1
@@ -8,7 +8,7 @@#include <asm/page.h> -#include "i915_reg_defs.h" +#include "../../i915/i915_reg_defs.h" #define RING_TAIL (base) _MMIO((base) + 0x30)
drivers/gpu/drm/xe/regs/xe_gt_regs.h +1 -1
@@ -6,7 +6,7 @@#ifndef _XE_GT_REGS_H_#define _XE_GT_REGS_H_ -#include "i915_reg_defs.h" +#include "../../i915/i915_reg_defs.h" /* RPM unit config (Gen8+) */ #define RPM_CONFIG0 _MMIO(0xd00)
drivers/gpu/drm/xe/regs/xe_regs.h +1 -1
@@ -5,7 +5,7 @@#ifndef _XE_REGS_H_#define _XE_REGS_H_ -#include "i915_reg_defs.h" +#include "../../i915/i915_reg_defs.h" #define GU_CNTL _MMIO(0x101010)#define LMEM_INIT REG_BIT(7)
drivers/gpu/drm/xe/xe_gt_mcr.h +1 -1
@@ -6,7 +6,7 @@#ifndef _XE_GT_MCR_H_#define _XE_GT_MCR_H_ -#include "i915_reg_defs.h" +#include "../i915/i915_reg_defs.h" struct drm_printer ;struct xe_gt ;
drivers/gpu/drm/xe/xe_guc.c +0 -2
@@ -21,8 +21,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
@@ -9,7 +9,7 @@#include <linux/compiler.h> #include <linux/types.h> -#include "i915_reg_defs.h" +#include "../i915/i915_reg_defs.h" /* Definitions of GuC H/W registers, bits, etc */
drivers/gpu/drm/xe/xe_reg_sr_types.h +0 -2
@@ -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
@@ -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
@@ -8,8 +8,6 @@#include <linux/types.h> -#include "i915_reg_defs.h" -struct xe_hw_engine ;struct xe_gt ;
Signature · 1 line
2.39.0
Re: [Intel-xe] [PATCH v2 11/11] drm/xe: Use relative includes for i915_reg_defs.h
Quoted 6 lines · Lucas De Marchi
With the goal of eliminating i915 includes from xe outside of the display area, it's better to use relative includes for the only shared header,
i915_reg_defs.h. With this the build system can be changed to stop adding i915 as an include dir.Signed-off-by Lucas De Marchi <[email protected]>
+Rodrigo
I know I've previously suggested changing the other way around and avoid the relative include. However with this cleanup we are very close to remove the -I for i915. So I think we can first remove the -I and then decide what to do with the single include that we still want.
Lucas De Marchi
Rodrigo Vivi
maintainerRe: [Intel-xe] [PATCH v2 11/11] drm/xe: Use relative includes for i915_reg_defs.h
In reply to Lucas De Marchidrivers/gpu/drm/xe/display/Makefile
Quoted 25 lines · Lucas De Marchi
With the goal of eliminating i915 includes from xe outside of the display area, it's better to use relative includes for the only shared header,
i915_reg_defs.h. With this the build system can be changed to stop adding i915 as an include dir.Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/display/Makefile | 120 +++++++++++++++++++++++ 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_regs.h | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.h | 2 +- drivers/gpu/drm/xe/xe_guc.c | 2 - drivers/gpu/drm/xe/xe_guc_reg.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 - 10 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/xe/display/Makefiledrivers/gpu/drm/xe/display/Makefile new file +0
-0
shouldn't this patch also be modifying the drm/xe/Makefile?
Quoted 241 lines
drivers/gpu/drm/xe/display/Makefile new file +120
-0@@ -0,0 +1,120 @@ +# SPDX-License-Identifier: GPL-2.0 + +subdir-ccflags-y += -I$(srctree)/$(src) + +# i915 Display compat #defines and #includes +subdir-ccflags-$(CONFIG_DRM_XE_DISPLAY) += -I$(srctree)/$(src)/display/ext \ + -I$(srctree)/drivers/gpu/drm/xe/display/ \ + -I$(srctree)/drivers/gpu/drm/i915/display/ \ + -I$(srctree)/drivers/gpu/drm/i915/ \ + -DBUILD_FOR_XE=1 \ + -Ddrm_i915_gem_object=xe_bo \ + -Ddrm_i915_private=xe_device + +CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init) + +$(obj)/display/i915_%.o: $(srctree)/drivers/gpu/drm/i915/display/i915_%.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +$(obj)/display/skl_%.o: $(srctree)/drivers/gpu/drm/i915/display/skl_%.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +$(obj)/display/icl_dsi.o: $(srctree)/drivers/gpu/drm/i915/display/icl_dsi.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +$(obj)/display/intel_%.o: $(srctree)/drivers/gpu/drm/i915/display/intel_%.c FORCE + $(call cmd,force_checksrc) + $(call if_changed_rule,cc_o_c) + +# Display.. +xe-$(CONFIG_DRM_XE_DISPLAY) += \ + xe_display.o \ + display/icl_dsi.o \ + display/intel_atomic.o \ + display/intel_atomic_plane.o \ + display/intel_audio.o \ + display/intel_backlight.o \ + display/intel_bios.o \ + display/intel_bw.o \ + display/intel_cdclk.o \ + display/intel_color.o \ + display/intel_combo_phy.o \ + display/intel_connector.o \ + display/intel_crtc_state_dump.o \ + display/intel_crtc.o \ + display/intel_cursor.o \ + display/intel_ddi_buf_trans.o \ + display/intel_ddi.o \ + display/intel_display.o \ + display/intel_display_debugfs.o \ + display/intel_display_power.o \ + display/intel_display_power_map.o \ + display/intel_display_power_well.o \ + display/intel_display_trace.o \ + display/intel_dkl_phy.o \ + display/intel_dmc.o \ + display/intel_dp_aux_backlight.o \ + display/intel_dp_aux.o \ + display/intel_dp.o \ + display/intel_dp_hdcp.o \ + display/intel_dp_link_training.o \ + display/intel_dpll.o \ + display/intel_dpll_mgr.o \ + display/intel_dp_mst.o \ + display/intel_drrs.o \ + display/intel_dsb.o \ + display/intel_dsi.o \ + display/intel_dsi_dcs_backlight.o \ + display/intel_dsi_vbt.o \ + display/intel_fb.o \ + display/intel_fbc.o \ + display/intel_fdi.o \ + display/intel_fifo_underrun.o \ + display/intel_frontbuffer.o \ + display/intel_global_state.o \ + display/intel_gmbus.o \ + display/intel_hdcp.o \ + display/intel_hdmi.o \ + display/intel_hotplug.o \ + display/intel_hti.o \ + display/intel_lspcon.o \ + display/intel_lvds.o \ + display/intel_modeset_setup.o \ + display/intel_modeset_verify.o \ + display/intel_panel.o \ + display/intel_pipe_crc.o \ + display/intel_pps.o \ + display/intel_psr.o \ + display/intel_qp_tables.o \ + display/intel_quirks.o \ + display/intel_snps_phy.o \ + display/intel_sprite.o \ + display/intel_tc.o \ + display/intel_vdsc.o \ + display/intel_vga.o \ + display/intel_vrr.o \ + display/xe_fb_pin.o \ + display/xe_plane_initial.o \ + display/skl_scaler.o \ + display/skl_universal_plane.o \ + display/skl_watermark.o \ + display/ext/i915_irq.o \ + display/ext/intel_device_info.o \ + display/ext/intel_dram.o \ + display/ext/intel_pch.o \ + display/ext/intel_pm.o + +ifeq ($(CONFIG_ACPI),y) + xe-$(CONFIG_DRM_XE_DISPLAY) += \ + display/intel_acpi.o \ + display/intel_opregion.o +endif + +ifeq ($(CONFIG_DRM_FBDEV_EMULATION),y) + xe-$(CONFIG_DRM_XE_DISPLAY) += display/intel_fbdev.o +endif + +drivers/gpu/drm/xe/regs/xe_engine_regs.h +1
-1@@ -8,7 +8,7 @@#include <asm/page.h> -#include "i915_reg_defs.h" +#include "../../i915/i915_reg_defs.h" #define RING_TAIL (base) _MMIO((base) + 0x30)drivers/gpu/drm/xe/regs/xe_gt_regs.h +1
-1@@ -6,7 +6,7 @@#ifndef _XE_GT_REGS_H_#define _XE_GT_REGS_H_ -#include "i915_reg_defs.h" +#include "../../i915/i915_reg_defs.h" /* RPM unit config (Gen8+) */ #define RPM_CONFIG0 _MMIO(0xd00)drivers/gpu/drm/xe/regs/xe_regs.h +1
-1@@ -5,7 +5,7 @@#ifndef _XE_REGS_H_#define _XE_REGS_H_ -#include "i915_reg_defs.h" +#include "../../i915/i915_reg_defs.h" #define GU_CNTL _MMIO(0x101010)#define LMEM_INIT REG_BIT(7)drivers/gpu/drm/xe/xe_gt_mcr.h +1
-1@@ -6,7 +6,7 @@#ifndef _XE_GT_MCR_H_#define _XE_GT_MCR_H_ -#include "i915_reg_defs.h" +#include "../i915/i915_reg_defs.h" struct drm_printer ;struct xe_gt ;drivers/gpu/drm/xe/xe_guc.c +0
-2@@ -21,8 +21,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 1drivers/gpu/drm/xe/xe_guc_reg.h +1
-1@@ -9,7 +9,7 @@#include <linux/compiler.h> #include <linux/types.h> -#include "i915_reg_defs.h" +#include "../i915/i915_reg_defs.h" /* Definitions of GuC H/W registers, bits, etc */ drivers/gpu/drm/xe/xe_reg_sr_types.h +0
-2@@ -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@@ -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@@ -8,8 +8,6 @@#include <linux/types.h> -#include "i915_reg_defs.h" -struct xe_hw_engine ;struct xe_gt ;Signature · 1 line
2.39.0
Re: [Intel-xe] [PATCH v2 11/11] drm/xe: Use relative includes for i915_reg_defs.h
Quoted 21 lines · Rodrigo Vivi
Quoted 20 lines · Lucas De Marchi
With the goal of eliminating i915 includes from xe outside of the display area, it's better to use relative includes for the only shared header,
i915_reg_defs.h. With this the build system can be changed to stop adding i915 as an include dir.Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/display/Makefile | 120 +++++++++++++++++++++++ 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_regs.h | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.h | 2 +- drivers/gpu/drm/xe/xe_guc.c | 2 - drivers/gpu/drm/xe/xe_guc_reg.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 - 10 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/xe/display/Makefile
Quoted 7 lines
drivers/gpu/drm/xe/display/Makefile
Quoted 5 lines
drivers/gpu/drm/xe/display/Makefile new file +0
-0shouldn't this patch also be modifying the drm/xe/Makefile?
sorry, while trying to resolve the display situation I squashed this by mistake here. Next version I'm giving up on the idea in this patch and I will just create a regs/xe_reg_defs.h. That will be the only file with the relative include.
Lucas De Marchi
Rodrigo Vivi
maintainerRe: [Intel-xe] [PATCH v2 11/11] drm/xe: Use relative includes for i915_reg_defs.h
Quoted 30 lines · Lucas De Marchi
Quoted 21 lines · Rodrigo Vivi
Quoted 20 lines · Lucas De Marchi
With the goal of eliminating i915 includes from xe outside of the display area, it's better to use relative includes for the only shared header,
i915_reg_defs.h. With this the build system can be changed to stop adding i915 as an include dir.Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/display/Makefile | 120 +++++++++++++++++++++++ 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_regs.h | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.h | 2 +- drivers/gpu/drm/xe/xe_guc.c | 2 - drivers/gpu/drm/xe/xe_guc_reg.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 - 10 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/xe/display/MakefileQuoted 7 lines
drivers/gpu/drm/xe/display/Makefile
Quoted 5 lines
drivers/gpu/drm/xe/display/Makefile new file +0
-0shouldn't this patch also be modifying the drm/xe/Makefile?
Quoted 4 lines
sorry, while trying to resolve the display situation I squashed this by mistake here. Next version I'm giving up on the idea in this patch and I will just create a
regs/xe_reg_defs.h. That will be the only file with the relative include.
But does this solve your main concern of the i915 directories getting included when display build is enabled even for folders that are not related to display?
Quoted 2 lines
Lucas De Marchi
Re: [Intel-xe] [PATCH v2 11/11] drm/xe: Use relative includes for i915_reg_defs.h
Quoted 31 lines · Rodrigo Vivi
Quoted 30 lines · Lucas De Marchi
Quoted 28 lines · Rodrigo Vivi
drivers/gpu/drm/xe/display/Makefile
Quoted 25 lines · Lucas De Marchi
With the goal of eliminating i915 includes from xe outside of the display area, it's better to use relative includes for the only shared header,
i915_reg_defs.h. With this the build system can be changed to stop adding i915 as an include dir.Signed-off-by Lucas De Marchi <[email protected]>--- drivers/gpu/drm/xe/display/Makefile | 120 +++++++++++++++++++++++ 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_regs.h | 2 +- drivers/gpu/drm/xe/xe_gt_mcr.h | 2 +- drivers/gpu/drm/xe/xe_guc.c | 2 - drivers/gpu/drm/xe/xe_guc_reg.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 - 10 files changed, 125 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/xe/display/Makefiledrivers/gpu/drm/xe/display/Makefile new file +0
-0shouldn't this patch also be modifying the drm/xe/Makefile?
Quoted 8 lines
Quoted 4 lines
sorry, while trying to resolve the display situation I squashed this by mistake here. Next version I'm giving up on the idea in this patch and I will just create a
regs/xe_reg_defs.h. That will be the only file with the relative include.But does this solve your main concern of the i915 directories getting included when display build is enabled even for folders that are not related to display?
no. Without a refactor on the display integration I couldn't find a easy way - even if we find a way in the build system to pass the cflags differently, it will break as the rest of the driver need the display includes.
I think we'd have to introduce an xe_display and then make xe_display be the "alias" for drm_i915_private instead of xe_device. However doing this may mean I'm doing some work that conflicts with what other people in CC are doing. I can try that later if it doesn't really conflict.
So... I decided to keep this cleanup only up to "everything but display". To make sure this patch series is complete for that goal I added a hack patch on top removing display. See v3 of this patch series
Lucas De Marchi
Quoted 3 lines
Quoted 3 lines
Lucas De Marchi
Quoted 24 lines · Lucas De Marchi
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.hThe 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/ files, xe still depends on:
-
i915_reg_defs.h
-display/intel_display_core.h
-display/ext/intel_device_info.h
-display/ext/intel_pch.hThe first one are the generic defines used for defining the registers. They probably can be split and part of them copied to
include/drmto be shared across the drivers. The last 3 are expected to be cleaned up together with the rest of the display.
Quoted 4 lines
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. There may be some inconsistencies how the
fwiw this is the quick hack script I used (helper.py only exports a git() wrapper). It does ~90% of the job -
just couldn't find a way to make it recurse into the macros - we'd need the preprocessed header, but then the values would not be valid.
------8<------------
#!/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 == 0def 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)