[RFC PATCH 22/28] drm/xe: Add BO flags required for SVM
Matthew Brost
matthew.brost at intel.com
Wed Aug 28 02:48:55 UTC 2024
Add XE_BO_FLAG_SYSTEM_ALLOC to indicate BO is tied to SVM range.
Add XE_BO_FLAG_SKIP_CLEAR to indicate BO does not need to cleared.
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/gpu/drm/xe/xe_bo.c | 11 +++++++----
drivers/gpu/drm/xe/xe_bo.h | 2 ++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index b6c6a4a3b4d4..ad804b6f9e84 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -704,9 +704,10 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
(!mem_type_is_vram(old_mem_type) && !tt_has_data);
clear_system_pages = ttm && (ttm->page_flags & TTM_TT_FLAG_CLEARED_ON_FREE);
- needs_clear = (ttm && ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC) ||
+ needs_clear = !(bo->flags & XE_BO_FLAG_SKIP_CLEAR) &&
+ ((ttm && ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC) ||
(!ttm && ttm_bo->type == ttm_bo_type_device) ||
- clear_system_pages;
+ clear_system_pages);
if (new_mem->mem_type == XE_PL_TT) {
ret = xe_tt_map_sg(ttm);
@@ -1284,7 +1285,8 @@ struct xe_bo *___xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo,
int err;
/* Only kernel objects should set GT */
- xe_assert(xe, !tile || type == ttm_bo_type_kernel);
+ xe_assert(xe, !tile || type == ttm_bo_type_kernel ||
+ flags & XE_BO_FLAG_SYSTEM_ALLOC);
if (XE_WARN_ON(!size)) {
xe_bo_free(bo);
@@ -2292,7 +2294,8 @@ bool xe_bo_needs_ccs_pages(struct xe_bo *bo)
* can't be used since there's no CCS storage associated with
* non-VRAM addresses.
*/
- if (IS_DGFX(xe) && (bo->flags & XE_BO_FLAG_SYSTEM))
+ if (IS_DGFX(xe) && ((bo->flags & XE_BO_FLAG_SYSTEM) ||
+ (bo->flags & XE_BO_FLAG_SYSTEM_ALLOC)))
return false;
return true;
diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
index dbfb3209615d..fe2ce641b256 100644
--- a/drivers/gpu/drm/xe/xe_bo.h
+++ b/drivers/gpu/drm/xe/xe_bo.h
@@ -39,6 +39,8 @@
#define XE_BO_FLAG_NEEDS_64K BIT(15)
#define XE_BO_FLAG_NEEDS_2M BIT(16)
#define XE_BO_FLAG_GGTT_INVALIDATE BIT(17)
+#define XE_BO_FLAG_SYSTEM_ALLOC BIT(18)
+#define XE_BO_FLAG_SKIP_CLEAR BIT(19)
/* this one is trigger internally only */
#define XE_BO_FLAG_INTERNAL_TEST BIT(30)
#define XE_BO_FLAG_INTERNAL_64K BIT(31)
--
2.34.1
More information about the dri-devel
mailing list