drm/xe: Handle unmapped userptr in analyze VM
authorMatthew Brost <matthew.brost@intel.com>
Fri, 9 Jun 2023 18:09:37 +0000 (11:09 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 19 Dec 2023 23:35:21 +0000 (18:35 -0500)
A corner exists where a userptr may have no mapping when analyze VM is
called, handle this case.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_vm.c

index ea205244fcf9cd9b6439ed7ef33579afee12e84b..fa4778bfd063955199a6d5afef7c7572d930c43b 100644 (file)
@@ -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);
                }