From 790bdc7cb2e7dafbac0aafc016dcb7493c925bac Mon Sep 17 00:00:00 2001 From: Matthew Brost Date: Fri, 9 Jun 2023 11:09:37 -0700 Subject: [PATCH] drm/xe: Handle unmapped userptr in analyze VM MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit A corner exists where a userptr may have no mapping when analyze VM is called, handle this case. Reviewed-by: José Roberto de Souza Reviewed-by: Thomas Hellström Signed-off-by: Matthew Brost Signed-off-by: Rodrigo Vivi --- drivers/gpu/drm/xe/xe_vm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c index ea205244fcf9c..fa4778bfd0639 100644 --- a/drivers/gpu/drm/xe/xe_vm.c +++ b/drivers/gpu/drm/xe/xe_vm.c @@ -3455,9 +3455,13 @@ int xe_analyze_vm(struct drm_printer *p, struct xe_vm *vm, int gt_id) if (is_userptr) { struct xe_res_cursor cur; - xe_res_first_sg(vma->userptr.sg, 0, XE_PAGE_SIZE, - &cur); - addr = xe_res_dma(&cur); + if (vma->userptr.sg) { + xe_res_first_sg(vma->userptr.sg, 0, XE_PAGE_SIZE, + &cur); + addr = xe_res_dma(&cur); + } else { + addr = 0; + } } else { addr = __xe_bo_addr(vma->bo, 0, XE_PAGE_SIZE, &is_vram); } -- 2.30.2