]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/xe: Add xe_tlb_inval structure
authorMatthew Brost <matthew.brost@intel.com>
Tue, 26 Aug 2025 18:29:06 +0000 (18:29 +0000)
committerMatthew Brost <matthew.brost@intel.com>
Wed, 27 Aug 2025 18:49:08 +0000 (11:49 -0700)
Extract TLB invalidation state into a structure to decouple TLB
invalidations from the GT, allowing the structure to be embedded
anywhere in the driver.

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
Reviewed-by: Stuart Summers <stuart.summers@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20250826182911.392550-5-stuart.summers@intel.com
drivers/gpu/drm/xe/xe_gt_tlb_inval_types.h
drivers/gpu/drm/xe/xe_gt_types.h

index 9194303591036baa29235ae1691ebdc5eecb05c1..442f72b78ccf31c8317c52ae3eb1c0d7bd609cf3 100644 (file)
@@ -6,10 +6,44 @@
 #ifndef _XE_GT_TLB_INVAL_TYPES_H_
 #define _XE_GT_TLB_INVAL_TYPES_H_
 
+#include <linux/workqueue.h>
 #include <linux/dma-fence.h>
 
 struct xe_gt;
 
+/** struct xe_tlb_inval - TLB invalidation client */
+struct xe_tlb_inval {
+       /** @tlb_inval.seqno: TLB invalidation seqno, protected by CT lock */
+#define TLB_INVALIDATION_SEQNO_MAX     0x100000
+       int seqno;
+       /** @tlb_invalidation.seqno_lock: protects @tlb_invalidation.seqno */
+       struct mutex seqno_lock;
+       /**
+        * @tlb_inval.seqno_recv: last received TLB invalidation seqno,
+        * protected by CT lock
+        */
+       int seqno_recv;
+       /**
+        * @tlb_inval.pending_fences: list of pending fences waiting TLB
+        * invaliations, protected by CT lock
+        */
+       struct list_head pending_fences;
+       /**
+        * @tlb_inval.pending_lock: protects @tlb_inval.pending_fences
+        * and updating @tlb_inval.seqno_recv.
+        */
+       spinlock_t pending_lock;
+       /**
+        * @tlb_inval.fence_tdr: schedules a delayed call to
+        * xe_gt_tlb_fence_timeout after the timeut interval is over.
+        */
+       struct delayed_work fence_tdr;
+       /** @wtlb_invalidation.wq: schedules GT TLB invalidation jobs */
+       struct workqueue_struct *job_wq;
+       /** @tlb_inval.lock: protects TLB invalidation fences */
+       spinlock_t lock;
+};
+
 /**
  * struct xe_gt_tlb_inval_fence - XE GT TLB invalidation fence
  *
index 85cfcc49472b7f8f370bdb337500948dd65dbb86..7dc5a3f310f155ae582e8b3b87c25e0f2491477f 100644 (file)
@@ -12,6 +12,7 @@
 #include "xe_gt_sriov_pf_types.h"
 #include "xe_gt_sriov_vf_types.h"
 #include "xe_gt_stats_types.h"
+#include "xe_gt_tlb_inval_types.h"
 #include "xe_hw_engine_types.h"
 #include "xe_hw_fence_types.h"
 #include "xe_oa_types.h"
@@ -186,37 +187,7 @@ struct xe_gt {
        } reset;
 
        /** @tlb_inval: TLB invalidation state */
-       struct {
-               /** @tlb_inval.seqno: TLB invalidation seqno, protected by CT lock */
-#define TLB_INVALIDATION_SEQNO_MAX     0x100000
-               int seqno;
-               /** @tlb_invalidation.seqno_lock: protects @tlb_invalidation.seqno */
-               struct mutex seqno_lock;
-               /**
-                * @tlb_inval.seqno_recv: last received TLB invalidation seqno,
-                * protected by CT lock
-                */
-               int seqno_recv;
-               /**
-                * @tlb_inval.pending_fences: list of pending fences waiting TLB
-                * invaliations, protected by CT lock
-                */
-               struct list_head pending_fences;
-               /**
-                * @tlb_inval.pending_lock: protects @tlb_inval.pending_fences
-                * and updating @tlb_inval.seqno_recv.
-                */
-               spinlock_t pending_lock;
-               /**
-                * @tlb_inval.fence_tdr: schedules a delayed call to
-                * xe_gt_tlb_fence_timeout after the timeut interval is over.
-                */
-               struct delayed_work fence_tdr;
-               /** @wtlb_invalidation.wq: schedules GT TLB invalidation jobs */
-               struct workqueue_struct *job_wq;
-               /** @tlb_inval.lock: protects TLB invalidation fences */
-               spinlock_t lock;
-       } tlb_inval;
+       struct xe_tlb_inval tlb_inval;
 
        /**
         * @ccs_mode: Number of compute engines enabled.