aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Brost <matthew.brost@intel.com>2023-06-09 11:09:37 -0700
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-19 18:35:21 -0500
commit790bdc7cb2e7dafbac0aafc016dcb7493c925bac (patch)
tree7d7706b57c76b01ccb8183e11c27691ddb2065e5
parent9f8f93bee3efdba3bf7853befe2219e3a300c305 (diff)
drm/xe: Handle unmapped userptr in analyze VM
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>
-rw-r--r--drivers/gpu/drm/xe/xe_vm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index ea205244fcf9..fa4778bfd063 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);
}