Commit a825cef2 authored by Maarten Lankhorst's avatar Maarten Lankhorst

drm/xe: Move xe_ggtt_invalidate out from ggtt->lock

Considering the caller of the GGTT functions should keep the
backing storage alive before the function completes, it's not
necessary to invalidate with the GGTT lock held. This just adds
latency for every user of the GGTT.
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240306052002.311196-5-matthew.brost@intel.com
parent 231c4110
...@@ -389,9 +389,6 @@ void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo) ...@@ -389,9 +389,6 @@ void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
pte = ggtt->pt_ops->pte_encode_bo(bo, offset, pat_index); pte = ggtt->pt_ops->pte_encode_bo(bo, offset, pat_index);
xe_ggtt_set_pte(ggtt, start + offset, pte); xe_ggtt_set_pte(ggtt, start + offset, pte);
} }
if (bo->flags & XE_BO_GGTT_INVALIDATE)
xe_ggtt_invalidate(ggtt);
} }
static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
...@@ -420,6 +417,9 @@ static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo, ...@@ -420,6 +417,9 @@ static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
if (!err) if (!err)
xe_ggtt_map_bo(ggtt, bo); xe_ggtt_map_bo(ggtt, bo);
mutex_unlock(&ggtt->lock); mutex_unlock(&ggtt->lock);
if (!err && bo->flags & XE_BO_GGTT_INVALIDATE)
xe_ggtt_invalidate(ggtt);
xe_device_mem_access_put(tile_to_xe(ggtt->tile)); xe_device_mem_access_put(tile_to_xe(ggtt->tile));
return err; return err;
...@@ -440,16 +440,16 @@ void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node, ...@@ -440,16 +440,16 @@ void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node,
bool invalidate) bool invalidate)
{ {
xe_device_mem_access_get(tile_to_xe(ggtt->tile)); xe_device_mem_access_get(tile_to_xe(ggtt->tile));
mutex_lock(&ggtt->lock);
mutex_lock(&ggtt->lock);
xe_ggtt_clear(ggtt, node->start, node->size); xe_ggtt_clear(ggtt, node->start, node->size);
drm_mm_remove_node(node); drm_mm_remove_node(node);
node->size = 0; node->size = 0;
mutex_unlock(&ggtt->lock);
if (invalidate) if (invalidate)
xe_ggtt_invalidate(ggtt); xe_ggtt_invalidate(ggtt);
mutex_unlock(&ggtt->lock);
xe_device_mem_access_put(tile_to_xe(ggtt->tile)); xe_device_mem_access_put(tile_to_xe(ggtt->tile));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment