From: Matthew Auld Date: Thu, 22 Dec 2022 14:09:02 +0000 (+0000) Subject: drm/xe/ppgtt: clear the scratch page X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e63f81adcc4283aed7d4fe5da1219881cc6f67d4;p=linux.git drm/xe/ppgtt: clear the scratch page We need to ensure we don't leak the contents to userspace. Signed-off-by: Matthew Auld Reviewed-by: Matthew Brost Cc: Thomas Hellström Signed-off-by: Rodrigo Vivi --- diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c index 688bc4b56294c..d7fb1ddb8789c 100644 --- a/drivers/gpu/drm/xe/xe_pt.c +++ b/drivers/gpu/drm/xe/xe_pt.c @@ -333,14 +333,16 @@ int xe_pt_create_scratch(struct xe_device *xe, struct xe_gt *gt, u8 id = gt->info.id; int i; - vm->scratch_bo[id] = xe_bo_create(xe, gt, vm, SZ_4K, - ttm_bo_type_kernel, - XE_BO_CREATE_VRAM_IF_DGFX(gt) | - XE_BO_CREATE_IGNORE_MIN_PAGE_SIZE_BIT | - XE_BO_CREATE_PINNED_BIT); + vm->scratch_bo[id] = xe_bo_create_pin_map(xe, gt, vm, SZ_4K, + ttm_bo_type_kernel, + XE_BO_CREATE_VRAM_IF_DGFX(gt) | + XE_BO_CREATE_IGNORE_MIN_PAGE_SIZE_BIT | + XE_BO_CREATE_PINNED_BIT); if (IS_ERR(vm->scratch_bo[id])) return PTR_ERR(vm->scratch_bo[id]); - xe_bo_pin(vm->scratch_bo[id]); + + xe_map_memset(vm->xe, &vm->scratch_bo[id]->vmap, 0, 0, + vm->scratch_bo[id]->size); for (i = 0; i < vm->pt_root[id]->level; i++) { vm->scratch_pt[id][i] = xe_pt_create(vm, gt, i);