[Intel-xe] [PATCH 16/22] drm/xe: Coalesce GGTT invalidations
Rodrigo Vivi
rodrigo.vivi at intel.com
Fri Feb 3 20:24:03 UTC 2023
From: Matthew Brost <matthew.brost at intel.com>
No need to invalidate the GGTT on every allocation / deallocation,
rather just invalidate the GGTT on an allocation after a deallocation.
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
drivers/gpu/drm/xe/xe_ggtt.c | 11 +++++++++--
drivers/gpu/drm/xe/xe_ggtt_types.h | 2 ++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index 20450ed8400b..81c7eb68bc46 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -264,15 +264,22 @@ int xe_ggtt_insert_special_node(struct xe_ggtt *ggtt, struct drm_mm_node *node,
void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
{
+ struct xe_device *xe = gt_to_xe(ggtt->gt);
u64 start = bo->ggtt_node.start;
u64 offset, pte;
+ lockdep_assert_held(&ggtt->lock);
+
for (offset = 0; offset < bo->size; offset += GEN8_PAGE_SIZE) {
pte = xe_ggtt_pte_encode(bo, offset);
xe_ggtt_set_pte(ggtt, start + offset, pte);
}
- xe_ggtt_invalidate(ggtt->gt);
+ /* XXX: Without doing this everytime on integrated driver load fails */
+ if (ggtt->invalidate || !IS_DGFX(xe)) {
+ xe_ggtt_invalidate(ggtt->gt);
+ ggtt->invalidate = false;
+ }
}
static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
@@ -330,7 +337,7 @@ void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node)
drm_mm_remove_node(node);
node->size = 0;
- xe_ggtt_invalidate(ggtt->gt);
+ ggtt->invalidate = true;
mutex_unlock(&ggtt->lock);
}
diff --git a/drivers/gpu/drm/xe/xe_ggtt_types.h b/drivers/gpu/drm/xe/xe_ggtt_types.h
index ea70aaef4b31..8198aa784654 100644
--- a/drivers/gpu/drm/xe/xe_ggtt_types.h
+++ b/drivers/gpu/drm/xe/xe_ggtt_types.h
@@ -26,6 +26,8 @@ struct xe_ggtt {
u64 __iomem *gsm;
struct drm_mm mm;
+
+ bool invalidate;
};
#endif
--
2.39.1
More information about the Intel-xe
mailing list