mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
drm/xe: Add xe_gt_tlb_invalidation_fence_init helper
Other layers should not be touching struct xe_gt_tlb_invalidation_fence directly, add helper for initialization. v2: - Add dma_fence_get and list init to xe_gt_tlb_invalidation_fence_init Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Nirmoy Das <nirmoy.das@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240719172905.1527927-2-matthew.brost@intel.com
This commit is contained in:
parent
ad16682db1
commit
a522b285c6
@ -508,3 +508,39 @@ int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
invalidation_fence_get_driver_name(struct dma_fence *dma_fence)
|
||||
{
|
||||
return "xe";
|
||||
}
|
||||
|
||||
static const char *
|
||||
invalidation_fence_get_timeline_name(struct dma_fence *dma_fence)
|
||||
{
|
||||
return "invalidation_fence";
|
||||
}
|
||||
|
||||
static const struct dma_fence_ops invalidation_fence_ops = {
|
||||
.get_driver_name = invalidation_fence_get_driver_name,
|
||||
.get_timeline_name = invalidation_fence_get_timeline_name,
|
||||
};
|
||||
|
||||
/**
|
||||
* xe_gt_tlb_invalidation_fence_init - Initialize TLB invalidation fence
|
||||
* @gt: GT
|
||||
* @fence: TLB invalidation fence to initialize
|
||||
*
|
||||
* Initialize TLB invalidation fence for use
|
||||
*/
|
||||
void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
|
||||
struct xe_gt_tlb_invalidation_fence *fence)
|
||||
{
|
||||
spin_lock_irq(>->tlb_invalidation.lock);
|
||||
dma_fence_init(&fence->base, &invalidation_fence_ops,
|
||||
>->tlb_invalidation.lock,
|
||||
dma_fence_context_alloc(1), 1);
|
||||
spin_unlock_irq(>->tlb_invalidation.lock);
|
||||
INIT_LIST_HEAD(&fence->link);
|
||||
dma_fence_get(&fence->base);
|
||||
}
|
||||
|
@ -26,4 +26,7 @@ int xe_gt_tlb_invalidation_range(struct xe_gt *gt,
|
||||
int xe_gt_tlb_invalidation_wait(struct xe_gt *gt, int seqno);
|
||||
int xe_guc_tlb_invalidation_done_handler(struct xe_guc *guc, u32 *msg, u32 len);
|
||||
|
||||
void xe_gt_tlb_invalidation_fence_init(struct xe_gt *gt,
|
||||
struct xe_gt_tlb_invalidation_fence *fence);
|
||||
|
||||
#endif /* _XE_GT_TLB_INVALIDATION_ */
|
||||
|
@ -1317,23 +1317,6 @@ struct invalidation_fence {
|
||||
u32 asid;
|
||||
};
|
||||
|
||||
static const char *
|
||||
invalidation_fence_get_driver_name(struct dma_fence *dma_fence)
|
||||
{
|
||||
return "xe";
|
||||
}
|
||||
|
||||
static const char *
|
||||
invalidation_fence_get_timeline_name(struct dma_fence *dma_fence)
|
||||
{
|
||||
return "invalidation_fence";
|
||||
}
|
||||
|
||||
static const struct dma_fence_ops invalidation_fence_ops = {
|
||||
.get_driver_name = invalidation_fence_get_driver_name,
|
||||
.get_timeline_name = invalidation_fence_get_timeline_name,
|
||||
};
|
||||
|
||||
static void invalidation_fence_cb(struct dma_fence *fence,
|
||||
struct dma_fence_cb *cb)
|
||||
{
|
||||
@ -1372,15 +1355,8 @@ static void invalidation_fence_init(struct xe_gt *gt,
|
||||
|
||||
trace_xe_gt_tlb_invalidation_fence_create(gt_to_xe(gt), &ifence->base);
|
||||
|
||||
spin_lock_irq(>->tlb_invalidation.lock);
|
||||
dma_fence_init(&ifence->base.base, &invalidation_fence_ops,
|
||||
>->tlb_invalidation.lock,
|
||||
dma_fence_context_alloc(1), 1);
|
||||
spin_unlock_irq(>->tlb_invalidation.lock);
|
||||
xe_gt_tlb_invalidation_fence_init(gt, &ifence->base);
|
||||
|
||||
INIT_LIST_HEAD(&ifence->base.link);
|
||||
|
||||
dma_fence_get(&ifence->base.base); /* Ref for caller */
|
||||
ifence->fence = fence;
|
||||
ifence->gt = gt;
|
||||
ifence->start = start;
|
||||
|
Loading…
Reference in New Issue
Block a user