]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/xe/multi_queue: Add exec_queue set_property ioctl support
authorNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Thu, 11 Dec 2025 01:02:54 +0000 (17:02 -0800)
committerNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Fri, 12 Dec 2025 03:21:04 +0000 (19:21 -0800)
This patch adds support for exec_queue set_property ioctl.
It is derived from the original work which is part of
https://patchwork.freedesktop.org/series/112188/

Currently only DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_QUEUE_PRIORITY
property can be dynamically set.

v2: Check for and update kernel-doc which property this ioctl
    supports (Matt Brost)

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Pallavi Mishra <pallavi.mishra@intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20251211010249.1647839-25-niranjana.vishwanathapura@intel.com
drivers/gpu/drm/xe/xe_device.c
drivers/gpu/drm/xe/xe_exec_queue.c
drivers/gpu/drm/xe/xe_exec_queue.h
include/uapi/drm/xe_drm.h

index 1197f914ef777ab9d466853e5893adc744d59210..7a498c8db7b1f5805d625c88bc76a43a2936b73a 100644 (file)
@@ -207,6 +207,8 @@ static const struct drm_ioctl_desc xe_ioctls[] = {
        DRM_IOCTL_DEF_DRV(XE_MADVISE, xe_vm_madvise_ioctl, DRM_RENDER_ALLOW),
        DRM_IOCTL_DEF_DRV(XE_VM_QUERY_MEM_RANGE_ATTRS, xe_vm_query_vmas_attrs_ioctl,
                          DRM_RENDER_ALLOW),
+       DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_SET_PROPERTY, xe_exec_queue_set_property_ioctl,
+                         DRM_RENDER_ALLOW),
 };
 
 static long xe_drm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
index d0082eb45a4a779177feeab4426e8127993ce05b..d738a9fea1e173dab6c76efeb0cae7ffbc8182e3 100644 (file)
@@ -790,6 +790,41 @@ static const xe_exec_queue_set_property_fn exec_queue_set_property_funcs[] = {
                                                        exec_queue_set_multi_queue_priority,
 };
 
+int xe_exec_queue_set_property_ioctl(struct drm_device *dev, void *data,
+                                    struct drm_file *file)
+{
+       struct xe_device *xe = to_xe_device(dev);
+       struct xe_file *xef = to_xe_file(file);
+       struct drm_xe_exec_queue_set_property *args = data;
+       struct xe_exec_queue *q;
+       int ret;
+       u32 idx;
+
+       if (XE_IOCTL_DBG(xe, args->reserved[0] || args->reserved[1]))
+               return -EINVAL;
+
+       if (XE_IOCTL_DBG(xe, args->property !=
+                        DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_QUEUE_PRIORITY))
+               return -EINVAL;
+
+       q = xe_exec_queue_lookup(xef, args->exec_queue_id);
+       if (XE_IOCTL_DBG(xe, !q))
+               return -ENOENT;
+
+       idx = array_index_nospec(args->property,
+                                ARRAY_SIZE(exec_queue_set_property_funcs));
+       ret = exec_queue_set_property_funcs[idx](xe, q, args->value);
+       if (XE_IOCTL_DBG(xe, ret))
+               goto err_post_lookup;
+
+       xe_exec_queue_put(q);
+       return 0;
+
+ err_post_lookup:
+       xe_exec_queue_put(q);
+       return ret;
+}
+
 static int exec_queue_user_ext_check(struct xe_exec_queue *q, u64 properties)
 {
        u64 secondary_queue_valid_props = BIT_ULL(DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_GROUP) |
index e6daa40003f2d70b6c2a5dd98cff6ec3ebc1a772..ffcc1feb879eccbb37077a29a5fb5ce6051c77ea 100644 (file)
@@ -125,6 +125,8 @@ int xe_exec_queue_destroy_ioctl(struct drm_device *dev, void *data,
                                struct drm_file *file);
 int xe_exec_queue_get_property_ioctl(struct drm_device *dev, void *data,
                                     struct drm_file *file);
+int xe_exec_queue_set_property_ioctl(struct drm_device *dev, void *data,
+                                    struct drm_file *file);
 enum xe_exec_queue_priority xe_exec_queue_device_get_max_priority(struct xe_device *xe);
 
 void xe_exec_queue_last_fence_put(struct xe_exec_queue *e, struct xe_vm *vm);
index fd79d78de2e9a12bd0fbf3224b3d8b66735f022c..705081bf0d817771210732eb13add988b004f086 100644 (file)
@@ -106,6 +106,7 @@ extern "C" {
 #define DRM_XE_OBSERVATION             0x0b
 #define DRM_XE_MADVISE                 0x0c
 #define DRM_XE_VM_QUERY_MEM_RANGE_ATTRS        0x0d
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY 0x0e
 
 /* Must be kept compact -- no holes */
 
@@ -123,6 +124,7 @@ extern "C" {
 #define DRM_IOCTL_XE_OBSERVATION               DRM_IOW(DRM_COMMAND_BASE + DRM_XE_OBSERVATION, struct drm_xe_observation_param)
 #define DRM_IOCTL_XE_MADVISE                   DRM_IOW(DRM_COMMAND_BASE + DRM_XE_MADVISE, struct drm_xe_madvise)
 #define DRM_IOCTL_XE_VM_QUERY_MEM_RANGE_ATTRS  DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_QUERY_MEM_RANGE_ATTRS, struct drm_xe_vm_query_mem_range_attr)
+#define DRM_IOCTL_XE_EXEC_QUEUE_SET_PROPERTY   DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_SET_PROPERTY, struct drm_xe_exec_queue_set_property)
 
 /**
  * DOC: Xe IOCTL Extensions
@@ -2315,6 +2317,30 @@ struct drm_xe_vm_query_mem_range_attr {
 
 };
 
+/**
+ * struct drm_xe_exec_queue_set_property - exec queue set property
+ *
+ * Sets execution queue properties dynamically.
+ * Currently only %DRM_XE_EXEC_QUEUE_SET_PROPERTY_MULTI_QUEUE_PRIORITY
+ * property can be dynamically set.
+ */
+struct drm_xe_exec_queue_set_property {
+       /** @extensions: Pointer to the first extension struct, if any */
+       __u64 extensions;
+
+       /** @exec_queue_id: Exec queue ID */
+       __u32 exec_queue_id;
+
+       /** @property: property to set */
+       __u32 property;
+
+       /** @value: property value */
+       __u64 value;
+
+       /** @reserved: Reserved */
+       __u64 reserved[2];
+};
+
 #if defined(__cplusplus)
 }
 #endif