History

drm/xe/uapi: Be more specific about the vm_bind prefetch region

Let's bring a bit of clarity on this 'region' field that is part of vm_bind operation struct. Rename and document to make it more than obvious that it is a region instance and not a mask and also that it should only be used with the prefetch operation itself.

Rodrigo Vivi committed 3 years ago

Commit aaa115f1 parent 4a349c82 files · +14 −9Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/xe/xe_vm.c +8 −7
  2. include/uapi/drm/xe_drm.h +6 −2
drivers/gpu/drm/xe/xe_vm.c+8−7
@@ -2160,7 +2160,8 @@ static void print_op(struct xe_device *xe, struct drm_gpuva_op *op) · 2159 unmodified lines
21602160 static struct drm_gpuva_ops *
21612161 vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
21622162 u64 bo_offset_or_userptr, u64 addr, u64 range,
2163− u32 operation, u32 flags, u8 tile_mask, u32 region)
2163+ u32 operation, u32 flags, u8 tile_mask,
2164+ u32 prefetch_region)
21642165 {
21652166 struct drm_gem_object *obj = bo ? &bo->ttm.base : NULL;
21662167 struct drm_gpuva_ops *ops;
@@ -2215,7 +2216,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo, · 48 unmodified lines
22152216 struct xe_vma_op *op = gpuva_op_to_vma_op(__op);
22162217
22172218 op->tile_mask = tile_mask;
2218− op->prefetch.region = region;
2219+ op->prefetch.region = prefetch_region;
22192220 }
22202221 break;
22212222 case DRM_XE_VM_BIND_OP_UNMAP_ALL:
@@ -2881,7 +2882,7 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe, · 659 unmodified lines
28812882 u32 flags = (*bind_ops)[i].flags;
28822883 u32 obj = (*bind_ops)[i].obj;
28832884 u64 obj_offset = (*bind_ops)[i].obj_offset;
2884− u32 region = (*bind_ops)[i].region;
2885+ u32 prefetch_region = (*bind_ops)[i].prefetch_mem_region_instance;
28852886 bool is_null = flags & DRM_XE_VM_BIND_FLAG_NULL;
28862887
28872888 if (i == 0) {
@@ -2915,9 +2916,9 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe, · 27 unmodified lines
29152916 op == DRM_XE_VM_BIND_OP_MAP_USERPTR) ||
29162917 XE_IOCTL_DBG(xe, obj &&
29172918 op == DRM_XE_VM_BIND_OP_PREFETCH) ||
2918− XE_IOCTL_DBG(xe, region &&
2919+ XE_IOCTL_DBG(xe, prefetch_region &&
29192920 op != DRM_XE_VM_BIND_OP_PREFETCH) ||
2920− XE_IOCTL_DBG(xe, !(BIT(region) &
2921+ XE_IOCTL_DBG(xe, !(BIT(prefetch_region) &
29212922 xe->info.mem_region_mask)) ||
29222923 XE_IOCTL_DBG(xe, obj &&
29232924 op == DRM_XE_VM_BIND_OP_UNMAP)) {
@@ -3099,11 +3100,11 @@ int xe_vm_bind_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 175 unmodified lines
30993100 u32 flags = bind_ops[i].flags;
31003101 u64 obj_offset = bind_ops[i].obj_offset;
31013102 u8 tile_mask = bind_ops[i].tile_mask;
3102− u32 region = bind_ops[i].region;
3103+ u32 prefetch_region = bind_ops[i].prefetch_mem_region_instance;
31033104
31043105 ops[i] = vm_bind_ioctl_ops_create(vm, bos[i], obj_offset,
31053106 addr, range, op, flags,
3106− tile_mask, region);
3107+ tile_mask, prefetch_region);
31073108 if (IS_ERR(ops[i])) {
31083109 err = PTR_ERR(ops[i]);
31093110 ops[i] = NULL;
include/uapi/drm/xe_drm.h+6−2
@@ -673,8 +673,12 @@ struct drm_xe_vm_bind_op { · 672 unmodified lines
673673 /** @flags: Bind flags */
674674 __u32 flags;
675675
676− /** @mem_region: Memory region to prefetch VMA to, instance not a mask */
677− __u32 region;
676+ /**
677+ * @prefetch_mem_region_instance: Memory region to prefetch VMA to.
678+ * It is a region instance, not a mask.
679+ * To be used only with %DRM_XE_VM_BIND_OP_PREFETCH operation.
680+ */
681+ __u32 prefetch_mem_region_instance;
678682
679683 /** @reserved: Reserved */
680684 __u64 reserved[2];