drm/i915: clean up i915_utils.h
cover drm/i915: clean up i915_utils.h
Split out functionality from i915_utils.h to not make it such a catch-all header that all files depend on. The end goal is to eventually remove the dependency on i915_utils.h from display/, but make the task easier by chopping up i915_utils.h and reducing the dependencies on it in core i915 first.
Whenever include lists need to be touched, group and sort them in a uniform manner instead of doing that in separate patches.
BR,
Jani.
Jani Nikula (5):
drm/i915: redundant i915_utils.h includes
drm/i915: split out i915_ptr_util.h
drm/i915: split out i915_timer_util.[ch]
drm/i915: split out i915_list_util.h
drm/i915: split out i915_wait_util.h
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gt/intel_context_types.h | 1 - .../drm/i915/gt/intel_execlists_submission.c | 6 +- .../gpu/drm/i915/gt/intel_gt_buffer_pool.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_mcr.c | 1 + drivers/gpu/drm/i915/gt/intel_reset.c | 7 +- .../gpu/drm/i915/gt/intel_ring_submission.c | 7 +- drivers/gpu/drm/i915/gt/intel_rps.c | 2 + drivers/gpu/drm/i915/gt/intel_timeline.h | 1 + drivers/gpu/drm/i915/gt/selftest_tlb.c | 6 +- drivers/gpu/drm/i915/gt/sysfs_engines.c | 1 + drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c | 6 +- .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c | 2 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 8 +- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 - drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 13 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 10 +- drivers/gpu/drm/i915/gvt/mmio_context.c | 6 +- drivers/gpu/drm/i915/i915_debugfs.c | 3 +- drivers/gpu/drm/i915/i915_gem.h | 2 - drivers/gpu/drm/i915/i915_list_util.h | 23 +++ drivers/gpu/drm/i915/i915_ptr_util.h | 66 ++++++ drivers/gpu/drm/i915/i915_request.h | 5 +- drivers/gpu/drm/i915/i915_timer_util.c | 36 ++++ drivers/gpu/drm/i915/i915_timer_util.h | 23 +++ drivers/gpu/drm/i915/i915_utils.c | 30 --- drivers/gpu/drm/i915/i915_utils.h | 191 ------------------ drivers/gpu/drm/i915/i915_vma.h | 6 +- drivers/gpu/drm/i915/i915_wait_util.h | 119 +++++++++++ drivers/gpu/drm/i915/intel_pcode.c | 1 + drivers/gpu/drm/i915/intel_uncore.c | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 4 +- drivers/gpu/drm/i915/selftests/i915_request.c | 5 +- .../gpu/drm/i915/selftests/i915_selftest.c | 2 +- drivers/gpu/drm/i915/selftests/igt_spinner.c | 5 +- drivers/gpu/drm/i915/vlv_suspend.c | 5 +- 38 files changed, 345 insertions(+), 275 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_list_util.h create mode 100644 drivers/gpu/drm/i915/i915_ptr_util.h create mode 100644 drivers/gpu/drm/i915/i915_timer_util.c create mode 100644 drivers/gpu/drm/i915/i915_timer_util.h create mode 100644 drivers/gpu/drm/i915/i915_wait_util.h
Signature · 1 line
2.47.3
PATCH 1/5 drm/i915: redundant i915_utils.h includes
Neither intel_guc.h nor i915_gem.h need i915_utils.h anymore. Just drop the includes.
--- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 - drivers/gpu/drm/i915/i915_gem.h | 2 -- 2 files changed, 3 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.h +0 -1
@@ -18,7 +18,6 @@#include "intel_guc_slpc_types.h" #include "intel_uc_fw.h" #include "intel_uncore.h" -#include "i915_utils.h" #include "i915_vma.h" struct __guc_ads_blob ;
drivers/gpu/drm/i915/i915_gem.h +0 -2
@@ -30,8 +30,6 @@#include <drm/drm_drv.h> -#include "i915_utils.h" -struct drm_file ;struct drm_i915_gem_object ;struct drm_i915_private ;
Signature · 1 line
2.47.3
Re: [PATCH 1/5] drm/i915: redundant i915_utils.h includes
Quoted 4 lines · Jani Nikula
Neither
intel_guc.hnori915_gem.hneedi915_utils.hanymore. Just drop the includes.Signed-off-by Jani Nikula <[email protected]>
Quoted 33 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 - drivers/gpu/drm/i915/i915_gem.h | 2 -- 2 files changed, 3 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc.h +0
-1@@ -18,7 +18,6 @@#include "intel_guc_slpc_types.h" #include "intel_uc_fw.h" #include "intel_uncore.h" -#include "i915_utils.h" #include "i915_vma.h" struct __guc_ads_blob ;drivers/gpu/drm/i915/i915_gem.h +0
-2@@ -30,8 +30,6 @@#include <drm/drm_drv.h> -#include "i915_utils.h" -struct drm_file ;struct drm_i915_gem_object ;struct drm_i915_private ;Signature · 1 line
2.47.3
PATCH 2/5 drm/i915: split out i915_ptr_util.h
In reply to Jani NikulaMove pointer related utilities from i915_utils.h to a separate new i915_ptr_util.h header. Clean up related includes.
--- drivers/gpu/drm/i915/gt/intel_context_types.h | 1 - drivers/gpu/drm/i915/gt/intel_timeline.h | 1 + drivers/gpu/drm/i915/i915_ptr_util.h | 66 +++++++++++++++++++ drivers/gpu/drm/i915/i915_request.h | 5 +- drivers/gpu/drm/i915/i915_utils.h | 57 ---------------- drivers/gpu/drm/i915/i915_vma.h | 6 +- 6 files changed, 73 insertions(+), 63 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_ptr_util.h
drivers/gpu/drm/i915/gt/intel_context_types.h +0 -1
@@ -14,7 +14,6 @@#include "i915_active_types.h" #include "i915_sw_fence.h" -#include "i915_utils.h" #include "intel_engine_types.h" #include "intel_sseu.h" #include "intel_wakeref.h"
drivers/gpu/drm/i915/gt/intel_timeline.h +1 -0
@@ -10,6 +10,7 @@#include "i915_active.h" #include "i915_syncmap.h" +#include "i915_utils.h" #include "intel_timeline_types.h" struct drm_printer ;
drivers/gpu/drm/i915/i915_ptr_util.h new file +66 -0
66 lines not on this page · raw message
drivers/gpu/drm/i915/i915_request.h +3 -2
@@ -31,19 +31,20 @@#include <linux/llist.h> #include <linux/lockdep.h> +#include <uapi/drm/i915_drm.h> +#include "gem/i915_gem_context_types.h" #include "gt/intel_context_types.h" #include "gt/intel_engine_types.h" #include "gt/intel_timeline_types.h" #include "i915_gem.h" +#include "i915_ptr_util.h" #include "i915_scheduler.h" #include "i915_selftest.h" #include "i915_sw_fence.h" #include "i915_vma_resource.h" -#include <uapi/drm/i915_drm.h> -struct drm_file ;struct drm_i915_gem_object ;struct drm_printer ;
drivers/gpu/drm/i915/i915_utils.h +0 -57
75 lines not on this page · raw message
drivers/gpu/drm/i915/i915_vma.h +3 -3
@@ -30,12 +30,12 @@#include <drm/drm_mm.h> -#include "gt/intel_ggtt_fencing.h" #include "gem/i915_gem_object.h" - -#include "i915_gem_gtt.h" +#include "gt/intel_ggtt_fencing.h" #include "i915_active.h" +#include "i915_gem_gtt.h" +#include "i915_ptr_util.h" #include "i915_request.h" #include "i915_vma_resource.h" #include "i915_vma_types.h"
Signature · 1 line
2.47.3
Re: [PATCH 2/5] drm/i915: split out i915_ptr_util.h
Quoted 4 lines · Jani Nikula
Move pointer related utilities from
i915_utils.hto a separate newi915_ptr_util.hheader. Clean up related includes.Signed-off-by Jani Nikula <[email protected]>
I wonder if we should add some 'i915_' prefix in them to avoid pretending they are a global kernel thing...
but the spin off is already a good clean-up start point...
Quoted 237 lines
--- drivers/gpu/drm/i915/gt/intel_context_types.h | 1 - drivers/gpu/drm/i915/gt/intel_timeline.h | 1 + drivers/gpu/drm/i915/i915_ptr_util.h | 66 +++++++++++++++++++ drivers/gpu/drm/i915/i915_request.h | 5 +- drivers/gpu/drm/i915/i915_utils.h | 57 ---------------- drivers/gpu/drm/i915/i915_vma.h | 6 +- 6 files changed, 73 insertions(+), 63 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_ptr_util.hdrivers/gpu/drm/i915/gt/intel_context_types.h +0
-1@@ -14,7 +14,6 @@#include "i915_active_types.h" #include "i915_sw_fence.h" -#include "i915_utils.h" #include "intel_engine_types.h" #include "intel_sseu.h" #include "intel_wakeref.h" drivers/gpu/drm/i915/gt/intel_timeline.h +1
-0@@ -10,6 +10,7 @@#include "i915_active.h" #include "i915_syncmap.h" +#include "i915_utils.h" #include "intel_timeline_types.h" struct drm_printer ;drivers/gpu/drm/i915/i915_ptr_util.h new file +66
-0@@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_PTR_UTIL_H__ +#define __I915_PTR_UTIL_H__ + +#include <linux/types.h> + +#define ptr_mask_bits (ptr, n) ({ \ + unsigned long __v = (unsigned long)(ptr); \ + (typeof(ptr))(__v & -BIT(n)); \ +}) + +#define ptr_unmask_bits (ptr, n) ((unsigned long)(ptr) & (BIT(n) - 1)) + +#define ptr_unpack_bits (ptr, bits, n) ({ \ + unsigned long __v = (unsigned long)(ptr); \ + *(bits) = __v & (BIT(n) - 1); \ + (typeof(ptr))(__v & -BIT(n)); \ +}) + +#define ptr_pack_bits (ptr, bits, n) ({ \ + unsigned long __bits = (bits); \ + GEM_BUG_ON(__bits & -BIT(n)); \ + ((typeof(ptr))((unsigned long)(ptr) | __bits)); \ +}) + +#define ptr_dec (ptr) ({ \ + unsigned long __v = (unsigned long)(ptr); \ + (typeof(ptr))(__v - 1); \ +}) + +#define ptr_inc (ptr) ({ \ + unsigned long __v = (unsigned long)(ptr); \ + (typeof(ptr))(__v + 1); \ +}) + +#define page_mask_bits (ptr) ptr_mask_bits(ptr, PAGE_SHIFT) +#define page_unmask_bits (ptr) ptr_unmask_bits(ptr, PAGE_SHIFT) +#define page_pack_bits (ptr, bits) ptr_pack_bits(ptr, bits, PAGE_SHIFT) +#define page_unpack_bits (ptr, bits) ptr_unpack_bits(ptr, bits, PAGE_SHIFT) + +static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b) +{ +return a - b; +} + +#define u64_to_ptr (T , x) ({ \ + typecheck(u64, x); \ + (T *)(uintptr_t)(x); \ +}) + +/* +* container_of_user: Extract the superclass from a pointer to a member. +* +* Exactly like container_of() with the exception that it plays nicely +* with sparse for __user @ptr. +*/ +#define container_of_user (ptr, type, member) ({ \ + void __user *__mptr = (void __user *)(ptr); \ + BUILD_BUG_ON_MSG(!__same_type(*(ptr), typeof_member(type, member)) && \ + !__same_type(*(ptr), void), \ + "pointer type mismatch in container_of()"); \ + ((type __user *)(__mptr - offsetof(type, member))); }) + +#endif /* __I915_PTR_UTIL_H__ */ drivers/gpu/drm/i915/i915_request.h +3
-2@@ -31,19 +31,20 @@#include <linux/llist.h> #include <linux/lockdep.h> +#include <uapi/drm/i915_drm.h> +#include "gem/i915_gem_context_types.h" #include "gt/intel_context_types.h" #include "gt/intel_engine_types.h" #include "gt/intel_timeline_types.h" #include "i915_gem.h" +#include "i915_ptr_util.h" #include "i915_scheduler.h" #include "i915_selftest.h" #include "i915_sw_fence.h" #include "i915_vma_resource.h" -#include <uapi/drm/i915_drm.h> -struct drm_file ;struct drm_i915_gem_object ;struct drm_printer ;drivers/gpu/drm/i915/i915_utils.h +0
-57@@ -67,64 +67,12 @@ bool i915_error_injected(void); drm_err(&(i915)->drm, fmt, ##__VA_ARGS__); \ }) -#define ptr_mask_bits (ptr, n) ({ \ - unsigned long __v = (unsigned long)(ptr); \ - (typeof(ptr))(__v & -BIT(n)); \ -}) - -#define ptr_unmask_bits (ptr, n) ((unsigned long)(ptr) & (BIT(n) - 1)) - -#define ptr_unpack_bits (ptr, bits, n) ({ \ - unsigned long __v = (unsigned long)(ptr); \ - *(bits) = __v & (BIT(n) - 1); \ - (typeof(ptr))(__v & -BIT(n)); \ -}) - -#define ptr_pack_bits (ptr, bits, n) ({ \ - unsigned long __bits = (bits); \ - GEM_BUG_ON(__bits & -BIT(n)); \ - ((typeof(ptr))((unsigned long)(ptr) | __bits)); \ -}) - -#define ptr_dec (ptr) ({ \ - unsigned long __v = (unsigned long)(ptr); \ - (typeof(ptr))(__v - 1); \ -}) - -#define ptr_inc (ptr) ({ \ - unsigned long __v = (unsigned long)(ptr); \ - (typeof(ptr))(__v + 1); \ -}) - -#define page_mask_bits (ptr) ptr_mask_bits(ptr, PAGE_SHIFT) -#define page_unmask_bits (ptr) ptr_unmask_bits(ptr, PAGE_SHIFT) -#define page_pack_bits (ptr, bits) ptr_pack_bits(ptr, bits, PAGE_SHIFT) -#define page_unpack_bits (ptr, bits) ptr_unpack_bits(ptr, bits, PAGE_SHIFT) -#define fetch_and_zero (ptr) ({ \ typeof(*ptr) __T = *(ptr); \ *(ptr) = (typeof(*ptr))0; \ __T; \ }) -static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b) -{ -return a - b; -} - -/* -* container_of_user: Extract the superclass from a pointer to a member. -* -* Exactly like container_of() with the exception that it plays nicely -* with sparse for __user @ptr. -*/ -#define container_of_user (ptr, type, member) ({ \ - void __user *__mptr = (void __user *)(ptr); \ - BUILD_BUG_ON_MSG(!__same_type(*(ptr), typeof_member(type, member)) && \ - !__same_type(*(ptr), void), \ - "pointer type mismatch in container_of()"); \ - ((type __user *)(__mptr - offsetof(type, member))); }) -/* * check_user_mbz: Check that a user value exists and is zero * @@ -143,11 +91,6 @@ static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b)get_user (mbz__, (U )) ? -EFAULT : mbz__ ? -EINVAL :0 ; \ }) -#define u64_to_ptr (T , x) ({ \ - typecheck(u64, x); \ - (T *)(uintptr_t)(x); \ -}) -#define __mask_next_bit (mask) ({ \ int __idx = ffs(mask) - 1; \ mask &= ~BIT(__idx); \drivers/gpu/drm/i915/i915_vma.h +3
-3@@ -30,12 +30,12 @@#include <drm/drm_mm.h> -#include "gt/intel_ggtt_fencing.h" #include "gem/i915_gem_object.h" - -#include "i915_gem_gtt.h" +#include "gt/intel_ggtt_fencing.h" #include "i915_active.h" +#include "i915_gem_gtt.h" +#include "i915_ptr_util.h" #include "i915_request.h" #include "i915_vma_resource.h" #include "i915_vma_types.h" Signature · 1 line
2.47.3
PATCH 3/5 drm/i915: split out i915_timer_util.[ch]
In reply to Jani NikulaMove timer related utilities from i915_utils.[ch] to separate new files i915_timer_util.[ch]. Clean up related includes.
Note: Arguably none of this should exist in i915 in the first place. At least isolate it better.
--- drivers/gpu/drm/i915/Makefile | 1 + .../drm/i915/gt/intel_execlists_submission.c | 4 ++- drivers/gpu/drm/i915/gt/sysfs_engines.c | 1 + drivers/gpu/drm/i915/i915_timer_util.c | 36 +++++++++++++++++++ drivers/gpu/drm/i915/i915_timer_util.h | 23 ++++++++++++ drivers/gpu/drm/i915/i915_utils.c | 30 ---------------- drivers/gpu/drm/i915/i915_utils.h | 14 -------- 7 files changed, 64 insertions(+), 45 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_timer_util.c create mode 100644 drivers/gpu/drm/i915/i915_timer_util.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -32,6 +32,7 @@ i915-y += \ i915_scatterlist.o \ i915_switcheroo.o \ i915_sysfs.o \ + i915_timer_util.o \ i915_utils.o \ intel_clock_gating.o \ intel_cpu_info.o \
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +3 -1
@@ -106,14 +106,16 @@* preemption, but just sampling the new tail pointer). * */ +#include <linux/interrupt.h> #include <linux/string_helpers.h> +#include "gen8_engine_cs.h" #include "i915_drv.h" #include "i915_reg.h" +#include "i915_timer_util.h" #include "i915_trace.h" #include "i915_vgpu.h" -#include "gen8_engine_cs.h" #include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_engine_heartbeat.h"
drivers/gpu/drm/i915/gt/sysfs_engines.c +1 -0
@@ -7,6 +7,7 @@#include <linux/sysfs.h> #include "i915_drv.h" +#include "i915_timer_util.h" #include "intel_engine.h" #include "intel_engine_heartbeat.h" #include "sysfs_engines.h"
drivers/gpu/drm/i915/i915_timer_util.c new file +36 -0
@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT +/* Copyright © 2025 Intel Corporation */ + +#include <linux/jiffies.h> + +#include "i915_timer_util.h" + +void cancel_timer (struct timer_list *t) +{ +if (!timer_active (t)) +return ; + +timer_delete (t); +WRITE_ONCE (t->expires,0 ); +} + +void set_timer_ms (struct timer_list *t,unsigned long timeout) +{ +if (!timeout) { +cancel_timer (t); +return ; + } + + timeout =msecs_to_jiffies (timeout); + +/* +* Paranoia to make sure the compiler computes the timeout before +* loading 'jiffies' as jiffies is volatile and may be updated in +* the background by a timer tick. All to reduce the complexity +* of the addition and reduce the risk of losing a jiffy. +*/ +barrier (); + +/* Keep t->expires = 0 reserved to indicate a canceled timer. */ +mod_timer (t, jiffies + timeout ?:1 ); +}
drivers/gpu/drm/i915/i915_timer_util.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_TIMER_UTIL_H__ +#define __I915_TIMER_UTIL_H__ + +#include <linux/timer.h> +#include <asm/rwonce.h> + +void cancel_timer (struct timer_list *t); +void set_timer_ms (struct timer_list *t,unsigned long timeout); + +static inline bool timer_active (const struct timer_list *t) +{ +return READ_ONCE (t->expires); +} + +static inline bool timer_expired (const struct timer_list *t) +{ +return timer_active (t) && !timer_pending (t); +} + +#endif /* __I915_TIMER_UTIL_H__ */
drivers/gpu/drm/i915/i915_utils.c +0 -30
@@ -47,36 +47,6 @@ bool i915_error_injected(void)#endif -void cancel_timer (struct timer_list *t) -{ -if (!timer_active (t)) -return ; - -timer_delete (t); -WRITE_ONCE (t->expires,0 ); -} - -void set_timer_ms (struct timer_list *t,unsigned long timeout) -{ -if (!timeout) { -cancel_timer (t); -return ; - } - - timeout =msecs_to_jiffies (timeout); - -/* -* Paranoia to make sure the compiler computes the timeout before -* loading 'jiffies' as jiffies is volatile and may be updated in -* the background by a timer tick. All to reduce the complexity -* of the addition and reduce the risk of losing a jiffy. -*/ -barrier (); - -/* Keep t->expires = 0 reserved to indicate a canceled timer. */ -mod_timer (t, jiffies + timeout ?:1 ); -} -bool i915_vtd_active (struct drm_i915_private *i915) {if (device_iommu_mapped (i915->drm.dev))
drivers/gpu/drm/i915/i915_utils.h +0 -14
@@ -38,7 +38,6 @@#endif struct drm_i915_private ; -struct timer_list ;#define MISSING_CASE (x) WARN(1, "Missing case (%s == %ld)\n", \ __stringify(x), (long)(x))
@@ -270,19 +269,6 @@ static inline void __add_taint_for_CI(unsigned int taint)add_taint (taint,LOCKDEP_STILL_OK ); } -void cancel_timer (struct timer_list *t); -void set_timer_ms (struct timer_list *t,unsigned long timeout); - -static inline bool timer_active (const struct timer_list *t) -{ -return READ_ONCE (t->expires); -} - -static inline bool timer_expired (const struct timer_list *t) -{ -return timer_active (t) && !timer_pending (t); -} -static inline bool i915_run_as_guest (void ) {#if IS_ENABLED (CONFIG_X86 )
Signature · 1 line
2.47.3
Re: [PATCH 3/5] drm/i915: split out i915_timer_util.[ch]
Quoted 7 lines · Jani Nikula
Move timer related utilities from i915_utils.[ch] to separate new files i915_timer_util.[ch]. Clean up related includes.
Note: Arguably none of this should exist in i915 in the first place. At least isolate it better.
Signed-off-by Jani Nikula <[email protected]>
Quoted 205 lines
--- drivers/gpu/drm/i915/Makefile | 1 + .../drm/i915/gt/intel_execlists_submission.c | 4 ++- drivers/gpu/drm/i915/gt/sysfs_engines.c | 1 + drivers/gpu/drm/i915/i915_timer_util.c | 36 +++++++++++++++++++ drivers/gpu/drm/i915/i915_timer_util.h | 23 ++++++++++++ drivers/gpu/drm/i915/i915_utils.c | 30 ---------------- drivers/gpu/drm/i915/i915_utils.h | 14 -------- 7 files changed, 64 insertions(+), 45 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_timer_util.c create mode 100644 drivers/gpu/drm/i915/i915_timer_util.hdrivers/gpu/drm/i915/Makefile +1
-0@@ -32,6 +32,7 @@ i915-y += \ i915_scatterlist.o \ i915_switcheroo.o \ i915_sysfs.o \ + i915_timer_util.o \ i915_utils.o \ intel_clock_gating.o \ intel_cpu_info.o \drivers/gpu/drm/i915/gt/intel_execlists_submission.c +3
-1@@ -106,14 +106,16 @@* preemption, but just sampling the new tail pointer). * */ +#include <linux/interrupt.h> #include <linux/string_helpers.h> +#include "gen8_engine_cs.h" #include "i915_drv.h" #include "i915_reg.h" +#include "i915_timer_util.h" #include "i915_trace.h" #include "i915_vgpu.h" -#include "gen8_engine_cs.h" #include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_engine_heartbeat.h" drivers/gpu/drm/i915/gt/sysfs_engines.c +1
-0@@ -7,6 +7,7 @@#include <linux/sysfs.h> #include "i915_drv.h" +#include "i915_timer_util.h" #include "intel_engine.h" #include "intel_engine_heartbeat.h" #include "sysfs_engines.h" drivers/gpu/drm/i915/i915_timer_util.c new file +36
-0@@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT +/* Copyright © 2025 Intel Corporation */ + +#include <linux/jiffies.h> + +#include "i915_timer_util.h" + +void cancel_timer (struct timer_list *t) +{ +if (!timer_active (t)) +return ; + +timer_delete (t); +WRITE_ONCE (t->expires,0 ); +} + +void set_timer_ms (struct timer_list *t,unsigned long timeout) +{ +if (!timeout) { +cancel_timer (t); +return ; + } + + timeout =msecs_to_jiffies (timeout); + +/* +* Paranoia to make sure the compiler computes the timeout before +* loading 'jiffies' as jiffies is volatile and may be updated in +* the background by a timer tick. All to reduce the complexity +* of the addition and reduce the risk of losing a jiffy. +*/ +barrier (); + +/* Keep t->expires = 0 reserved to indicate a canceled timer. */ +mod_timer (t, jiffies + timeout ?:1 ); +}drivers/gpu/drm/i915/i915_timer_util.h new file +23
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_TIMER_UTIL_H__ +#define __I915_TIMER_UTIL_H__ + +#include <linux/timer.h> +#include <asm/rwonce.h> + +void cancel_timer (struct timer_list *t); +void set_timer_ms (struct timer_list *t,unsigned long timeout); + +static inline bool timer_active (const struct timer_list *t) +{ +return READ_ONCE (t->expires); +} + +static inline bool timer_expired (const struct timer_list *t) +{ +return timer_active (t) && !timer_pending (t); +} + +#endif /* __I915_TIMER_UTIL_H__ */ drivers/gpu/drm/i915/i915_utils.c +0
-30@@ -47,36 +47,6 @@ bool i915_error_injected(void)#endif -void cancel_timer (struct timer_list *t) -{ -if (!timer_active (t)) -return ; - -timer_delete (t); -WRITE_ONCE (t->expires,0 ); -} - -void set_timer_ms (struct timer_list *t,unsigned long timeout) -{ -if (!timeout) { -cancel_timer (t); -return ; - } - - timeout =msecs_to_jiffies (timeout); - -/* -* Paranoia to make sure the compiler computes the timeout before -* loading 'jiffies' as jiffies is volatile and may be updated in -* the background by a timer tick. All to reduce the complexity -* of the addition and reduce the risk of losing a jiffy. -*/ -barrier (); - -/* Keep t->expires = 0 reserved to indicate a canceled timer. */ -mod_timer (t, jiffies + timeout ?:1 ); -} -bool i915_vtd_active (struct drm_i915_private *i915) {if (device_iommu_mapped (i915->drm.dev))drivers/gpu/drm/i915/i915_utils.h +0
-14@@ -38,7 +38,6 @@#endif struct drm_i915_private ; -struct timer_list ;#define MISSING_CASE (x) WARN(1, "Missing case (%s == %ld)\n", \ __stringify(x), (long)(x))@@ -270,19 +269,6 @@ static inline void __add_taint_for_CI(unsigned int taint)add_taint (taint,LOCKDEP_STILL_OK ); } -void cancel_timer (struct timer_list *t); -void set_timer_ms (struct timer_list *t,unsigned long timeout); - -static inline bool timer_active (const struct timer_list *t) -{ -return READ_ONCE (t->expires); -} - -static inline bool timer_expired (const struct timer_list *t) -{ -return timer_active (t) && !timer_pending (t); -} -static inline bool i915_run_as_guest (void ) {#if IS_ENABLED (CONFIG_X86 )Signature · 1 line
2.47.3
PATCH 4/5 drm/i915: split out i915_list_util.h
In reply to Jani NikulaMove list related utilities from i915_utils.h to separate new file i915_list_util.h. Clean up related includes.
Note: Arguably none of this should exist in i915 in the first place. At least isolate it better.
--- .../drm/i915/gt/intel_execlists_submission.c | 1 + .../gpu/drm/i915/gt/intel_gt_buffer_pool.c | 1 + drivers/gpu/drm/i915/gt/intel_timeline.h | 2 +- drivers/gpu/drm/i915/i915_list_util.h | 23 +++++++++++++++++++ drivers/gpu/drm/i915/i915_utils.h | 14 ----------- 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_list_util.h
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +1 -0
@@ -112,6 +112,7 @@#include "gen8_engine_cs.h" #include "i915_drv.h" +#include "i915_list_util.h" #include "i915_reg.h" #include "i915_timer_util.h" #include "i915_trace.h"
drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c +1 -0
@@ -7,6 +7,7 @@#include "gem/i915_gem_object.h" #include "i915_drv.h" +#include "i915_list_util.h" #include "intel_engine_pm.h" #include "intel_gt_buffer_pool.h"
drivers/gpu/drm/i915/gt/intel_timeline.h +1 -1
@@ -9,8 +9,8 @@#include <linux/lockdep.h> #include "i915_active.h" +#include "i915_list_util.h" #include "i915_syncmap.h" -#include "i915_utils.h" #include "intel_timeline_types.h" struct drm_printer ;
drivers/gpu/drm/i915/i915_list_util.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_LIST_UTIL_H__ +#define __I915_LIST_UTIL_H__ + +#include <linux/list.h> +#include <asm/rwonce.h> + +static inline void __list_del_many (struct list_head *head, +struct list_head *first) +{ + first->prev = head; +WRITE_ONCE (head->next, first); +} + +static inline int list_is_last_rcu (const struct list_head *list, +const struct list_head *head) +{ +return READ_ONCE (list->next) == head; +} + +#endif /* __I915_LIST_UTIL_H__ */
drivers/gpu/drm/i915/i915_utils.h +0 -14
@@ -25,7 +25,6 @@#ifndef __I915_UTILS_H#define __I915_UTILS_H -#include <linux/list.h> #include <linux/overflow.h> #include <linux/sched.h> #include <linux/string_helpers.h>
@@ -101,19 +100,6 @@ static inline bool is_power_of_2_u64(u64 n)return (n !=0 && ((n & (n -1 )) ==0 )); } -static inline void __list_del_many (struct list_head *head, -struct list_head *first) -{ - first->prev = head; -WRITE_ONCE (head->next, first); -} - -static inline int list_is_last_rcu (const struct list_head *list, -const struct list_head *head) -{ -return READ_ONCE (list->next) == head; -} -static inline unsigned long msecs_to_jiffies_timeout (const unsigned int m) {unsigned long j =msecs_to_jiffies (m);
Signature · 1 line
2.47.3
Re: [PATCH 4/5] drm/i915: split out i915_list_util.h
Quoted 3 lines · Jani Nikula
Move list related utilities from
i915_utils.hto separate new filei915_list_util.h. Clean up related includes.
here as well I believe it would be better to have an i915_ prefix.
but up to you
Quoted 115 lines
Note: Arguably none of this should exist in i915 in the first place. At least isolate it better.
Signed-off-by Jani Nikula <[email protected]>--- .../drm/i915/gt/intel_execlists_submission.c | 1 + .../gpu/drm/i915/gt/intel_gt_buffer_pool.c | 1 + drivers/gpu/drm/i915/gt/intel_timeline.h | 2 +- drivers/gpu/drm/i915/i915_list_util.h | 23 +++++++++++++++++++ drivers/gpu/drm/i915/i915_utils.h | 14 ----------- 5 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_list_util.hdrivers/gpu/drm/i915/gt/intel_execlists_submission.c +1
-0@@ -112,6 +112,7 @@#include "gen8_engine_cs.h" #include "i915_drv.h" +#include "i915_list_util.h" #include "i915_reg.h" #include "i915_timer_util.h" #include "i915_trace.h" drivers/gpu/drm/i915/gt/intel_gt_buffer_pool.c +1
-0@@ -7,6 +7,7 @@#include "gem/i915_gem_object.h" #include "i915_drv.h" +#include "i915_list_util.h" #include "intel_engine_pm.h" #include "intel_gt_buffer_pool.h" drivers/gpu/drm/i915/gt/intel_timeline.h +1
-1@@ -9,8 +9,8 @@#include <linux/lockdep.h> #include "i915_active.h" +#include "i915_list_util.h" #include "i915_syncmap.h" -#include "i915_utils.h" #include "intel_timeline_types.h" struct drm_printer ;drivers/gpu/drm/i915/i915_list_util.h new file +23
-0@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_LIST_UTIL_H__ +#define __I915_LIST_UTIL_H__ + +#include <linux/list.h> +#include <asm/rwonce.h> + +static inline void __list_del_many (struct list_head *head, +struct list_head *first) +{ + first->prev = head; +WRITE_ONCE (head->next, first); +} + +static inline int list_is_last_rcu (const struct list_head *list, +const struct list_head *head) +{ +return READ_ONCE (list->next) == head; +} + +#endif /* __I915_LIST_UTIL_H__ */ drivers/gpu/drm/i915/i915_utils.h +0
-14@@ -25,7 +25,6 @@#ifndef __I915_UTILS_H#define __I915_UTILS_H -#include <linux/list.h> #include <linux/overflow.h> #include <linux/sched.h> #include <linux/string_helpers.h> @@ -101,19 +100,6 @@ static inline bool is_power_of_2_u64(u64 n)return (n !=0 && ((n & (n -1 )) ==0 )); } -static inline void __list_del_many (struct list_head *head, -struct list_head *first) -{ - first->prev = head; -WRITE_ONCE (head->next, first); -} - -static inline int list_is_last_rcu (const struct list_head *list, -const struct list_head *head) -{ -return READ_ONCE (list->next) == head; -} -static inline unsigned long msecs_to_jiffies_timeout (const unsigned int m) {unsigned long j =msecs_to_jiffies (m);Signature · 1 line
2.47.3
PATCH 5/5 drm/i915: split out i915_wait_util.h
In reply to Jani NikulaMove waiting related utilities from i915_utils.h to separate new file i915_wait_util.h. Clean up related includes.
Note: Many of the various wait macro usages could likely be refactored to use poll_timeout_us().
--- .../drm/i915/gt/intel_execlists_submission.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_mcr.c | 1 + drivers/gpu/drm/i915/gt/intel_reset.c | 7 +- .../gpu/drm/i915/gt/intel_ring_submission.c | 7 +- drivers/gpu/drm/i915/gt/intel_rps.c | 2 + drivers/gpu/drm/i915/gt/selftest_tlb.c | 6 +- drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c | 6 +- .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c | 2 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 8 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 13 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 10 +- drivers/gpu/drm/i915/gvt/mmio_context.c | 6 +- drivers/gpu/drm/i915/i915_debugfs.c | 3 +- drivers/gpu/drm/i915/i915_utils.h | 106 ---------------- drivers/gpu/drm/i915/i915_wait_util.h | 119 ++++++++++++++++++ drivers/gpu/drm/i915/intel_pcode.c | 1 + drivers/gpu/drm/i915/intel_uncore.c | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 4 +- drivers/gpu/drm/i915/selftests/i915_request.c | 5 +- .../gpu/drm/i915/selftests/i915_selftest.c | 2 +- drivers/gpu/drm/i915/selftests/igt_spinner.c | 5 +- drivers/gpu/drm/i915/vlv_suspend.c | 5 +- 24 files changed, 183 insertions(+), 150 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_wait_util.h
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +1 -0
@@ -117,6 +117,7 @@#include "i915_timer_util.h" #include "i915_trace.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_engine_heartbeat.h"
drivers/gpu/drm/i915/gt/intel_gt_mcr.c +1 -0
@@ -4,6 +4,7 @@*/ #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_gt.h" #include "intel_gt_mcr.h" #include "intel_gt_print.h"
drivers/gpu/drm/i915/gt/intel_reset.c +2 -5
@@ -9,18 +9,17 @@#include "display/intel_display_reset.h" #include "display/intel_overlay.h" -#include "gem/i915_gem_context.h" -#include "gt/intel_gt_regs.h" -#include "gt/uc/intel_gsc_fw.h" +#include "uc/intel_guc.h" #include "i915_drv.h" #include "i915_file_private.h" #include "i915_gpu_error.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_engine_pm.h" #include "intel_engine_regs.h"
@@ -32,8 +31,6 @@#include "intel_pci_config.h" #include "intel_reset.h" -#include "uc/intel_guc.h" -#define RESET_MAX_RETRIES 3static void client_mark_guilty (struct i915_gem_context *ctx,bool banned)
drivers/gpu/drm/i915/gt/intel_ring_submission.c +4 -3
@@ -15,18 +15,19 @@#include "i915_irq.h" #include "i915_mitigations.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" +#include "intel_engine_heartbeat.h" +#include "intel_engine_pm.h" #include "intel_engine_regs.h" #include "intel_gt.h" #include "intel_gt_irq.h" +#include "intel_gt_print.h" #include "intel_gt_regs.h" #include "intel_reset.h" #include "intel_ring.h" #include "shmem_utils.h" -#include "intel_engine_heartbeat.h" -#include "intel_engine_pm.h" -#include "intel_gt_print.h" /* Rough estimate of the typical request size, performing a flush, * set-context and then emitting the batch.
drivers/gpu/drm/i915/gt/intel_rps.c +2 -0
@@ -10,9 +10,11 @@#include "display/intel_display.h" #include "display/intel_display_rps.h" #include "soc/intel_dram.h" +#include "i915_drv.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_gt.h" #include "intel_gt_clock_utils.h"
drivers/gpu/drm/i915/gt/selftest_tlb.c +3 -3
@@ -3,17 +3,17 @@* Copyright © 2022 Intel Corporation */ -#include "i915_selftest.h" -#include "gem/i915_gem_internal.h" #include "gem/i915_gem_lmem.h" #include "gem/i915_gem_region.h" #include "gen8_engine_cs.h" #include "i915_gem_ww.h" +#include "i915_selftest.h" +#include "i915_wait_util.h" +#include "intel_context.h" #include "intel_engine_regs.h" #include "intel_gpu_commands.h" -#include "intel_context.h" #include "intel_gt.h" #include "intel_ring.h"
drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c +4 -2
@@ -10,11 +10,13 @@#include "gt/intel_gt.h" #include "gt/intel_gt_print.h" + +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_gsc_proxy.h" #include "intel_gsc_uc.h" #include "intel_gsc_uc_heci_cmd_submit.h" -#include "i915_drv.h" -#include "i915_reg.h" /* * GSC proxy:
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +2 -0
@@ -8,6 +8,8 @@#include "gt/intel_gpu_commands.h" #include "gt/intel_gt.h" #include "gt/intel_ring.h" + +#include "i915_wait_util.h" #include "intel_gsc_uc_heci_cmd_submit.h" struct gsc_heci_pkt {
drivers/gpu/drm/i915/gt/uc/intel_guc.c +5 -3
@@ -8,15 +8,17 @@#include "gt/intel_gt_irq.h" #include "gt/intel_gt_pm_irq.h" #include "gt/intel_gt_regs.h" + +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_guc.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_slpc.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_irq.h" -#include "i915_reg.h" /** * DOC: GuC
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +2 -1
@@ -5,11 +5,12 @@#include <linux/circ_buf.h> #include <linux/ktime.h> -#include <linux/time64.h> #include <linux/string_helpers.h> +#include <linux/time64.h> #include <linux/timekeeping.h> #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_ct.h" #include "intel_guc_print.h"
drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c +3 -1
@@ -13,9 +13,11 @@#include "gt/intel_gt_mcr.h" #include "gt/intel_gt_regs.h" #include "gt/intel_rps.h" + +#include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_fw.h" #include "intel_guc_print.h" -#include "i915_drv.h" static void guc_prepare_xfer (struct intel_gt *gt) {
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +8 -5
@@ -3,17 +3,20 @@* Copyright © 2021 Intel Corporation */ -#include <drm/drm_cache.h> #include <linux/string_helpers.h> +#include <drm/drm_cache.h> + +#include "gt/intel_gt.h" +#include "gt/intel_gt_regs.h" +#include "gt/intel_rps.h" +#include "i915_drv.h" #include "i915_reg.h" -#include "intel_guc_slpc.h" +#include "i915_wait_util.h" #include "intel_guc_print.h" +#include "intel_guc_slpc.h" #include "intel_mchbar_regs.h" -#include "gt/intel_gt.h" -#include "gt/intel_gt_regs.h" -#include "gt/intel_rps.h" /** * DOC: SLPC - Dynamic Frequency management
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +5 -5
@@ -25,16 +25,16 @@#include "gt/intel_mocs.h" #include "gt/intel_ring.h" +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_trace.h" +#include "i915_wait_util.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_reg.h" -#include "i915_irq.h" -#include "i915_trace.h" -/** * DOC: GuC-based command submission *
drivers/gpu/drm/i915/gvt/mmio_context.c +4 -2
@@ -33,14 +33,16 @@* */ -#include "i915_drv.h" -#include "i915_reg.h" #include "gt/intel_context.h" #include "gt/intel_engine_regs.h" #include "gt/intel_gpu_commands.h" #include "gt/intel_gt_regs.h" #include "gt/intel_ring.h" +#include "gvt.h" +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "trace.h" #define GEN9_MOCS_SIZE 64
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
@@ -26,11 +26,11 @@* */ +#include <linux/debugfs.h> #include <linux/sched/mm.h> #include <linux/sort.h> #include <linux/string_helpers.h> -#include <linux/debugfs.h> #include <drm/drm_debugfs.h> #include "gem/i915_gem_context.h"
@@ -54,6 +54,7 @@#include "i915_irq.h" #include "i915_reg.h" #include "i915_scheduler.h" +#include "i915_wait_util.h" #include "intel_mchbar_regs.h" static inline struct drm_i915_private *node_to_i915 (struct drm_info_node *node)
drivers/gpu/drm/i915/i915_utils.h +0 -106
112 lines not on this page · raw message
drivers/gpu/drm/i915/i915_wait_util.h new file +119 -0
119 lines not on this page · raw message
drivers/gpu/drm/i915/intel_pcode.c +1 -0
@@ -5,6 +5,7 @@#include "i915_drv.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_pcode.h" static int gen6_check_mailbox_status (u32 mbox)
drivers/gpu/drm/i915/intel_uncore.c +4 -3
@@ -21,19 +21,20 @@* IN THE SOFTWARE. */ -#include <drm/drm_managed.h> #include <linux/pm_runtime.h> -#include "display/intel_display_core.h" +#include <drm/drm_managed.h> -#include "gt/intel_gt.h" +#include "display/intel_display_core.h" #include "gt/intel_engine_regs.h" +#include "gt/intel_gt.h" #include "gt/intel_gt_regs.h" #include "i915_drv.h" #include "i915_iosf_mbi.h" #include "i915_reg.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_uncore_trace.h" #define FORCEWAKE_ACK_TIMEOUT_MS 50
drivers/gpu/drm/i915/pxp/intel_pxp.c +2 -2
@@ -2,15 +2,15 @@/* * Copyright(c) 2020 Intel Corporation. */ +#include <linux/workqueue.h> #include "gem/i915_gem_context.h" -#include "gt/intel_context.h" #include "gt/intel_gt.h" #include "i915_drv.h" - +#include "i915_wait_util.h" #include "intel_pxp.h" #include "intel_pxp_gsccs.h" #include "intel_pxp_irq.h"
drivers/gpu/drm/i915/selftests/i915_request.c +2 -3
@@ -22,14 +22,13 @@* */ -#include <linux/prime_numbers.h> #include <linux/pm_qos.h> +#include <linux/prime_numbers.h> #include <linux/sort.h> #include "gem/i915_gem_internal.h" #include "gem/i915_gem_pm.h" #include "gem/selftests/mock_context.h" -#include "gt/intel_engine_heartbeat.h" #include "gt/intel_engine_pm.h" #include "gt/intel_engine_user.h"
@@ -40,11 +39,11 @@#include "i915_random.h" #include "i915_selftest.h" +#include "i915_wait_util.h" #include "igt_flush_test.h" #include "igt_live_test.h" #include "igt_spinner.h" #include "lib_sw_fence.h" -#include "mock_drm.h" #include "mock_gem_device.h"
drivers/gpu/drm/i915/selftests/i915_selftest.c +1 -1
@@ -31,7 +31,7 @@#include "i915_driver.h" #include "i915_drv.h" #include "i915_selftest.h" - +#include "i915_wait_util.h" #include "igt_flush_test.h" struct i915_selftest i915_selftest__read_mostly = {
drivers/gpu/drm/i915/selftests/igt_spinner.c +3 -2
@@ -3,12 +3,13 @@* * Copyright © 2018 Intel Corporation */ -#include "gt/intel_gpu_commands.h" -#include "gt/intel_gt.h" #include "gem/i915_gem_internal.h" #include "gem/selftests/igt_gem_utils.h" +#include "gt/intel_gpu_commands.h" +#include "gt/intel_gt.h" +#include "i915_wait_util.h" #include "igt_spinner.h" int igt_spinner_init (struct igt_spinner *spin,struct intel_gt *gt)
drivers/gpu/drm/i915/vlv_suspend.c +3 -2
@@ -8,16 +8,17 @@#include <drm/drm_print.h> +#include "gt/intel_gt_regs.h" +#include "i915_drv.h" #include "i915_reg.h" #include "i915_trace.h" #include "i915_utils.h" +#include "i915_wait_util.h" #include "intel_clock_gating.h" #include "intel_uncore_trace.h" #include "vlv_suspend.h" -#include "gt/intel_gt_regs.h" -struct vlv_s0ix_state {/* GAM */ u32 wr_watermark;
Signature · 1 line
2.47.3
Re: [PATCH 5/5] drm/i915: split out i915_wait_util.h
Quoted 5 lines · Jani Nikula
Move waiting related utilities from
i915_utils.hto separate new filei915_wait_util.h. Clean up related includes.Note: Many of the various wait macro usages could likely be refactored to use
poll_timeout_us().
I hope so! :)
nice clean up overall, although my dream is that we could get rid entirely of these utils that pretend they are core kernel.
Quoted 750 lines
Signed-off-by Jani Nikula <[email protected]>--- .../drm/i915/gt/intel_execlists_submission.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_mcr.c | 1 + drivers/gpu/drm/i915/gt/intel_reset.c | 7 +- .../gpu/drm/i915/gt/intel_ring_submission.c | 7 +- drivers/gpu/drm/i915/gt/intel_rps.c | 2 + drivers/gpu/drm/i915/gt/selftest_tlb.c | 6 +- drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c | 6 +- .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c | 2 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 8 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 13 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 10 +- drivers/gpu/drm/i915/gvt/mmio_context.c | 6 +- drivers/gpu/drm/i915/i915_debugfs.c | 3 +- drivers/gpu/drm/i915/i915_utils.h | 106 ---------------- drivers/gpu/drm/i915/i915_wait_util.h | 119 ++++++++++++++++++ drivers/gpu/drm/i915/intel_pcode.c | 1 + drivers/gpu/drm/i915/intel_uncore.c | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 4 +- drivers/gpu/drm/i915/selftests/i915_request.c | 5 +- .../gpu/drm/i915/selftests/i915_selftest.c | 2 +- drivers/gpu/drm/i915/selftests/igt_spinner.c | 5 +- drivers/gpu/drm/i915/vlv_suspend.c | 5 +- 24 files changed, 183 insertions(+), 150 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_wait_util.hdrivers/gpu/drm/i915/gt/intel_execlists_submission.c +1
-0@@ -117,6 +117,7 @@#include "i915_timer_util.h" #include "i915_trace.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_engine_heartbeat.h" drivers/gpu/drm/i915/gt/intel_gt_mcr.c +1
-0@@ -4,6 +4,7 @@*/ #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_gt.h" #include "intel_gt_mcr.h" #include "intel_gt_print.h" drivers/gpu/drm/i915/gt/intel_reset.c +2
-5@@ -9,18 +9,17 @@#include "display/intel_display_reset.h" #include "display/intel_overlay.h" -#include "gem/i915_gem_context.h" -#include "gt/intel_gt_regs.h" -#include "gt/uc/intel_gsc_fw.h" +#include "uc/intel_guc.h" #include "i915_drv.h" #include "i915_file_private.h" #include "i915_gpu_error.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_engine_pm.h" #include "intel_engine_regs.h" @@ -32,8 +31,6 @@#include "intel_pci_config.h" #include "intel_reset.h" -#include "uc/intel_guc.h" -#define RESET_MAX_RETRIES 3static void client_mark_guilty (struct i915_gem_context *ctx,bool banned)drivers/gpu/drm/i915/gt/intel_ring_submission.c +4
-3@@ -15,18 +15,19 @@#include "i915_irq.h" #include "i915_mitigations.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" +#include "intel_engine_heartbeat.h" +#include "intel_engine_pm.h" #include "intel_engine_regs.h" #include "intel_gt.h" #include "intel_gt_irq.h" +#include "intel_gt_print.h" #include "intel_gt_regs.h" #include "intel_reset.h" #include "intel_ring.h" #include "shmem_utils.h" -#include "intel_engine_heartbeat.h" -#include "intel_engine_pm.h" -#include "intel_gt_print.h" /* Rough estimate of the typical request size, performing a flush, * set-context and then emitting the batch. drivers/gpu/drm/i915/gt/intel_rps.c +2
-0@@ -10,9 +10,11 @@#include "display/intel_display.h" #include "display/intel_display_rps.h" #include "soc/intel_dram.h" +#include "i915_drv.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_gt.h" #include "intel_gt_clock_utils.h" drivers/gpu/drm/i915/gt/selftest_tlb.c +3
-3@@ -3,17 +3,17 @@* Copyright © 2022 Intel Corporation */ -#include "i915_selftest.h" -#include "gem/i915_gem_internal.h" #include "gem/i915_gem_lmem.h" #include "gem/i915_gem_region.h" #include "gen8_engine_cs.h" #include "i915_gem_ww.h" +#include "i915_selftest.h" +#include "i915_wait_util.h" +#include "intel_context.h" #include "intel_engine_regs.h" #include "intel_gpu_commands.h" -#include "intel_context.h" #include "intel_gt.h" #include "intel_ring.h" drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c +4
-2@@ -10,11 +10,13 @@#include "gt/intel_gt.h" #include "gt/intel_gt_print.h" + +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_gsc_proxy.h" #include "intel_gsc_uc.h" #include "intel_gsc_uc_heci_cmd_submit.h" -#include "i915_drv.h" -#include "i915_reg.h" /* * GSC proxy: drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +2
-0@@ -8,6 +8,8 @@#include "gt/intel_gpu_commands.h" #include "gt/intel_gt.h" #include "gt/intel_ring.h" + +#include "i915_wait_util.h" #include "intel_gsc_uc_heci_cmd_submit.h" struct gsc_heci_pkt {drivers/gpu/drm/i915/gt/uc/intel_guc.c +5
-3@@ -8,15 +8,17 @@#include "gt/intel_gt_irq.h" #include "gt/intel_gt_pm_irq.h" #include "gt/intel_gt_regs.h" + +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_guc.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_slpc.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_irq.h" -#include "i915_reg.h" /** * DOC: GuC drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +2
-1@@ -5,11 +5,12 @@#include <linux/circ_buf.h> #include <linux/ktime.h> -#include <linux/time64.h> #include <linux/string_helpers.h> +#include <linux/time64.h> #include <linux/timekeeping.h> #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_ct.h" #include "intel_guc_print.h" drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c +3
-1@@ -13,9 +13,11 @@#include "gt/intel_gt_mcr.h" #include "gt/intel_gt_regs.h" #include "gt/intel_rps.h" + +#include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_fw.h" #include "intel_guc_print.h" -#include "i915_drv.h" static void guc_prepare_xfer (struct intel_gt *gt) {drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +8
-5@@ -3,17 +3,20 @@* Copyright © 2021 Intel Corporation */ -#include <drm/drm_cache.h> #include <linux/string_helpers.h> +#include <drm/drm_cache.h> + +#include "gt/intel_gt.h" +#include "gt/intel_gt_regs.h" +#include "gt/intel_rps.h" +#include "i915_drv.h" #include "i915_reg.h" -#include "intel_guc_slpc.h" +#include "i915_wait_util.h" #include "intel_guc_print.h" +#include "intel_guc_slpc.h" #include "intel_mchbar_regs.h" -#include "gt/intel_gt.h" -#include "gt/intel_gt_regs.h" -#include "gt/intel_rps.h" /** * DOC: SLPC - Dynamic Frequency management drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +5
-5@@ -25,16 +25,16 @@#include "gt/intel_mocs.h" #include "gt/intel_ring.h" +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_trace.h" +#include "i915_wait_util.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_reg.h" -#include "i915_irq.h" -#include "i915_trace.h" -/** * DOC: GuC-based command submission * drivers/gpu/drm/i915/gvt/mmio_context.c +4
-2@@ -33,14 +33,16 @@* */ -#include "i915_drv.h" -#include "i915_reg.h" #include "gt/intel_context.h" #include "gt/intel_engine_regs.h" #include "gt/intel_gpu_commands.h" #include "gt/intel_gt_regs.h" #include "gt/intel_ring.h" +#include "gvt.h" +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "trace.h" #define GEN9_MOCS_SIZE 64drivers/gpu/drm/i915/i915_debugfs.c +2
-1@@ -26,11 +26,11 @@* */ +#include <linux/debugfs.h> #include <linux/sched/mm.h> #include <linux/sort.h> #include <linux/string_helpers.h> -#include <linux/debugfs.h> #include <drm/drm_debugfs.h> #include "gem/i915_gem_context.h" @@ -54,6 +54,7 @@#include "i915_irq.h" #include "i915_reg.h" #include "i915_scheduler.h" +#include "i915_wait_util.h" #include "intel_mchbar_regs.h" static inline struct drm_i915_private *node_to_i915 (struct drm_info_node *node)drivers/gpu/drm/i915/i915_utils.h +0
-106@@ -134,112 +134,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) } } -/* -* __wait_for - magic wait macro -* -* Macro to help avoid open coding check/wait/timeout patterns. Note that it's -* important that we check the condition again after having timed out, since the -* timeout could be due to preemption or similar and we've never had a chance to -* check the condition before the timeout. -*/ -#define __wait_for (OP ,COND ,US , Wmin, Wmax) ({ \ - const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ - long wait__ = (Wmin);/* recommended min for usleep is 10 us */ \ -int ret__; \ -might_sleep (); \ -for (;;) { \ -const bool expired__ =ktime_after (ktime_get_raw (), end__); \ -OP ; \ -/* Guarantee COND check prior to timeout */ \ -barrier (); \ -if (COND ) { \ - ret__ =0 ; \ -break ; \ - } \ -if (expired__) { \ - ret__ = -ETIMEDOUT ; \ -break ; \ - } \ -usleep_range (wait__, wait__ *2 ); \ -if (wait__ < (Wmax)) \ - wait__ <<=1 ; \ - } \ - ret__; \ -}) - -#define _wait_for (COND ,US , Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ - (Wmax)) -#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000) - -/* -* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. -* On PREEMPT_RT the context isn't becoming atomic because it is used in an -* interrupt handler or because a spinlock_t is acquired. This leads to -* warnings which don't occur otherwise and therefore the check is disabled. -*/ -#if IS_ENABLED (CONFIG_DRM_I915_DEBUG ) &&IS_ENABLED (CONFIG_PREEMPT_COUNT ) && !defined(CONFIG_PREEMPT_RT ) -# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) WARN_ON_ONCE((ATOMIC) && !in_atomic()) -#else -# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) do { } while (0) -#endif - -#define _wait_for_atomic (COND ,US ,ATOMIC ) \ -({ \ - int cpu, ret, timeout = (US) * 1000; \ - u64 base; \ - _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \ - if (!(ATOMIC)) { \ - preempt_disable(); \ - cpu = smp_processor_id(); \ - } \ - base = local_clock(); \ - for (;;) { \ - u64 now = local_clock(); \ - if (!(ATOMIC)) \ - preempt_enable(); \ -/* Guarantee COND check prior to timeout */ \ -barrier (); \ -if (COND ) { \ - ret =0 ; \ -break ; \ - } \ -if (now - base >= timeout) { \ - ret = -ETIMEDOUT ; \ -break ; \ - } \ -cpu_relax (); \ -if (!(ATOMIC )) { \ -preempt_disable (); \ -if (unlikely (cpu !=smp_processor_id ())) { \ - timeout -= now - base; \ - cpu =smp_processor_id (); \ - base =local_clock (); \ - } \ - } \ - } \ - ret; \ -}) - -#define wait_for_us (COND ,US ) \ -({ \ - int ret__; \ - BUILD_BUG_ON(!__builtin_constant_p(US)); \ - if ((US) > 10) \ - ret__ = _wait_for((COND), (US), 10, 10); \ - else \ - ret__ = _wait_for_atomic((COND), (US), 0); \ - ret__; \ -}) - -#define wait_for_atomic_us (COND ,US ) \ -({ \ - BUILD_BUG_ON(!__builtin_constant_p(US)); \ - BUILD_BUG_ON((US) > 50000); \ - _wait_for_atomic((COND), (US), 1); \ -}) - -#define wait_for_atomic (COND ,MS ) wait_for_atomic_us((COND), (MS) * 1000) -#define KHz (x) (1000 * (x))#define MHz (x) KHz(1000 * (x))drivers/gpu/drm/i915/i915_wait_util.h new file +119
-0@@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_WAIT_UTIL_H__ +#define __I915_WAIT_UTIL_H__ + +#include <linux/compiler.h> +#include <linux/delay.h> +#include <linux/ktime.h> +#include <linux/sched/clock.h> +#include <linux/smp.h> + +/* +* __wait_for - magic wait macro +* +* Macro to help avoid open coding check/wait/timeout patterns. Note that it's +* important that we check the condition again after having timed out, since the +* timeout could be due to preemption or similar and we've never had a chance to +* check the condition before the timeout. +*/ +#define __wait_for (OP ,COND ,US , Wmin, Wmax) ({ \ + const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ + long wait__ = (Wmin);/* recommended min for usleep is 10 us */ \ +int ret__; \ +might_sleep (); \ +for (;;) { \ +const bool expired__ =ktime_after (ktime_get_raw (), end__); \ +OP ; \ +/* Guarantee COND check prior to timeout */ \ +barrier (); \ +if (COND ) { \ + ret__ =0 ; \ +break ; \ + } \ +if (expired__) { \ + ret__ = -ETIMEDOUT ; \ +break ; \ + } \ +usleep_range (wait__, wait__ *2 ); \ +if (wait__ < (Wmax)) \ + wait__ <<=1 ; \ + } \ + ret__; \ +}) + +#define _wait_for (COND ,US , Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ + (Wmax)) +#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000) + +/* +* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. +* On PREEMPT_RT the context isn't becoming atomic because it is used in an +* interrupt handler or because a spinlock_t is acquired. This leads to +* warnings which don't occur otherwise and therefore the check is disabled. +*/ +#if IS_ENABLED (CONFIG_DRM_I915_DEBUG ) &&IS_ENABLED (CONFIG_PREEMPT_COUNT ) && !defined(CONFIG_PREEMPT_RT ) +# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) WARN_ON_ONCE((ATOMIC) && !in_atomic()) +#else +# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) do { } while (0) +#endif + +#define _wait_for_atomic (COND ,US ,ATOMIC ) \ +({ \ + int cpu, ret, timeout = (US) * 1000; \ + u64 base; \ + _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \ + if (!(ATOMIC)) { \ + preempt_disable(); \ + cpu = smp_processor_id(); \ + } \ + base = local_clock(); \ + for (;;) { \ + u64 now = local_clock(); \ + if (!(ATOMIC)) \ + preempt_enable(); \ +/* Guarantee COND check prior to timeout */ \ +barrier (); \ +if (COND ) { \ + ret =0 ; \ +break ; \ + } \ +if (now - base >= timeout) { \ + ret = -ETIMEDOUT ; \ +break ; \ + } \ +cpu_relax (); \ +if (!(ATOMIC )) { \ +preempt_disable (); \ +if (unlikely (cpu !=smp_processor_id ())) { \ + timeout -= now - base; \ + cpu =smp_processor_id (); \ + base =local_clock (); \ + } \ + } \ + } \ + ret; \ +}) + +#define wait_for_us (COND ,US ) \ +({ \ + int ret__; \ + BUILD_BUG_ON(!__builtin_constant_p(US)); \ + if ((US) > 10) \ + ret__ = _wait_for((COND), (US), 10, 10); \ + else \ + ret__ = _wait_for_atomic((COND), (US), 0); \ + ret__; \ +}) + +#define wait_for_atomic_us (COND ,US ) \ +({ \ + BUILD_BUG_ON(!__builtin_constant_p(US)); \ + BUILD_BUG_ON((US) > 50000); \ + _wait_for_atomic((COND), (US), 1); \ +}) + +#define wait_for_atomic (COND ,MS ) wait_for_atomic_us((COND), (MS) * 1000) + +#endif /* __I915_WAIT_UTIL_H__ */ drivers/gpu/drm/i915/intel_pcode.c +1
-0@@ -5,6 +5,7 @@#include "i915_drv.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_pcode.h" static int gen6_check_mailbox_status (u32 mbox)drivers/gpu/drm/i915/intel_uncore.c +4
-3@@ -21,19 +21,20 @@* IN THE SOFTWARE. */ -#include <drm/drm_managed.h> #include <linux/pm_runtime.h> -#include "display/intel_display_core.h" +#include <drm/drm_managed.h> -#include "gt/intel_gt.h" +#include "display/intel_display_core.h" #include "gt/intel_engine_regs.h" +#include "gt/intel_gt.h" #include "gt/intel_gt_regs.h" #include "i915_drv.h" #include "i915_iosf_mbi.h" #include "i915_reg.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_uncore_trace.h" #define FORCEWAKE_ACK_TIMEOUT_MS 50drivers/gpu/drm/i915/pxp/intel_pxp.c +2
-2@@ -2,15 +2,15 @@/* * Copyright(c) 2020 Intel Corporation. */ +#include <linux/workqueue.h> #include "gem/i915_gem_context.h" -#include "gt/intel_context.h" #include "gt/intel_gt.h" #include "i915_drv.h" - +#include "i915_wait_util.h" #include "intel_pxp.h" #include "intel_pxp_gsccs.h" #include "intel_pxp_irq.h" drivers/gpu/drm/i915/selftests/i915_request.c +2
-3@@ -22,14 +22,13 @@* */ -#include <linux/prime_numbers.h> #include <linux/pm_qos.h> +#include <linux/prime_numbers.h> #include <linux/sort.h> #include "gem/i915_gem_internal.h" #include "gem/i915_gem_pm.h" #include "gem/selftests/mock_context.h" -#include "gt/intel_engine_heartbeat.h" #include "gt/intel_engine_pm.h" #include "gt/intel_engine_user.h" @@ -40,11 +39,11 @@#include "i915_random.h" #include "i915_selftest.h" +#include "i915_wait_util.h" #include "igt_flush_test.h" #include "igt_live_test.h" #include "igt_spinner.h" #include "lib_sw_fence.h" -#include "mock_drm.h" #include "mock_gem_device.h" drivers/gpu/drm/i915/selftests/i915_selftest.c +1
-1@@ -31,7 +31,7 @@#include "i915_driver.h" #include "i915_drv.h" #include "i915_selftest.h" - +#include "i915_wait_util.h" #include "igt_flush_test.h" struct i915_selftest i915_selftest__read_mostly = {drivers/gpu/drm/i915/selftests/igt_spinner.c +3
-2@@ -3,12 +3,13 @@* * Copyright © 2018 Intel Corporation */ -#include "gt/intel_gpu_commands.h" -#include "gt/intel_gt.h" #include "gem/i915_gem_internal.h" #include "gem/selftests/igt_gem_utils.h" +#include "gt/intel_gpu_commands.h" +#include "gt/intel_gt.h" +#include "i915_wait_util.h" #include "igt_spinner.h" int igt_spinner_init (struct igt_spinner *spin,struct intel_gt *gt)drivers/gpu/drm/i915/vlv_suspend.c +3
-2@@ -8,16 +8,17 @@#include <drm/drm_print.h> +#include "gt/intel_gt_regs.h" +#include "i915_drv.h" #include "i915_reg.h" #include "i915_trace.h" #include "i915_utils.h" +#include "i915_wait_util.h" #include "intel_clock_gating.h" #include "intel_uncore_trace.h" #include "vlv_suspend.h" -#include "gt/intel_gt_regs.h" -struct vlv_s0ix_state {/* GAM */ u32 wr_watermark;Signature · 1 line
2.47.3
Re: [PATCH 5/5] drm/i915: split out i915_wait_util.h
Quoted 7 lines · Rodrigo Vivi
Quoted 5 lines · Jani Nikula
Move waiting related utilities from
i915_utils.hto separate new filei915_wait_util.h. Clean up related includes.Note: Many of the various wait macro usages could likely be refactored to use
poll_timeout_us().
Quoted 7 lines
I hope so! :)
nice clean up overall, although my dream is that we could get rid entirely of these utils that pretend they are core kernel.
Reviewed-by Rodrigo Vivi <[email protected]>
Thanks, but no dice. :(
I didn't realize GEM_BUG_ON() uses GEM_TRACE_DUMP() uses __add_taint_for_CI(), i.e. roughly everything requires i915_utils.h.
Maybe I'll post just some of these and drop patch 1.
BR,
Jani.
Quoted 752 lines
Quoted 752 lines
Signed-off-by Jani Nikula <[email protected]>--- .../drm/i915/gt/intel_execlists_submission.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_mcr.c | 1 + drivers/gpu/drm/i915/gt/intel_reset.c | 7 +- .../gpu/drm/i915/gt/intel_ring_submission.c | 7 +- drivers/gpu/drm/i915/gt/intel_rps.c | 2 + drivers/gpu/drm/i915/gt/selftest_tlb.c | 6 +- drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c | 6 +- .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c | 2 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 8 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 13 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 10 +- drivers/gpu/drm/i915/gvt/mmio_context.c | 6 +- drivers/gpu/drm/i915/i915_debugfs.c | 3 +- drivers/gpu/drm/i915/i915_utils.h | 106 ---------------- drivers/gpu/drm/i915/i915_wait_util.h | 119 ++++++++++++++++++ drivers/gpu/drm/i915/intel_pcode.c | 1 + drivers/gpu/drm/i915/intel_uncore.c | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 4 +- drivers/gpu/drm/i915/selftests/i915_request.c | 5 +- .../gpu/drm/i915/selftests/i915_selftest.c | 2 +- drivers/gpu/drm/i915/selftests/igt_spinner.c | 5 +- drivers/gpu/drm/i915/vlv_suspend.c | 5 +- 24 files changed, 183 insertions(+), 150 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_wait_util.hdrivers/gpu/drm/i915/gt/intel_execlists_submission.c +1
-0@@ -117,6 +117,7 @@#include "i915_timer_util.h" #include "i915_trace.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_engine_heartbeat.h" drivers/gpu/drm/i915/gt/intel_gt_mcr.c +1
-0@@ -4,6 +4,7 @@*/ #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_gt.h" #include "intel_gt_mcr.h" #include "intel_gt_print.h" drivers/gpu/drm/i915/gt/intel_reset.c +2
-5@@ -9,18 +9,17 @@#include "display/intel_display_reset.h" #include "display/intel_overlay.h" -#include "gem/i915_gem_context.h" -#include "gt/intel_gt_regs.h" -#include "gt/uc/intel_gsc_fw.h" +#include "uc/intel_guc.h" #include "i915_drv.h" #include "i915_file_private.h" #include "i915_gpu_error.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_engine_pm.h" #include "intel_engine_regs.h" @@ -32,8 +31,6 @@#include "intel_pci_config.h" #include "intel_reset.h" -#include "uc/intel_guc.h" -#define RESET_MAX_RETRIES 3static void client_mark_guilty (struct i915_gem_context *ctx,bool banned)drivers/gpu/drm/i915/gt/intel_ring_submission.c +4
-3@@ -15,18 +15,19 @@#include "i915_irq.h" #include "i915_mitigations.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" +#include "intel_engine_heartbeat.h" +#include "intel_engine_pm.h" #include "intel_engine_regs.h" #include "intel_gt.h" #include "intel_gt_irq.h" +#include "intel_gt_print.h" #include "intel_gt_regs.h" #include "intel_reset.h" #include "intel_ring.h" #include "shmem_utils.h" -#include "intel_engine_heartbeat.h" -#include "intel_engine_pm.h" -#include "intel_gt_print.h" /* Rough estimate of the typical request size, performing a flush, * set-context and then emitting the batch. drivers/gpu/drm/i915/gt/intel_rps.c +2
-0@@ -10,9 +10,11 @@#include "display/intel_display.h" #include "display/intel_display_rps.h" #include "soc/intel_dram.h" +#include "i915_drv.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_gt.h" #include "intel_gt_clock_utils.h" drivers/gpu/drm/i915/gt/selftest_tlb.c +3
-3@@ -3,17 +3,17 @@* Copyright © 2022 Intel Corporation */ -#include "i915_selftest.h" -#include "gem/i915_gem_internal.h" #include "gem/i915_gem_lmem.h" #include "gem/i915_gem_region.h" #include "gen8_engine_cs.h" #include "i915_gem_ww.h" +#include "i915_selftest.h" +#include "i915_wait_util.h" +#include "intel_context.h" #include "intel_engine_regs.h" #include "intel_gpu_commands.h" -#include "intel_context.h" #include "intel_gt.h" #include "intel_ring.h" drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c +4
-2@@ -10,11 +10,13 @@#include "gt/intel_gt.h" #include "gt/intel_gt_print.h" + +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_gsc_proxy.h" #include "intel_gsc_uc.h" #include "intel_gsc_uc_heci_cmd_submit.h" -#include "i915_drv.h" -#include "i915_reg.h" /* * GSC proxy: drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +2
-0@@ -8,6 +8,8 @@#include "gt/intel_gpu_commands.h" #include "gt/intel_gt.h" #include "gt/intel_ring.h" + +#include "i915_wait_util.h" #include "intel_gsc_uc_heci_cmd_submit.h" struct gsc_heci_pkt {drivers/gpu/drm/i915/gt/uc/intel_guc.c +5
-3@@ -8,15 +8,17 @@#include "gt/intel_gt_irq.h" #include "gt/intel_gt_pm_irq.h" #include "gt/intel_gt_regs.h" + +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_guc.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_slpc.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_irq.h" -#include "i915_reg.h" /** * DOC: GuC drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +2
-1@@ -5,11 +5,12 @@#include <linux/circ_buf.h> #include <linux/ktime.h> -#include <linux/time64.h> #include <linux/string_helpers.h> +#include <linux/time64.h> #include <linux/timekeeping.h> #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_ct.h" #include "intel_guc_print.h" drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c +3
-1@@ -13,9 +13,11 @@#include "gt/intel_gt_mcr.h" #include "gt/intel_gt_regs.h" #include "gt/intel_rps.h" + +#include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_fw.h" #include "intel_guc_print.h" -#include "i915_drv.h" static void guc_prepare_xfer (struct intel_gt *gt) {drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +8
-5@@ -3,17 +3,20 @@* Copyright © 2021 Intel Corporation */ -#include <drm/drm_cache.h> #include <linux/string_helpers.h> +#include <drm/drm_cache.h> + +#include "gt/intel_gt.h" +#include "gt/intel_gt_regs.h" +#include "gt/intel_rps.h" +#include "i915_drv.h" #include "i915_reg.h" -#include "intel_guc_slpc.h" +#include "i915_wait_util.h" #include "intel_guc_print.h" +#include "intel_guc_slpc.h" #include "intel_mchbar_regs.h" -#include "gt/intel_gt.h" -#include "gt/intel_gt_regs.h" -#include "gt/intel_rps.h" /** * DOC: SLPC - Dynamic Frequency management drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +5
-5@@ -25,16 +25,16 @@#include "gt/intel_mocs.h" #include "gt/intel_ring.h" +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_trace.h" +#include "i915_wait_util.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_reg.h" -#include "i915_irq.h" -#include "i915_trace.h" -/** * DOC: GuC-based command submission * drivers/gpu/drm/i915/gvt/mmio_context.c +4
-2@@ -33,14 +33,16 @@* */ -#include "i915_drv.h" -#include "i915_reg.h" #include "gt/intel_context.h" #include "gt/intel_engine_regs.h" #include "gt/intel_gpu_commands.h" #include "gt/intel_gt_regs.h" #include "gt/intel_ring.h" +#include "gvt.h" +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "trace.h" #define GEN9_MOCS_SIZE 64drivers/gpu/drm/i915/i915_debugfs.c +2
-1@@ -26,11 +26,11 @@* */ +#include <linux/debugfs.h> #include <linux/sched/mm.h> #include <linux/sort.h> #include <linux/string_helpers.h> -#include <linux/debugfs.h> #include <drm/drm_debugfs.h> #include "gem/i915_gem_context.h" @@ -54,6 +54,7 @@#include "i915_irq.h" #include "i915_reg.h" #include "i915_scheduler.h" +#include "i915_wait_util.h" #include "intel_mchbar_regs.h" static inline struct drm_i915_private *node_to_i915 (struct drm_info_node *node)drivers/gpu/drm/i915/i915_utils.h +0
-106@@ -134,112 +134,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) } } -/* -* __wait_for - magic wait macro -* -* Macro to help avoid open coding check/wait/timeout patterns. Note that it's -* important that we check the condition again after having timed out, since the -* timeout could be due to preemption or similar and we've never had a chance to -* check the condition before the timeout. -*/ -#define __wait_for (OP ,COND ,US , Wmin, Wmax) ({ \ - const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ - long wait__ = (Wmin);/* recommended min for usleep is 10 us */ \ -int ret__; \ -might_sleep (); \ -for (;;) { \ -const bool expired__ =ktime_after (ktime_get_raw (), end__); \ -OP ; \ -/* Guarantee COND check prior to timeout */ \ -barrier (); \ -if (COND ) { \ - ret__ =0 ; \ -break ; \ - } \ -if (expired__) { \ - ret__ = -ETIMEDOUT ; \ -break ; \ - } \ -usleep_range (wait__, wait__ *2 ); \ -if (wait__ < (Wmax)) \ - wait__ <<=1 ; \ - } \ - ret__; \ -}) - -#define _wait_for (COND ,US , Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ - (Wmax)) -#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000) - -/* -* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. -* On PREEMPT_RT the context isn't becoming atomic because it is used in an -* interrupt handler or because a spinlock_t is acquired. This leads to -* warnings which don't occur otherwise and therefore the check is disabled. -*/ -#if IS_ENABLED (CONFIG_DRM_I915_DEBUG ) &&IS_ENABLED (CONFIG_PREEMPT_COUNT ) && !defined(CONFIG_PREEMPT_RT ) -# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) WARN_ON_ONCE((ATOMIC) && !in_atomic()) -#else -# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) do { } while (0) -#endif - -#define _wait_for_atomic (COND ,US ,ATOMIC ) \ -({ \ - int cpu, ret, timeout = (US) * 1000; \ - u64 base; \ - _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \ - if (!(ATOMIC)) { \ - preempt_disable(); \ - cpu = smp_processor_id(); \ - } \ - base = local_clock(); \ - for (;;) { \ - u64 now = local_clock(); \ - if (!(ATOMIC)) \ - preempt_enable(); \ -/* Guarantee COND check prior to timeout */ \ -barrier (); \ -if (COND ) { \ - ret =0 ; \ -break ; \ - } \ -if (now - base >= timeout) { \ - ret = -ETIMEDOUT ; \ -break ; \ - } \ -cpu_relax (); \ -if (!(ATOMIC )) { \ -preempt_disable (); \ -if (unlikely (cpu !=smp_processor_id ())) { \ - timeout -= now - base; \ - cpu =smp_processor_id (); \ - base =local_clock (); \ - } \ - } \ - } \ - ret; \ -}) - -#define wait_for_us (COND ,US ) \ -({ \ - int ret__; \ - BUILD_BUG_ON(!__builtin_constant_p(US)); \ - if ((US) > 10) \ - ret__ = _wait_for((COND), (US), 10, 10); \ - else \ - ret__ = _wait_for_atomic((COND), (US), 0); \ - ret__; \ -}) - -#define wait_for_atomic_us (COND ,US ) \ -({ \ - BUILD_BUG_ON(!__builtin_constant_p(US)); \ - BUILD_BUG_ON((US) > 50000); \ - _wait_for_atomic((COND), (US), 1); \ -}) - -#define wait_for_atomic (COND ,MS ) wait_for_atomic_us((COND), (MS) * 1000) -#define KHz (x) (1000 * (x))#define MHz (x) KHz(1000 * (x))drivers/gpu/drm/i915/i915_wait_util.h new file +119
-0@@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_WAIT_UTIL_H__ +#define __I915_WAIT_UTIL_H__ + +#include <linux/compiler.h> +#include <linux/delay.h> +#include <linux/ktime.h> +#include <linux/sched/clock.h> +#include <linux/smp.h> + +/* +* __wait_for - magic wait macro +* +* Macro to help avoid open coding check/wait/timeout patterns. Note that it's +* important that we check the condition again after having timed out, since the +* timeout could be due to preemption or similar and we've never had a chance to +* check the condition before the timeout. +*/ +#define __wait_for (OP ,COND ,US , Wmin, Wmax) ({ \ + const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ + long wait__ = (Wmin);/* recommended min for usleep is 10 us */ \ +int ret__; \ +might_sleep (); \ +for (;;) { \ +const bool expired__ =ktime_after (ktime_get_raw (), end__); \ +OP ; \ +/* Guarantee COND check prior to timeout */ \ +barrier (); \ +if (COND ) { \ + ret__ =0 ; \ +break ; \ + } \ +if (expired__) { \ + ret__ = -ETIMEDOUT ; \ +break ; \ + } \ +usleep_range (wait__, wait__ *2 ); \ +if (wait__ < (Wmax)) \ + wait__ <<=1 ; \ + } \ + ret__; \ +}) + +#define _wait_for (COND ,US , Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ + (Wmax)) +#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000) + +/* +* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. +* On PREEMPT_RT the context isn't becoming atomic because it is used in an +* interrupt handler or because a spinlock_t is acquired. This leads to +* warnings which don't occur otherwise and therefore the check is disabled. +*/ +#if IS_ENABLED (CONFIG_DRM_I915_DEBUG ) &&IS_ENABLED (CONFIG_PREEMPT_COUNT ) && !defined(CONFIG_PREEMPT_RT ) +# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) WARN_ON_ONCE((ATOMIC) && !in_atomic()) +#else +# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) do { } while (0) +#endif + +#define _wait_for_atomic (COND ,US ,ATOMIC ) \ +({ \ + int cpu, ret, timeout = (US) * 1000; \ + u64 base; \ + _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \ + if (!(ATOMIC)) { \ + preempt_disable(); \ + cpu = smp_processor_id(); \ + } \ + base = local_clock(); \ + for (;;) { \ + u64 now = local_clock(); \ + if (!(ATOMIC)) \ + preempt_enable(); \ +/* Guarantee COND check prior to timeout */ \ +barrier (); \ +if (COND ) { \ + ret =0 ; \ +break ; \ + } \ +if (now - base >= timeout) { \ + ret = -ETIMEDOUT ; \ +break ; \ + } \ +cpu_relax (); \ +if (!(ATOMIC )) { \ +preempt_disable (); \ +if (unlikely (cpu !=smp_processor_id ())) { \ + timeout -= now - base; \ + cpu =smp_processor_id (); \ + base =local_clock (); \ + } \ + } \ + } \ + ret; \ +}) + +#define wait_for_us (COND ,US ) \ +({ \ + int ret__; \ + BUILD_BUG_ON(!__builtin_constant_p(US)); \ + if ((US) > 10) \ + ret__ = _wait_for((COND), (US), 10, 10); \ + else \ + ret__ = _wait_for_atomic((COND), (US), 0); \ + ret__; \ +}) + +#define wait_for_atomic_us (COND ,US ) \ +({ \ + BUILD_BUG_ON(!__builtin_constant_p(US)); \ + BUILD_BUG_ON((US) > 50000); \ + _wait_for_atomic((COND), (US), 1); \ +}) + +#define wait_for_atomic (COND ,MS ) wait_for_atomic_us((COND), (MS) * 1000) + +#endif /* __I915_WAIT_UTIL_H__ */ drivers/gpu/drm/i915/intel_pcode.c +1
-0@@ -5,6 +5,7 @@#include "i915_drv.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_pcode.h" static int gen6_check_mailbox_status (u32 mbox)drivers/gpu/drm/i915/intel_uncore.c +4
-3@@ -21,19 +21,20 @@* IN THE SOFTWARE. */ -#include <drm/drm_managed.h> #include <linux/pm_runtime.h> -#include "display/intel_display_core.h" +#include <drm/drm_managed.h> -#include "gt/intel_gt.h" +#include "display/intel_display_core.h" #include "gt/intel_engine_regs.h" +#include "gt/intel_gt.h" #include "gt/intel_gt_regs.h" #include "i915_drv.h" #include "i915_iosf_mbi.h" #include "i915_reg.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_uncore_trace.h" #define FORCEWAKE_ACK_TIMEOUT_MS 50drivers/gpu/drm/i915/pxp/intel_pxp.c +2
-2@@ -2,15 +2,15 @@/* * Copyright(c) 2020 Intel Corporation. */ +#include <linux/workqueue.h> #include "gem/i915_gem_context.h" -#include "gt/intel_context.h" #include "gt/intel_gt.h" #include "i915_drv.h" - +#include "i915_wait_util.h" #include "intel_pxp.h" #include "intel_pxp_gsccs.h" #include "intel_pxp_irq.h" drivers/gpu/drm/i915/selftests/i915_request.c +2
-3@@ -22,14 +22,13 @@* */ -#include <linux/prime_numbers.h> #include <linux/pm_qos.h> +#include <linux/prime_numbers.h> #include <linux/sort.h> #include "gem/i915_gem_internal.h" #include "gem/i915_gem_pm.h" #include "gem/selftests/mock_context.h" -#include "gt/intel_engine_heartbeat.h" #include "gt/intel_engine_pm.h" #include "gt/intel_engine_user.h" @@ -40,11 +39,11 @@#include "i915_random.h" #include "i915_selftest.h" +#include "i915_wait_util.h" #include "igt_flush_test.h" #include "igt_live_test.h" #include "igt_spinner.h" #include "lib_sw_fence.h" -#include "mock_drm.h" #include "mock_gem_device.h" drivers/gpu/drm/i915/selftests/i915_selftest.c +1
-1@@ -31,7 +31,7 @@#include "i915_driver.h" #include "i915_drv.h" #include "i915_selftest.h" - +#include "i915_wait_util.h" #include "igt_flush_test.h" struct i915_selftest i915_selftest__read_mostly = {drivers/gpu/drm/i915/selftests/igt_spinner.c +3
-2@@ -3,12 +3,13 @@* * Copyright © 2018 Intel Corporation */ -#include "gt/intel_gpu_commands.h" -#include "gt/intel_gt.h" #include "gem/i915_gem_internal.h" #include "gem/selftests/igt_gem_utils.h" +#include "gt/intel_gpu_commands.h" +#include "gt/intel_gt.h" +#include "i915_wait_util.h" #include "igt_spinner.h" int igt_spinner_init (struct igt_spinner *spin,struct intel_gt *gt)drivers/gpu/drm/i915/vlv_suspend.c +3
-2@@ -8,16 +8,17 @@#include <drm/drm_print.h> +#include "gt/intel_gt_regs.h" +#include "i915_drv.h" #include "i915_reg.h" #include "i915_trace.h" #include "i915_utils.h" +#include "i915_wait_util.h" #include "intel_clock_gating.h" #include "intel_uncore_trace.h" #include "vlv_suspend.h" -#include "gt/intel_gt_regs.h" -struct vlv_s0ix_state {/* GAM */ u32 wr_watermark;Signature · 1 line
2.47.3
Signature · 1 line
Jani Nikula, Intel
Rodrigo Vivi
maintainerRe: [PATCH 5/5] drm/i915: split out i915_wait_util.h
Quoted 14 lines · Jani Nikula
Quoted 13 lines · Rodrigo Vivi
Quoted 5 lines · Jani Nikula
Move waiting related utilities from
i915_utils.hto separate new filei915_wait_util.h. Clean up related includes.Note: Many of the various wait macro usages could likely be refactored to use
poll_timeout_us().I hope so! :)
nice clean up overall, although my dream is that we could get rid entirely of these utils that pretend they are core kernel.
Quoted 5 lines
Quoted 1 line
Reviewed-by Rodrigo Vivi <[email protected]>Thanks, but no dice. :(
I didn't realize
GEM_BUG_ON()usesGEM_TRACE_DUMP()uses
sorry for missing that too
Quoted 3 lines
__add_taint_for_CI(), i.e.
roughly everything requiresi915_utils.h.
(facepalm)...
Quoted 1 line
Maybe I'll post just some of these and drop patch 1.
already a good start anyway ;)
Quoted 762 lines
BR,
Jani.Quoted 752 lines
Quoted 752 lines
Signed-off-by Jani Nikula <[email protected]>--- .../drm/i915/gt/intel_execlists_submission.c | 1 + drivers/gpu/drm/i915/gt/intel_gt_mcr.c | 1 + drivers/gpu/drm/i915/gt/intel_reset.c | 7 +- .../gpu/drm/i915/gt/intel_ring_submission.c | 7 +- drivers/gpu/drm/i915/gt/intel_rps.c | 2 + drivers/gpu/drm/i915/gt/selftest_tlb.c | 6 +- drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c | 6 +- .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c | 2 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 8 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 4 +- drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 13 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 10 +- drivers/gpu/drm/i915/gvt/mmio_context.c | 6 +- drivers/gpu/drm/i915/i915_debugfs.c | 3 +- drivers/gpu/drm/i915/i915_utils.h | 106 ---------------- drivers/gpu/drm/i915/i915_wait_util.h | 119 ++++++++++++++++++ drivers/gpu/drm/i915/intel_pcode.c | 1 + drivers/gpu/drm/i915/intel_uncore.c | 7 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 4 +- drivers/gpu/drm/i915/selftests/i915_request.c | 5 +- .../gpu/drm/i915/selftests/i915_selftest.c | 2 +- drivers/gpu/drm/i915/selftests/igt_spinner.c | 5 +- drivers/gpu/drm/i915/vlv_suspend.c | 5 +- 24 files changed, 183 insertions(+), 150 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_wait_util.hdrivers/gpu/drm/i915/gt/intel_execlists_submission.c +1
-0@@ -117,6 +117,7 @@#include "i915_timer_util.h" #include "i915_trace.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_engine_heartbeat.h" drivers/gpu/drm/i915/gt/intel_gt_mcr.c +1
-0@@ -4,6 +4,7 @@*/ #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_gt.h" #include "intel_gt_mcr.h" #include "intel_gt_print.h" drivers/gpu/drm/i915/gt/intel_reset.c +2
-5@@ -9,18 +9,17 @@#include "display/intel_display_reset.h" #include "display/intel_overlay.h" -#include "gem/i915_gem_context.h" -#include "gt/intel_gt_regs.h" -#include "gt/uc/intel_gsc_fw.h" +#include "uc/intel_guc.h" #include "i915_drv.h" #include "i915_file_private.h" #include "i915_gpu_error.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_engine_pm.h" #include "intel_engine_regs.h" @@ -32,8 +31,6 @@#include "intel_pci_config.h" #include "intel_reset.h" -#include "uc/intel_guc.h" -#define RESET_MAX_RETRIES 3static void client_mark_guilty (struct i915_gem_context *ctx,bool banned)drivers/gpu/drm/i915/gt/intel_ring_submission.c +4
-3@@ -15,18 +15,19 @@#include "i915_irq.h" #include "i915_mitigations.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_context.h" +#include "intel_engine_heartbeat.h" +#include "intel_engine_pm.h" #include "intel_engine_regs.h" #include "intel_gt.h" #include "intel_gt_irq.h" +#include "intel_gt_print.h" #include "intel_gt_regs.h" #include "intel_reset.h" #include "intel_ring.h" #include "shmem_utils.h" -#include "intel_engine_heartbeat.h" -#include "intel_engine_pm.h" -#include "intel_gt_print.h" /* Rough estimate of the typical request size, performing a flush, * set-context and then emitting the batch. drivers/gpu/drm/i915/gt/intel_rps.c +2
-0@@ -10,9 +10,11 @@#include "display/intel_display.h" #include "display/intel_display_rps.h" #include "soc/intel_dram.h" +#include "i915_drv.h" #include "i915_irq.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_breadcrumbs.h" #include "intel_gt.h" #include "intel_gt_clock_utils.h" drivers/gpu/drm/i915/gt/selftest_tlb.c +3
-3@@ -3,17 +3,17 @@* Copyright © 2022 Intel Corporation */ -#include "i915_selftest.h" -#include "gem/i915_gem_internal.h" #include "gem/i915_gem_lmem.h" #include "gem/i915_gem_region.h" #include "gen8_engine_cs.h" #include "i915_gem_ww.h" +#include "i915_selftest.h" +#include "i915_wait_util.h" +#include "intel_context.h" #include "intel_engine_regs.h" #include "intel_gpu_commands.h" -#include "intel_context.h" #include "intel_gt.h" #include "intel_ring.h" drivers/gpu/drm/i915/gt/uc/intel_gsc_proxy.c +4
-2@@ -10,11 +10,13 @@#include "gt/intel_gt.h" #include "gt/intel_gt_print.h" + +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_gsc_proxy.h" #include "intel_gsc_uc.h" #include "intel_gsc_uc_heci_cmd_submit.h" -#include "i915_drv.h" -#include "i915_reg.h" /* * GSC proxy: drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +2
-0@@ -8,6 +8,8 @@#include "gt/intel_gpu_commands.h" #include "gt/intel_gt.h" #include "gt/intel_ring.h" + +#include "i915_wait_util.h" #include "intel_gsc_uc_heci_cmd_submit.h" struct gsc_heci_pkt {drivers/gpu/drm/i915/gt/uc/intel_guc.c +5
-3@@ -8,15 +8,17 @@#include "gt/intel_gt_irq.h" #include "gt/intel_gt_pm_irq.h" #include "gt/intel_gt_regs.h" + +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_guc.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_slpc.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_irq.h" -#include "i915_reg.h" /** * DOC: GuC drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +2
-1@@ -5,11 +5,12 @@#include <linux/circ_buf.h> #include <linux/ktime.h> -#include <linux/time64.h> #include <linux/string_helpers.h> +#include <linux/time64.h> #include <linux/timekeeping.h> #include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_ct.h" #include "intel_guc_print.h" drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c +3
-1@@ -13,9 +13,11 @@#include "gt/intel_gt_mcr.h" #include "gt/intel_gt_regs.h" #include "gt/intel_rps.h" + +#include "i915_drv.h" +#include "i915_wait_util.h" #include "intel_guc_fw.h" #include "intel_guc_print.h" -#include "i915_drv.h" static void guc_prepare_xfer (struct intel_gt *gt) {drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +8
-5@@ -3,17 +3,20 @@* Copyright © 2021 Intel Corporation */ -#include <drm/drm_cache.h> #include <linux/string_helpers.h> +#include <drm/drm_cache.h> + +#include "gt/intel_gt.h" +#include "gt/intel_gt_regs.h" +#include "gt/intel_rps.h" +#include "i915_drv.h" #include "i915_reg.h" -#include "intel_guc_slpc.h" +#include "i915_wait_util.h" #include "intel_guc_print.h" +#include "intel_guc_slpc.h" #include "intel_mchbar_regs.h" -#include "gt/intel_gt.h" -#include "gt/intel_gt_regs.h" -#include "gt/intel_rps.h" /** * DOC: SLPC - Dynamic Frequency management drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +5
-5@@ -25,16 +25,16 @@#include "gt/intel_mocs.h" #include "gt/intel_ring.h" +#include "i915_drv.h" +#include "i915_irq.h" +#include "i915_reg.h" +#include "i915_trace.h" +#include "i915_wait_util.h" #include "intel_guc_ads.h" #include "intel_guc_capture.h" #include "intel_guc_print.h" #include "intel_guc_submission.h" -#include "i915_drv.h" -#include "i915_reg.h" -#include "i915_irq.h" -#include "i915_trace.h" -/** * DOC: GuC-based command submission * drivers/gpu/drm/i915/gvt/mmio_context.c +4
-2@@ -33,14 +33,16 @@* */ -#include "i915_drv.h" -#include "i915_reg.h" #include "gt/intel_context.h" #include "gt/intel_engine_regs.h" #include "gt/intel_gpu_commands.h" #include "gt/intel_gt_regs.h" #include "gt/intel_ring.h" +#include "gvt.h" +#include "i915_drv.h" +#include "i915_reg.h" +#include "i915_wait_util.h" #include "trace.h" #define GEN9_MOCS_SIZE 64drivers/gpu/drm/i915/i915_debugfs.c +2
-1@@ -26,11 +26,11 @@* */ +#include <linux/debugfs.h> #include <linux/sched/mm.h> #include <linux/sort.h> #include <linux/string_helpers.h> -#include <linux/debugfs.h> #include <drm/drm_debugfs.h> #include "gem/i915_gem_context.h" @@ -54,6 +54,7 @@#include "i915_irq.h" #include "i915_reg.h" #include "i915_scheduler.h" +#include "i915_wait_util.h" #include "intel_mchbar_regs.h" static inline struct drm_i915_private *node_to_i915 (struct drm_info_node *node)drivers/gpu/drm/i915/i915_utils.h +0
-106@@ -134,112 +134,6 @@ wait_remaining_ms_from_jiffies(unsigned long timestamp_jiffies, int to_wait_ms) } } -/* -* __wait_for - magic wait macro -* -* Macro to help avoid open coding check/wait/timeout patterns. Note that it's -* important that we check the condition again after having timed out, since the -* timeout could be due to preemption or similar and we've never had a chance to -* check the condition before the timeout. -*/ -#define __wait_for (OP ,COND ,US , Wmin, Wmax) ({ \ - const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ - long wait__ = (Wmin);/* recommended min for usleep is 10 us */ \ -int ret__; \ -might_sleep (); \ -for (;;) { \ -const bool expired__ =ktime_after (ktime_get_raw (), end__); \ -OP ; \ -/* Guarantee COND check prior to timeout */ \ -barrier (); \ -if (COND ) { \ - ret__ =0 ; \ -break ; \ - } \ -if (expired__) { \ - ret__ = -ETIMEDOUT ; \ -break ; \ - } \ -usleep_range (wait__, wait__ *2 ); \ -if (wait__ < (Wmax)) \ - wait__ <<=1 ; \ - } \ - ret__; \ -}) - -#define _wait_for (COND ,US , Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ - (Wmax)) -#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000) - -/* -* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. -* On PREEMPT_RT the context isn't becoming atomic because it is used in an -* interrupt handler or because a spinlock_t is acquired. This leads to -* warnings which don't occur otherwise and therefore the check is disabled. -*/ -#if IS_ENABLED (CONFIG_DRM_I915_DEBUG ) &&IS_ENABLED (CONFIG_PREEMPT_COUNT ) && !defined(CONFIG_PREEMPT_RT ) -# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) WARN_ON_ONCE((ATOMIC) && !in_atomic()) -#else -# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) do { } while (0) -#endif - -#define _wait_for_atomic (COND ,US ,ATOMIC ) \ -({ \ - int cpu, ret, timeout = (US) * 1000; \ - u64 base; \ - _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \ - if (!(ATOMIC)) { \ - preempt_disable(); \ - cpu = smp_processor_id(); \ - } \ - base = local_clock(); \ - for (;;) { \ - u64 now = local_clock(); \ - if (!(ATOMIC)) \ - preempt_enable(); \ -/* Guarantee COND check prior to timeout */ \ -barrier (); \ -if (COND ) { \ - ret =0 ; \ -break ; \ - } \ -if (now - base >= timeout) { \ - ret = -ETIMEDOUT ; \ -break ; \ - } \ -cpu_relax (); \ -if (!(ATOMIC )) { \ -preempt_disable (); \ -if (unlikely (cpu !=smp_processor_id ())) { \ - timeout -= now - base; \ - cpu =smp_processor_id (); \ - base =local_clock (); \ - } \ - } \ - } \ - ret; \ -}) - -#define wait_for_us (COND ,US ) \ -({ \ - int ret__; \ - BUILD_BUG_ON(!__builtin_constant_p(US)); \ - if ((US) > 10) \ - ret__ = _wait_for((COND), (US), 10, 10); \ - else \ - ret__ = _wait_for_atomic((COND), (US), 0); \ - ret__; \ -}) - -#define wait_for_atomic_us (COND ,US ) \ -({ \ - BUILD_BUG_ON(!__builtin_constant_p(US)); \ - BUILD_BUG_ON((US) > 50000); \ - _wait_for_atomic((COND), (US), 1); \ -}) - -#define wait_for_atomic (COND ,MS ) wait_for_atomic_us((COND), (MS) * 1000) -#define KHz (x) (1000 * (x))#define MHz (x) KHz(1000 * (x))drivers/gpu/drm/i915/i915_wait_util.h new file +119
-0@@ -0,0 +1,119 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright © 2025 Intel Corporation */ + +#ifndef __I915_WAIT_UTIL_H__ +#define __I915_WAIT_UTIL_H__ + +#include <linux/compiler.h> +#include <linux/delay.h> +#include <linux/ktime.h> +#include <linux/sched/clock.h> +#include <linux/smp.h> + +/* +* __wait_for - magic wait macro +* +* Macro to help avoid open coding check/wait/timeout patterns. Note that it's +* important that we check the condition again after having timed out, since the +* timeout could be due to preemption or similar and we've never had a chance to +* check the condition before the timeout. +*/ +#define __wait_for (OP ,COND ,US , Wmin, Wmax) ({ \ + const ktime_t end__ = ktime_add_ns(ktime_get_raw(), 1000ll * (US)); \ + long wait__ = (Wmin);/* recommended min for usleep is 10 us */ \ +int ret__; \ +might_sleep (); \ +for (;;) { \ +const bool expired__ =ktime_after (ktime_get_raw (), end__); \ +OP ; \ +/* Guarantee COND check prior to timeout */ \ +barrier (); \ +if (COND ) { \ + ret__ =0 ; \ +break ; \ + } \ +if (expired__) { \ + ret__ = -ETIMEDOUT ; \ +break ; \ + } \ +usleep_range (wait__, wait__ *2 ); \ +if (wait__ < (Wmax)) \ + wait__ <<=1 ; \ + } \ + ret__; \ +}) + +#define _wait_for (COND ,US , Wmin, Wmax) __wait_for(, (COND), (US), (Wmin), \ + (Wmax)) +#define wait_for (COND ,MS ) _wait_for((COND), (MS) * 1000, 10, 1000) + +/* +* If CONFIG_PREEMPT_COUNT is disabled, in_atomic() always reports false. +* On PREEMPT_RT the context isn't becoming atomic because it is used in an +* interrupt handler or because a spinlock_t is acquired. This leads to +* warnings which don't occur otherwise and therefore the check is disabled. +*/ +#if IS_ENABLED (CONFIG_DRM_I915_DEBUG ) &&IS_ENABLED (CONFIG_PREEMPT_COUNT ) && !defined(CONFIG_PREEMPT_RT ) +# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) WARN_ON_ONCE((ATOMIC) && !in_atomic()) +#else +# define _WAIT_FOR_ATOMIC_CHECK (ATOMIC ) do { } while (0) +#endif + +#define _wait_for_atomic (COND ,US ,ATOMIC ) \ +({ \ + int cpu, ret, timeout = (US) * 1000; \ + u64 base; \ + _WAIT_FOR_ATOMIC_CHECK(ATOMIC); \ + if (!(ATOMIC)) { \ + preempt_disable(); \ + cpu = smp_processor_id(); \ + } \ + base = local_clock(); \ + for (;;) { \ + u64 now = local_clock(); \ + if (!(ATOMIC)) \ + preempt_enable(); \ +/* Guarantee COND check prior to timeout */ \ +barrier (); \ +if (COND ) { \ + ret =0 ; \ +break ; \ + } \ +if (now - base >= timeout) { \ + ret = -ETIMEDOUT ; \ +break ; \ + } \ +cpu_relax (); \ +if (!(ATOMIC )) { \ +preempt_disable (); \ +if (unlikely (cpu !=smp_processor_id ())) { \ + timeout -= now - base; \ + cpu =smp_processor_id (); \ + base =local_clock (); \ + } \ + } \ + } \ + ret; \ +}) + +#define wait_for_us (COND ,US ) \ +({ \ + int ret__; \ + BUILD_BUG_ON(!__builtin_constant_p(US)); \ + if ((US) > 10) \ + ret__ = _wait_for((COND), (US), 10, 10); \ + else \ + ret__ = _wait_for_atomic((COND), (US), 0); \ + ret__; \ +}) + +#define wait_for_atomic_us (COND ,US ) \ +({ \ + BUILD_BUG_ON(!__builtin_constant_p(US)); \ + BUILD_BUG_ON((US) > 50000); \ + _wait_for_atomic((COND), (US), 1); \ +}) + +#define wait_for_atomic (COND ,MS ) wait_for_atomic_us((COND), (MS) * 1000) + +#endif /* __I915_WAIT_UTIL_H__ */ drivers/gpu/drm/i915/intel_pcode.c +1
-0@@ -5,6 +5,7 @@#include "i915_drv.h" #include "i915_reg.h" +#include "i915_wait_util.h" #include "intel_pcode.h" static int gen6_check_mailbox_status (u32 mbox)drivers/gpu/drm/i915/intel_uncore.c +4
-3@@ -21,19 +21,20 @@* IN THE SOFTWARE. */ -#include <drm/drm_managed.h> #include <linux/pm_runtime.h> -#include "display/intel_display_core.h" +#include <drm/drm_managed.h> -#include "gt/intel_gt.h" +#include "display/intel_display_core.h" #include "gt/intel_engine_regs.h" +#include "gt/intel_gt.h" #include "gt/intel_gt_regs.h" #include "i915_drv.h" #include "i915_iosf_mbi.h" #include "i915_reg.h" #include "i915_vgpu.h" +#include "i915_wait_util.h" #include "intel_uncore_trace.h" #define FORCEWAKE_ACK_TIMEOUT_MS 50drivers/gpu/drm/i915/pxp/intel_pxp.c +2
-2@@ -2,15 +2,15 @@/* * Copyright(c) 2020 Intel Corporation. */ +#include <linux/workqueue.h> #include "gem/i915_gem_context.h" -#include "gt/intel_context.h" #include "gt/intel_gt.h" #include "i915_drv.h" - +#include "i915_wait_util.h" #include "intel_pxp.h" #include "intel_pxp_gsccs.h" #include "intel_pxp_irq.h" drivers/gpu/drm/i915/selftests/i915_request.c +2
-3@@ -22,14 +22,13 @@* */ -#include <linux/prime_numbers.h> #include <linux/pm_qos.h> +#include <linux/prime_numbers.h> #include <linux/sort.h> #include "gem/i915_gem_internal.h" #include "gem/i915_gem_pm.h" #include "gem/selftests/mock_context.h" -#include "gt/intel_engine_heartbeat.h" #include "gt/intel_engine_pm.h" #include "gt/intel_engine_user.h" @@ -40,11 +39,11 @@#include "i915_random.h" #include "i915_selftest.h" +#include "i915_wait_util.h" #include "igt_flush_test.h" #include "igt_live_test.h" #include "igt_spinner.h" #include "lib_sw_fence.h" -#include "mock_drm.h" #include "mock_gem_device.h" drivers/gpu/drm/i915/selftests/i915_selftest.c +1
-1@@ -31,7 +31,7 @@#include "i915_driver.h" #include "i915_drv.h" #include "i915_selftest.h" - +#include "i915_wait_util.h" #include "igt_flush_test.h" struct i915_selftest i915_selftest__read_mostly = {drivers/gpu/drm/i915/selftests/igt_spinner.c +3
-2@@ -3,12 +3,13 @@* * Copyright © 2018 Intel Corporation */ -#include "gt/intel_gpu_commands.h" -#include "gt/intel_gt.h" #include "gem/i915_gem_internal.h" #include "gem/selftests/igt_gem_utils.h" +#include "gt/intel_gpu_commands.h" +#include "gt/intel_gt.h" +#include "i915_wait_util.h" #include "igt_spinner.h" int igt_spinner_init (struct igt_spinner *spin,struct intel_gt *gt)drivers/gpu/drm/i915/vlv_suspend.c +3
-2@@ -8,16 +8,17 @@#include <drm/drm_print.h> +#include "gt/intel_gt_regs.h" +#include "i915_drv.h" #include "i915_reg.h" #include "i915_trace.h" #include "i915_utils.h" +#include "i915_wait_util.h" #include "intel_clock_gating.h" #include "intel_uncore_trace.h" #include "vlv_suspend.h" -#include "gt/intel_gt_regs.h" -struct vlv_s0ix_state {/* GAM */ u32 wr_watermark;Signature · 1 line
2.47.3Signature · 1 line
Jani Nikula, Intel
Patchwork
CI✗ Fi.CI.BUILD: failure for drm/i915: clean up i915_utils.h
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: drm/i915: clean up i915_utils.h
URL : https://patchwork.freedesktop.org/series/154194/
State : failure
== Summary ==
Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
CC [M] drivers/gpu/drm/i915/i915_driver.o
In file included from ./drivers/gpu/drm/i915/gt/intel_engine_types.h:20,
from ./drivers/gpu/drm/i915/gt/intel_context_types.h:17,
from drivers/gpu/drm/i915/gem/i915_gem_context_types.h:19,
from drivers/gpu/drm/i915/gem/i915_gem_context.h:9,
from drivers/gpu/drm/i915/i915_driver.c:70:
./drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h: In function ‘engine_class_to_guc_class’:
./drivers/gpu/drm/i915/i915_gem.h:123:37: error: implicit declaration of function ‘__add_taint_for_CI’ [-Werror=implicit-function-declaration]
123 | do { ftrace_dump(DUMP_ALL); __add_taint_for_CI(TAINT_WARN); } while (0)
| ^~~~~~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_gem.h:98:17: note: in expansion of macro ‘GEM_TRACE_DUMP’
98 | GEM_TRACE_DUMP(); \
| ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h:186:9: note: in expansion of macro ‘GEM_BUG_ON’
186 | GEM_BUG_ON(class > MAX_ENGINE_CLASS);
| ^~~~~~~~~~
In file included from ./drivers/gpu/drm/i915/i915_drv.h:56,
from ./drivers/gpu/drm/i915/gt/intel_context.h:14,
from drivers/gpu/drm/i915/gem/i915_gem_context.h:11:
./drivers/gpu/drm/i915/i915_utils.h: At top level:
./drivers/gpu/drm/i915/i915_utils.h:141:20: error: conflicting types for ‘__add_taint_for_CI’; have ‘void(unsigned int)’ [-Werror]
141 | static inline void __add_taint_for_CI(unsigned int taint)
| ^~~~~~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_utils.h:141:20: error: static declaration of ‘__add_taint_for_CI’ follows non-static declaration
./drivers/gpu/drm/i915/i915_gem.h:123:37: note: previous implicit declaration of ‘__add_taint_for_CI’ with type ‘void(unsigned int)’
123 | do { ftrace_dump(DUMP_ALL); __add_taint_for_CI(TAINT_WARN); } while (0)
| ^~~~~~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_gem.h:98:17: note: in expansion of macro ‘GEM_TRACE_DUMP’
98 | GEM_TRACE_DUMP(); \
| ^~~~~~~~~~~~~~
./drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h:186:9: note: in expansion of macro ‘GEM_BUG_ON’
186 | GEM_BUG_ON(class > MAX_ENGINE_CLASS);
| ^~~~~~~~~~cc1: all warnings being treated as errors
make[6]: *** [scripts/Makefile.build:287: drivers/gpu/drm/i915/i915_driver.o] Error 1 make[5]: *** [scripts/Makefile.build:556: drivers/gpu/drm/i915] Error 2 make[4]: *** [scripts/Makefile.build:556: drivers/gpu/drm] Error 2 make[3]: *** [scripts/Makefile.build:556: drivers/gpu] Error 2
make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
make[1]: *** [/home/kbuild2/kernel/Makefile:2011: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
Build failed, no error log produced