@@ -12,7 +12,6 @@
#include "gt/intel_context.h"
#include "i915_drv.h"
-#include "i915_gem.h"
#include "i915_scheduler.h"
#include "intel_device_info.h"
@@ -9,7 +9,6 @@
#include <linux/swiotlb.h>
#include "i915_drv.h"
-#include "i915_gem.h"
#include "i915_gem_internal.h"
#include "i915_gem_object.h"
#include "i915_scatterlist.h"
@@ -12,11 +12,12 @@
#include <drm/drm_device.h>
#include "display/intel_frontbuffer.h"
-#include "intel_memory_region.h"
-#include "i915_gem_object_types.h"
+#include "i915_debug.h"
#include "i915_gem_gtt.h"
+#include "i915_gem_object_types.h"
#include "i915_gem_ww.h"
#include "i915_vma_types.h"
+#include "intel_memory_region.h"
enum intel_region_id;
@@ -8,7 +8,6 @@
#include <linux/bitops.h>
#include "i915_drv.h"
-#include "i915_gem.h"
#include "i915_gem_ioctls.h"
#include "i915_gem_mman.h"
#include "i915_gem_object.h"
@@ -9,7 +9,7 @@
#include <linux/string.h>
#include <linux/types.h>
-#include "i915_gem.h" /* GEM_BUG_ON */
+#include "i915_debug.h"
#include "intel_gt_regs.h"
#include "intel_gpu_commands.h"
@@ -10,7 +10,7 @@
#include <linux/ktime.h>
#include <linux/seqlock.h>
-#include "i915_gem.h" /* GEM_BUG_ON */
+#include "i915_debug.h"
#include "intel_engine.h"
static inline void intel_engine_context_in(struct intel_engine_cs *engine)
@@ -17,7 +17,6 @@
#include <linux/types.h>
#include <linux/workqueue.h>
-#include "i915_gem.h"
#include "i915_pmu.h"
#include "i915_priolist_types.h"
#include "i915_selftest.h"
@@ -10,6 +10,7 @@
#include "pxp/intel_pxp.h"
#include "i915_drv.h"
+#include "i915_gem.h"
#include "intel_context.h"
#include "intel_engine_regs.h"
#include "intel_gt.h"
@@ -9,8 +9,6 @@
#include <linux/ctype.h>
#include <linux/kobject.h>
-#include "i915_gem.h" /* GEM_BUG_ON() */
-
struct intel_gt;
bool is_object_gt(struct kobject *kobj);
@@ -7,7 +7,7 @@
#define _INTEL_RENDERSTATE_H_
#include <linux/types.h>
-#include "i915_gem.h"
+
#include "i915_gem_ww.h"
struct i915_request;
@@ -6,7 +6,7 @@
#ifndef INTEL_RING_H
#define INTEL_RING_H
-#include "i915_gem.h" /* GEM_BUG_ON */
+#include "i915_debug.h"
#include "i915_request.h"
#include "intel_ring_types.h"
@@ -9,11 +9,12 @@
#include <linux/types.h>
#include <linux/kernel.h>
-#include "i915_gem.h"
+#include "i915_utils.h"
struct drm_i915_private;
-struct intel_gt;
struct drm_printer;
+struct intel_gt;
+struct seq_file;
/*
* Maximum number of slices on older platforms. Slices no longer exist
@@ -19,6 +19,8 @@
#include "abi/guc_klvs_abi.h"
#include "abi/guc_messages_abi.h"
+#include "i915_debug.h"
+
/* Payload length only i.e. don't include G2H header length */
#define G2H_LEN_DW_SCHED_CONTEXT_MODE_SET 2
#define G2H_LEN_DW_DEREGISTER_CONTEXT 1
@@ -11,7 +11,6 @@
#include <linux/workqueue.h>
#include "intel_guc_fwif.h"
-#include "i915_gem.h"
struct intel_guc;
@@ -9,7 +9,6 @@
#include <linux/types.h>
#include "intel_uc_fw_abi.h"
#include "intel_device_info.h"
-#include "i915_gem.h"
#include "i915_vma.h"
struct drm_printer;
new file mode 100644
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2022 Intel Corporation
+ */
+
+#ifndef __I915_DEBUG_H__
+#define __I915_DEBUG_H__
+
+#include <linux/bug.h>
+#include <drm/drm_print.h>
+
+#include "i915_utils.h"
+
+#ifdef CONFIG_DRM_I915_DEBUG_GEM
+
+#define GEM_SHOW_DEBUG() drm_debug_enabled(DRM_UT_DRIVER)
+
+#ifdef CONFIG_DRM_I915_DEBUG_GEM_ONCE
+#define __GEM_BUG(cond) BUG()
+#else
+#define __GEM_BUG(cond) \
+ WARN(1, "%s:%d GEM_BUG_ON(%s)\n", __func__, __LINE__, __stringify(cond))
+#endif
+
+#define GEM_BUG_ON(condition) do { if (unlikely((condition))) { \
+ GEM_TRACE_ERR("%s:%d GEM_BUG_ON(%s)\n", \
+ __func__, __LINE__, __stringify(condition)); \
+ GEM_TRACE_DUMP(); \
+ __GEM_BUG(condition); \
+ } \
+ } while(0)
+#define GEM_WARN_ON(expr) WARN_ON(expr)
+
+#define GEM_DEBUG_WARN_ON(expr) GEM_WARN_ON(expr)
+
+#else
+
+#define GEM_SHOW_DEBUG() (0)
+
+#define GEM_BUG_ON(expr) BUILD_BUG_ON_INVALID(expr)
+#define GEM_WARN_ON(expr) ({ unlikely(!!(expr)); })
+
+#define GEM_DEBUG_WARN_ON(expr) ({ BUILD_BUG_ON_INVALID(expr); 0; })
+#endif
+
+#if IS_ENABLED(CONFIG_DRM_I915_TRACE_GEM)
+#define GEM_TRACE(...) trace_printk(__VA_ARGS__)
+#define GEM_TRACE_ERR(...) do { \
+ pr_err(__VA_ARGS__); \
+ trace_printk(__VA_ARGS__); \
+} while (0)
+#define GEM_TRACE_DUMP() \
+ do { ftrace_dump(DUMP_ALL); __add_taint_for_CI(TAINT_WARN); } while (0)
+#define GEM_TRACE_DUMP_ON(expr) \
+ do { if (expr) GEM_TRACE_DUMP(); } while (0)
+#else
+#define GEM_TRACE(...) do { } while (0)
+#define GEM_TRACE_ERR(...) do { } while (0)
+#define GEM_TRACE_DUMP() do { } while (0)
+#define GEM_TRACE_DUMP_ON(expr) BUILD_BUG_ON_INVALID(expr)
+#endif
+
+#endif /* __I915_DEBUG_H__ */
@@ -14,7 +14,6 @@
#include "gem/i915_gem_context.h"
#include "i915_drm_client.h"
#include "i915_file_private.h"
-#include "i915_gem.h"
#include "i915_utils.h"
void i915_drm_clients_init(struct i915_drm_clients *clients,
@@ -62,7 +62,6 @@
#include "gt/uc/intel_uc.h"
#include "i915_drm_client.h"
-#include "i915_gem.h"
#include "i915_gpu_error.h"
#include "i915_params.h"
#include "i915_perf_types.h"
@@ -25,63 +25,6 @@
#ifndef __I915_GEM_H__
#define __I915_GEM_H__
-#include <linux/bug.h>
-
-#include <drm/drm_drv.h>
-
-#include "i915_utils.h"
-
-struct drm_i915_private;
-
-#ifdef CONFIG_DRM_I915_DEBUG_GEM
-
-#define GEM_SHOW_DEBUG() drm_debug_enabled(DRM_UT_DRIVER)
-
-#ifdef CONFIG_DRM_I915_DEBUG_GEM_ONCE
-#define __GEM_BUG(cond) BUG()
-#else
-#define __GEM_BUG(cond) \
- WARN(1, "%s:%d GEM_BUG_ON(%s)\n", __func__, __LINE__, __stringify(cond))
-#endif
-
-#define GEM_BUG_ON(condition) do { if (unlikely((condition))) { \
- GEM_TRACE_ERR("%s:%d GEM_BUG_ON(%s)\n", \
- __func__, __LINE__, __stringify(condition)); \
- GEM_TRACE_DUMP(); \
- __GEM_BUG(condition); \
- } \
- } while(0)
-#define GEM_WARN_ON(expr) WARN_ON(expr)
-
-#define GEM_DEBUG_WARN_ON(expr) GEM_WARN_ON(expr)
-
-#else
-
-#define GEM_SHOW_DEBUG() (0)
-
-#define GEM_BUG_ON(expr) BUILD_BUG_ON_INVALID(expr)
-#define GEM_WARN_ON(expr) ({ unlikely(!!(expr)); })
-
-#define GEM_DEBUG_WARN_ON(expr) ({ BUILD_BUG_ON_INVALID(expr); 0; })
-#endif
-
-#if IS_ENABLED(CONFIG_DRM_I915_TRACE_GEM)
-#define GEM_TRACE(...) trace_printk(__VA_ARGS__)
-#define GEM_TRACE_ERR(...) do { \
- pr_err(__VA_ARGS__); \
- trace_printk(__VA_ARGS__); \
-} while (0)
-#define GEM_TRACE_DUMP() \
- do { ftrace_dump(DUMP_ALL); __add_taint_for_CI(TAINT_WARN); } while (0)
-#define GEM_TRACE_DUMP_ON(expr) \
- do { if (expr) GEM_TRACE_DUMP(); } while (0)
-#else
-#define GEM_TRACE(...) do { } while (0)
-#define GEM_TRACE_ERR(...) do { } while (0)
-#define GEM_TRACE_DUMP() do { } while (0)
-#define GEM_TRACE_DUMP_ON(expr) BUILD_BUG_ON_INVALID(expr)
-#endif
-
#define I915_GEM_IDLE_TIMEOUT (HZ / 5)
#endif /* __I915_GEM_H__ */
@@ -20,7 +20,6 @@
#include "intel_device_info.h"
-#include "i915_gem.h"
#include "i915_gem_gtt.h"
#include "i915_params.h"
#include "i915_scheduler.h"
@@ -6,7 +6,6 @@
#include "gt/intel_engine_regs.h"
#include "i915_drv.h"
-#include "i915_gem.h"
#include "i915_ioctl.h"
#include "i915_reg.h"
#include "intel_runtime_pm.h"
@@ -36,7 +36,6 @@
#include "gt/intel_engine_types.h"
#include "gt/intel_timeline_types.h"
-#include "i915_gem.h"
#include "i915_scheduler.h"
#include "i915_selftest.h"
#include "i915_sw_fence.h"
@@ -11,7 +11,7 @@
#include <linux/scatterlist.h>
#include <linux/swiotlb.h>
-#include "i915_gem.h"
+#include "i915_debug.h"
struct drm_mm_node;
struct ttm_resource;
@@ -24,10 +24,9 @@
#include <linux/slab.h>
-#include "i915_syncmap.h"
-
-#include "i915_gem.h" /* GEM_BUG_ON() */
+#include "i915_debug.h"
#include "i915_selftest.h"
+#include "i915_syncmap.h"
#define SHIFT ilog2(KSYNCMAP)
#define MASK (KSYNCMAP - 1)
@@ -10,10 +10,9 @@
#include <drm/drm_buddy.h>
+#include "i915_debug.h"
#include "i915_ttm_buddy_manager.h"
-#include "i915_gem.h"
-
struct i915_ttm_buddy_manager {
struct ttm_resource_manager manager;
struct drm_buddy mm;
@@ -9,7 +9,6 @@
#include <linux/dma-fence.h>
#include <linux/refcount.h>
-#include "i915_gem.h"
#include "i915_scatterlist.h"
#include "i915_sw_fence.h"
#include "intel_runtime_pm.h"
Move the various GEM_BUG_ON(), GEM_WARN_ON(), etc. debug macros to a dedicated i915_debug.h file. Unfortunately, the i915_debug.h needs to be included from some headers that get included from i915_drv.h, so we don't really get much build benefits here, other than getting rid of superfluous i915_gem.h includes. Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/i915/gem/i915_gem_context.h | 1 - drivers/gpu/drm/i915/gem/i915_gem_internal.c | 1 - drivers/gpu/drm/i915/gem/i915_gem_object.h | 5 +- drivers/gpu/drm/i915/gem/i915_gem_tiling.c | 1 - drivers/gpu/drm/i915/gt/gen8_engine_cs.h | 2 +- drivers/gpu/drm/i915/gt/intel_engine_stats.h | 2 +- drivers/gpu/drm/i915/gt/intel_engine_types.h | 1 - drivers/gpu/drm/i915/gt/intel_gt.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_sysfs.h | 2 - drivers/gpu/drm/i915/gt/intel_renderstate.h | 2 +- drivers/gpu/drm/i915/gt/intel_ring.h | 2 +- drivers/gpu/drm/i915/gt/intel_sseu.h | 5 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 2 + drivers/gpu/drm/i915/gt/uc/intel_guc_log.h | 1 - drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 1 - drivers/gpu/drm/i915/i915_debug.h | 63 +++++++++++++++++++ drivers/gpu/drm/i915/i915_drm_client.c | 1 - drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_gem.h | 57 ----------------- drivers/gpu/drm/i915/i915_gpu_error.h | 1 - drivers/gpu/drm/i915/i915_ioctl.c | 1 - drivers/gpu/drm/i915/i915_request.h | 1 - drivers/gpu/drm/i915/i915_scatterlist.h | 2 +- drivers/gpu/drm/i915/i915_syncmap.c | 5 +- drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 3 +- drivers/gpu/drm/i915/i915_vma_resource.h | 1 - 26 files changed, 80 insertions(+), 85 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_debug.h