Skip to content

Commit 594bb93

Browse files
committed
drm/xe: Add xe_tlb_inval structure
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
1 parent c697ddc commit 594bb93

2 files changed

Lines changed: 36 additions & 31 deletions

File tree

drivers/gpu/drm/xe/xe_gt_tlb_inval_types.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,44 @@
66
#ifndef _XE_GT_TLB_INVAL_TYPES_H_
77
#define _XE_GT_TLB_INVAL_TYPES_H_
88

9+
#include <linux/workqueue.h>
910
#include <linux/dma-fence.h>
1011

1112
struct xe_gt;
1213

14+
/** struct xe_tlb_inval - TLB invalidation client */
15+
struct xe_tlb_inval {
16+
/** @tlb_inval.seqno: TLB invalidation seqno, protected by CT lock */
17+
#define TLB_INVALIDATION_SEQNO_MAX 0x100000
18+
int seqno;
19+
/** @tlb_invalidation.seqno_lock: protects @tlb_invalidation.seqno */
20+
struct mutex seqno_lock;
21+
/**
22+
* @tlb_inval.seqno_recv: last received TLB invalidation seqno,
23+
* protected by CT lock
24+
*/
25+
int seqno_recv;
26+
/**
27+
* @tlb_inval.pending_fences: list of pending fences waiting TLB
28+
* invaliations, protected by CT lock
29+
*/
30+
struct list_head pending_fences;
31+
/**
32+
* @tlb_inval.pending_lock: protects @tlb_inval.pending_fences
33+
* and updating @tlb_inval.seqno_recv.
34+
*/
35+
spinlock_t pending_lock;
36+
/**
37+
* @tlb_inval.fence_tdr: schedules a delayed call to
38+
* xe_gt_tlb_fence_timeout after the timeut interval is over.
39+
*/
40+
struct delayed_work fence_tdr;
41+
/** @wtlb_invalidation.wq: schedules GT TLB invalidation jobs */
42+
struct workqueue_struct *job_wq;
43+
/** @tlb_inval.lock: protects TLB invalidation fences */
44+
spinlock_t lock;
45+
};
46+
1347
/**
1448
* struct xe_gt_tlb_inval_fence - XE GT TLB invalidation fence
1549
*

drivers/gpu/drm/xe/xe_gt_types.h

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "xe_gt_sriov_pf_types.h"
1313
#include "xe_gt_sriov_vf_types.h"
1414
#include "xe_gt_stats_types.h"
15+
#include "xe_gt_tlb_inval_types.h"
1516
#include "xe_hw_engine_types.h"
1617
#include "xe_hw_fence_types.h"
1718
#include "xe_oa_types.h"
@@ -186,37 +187,7 @@ struct xe_gt {
186187
} reset;
187188

188189
/** @tlb_inval: TLB invalidation state */
189-
struct {
190-
/** @tlb_inval.seqno: TLB invalidation seqno, protected by CT lock */
191-
#define TLB_INVALIDATION_SEQNO_MAX 0x100000
192-
int seqno;
193-
/** @tlb_invalidation.seqno_lock: protects @tlb_invalidation.seqno */
194-
struct mutex seqno_lock;
195-
/**
196-
* @tlb_inval.seqno_recv: last received TLB invalidation seqno,
197-
* protected by CT lock
198-
*/
199-
int seqno_recv;
200-
/**
201-
* @tlb_inval.pending_fences: list of pending fences waiting TLB
202-
* invaliations, protected by CT lock
203-
*/
204-
struct list_head pending_fences;
205-
/**
206-
* @tlb_inval.pending_lock: protects @tlb_inval.pending_fences
207-
* and updating @tlb_inval.seqno_recv.
208-
*/
209-
spinlock_t pending_lock;
210-
/**
211-
* @tlb_inval.fence_tdr: schedules a delayed call to
212-
* xe_gt_tlb_fence_timeout after the timeut interval is over.
213-
*/
214-
struct delayed_work fence_tdr;
215-
/** @wtlb_invalidation.wq: schedules GT TLB invalidation jobs */
216-
struct workqueue_struct *job_wq;
217-
/** @tlb_inval.lock: protects TLB invalidation fences */
218-
spinlock_t lock;
219-
} tlb_inval;
190+
struct xe_tlb_inval tlb_inval;
220191

221192
/**
222193
* @ccs_mode: Number of compute engines enabled.

0 commit comments

Comments
 (0)