From: Matthew Auld Date: Thu, 19 Jan 2023 12:16:51 +0000 (+0000) Subject: drm/xe/ppgtt: fix scratch page usage on DG2 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b1e52b65712969a74f0ba9ffbf67dde98ce33c2f;p=linux.git drm/xe/ppgtt: fix scratch page usage on DG2 On DG2 when running the xe_vm IGT, the kernel generates loads of CAT errors and GT resets (sometimes at least). On small-bar systems seems to trigger a lot more easily (maybe due to difference in allocation strategy). Appears to be related to scratch, since we seem to use the 64K TLB hint on scratch entries, even though the scratch page is a 4K vram page. Bumping the scratch page size and physical alignment seems to fix it. Or at least we no longer hit: [ 148.872683] xe 0000:03:00.0: [drm] Engine memory cat error: guc_id=0 [ 148.872701] xe 0000:03:00.0: [drm] Engine memory cat error: guc_id=0 [ 148.875108] WARNING: CPU: 0 PID: 953 at drivers/gpu/drm/xe/xe_guc_submit.c:797 However to keep things simple, so we don't have to deal with 64K TLB hints, just move the scratch page into system memory on platforms that require 64K VRAM pages. 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 d7fb1ddb8789c..01673fe969302 100644 --- a/drivers/gpu/drm/xe/xe_pt.c +++ b/drivers/gpu/drm/xe/xe_pt.c @@ -175,8 +175,6 @@ static u64 __xe_pt_empty_pte(struct xe_gt *gt, struct xe_vm *vm, if (level == 0) { u64 empty = gen8_pte_encode(NULL, vm->scratch_bo[id], 0, XE_CACHE_WB, 0, 0); - if (vm->flags & XE_VM_FLAGS_64K) - empty |= GEN12_PTE_PS64; return empty; } else { @@ -331,13 +329,23 @@ int xe_pt_create_scratch(struct xe_device *xe, struct xe_gt *gt, struct xe_vm *vm) { u8 id = gt->info.id; + unsigned int flags; int i; + /* + * So we don't need to worry about 64K TLB hints when dealing with + * scratch entires, rather keep the scratch page in system memory on + * platforms where 64K pages are needed for VRAM. + */ + flags = XE_BO_CREATE_PINNED_BIT; + if (vm->flags & XE_VM_FLAGS_64K) + flags |= XE_BO_CREATE_SYSTEM_BIT; + else + flags |= XE_BO_CREATE_VRAM_IF_DGFX(gt); + 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); + flags); if (IS_ERR(vm->scratch_bo[id])) return PTR_ERR(vm->scratch_bo[id]);