Skip to content

Commit ffb7249

Browse files
committed
drm/xe: Annotate each dumpable vma as such
In preparation for snapshot dumping, mark each dumpable VMA as such, so we can walk over the VM later and dump it. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240221133024.898315-4-maarten.lankhorst@linux.intel.com
1 parent 76a86b5 commit ffb7249

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ static void xe_vma_free(struct xe_vma *vma)
792792

793793
#define VMA_CREATE_FLAG_READ_ONLY BIT(0)
794794
#define VMA_CREATE_FLAG_IS_NULL BIT(1)
795+
#define VMA_CREATE_FLAG_DUMPABLE BIT(2)
795796

796797
static struct xe_vma *xe_vma_create(struct xe_vm *vm,
797798
struct xe_bo *bo,
@@ -804,6 +805,7 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
804805
u8 id;
805806
bool read_only = (flags & VMA_CREATE_FLAG_READ_ONLY);
806807
bool is_null = (flags & VMA_CREATE_FLAG_IS_NULL);
808+
bool dumpable = (flags & VMA_CREATE_FLAG_DUMPABLE);
807809

808810
xe_assert(vm->xe, start < end);
809811
xe_assert(vm->xe, end < vm->size);
@@ -838,6 +840,8 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
838840
vma->gpuva.va.range = end - start + 1;
839841
if (read_only)
840842
vma->gpuva.flags |= XE_VMA_READ_ONLY;
843+
if (dumpable)
844+
vma->gpuva.flags |= XE_VMA_DUMPABLE;
841845

842846
for_each_tile(tile, vm->xe, id)
843847
vma->tile_mask |= 0x1 << id;
@@ -2122,6 +2126,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
21222126
op->map.read_only =
21232127
flags & DRM_XE_VM_BIND_FLAG_READONLY;
21242128
op->map.is_null = flags & DRM_XE_VM_BIND_FLAG_NULL;
2129+
op->map.dumpable = flags & DRM_XE_VM_BIND_FLAG_DUMPABLE;
21252130
op->map.pat_index = pat_index;
21262131
} else if (__op->op == DRM_GPUVA_OP_PREFETCH) {
21272132
op->prefetch.region = prefetch_region;
@@ -2317,6 +2322,8 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
23172322
VMA_CREATE_FLAG_READ_ONLY : 0;
23182323
flags |= op->map.is_null ?
23192324
VMA_CREATE_FLAG_IS_NULL : 0;
2325+
flags |= op->map.dumpable ?
2326+
VMA_CREATE_FLAG_DUMPABLE : 0;
23202327

23212328
vma = new_vma(vm, &op->base.map, op->map.pat_index,
23222329
flags);
@@ -2341,6 +2348,9 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
23412348
flags |= op->base.remap.unmap->va->flags &
23422349
DRM_GPUVA_SPARSE ?
23432350
VMA_CREATE_FLAG_IS_NULL : 0;
2351+
flags |= op->base.remap.unmap->va->flags &
2352+
XE_VMA_DUMPABLE ?
2353+
VMA_CREATE_FLAG_DUMPABLE : 0;
23442354

23452355
vma = new_vma(vm, op->base.remap.prev,
23462356
old->pat_index, flags);
@@ -2372,6 +2382,9 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
23722382
flags |= op->base.remap.unmap->va->flags &
23732383
DRM_GPUVA_SPARSE ?
23742384
VMA_CREATE_FLAG_IS_NULL : 0;
2385+
flags |= op->base.remap.unmap->va->flags &
2386+
XE_VMA_DUMPABLE ?
2387+
VMA_CREATE_FLAG_DUMPABLE : 0;
23752388

23762389
vma = new_vma(vm, op->base.remap.next,
23772390
old->pat_index, flags);

drivers/gpu/drm/xe/xe_vm_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct xe_vm;
3131
#define XE_VMA_PTE_1G (DRM_GPUVA_USERBITS << 7)
3232
#define XE_VMA_PTE_64K (DRM_GPUVA_USERBITS << 8)
3333
#define XE_VMA_PTE_COMPACT (DRM_GPUVA_USERBITS << 9)
34+
#define XE_VMA_DUMPABLE (DRM_GPUVA_USERBITS << 10)
3435

3536
/** struct xe_userptr - User pointer */
3637
struct xe_userptr {
@@ -294,6 +295,8 @@ struct xe_vma_op_map {
294295
bool read_only;
295296
/** @is_null: is NULL binding */
296297
bool is_null;
298+
/** @dumpable: whether BO is dumped on GPU hang */
299+
bool dumpable;
297300
/** @pat_index: The pat index to use for this operation. */
298301
u16 pat_index;
299302
};

0 commit comments

Comments
 (0)