]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/xe/uapi: Be more specific about the vm_bind prefetch region
authorRodrigo Vivi <rodrigo.vivi@intel.com>
Tue, 14 Nov 2023 13:34:34 +0000 (13:34 +0000)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:44:38 +0000 (11:44 -0500)
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.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_vm.c
include/uapi/drm/xe_drm.h

index e8dd467895377550c74b288ac478f18174df2b8a..174441c4ca5a04232642a53d661b6c151159606a 100644 (file)
@@ -2160,7 +2160,8 @@ static void print_op(struct xe_device *xe, struct drm_gpuva_op *op)
 static struct drm_gpuva_ops *
 vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
                         u64 bo_offset_or_userptr, u64 addr, u64 range,
-                        u32 operation, u32 flags, u8 tile_mask, u32 region)
+                        u32 operation, u32 flags, u8 tile_mask,
+                        u32 prefetch_region)
 {
        struct drm_gem_object *obj = bo ? &bo->ttm.base : NULL;
        struct drm_gpuva_ops *ops;
@@ -2215,7 +2216,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
                        struct xe_vma_op *op = gpuva_op_to_vma_op(__op);
 
                        op->tile_mask = tile_mask;
-                       op->prefetch.region = region;
+                       op->prefetch.region = prefetch_region;
                }
                break;
        case DRM_XE_VM_BIND_OP_UNMAP_ALL:
@@ -2881,7 +2882,7 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe,
                u32 flags = (*bind_ops)[i].flags;
                u32 obj = (*bind_ops)[i].obj;
                u64 obj_offset = (*bind_ops)[i].obj_offset;
-               u32 region = (*bind_ops)[i].region;
+               u32 prefetch_region = (*bind_ops)[i].prefetch_mem_region_instance;
                bool is_null = flags & DRM_XE_VM_BIND_FLAG_NULL;
 
                if (i == 0) {
@@ -2915,9 +2916,9 @@ static int vm_bind_ioctl_check_args(struct xe_device *xe,
                                 op == DRM_XE_VM_BIND_OP_MAP_USERPTR) ||
                    XE_IOCTL_DBG(xe, obj &&
                                 op == DRM_XE_VM_BIND_OP_PREFETCH) ||
-                   XE_IOCTL_DBG(xe, region &&
+                   XE_IOCTL_DBG(xe, prefetch_region &&
                                 op != DRM_XE_VM_BIND_OP_PREFETCH) ||
-                   XE_IOCTL_DBG(xe, !(BIT(region) &
+                   XE_IOCTL_DBG(xe, !(BIT(prefetch_region) &
                                       xe->info.mem_region_mask)) ||
                    XE_IOCTL_DBG(xe, obj &&
                                 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)
                u32 flags = bind_ops[i].flags;
                u64 obj_offset = bind_ops[i].obj_offset;
                u8 tile_mask = bind_ops[i].tile_mask;
-               u32 region = bind_ops[i].region;
+               u32 prefetch_region = bind_ops[i].prefetch_mem_region_instance;
 
                ops[i] = vm_bind_ioctl_ops_create(vm, bos[i], obj_offset,
                                                  addr, range, op, flags,
-                                                 tile_mask, region);
+                                                 tile_mask, prefetch_region);
                if (IS_ERR(ops[i])) {
                        err = PTR_ERR(ops[i]);
                        ops[i] = NULL;
index b2bd76efd94022937dec29f76d51c45d3d5f16a4..88f3aca02b08569c100467e0c16789bb13cefd4e 100644 (file)
@@ -673,8 +673,12 @@ struct drm_xe_vm_bind_op {
        /** @flags: Bind flags */
        __u32 flags;
 
-       /** @mem_region: Memory region to prefetch VMA to, instance not a mask */
-       __u32 region;
+       /**
+        * @prefetch_mem_region_instance: Memory region to prefetch VMA to.
+        * It is a region instance, not a mask.
+        * To be used only with %DRM_XE_VM_BIND_OP_PREFETCH operation.
+        */
+       __u32 prefetch_mem_region_instance;
 
        /** @reserved: Reserved */
        __u64 reserved[2];