drm/xe: uAPI cleanup
Subsystems (3)
cover drm/xe: uAPI cleanup
This series addresses some feedback on xe_drm.h provided here:
https://lists.freedesktop.org/archives/intel-xe/2023-May/004704.html
It is based on xe-rev1-2023-05-02, not on drm-xe-next, so it will likely break CI.
Francois Dugast (5):
drm/xe: Use SPDX-License-Identifier instead of license text drm/xe: Group engine related structs
drm/xe: Move defines after relevant fields drm/xe: Document usage of struct drm_xe_device_query drm/xe: Fix some formatting issues in uAPI
include/uapi/drm/xe_drm.h | 152 ++++++++++++++++++++------------------ 1 file changed, 80 insertions(+), 72 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/5 drm/xe: Use SPDX-License-Identifier instead of license text
Replace the license text with its SPDX-License-Identifier for quick identification of the license and consistency with the rest of the driver.
--- include/uapi/drm/xe_drm.h | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-)
include/uapi/drm/xe_drm.h +2 -22
@@ -1,26 +1,6 @@ +/* SPDX-License-Identifier: MIT */ /* -* Copyright 2021 Intel Corporation. All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sub license, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice (including the -* next paragraph) shall be included in all copies or substantial portions -* of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR -* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -* +* Copyright © 2023 Intel Corporation */ #ifndef _UAPI_XE_DRM_H_
Signature · 1 line
2.34.1
PATCH 2/5 drm/xe: Group engine related structs
In reply to Francois DugastMove the definition of drm_xe_engine_class_instance to group it with other engine related structs and to follow the ioctls order.
--- include/uapi/drm/xe_drm.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
include/uapi/drm/xe_drm.h +18 -18
@@ -116,24 +116,6 @@ struct xe_user_extension {#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise) -struct drm_xe_engine_class_instance { -__u16 engine_class; - -#define DRM_XE_ENGINE_CLASS_RENDER 0 -#define DRM_XE_ENGINE_CLASS_COPY 1 -#define DRM_XE_ENGINE_CLASS_VIDEO_DECODE 2 -#define DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE 3 -#define DRM_XE_ENGINE_CLASS_COMPUTE 4 -/* -* Kernel only class (not actual hardware engine class). Used for -* creating ordered queues of VM bind operations. -*/ -#define DRM_XE_ENGINE_CLASS_VM_BIND 5 - -__u16 engine_instance; -__u16 gt_id; -}; -#define XE_MEM_REGION_CLASS_SYSMEM 0#define XE_MEM_REGION_CLASS_VRAM 1
@@ -518,6 +500,24 @@ struct drm_xe_engine_set_property {__u64 reserved[2 ]; }; +struct drm_xe_engine_class_instance { +__u16 engine_class; + +#define DRM_XE_ENGINE_CLASS_RENDER 0 +#define DRM_XE_ENGINE_CLASS_COPY 1 +#define DRM_XE_ENGINE_CLASS_VIDEO_DECODE 2 +#define DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE 3 +#define DRM_XE_ENGINE_CLASS_COMPUTE 4 +/* +* Kernel only class (not actual hardware engine class). Used for +* creating ordered queues of VM bind operations. +*/ +#define DRM_XE_ENGINE_CLASS_VM_BIND 5 + +__u16 engine_instance; +__u16 gt_id; +}; +struct drm_xe_engine_create {/** @extensions: Pointer to the first extension struct, if any */ #define XE_ENGINE_EXTENSION_SET_PROPERTY 0
Signature · 1 line
2.34.1
PATCH 3/5 drm/xe: Move defines after relevant fields
In reply to Francois DugastAlign on same rule in the whoe file: defines come after the relevant fields.
--- include/uapi/drm/xe_drm.h | 40 +++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-)
include/uapi/drm/xe_drm.h +20 -20
@@ -116,9 +116,6 @@ struct xe_user_extension {#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise) -#define XE_MEM_REGION_CLASS_SYSMEM 0 -#define XE_MEM_REGION_CLASS_VRAM 1 -struct drm_xe_query_mem_usage {__u32 num_regions;__u32 pad;
@@ -135,9 +132,13 @@ struct drm_xe_query_mem_usage { } regions[]; }; +#define XE_MEM_REGION_CLASS_SYSMEM 0 +#define XE_MEM_REGION_CLASS_VRAM 1 +struct drm_xe_query_config {__u32 num_params;__u32 pad; +__u64 info[];#define XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0#define XE_QUERY_CONFIG_FLAGS 1#define XE_QUERY_CONFIG_FLAGS_HAS_VRAM (0x1 << 0)
@@ -148,7 +149,6 @@ struct drm_xe_query_config {#define XE_QUERY_CONFIG_MEM_REGION_COUNT 5#define XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY 6#define XE_QUERY_CONFIG_NUM_PARAM XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY + 1 -__u64 info[]; };struct drm_xe_query_gts {
@@ -161,10 +161,10 @@ struct drm_xe_query_gts {*/ struct drm_xe_query_gt { +__u16 type;#define XE_QUERY_GT_TYPE_MAIN 0#define XE_QUERY_GT_TYPE_REMOTE 1#define XE_QUERY_GT_TYPE_MEDIA 2 -__u16 type;__u16 instance;__u32 clock_freq;__u64 features;
@@ -231,9 +231,9 @@ struct drm_xe_gem_create {* @flags: Flags, currently a mask of memory instances of where BO can * be placed */ +__u32 flags;#define XE_GEM_CREATE_FLAG_DEFER_BACKING (0x1 << 24)#define XE_GEM_CREATE_FLAG_SCANOUT (0x1 << 25) -__u32 flags;/** * @vm_id: Attached VM, if any
@@ -294,8 +294,8 @@ struct drm_xe_ext_vm_set_property {struct xe_user_extension base;/** @property: property to set */ -#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0__u32 property; +#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0/** @value: property value */ __u64 value;
@@ -306,8 +306,8 @@ struct drm_xe_ext_vm_set_property {struct drm_xe_vm_create {/** @extensions: Pointer to the first extension struct, if any */ -#define XE_VM_EXTENSION_SET_PROPERTY 0__u64 extensions; +#define XE_VM_EXTENSION_SET_PROPERTY 0/** @flags: Flags */ __u32 flags;
@@ -368,9 +368,6 @@ struct drm_xe_vm_bind_op {/** @op: Operation to perform (lower 16 bits) and flags (upper 16 bits) */ __u32 op; -/** @mem_region: Memory region to prefetch VMA to, instance not a mask */ -__u32 region; -#define XE_VM_BIND_OP_MAP 0x0#define XE_VM_BIND_OP_UNMAP 0x1#define XE_VM_BIND_OP_MAP_USERPTR 0x2
@@ -410,6 +407,9 @@ struct drm_xe_vm_bind_op {*/ #define XE_VM_BIND_FLAG_IMMEDIATE (0x1 << 18) +/** @mem_region: Memory region to prefetch VMA to, instance not a mask */ +__u32 region; +/** @reserved: Reserved */ __u64 reserved[2 ]; };
@@ -476,6 +476,7 @@ struct drm_xe_engine_set_property {__u32 engine_id;/** @property: property to set */ +__u32 property;#define XE_ENGINE_SET_PROPERTY_PRIORITY 0#define XE_ENGINE_SET_PROPERTY_TIMESLICE 1#define XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT 2
@@ -491,7 +492,6 @@ struct drm_xe_engine_set_property {#define XE_ENGINE_SET_PROPERTY_ACC_TRIGGER 6#define XE_ENGINE_SET_PROPERTY_ACC_NOTIFY 7#define XE_ENGINE_SET_PROPERTY_ACC_GRANULARITY 8 -__u32 property;/** @value: property value */ __u64 value;
@@ -520,8 +520,8 @@ struct drm_xe_engine_class_instance {struct drm_xe_engine_create {/** @extensions: Pointer to the first extension struct, if any */ -#define XE_ENGINE_EXTENSION_SET_PROPERTY 0__u64 extensions; +#define XE_ENGINE_EXTENSION_SET_PROPERTY 0/** @width: submission width (number BB per exec) for this engine */ __u16 width;
@@ -559,8 +559,8 @@ struct drm_xe_engine_get_property {__u32 engine_id;/** @property: property to get */ -#define XE_ENGINE_GET_PROPERTY_BAN 0__u32 property; +#define XE_ENGINE_GET_PROPERTY_BAN 0/** @value: property value */ __u64 value;
@@ -686,26 +686,26 @@ struct drm_xe_wait_user_fence {__u64 vm_id; };/** @op: wait operation (type of comparison) */ +__u16 op;#define DRM_XE_UFENCE_WAIT_EQ 0#define DRM_XE_UFENCE_WAIT_NEQ 1#define DRM_XE_UFENCE_WAIT_GT 2#define DRM_XE_UFENCE_WAIT_GTE 3#define DRM_XE_UFENCE_WAIT_LT 4#define DRM_XE_UFENCE_WAIT_LTE 5 -__u16 op;/** @flags: wait flags */ +__u16 flags;#define DRM_XE_UFENCE_WAIT_SOFT_OP (1 << 0)/* e.g. Wait on VM bind */ #define DRM_XE_UFENCE_WAIT_ABSTIME (1 << 1)#define DRM_XE_UFENCE_WAIT_VM_ERROR (1 << 2) -__u16 flags;/** @value: compare value */ __u64 value;/** @mask: comparison mask */ +__u64 mask;#define DRM_XE_UFENCE_WAIT_U8 0xffu#define DRM_XE_UFENCE_WAIT_U16 0xffffu#define DRM_XE_UFENCE_WAIT_U32 0xffffffffu#define DRM_XE_UFENCE_WAIT_U64 0xffffffffffffffffu -__u64 mask;/** @timeout: how long to wait before bailing, value in jiffies */ __s64 timeout;/**
@@ -736,6 +736,9 @@ struct drm_xe_vm_madvise {/** @addr: Address of the VMA to operation on */ __u64 addr; +/** @property: property to set */ +__u32 property; +/* * Setting the preferred location will trigger a migrate of the VMA * backing store to new location if the backing store is already
@@ -771,9 +774,6 @@ struct drm_xe_vm_madvise {/* Pin the VMA in memory, must be elevated user */ #define DRM_XE_VM_MADVISE_PIN 6 -/** @property: property to set */ -__u32 property; -/** @value: property value */ __u64 value;
Signature · 1 line
2.34.1
Re: [Intel-xe] [PATCH 3/5] drm/xe: Move defines after relevant fields
Quoted 2 lines · Francois Dugast
Align on same rule in the whoe file: defines come after the relevant fields.
is that a convention from somewhere? See below.
Quoted 26 lines
Reported-by Oded Gabbay <[email protected]>Signed-off-by Francois Dugast <[email protected]>---
include/uapi/drm/xe_drm.h| 40 +++++++++++++++++++--------------------1 file changed, 20 insertions(+), 20 deletions(-)include/uapi/drm/xe_drm.h +0
-3@@ -116,9 +116,6 @@ struct xe_user_extension {#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise) -#define XE_MEM_REGION_CLASS_SYSMEM 0 -#define XE_MEM_REGION_CLASS_VRAM 1 -struct drm_xe_query_mem_usage {__u32 num_regions;__u32 pad;@@ -135,9 +132,13 @@ struct drm_xe_query_mem_usage { } regions[]; };
include/uapi/drm/xe_drm.h struct drm_xe_query_mem_usage { · line 144
Quoted 10 lines
include/uapi/drm/xe_drm.h +4
-0+#define XE_MEM_REGION_CLASS_SYSMEM 0 +#define XE_MEM_REGION_CLASS_VRAM 1 +struct drm_xe_query_config {__u32 num_params;__u32 pad; +__u64 info[];#define XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0#define XE_QUERY_CONFIG_FLAGS 1#define XE_QUERY_CONFIG_FLAGS_HAS_VRAM (0x1 << 0)
I thnk it would be much cleaner to go the opposite and ensure a newline in place so it's not ambiguous.
struct drm_xe_query_config {
__u32 num_params;
__u32 pad;#define XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0
#define XE_QUERY_CONFIG_FLAGS 1
#define ... /** @info: .... */ __u64 info[]; };
Lucas De Marchi
Quoted 160 lines
include/uapi/drm/xe_drm.h +16
-17@@ -148,7 +149,6 @@ struct drm_xe_query_config {#define XE_QUERY_CONFIG_MEM_REGION_COUNT 5#define XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY 6#define XE_QUERY_CONFIG_NUM_PARAM XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY + 1 -__u64 info[]; };struct drm_xe_query_gts {@@ -161,10 +161,10 @@ struct drm_xe_query_gts {*/ struct drm_xe_query_gt { +__u16 type;#define XE_QUERY_GT_TYPE_MAIN 0#define XE_QUERY_GT_TYPE_REMOTE 1#define XE_QUERY_GT_TYPE_MEDIA 2 -__u16 type;__u16 instance;__u32 clock_freq;__u64 features;@@ -231,9 +231,9 @@ struct drm_xe_gem_create {* @flags: Flags, currently a mask of memory instances of where BO can * be placed */ +__u32 flags;#define XE_GEM_CREATE_FLAG_DEFER_BACKING (0x1 << 24)#define XE_GEM_CREATE_FLAG_SCANOUT (0x1 << 25) -__u32 flags;/** * @vm_id: Attached VM, if any @@ -294,8 +294,8 @@ struct drm_xe_ext_vm_set_property {struct xe_user_extension base;/** @property: property to set */ -#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0__u32 property; +#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0/** @value: property value */ __u64 value;@@ -306,8 +306,8 @@ struct drm_xe_ext_vm_set_property {struct drm_xe_vm_create {/** @extensions: Pointer to the first extension struct, if any */ -#define XE_VM_EXTENSION_SET_PROPERTY 0__u64 extensions; +#define XE_VM_EXTENSION_SET_PROPERTY 0/** @flags: Flags */ __u32 flags;@@ -368,9 +368,6 @@ struct drm_xe_vm_bind_op {/** @op: Operation to perform (lower 16 bits) and flags (upper 16 bits) */ __u32 op; -/** @mem_region: Memory region to prefetch VMA to, instance not a mask */ -__u32 region; -#define XE_VM_BIND_OP_MAP 0x0#define XE_VM_BIND_OP_UNMAP 0x1#define XE_VM_BIND_OP_MAP_USERPTR 0x2@@ -410,6 +407,9 @@ struct drm_xe_vm_bind_op {*/ #define XE_VM_BIND_FLAG_IMMEDIATE (0x1 << 18) +/** @mem_region: Memory region to prefetch VMA to, instance not a mask */ +__u32 region; +/** @reserved: Reserved */ __u64 reserved[2 ]; };@@ -476,6 +476,7 @@ struct drm_xe_engine_set_property {__u32 engine_id;/** @property: property to set */ +__u32 property;#define XE_ENGINE_SET_PROPERTY_PRIORITY 0#define XE_ENGINE_SET_PROPERTY_TIMESLICE 1#define XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT 2@@ -491,7 +492,6 @@ struct drm_xe_engine_set_property {#define XE_ENGINE_SET_PROPERTY_ACC_TRIGGER 6#define XE_ENGINE_SET_PROPERTY_ACC_NOTIFY 7#define XE_ENGINE_SET_PROPERTY_ACC_GRANULARITY 8 -__u32 property;/** @value: property value */ __u64 value;@@ -520,8 +520,8 @@ struct drm_xe_engine_class_instance {struct drm_xe_engine_create {/** @extensions: Pointer to the first extension struct, if any */ -#define XE_ENGINE_EXTENSION_SET_PROPERTY 0__u64 extensions; +#define XE_ENGINE_EXTENSION_SET_PROPERTY 0/** @width: submission width (number BB per exec) for this engine */ __u16 width;@@ -559,8 +559,8 @@ struct drm_xe_engine_get_property {__u32 engine_id;/** @property: property to get */ -#define XE_ENGINE_GET_PROPERTY_BAN 0__u32 property; +#define XE_ENGINE_GET_PROPERTY_BAN 0/** @value: property value */ __u64 value;@@ -686,26 +686,26 @@ struct drm_xe_wait_user_fence {__u64 vm_id; };/** @op: wait operation (type of comparison) */ +__u16 op;#define DRM_XE_UFENCE_WAIT_EQ 0#define DRM_XE_UFENCE_WAIT_NEQ 1#define DRM_XE_UFENCE_WAIT_GT 2#define DRM_XE_UFENCE_WAIT_GTE 3#define DRM_XE_UFENCE_WAIT_LT 4#define DRM_XE_UFENCE_WAIT_LTE 5 -__u16 op;/** @flags: wait flags */ +__u16 flags;#define DRM_XE_UFENCE_WAIT_SOFT_OP (1 << 0)/* e.g. Wait on VM bind */ #define DRM_XE_UFENCE_WAIT_ABSTIME (1 << 1)#define DRM_XE_UFENCE_WAIT_VM_ERROR (1 << 2) -__u16 flags;/** @value: compare value */ __u64 value;/** @mask: comparison mask */ +__u64 mask;#define DRM_XE_UFENCE_WAIT_U8 0xffu#define DRM_XE_UFENCE_WAIT_U16 0xffffu#define DRM_XE_UFENCE_WAIT_U32 0xffffffffu#define DRM_XE_UFENCE_WAIT_U64 0xffffffffffffffffu -__u64 mask;/** @timeout: how long to wait before bailing, value in jiffies */ __s64 timeout;/** @@ -736,6 +736,9 @@ struct drm_xe_vm_madvise {/** @addr: Address of the VMA to operation on */ __u64 addr; +/** @property: property to set */ +__u32 property; +/* * Setting the preferred location will trigger a migrate of the VMA * backing store to new location if the backing store is already @@ -771,9 +774,6 @@ struct drm_xe_vm_madvise {/* Pin the VMA in memory, must be elevated user */ #define DRM_XE_VM_MADVISE_PIN 6 -/** @property: property to set */ -__u32 property; -/** @value: property value */ __u64 value;Signature · 1 line
2.34.1
Re: [Intel-xe] [PATCH 3/5] drm/xe: Move defines after relevant fields
Quoted 5 lines · Lucas De Marchi
Quoted 2 lines · Francois Dugast
Align on same rule in the whoe file: defines come after the relevant fields.
is that a convention from somewhere? See below.
Not that I know. It is one of the patterns previously used in this file but I am fine changing it to what you described below, in a new revision.
Francois
Quoted 214 lines
Quoted 27 lines
Reported-by Oded Gabbay <[email protected]>Signed-off-by Francois Dugast <[email protected]>---
include/uapi/drm/xe_drm.h| 40 +++++++++++++++++++--------------------1 file changed, 20 insertions(+), 20 deletions(-)include/uapi/drm/xe_drm.h +0
-3@@ -116,9 +116,6 @@ struct xe_user_extension {#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise) -#define XE_MEM_REGION_CLASS_SYSMEM 0 -#define XE_MEM_REGION_CLASS_VRAM 1 -struct drm_xe_query_mem_usage {__u32 num_regions;__u32 pad;@@ -135,9 +132,13 @@ struct drm_xe_query_mem_usage { } regions[]; };include/uapi/drm/xe_drm.h struct drm_xe_query_mem_usage { · line 144
Quoted 10 lines
include/uapi/drm/xe_drm.h +4
-0+#define XE_MEM_REGION_CLASS_SYSMEM 0 +#define XE_MEM_REGION_CLASS_VRAM 1 +struct drm_xe_query_config {__u32 num_params;__u32 pad; +__u64 info[];#define XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0#define XE_QUERY_CONFIG_FLAGS 1#define XE_QUERY_CONFIG_FLAGS_HAS_VRAM (0x1 << 0)I thnk it would be much cleaner to go the opposite and ensure a newline in place so it's not ambiguous.
struct drm_xe_query_config { __u32 num_params; __u32 pad;#define
XE_QUERY_CONFIG_REV_AND_DEVICE_ID0
#defineXE_QUERY_CONFIG_FLAGS1#define ... /** @info: .... */ __u64 info[]; };Lucas De Marchi
Quoted 160 lines
include/uapi/drm/xe_drm.h +16
-17@@ -148,7 +149,6 @@ struct drm_xe_query_config {#define XE_QUERY_CONFIG_MEM_REGION_COUNT 5#define XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY 6#define XE_QUERY_CONFIG_NUM_PARAM XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY + 1 -__u64 info[]; };struct drm_xe_query_gts {@@ -161,10 +161,10 @@ struct drm_xe_query_gts {*/ struct drm_xe_query_gt { +__u16 type;#define XE_QUERY_GT_TYPE_MAIN 0#define XE_QUERY_GT_TYPE_REMOTE 1#define XE_QUERY_GT_TYPE_MEDIA 2 -__u16 type;__u16 instance;__u32 clock_freq;__u64 features;@@ -231,9 +231,9 @@ struct drm_xe_gem_create {* @flags: Flags, currently a mask of memory instances of where BO can * be placed */ +__u32 flags;#define XE_GEM_CREATE_FLAG_DEFER_BACKING (0x1 << 24)#define XE_GEM_CREATE_FLAG_SCANOUT (0x1 << 25) -__u32 flags;/** * @vm_id: Attached VM, if any @@ -294,8 +294,8 @@ struct drm_xe_ext_vm_set_property {struct xe_user_extension base;/** @property: property to set */ -#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0__u32 property; +#define XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS 0/** @value: property value */ __u64 value;@@ -306,8 +306,8 @@ struct drm_xe_ext_vm_set_property {struct drm_xe_vm_create {/** @extensions: Pointer to the first extension struct, if any */ -#define XE_VM_EXTENSION_SET_PROPERTY 0__u64 extensions; +#define XE_VM_EXTENSION_SET_PROPERTY 0/** @flags: Flags */ __u32 flags;@@ -368,9 +368,6 @@ struct drm_xe_vm_bind_op {/** @op: Operation to perform (lower 16 bits) and flags (upper 16 bits) */ __u32 op; -/** @mem_region: Memory region to prefetch VMA to, instance not a mask */ -__u32 region; -#define XE_VM_BIND_OP_MAP 0x0#define XE_VM_BIND_OP_UNMAP 0x1#define XE_VM_BIND_OP_MAP_USERPTR 0x2@@ -410,6 +407,9 @@ struct drm_xe_vm_bind_op {*/ #define XE_VM_BIND_FLAG_IMMEDIATE (0x1 << 18) +/** @mem_region: Memory region to prefetch VMA to, instance not a mask */ +__u32 region; +/** @reserved: Reserved */ __u64 reserved[2 ]; };@@ -476,6 +476,7 @@ struct drm_xe_engine_set_property {__u32 engine_id;/** @property: property to set */ +__u32 property;#define XE_ENGINE_SET_PROPERTY_PRIORITY 0#define XE_ENGINE_SET_PROPERTY_TIMESLICE 1#define XE_ENGINE_SET_PROPERTY_PREEMPTION_TIMEOUT 2@@ -491,7 +492,6 @@ struct drm_xe_engine_set_property {#define XE_ENGINE_SET_PROPERTY_ACC_TRIGGER 6#define XE_ENGINE_SET_PROPERTY_ACC_NOTIFY 7#define XE_ENGINE_SET_PROPERTY_ACC_GRANULARITY 8 -__u32 property;/** @value: property value */ __u64 value;@@ -520,8 +520,8 @@ struct drm_xe_engine_class_instance {struct drm_xe_engine_create {/** @extensions: Pointer to the first extension struct, if any */ -#define XE_ENGINE_EXTENSION_SET_PROPERTY 0__u64 extensions; +#define XE_ENGINE_EXTENSION_SET_PROPERTY 0/** @width: submission width (number BB per exec) for this engine */ __u16 width;@@ -559,8 +559,8 @@ struct drm_xe_engine_get_property {__u32 engine_id;/** @property: property to get */ -#define XE_ENGINE_GET_PROPERTY_BAN 0__u32 property; +#define XE_ENGINE_GET_PROPERTY_BAN 0/** @value: property value */ __u64 value;@@ -686,26 +686,26 @@ struct drm_xe_wait_user_fence {__u64 vm_id; };/** @op: wait operation (type of comparison) */ +__u16 op;#define DRM_XE_UFENCE_WAIT_EQ 0#define DRM_XE_UFENCE_WAIT_NEQ 1#define DRM_XE_UFENCE_WAIT_GT 2#define DRM_XE_UFENCE_WAIT_GTE 3#define DRM_XE_UFENCE_WAIT_LT 4#define DRM_XE_UFENCE_WAIT_LTE 5 -__u16 op;/** @flags: wait flags */ +__u16 flags;#define DRM_XE_UFENCE_WAIT_SOFT_OP (1 << 0)/* e.g. Wait on VM bind */ #define DRM_XE_UFENCE_WAIT_ABSTIME (1 << 1)#define DRM_XE_UFENCE_WAIT_VM_ERROR (1 << 2) -__u16 flags;/** @value: compare value */ __u64 value;/** @mask: comparison mask */ +__u64 mask;#define DRM_XE_UFENCE_WAIT_U8 0xffu#define DRM_XE_UFENCE_WAIT_U16 0xffffu#define DRM_XE_UFENCE_WAIT_U32 0xffffffffu#define DRM_XE_UFENCE_WAIT_U64 0xffffffffffffffffu -__u64 mask;/** @timeout: how long to wait before bailing, value in jiffies */ __s64 timeout;/** @@ -736,6 +736,9 @@ struct drm_xe_vm_madvise {/** @addr: Address of the VMA to operation on */ __u64 addr; +/** @property: property to set */ +__u32 property; +/* * Setting the preferred location will trigger a migrate of the VMA * backing store to new location if the backing store is already @@ -771,9 +774,6 @@ struct drm_xe_vm_madvise {/* Pin the VMA in memory, must be elevated user */ #define DRM_XE_VM_MADVISE_PIN 6 -/** @property: property to set */ -__u32 property; -/** @value: property value */ __u64 value;Signature · 1 line
2.34.1
PATCH 4/5 drm/xe: Document usage of struct drm_xe_device_query
In reply to Francois DugastExplain how to use struct drm_xe_device_query, in particular the behavior for size.
--- include/uapi/drm/xe_drm.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
include/uapi/drm/xe_drm.h +28 -0
@@ -117,7 +117,10 @@ struct xe_user_extension {#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise) struct drm_xe_query_mem_usage { + /** @num_params: number of memory regions returned in regions */ __u32 num_regions; + + /** @pad: MBZ */ __u32 pad; struct drm_xe_query_mem_region {
@@ -136,8 +139,13 @@ struct drm_xe_query_mem_usage {#define XE_MEM_REGION_CLASS_VRAM 1struct drm_xe_query_config { +/** @num_params: number of parameters returned in info */ __u32 num_params; + +/** @pad: MBZ */ __u32 pad; + +/** @info: array containing the config info below */ __u64 info[];#define XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0#define XE_QUERY_CONFIG_FLAGS 1
@@ -152,7 +160,10 @@ struct drm_xe_query_config { };struct drm_xe_query_gts { +/** @num_gt: number of GTs returned in gts */ __u32 num_gt; + +/** @pad: MBZ */ __u32 pad;/*
@@ -192,6 +203,23 @@ struct drm_xe_query_topology_mask {__u8 mask[]; }; +/** +* struct drm_xe_device_query - main structure to query device information +* +* If size is set to 0, the driver fills it with the required size for the +* requested type of data to query. If size is equal to the required size, +* the queried information is copied into data. +* +* A typical usage from user space is: +* - create a struct drm_xe_device_query with size = 0 and query = one of +* the types DRM_XE_DEVICE_QUERY_*, for example DRM_XE_DEVICE_QUERY_ENGINES +* - call DRM_IOCTL_XE_DEVICE_QUERY +* - create a pointer to a query struct matching the query type selected +* previously, for example struct drm_xe_engine_class_instance * +* - allocate memory of the size returned in drm_xe_device_query +* - call DRM_IOCTL_XE_DEVICE_QUERY +* - read the queried information in data +*/ struct drm_xe_device_query {/** @extensions: Pointer to the first extension struct, if any */ __u64 extensions;
Signature · 1 line
2.34.1
PATCH 5/5 drm/xe: Fix some formatting issues in uAPI
In reply to Francois Dugast--- include/uapi/drm/xe_drm.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
include/uapi/drm/xe_drm.h +12 -12
@@ -105,16 +105,16 @@ struct xe_user_extension {#define DRM_IOCTL_XE_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_CREATE, struct drm_xe_gem_create)#define DRM_IOCTL_XE_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_MMAP_OFFSET, struct drm_xe_gem_mmap_offset)#define DRM_IOCTL_XE_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_CREATE, struct drm_xe_vm_create) -#define DRM_IOCTL_XE_VM_DESTROY DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy) -#define DRM_IOCTL_XE_VM_BIND DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind) +#define DRM_IOCTL_XE_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy) +#define DRM_IOCTL_XE_VM_BIND DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)#define DRM_IOCTL_XE_ENGINE_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_ENGINE_CREATE, struct drm_xe_engine_create)#define DRM_IOCTL_XE_ENGINE_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_ENGINE_GET_PROPERTY, struct drm_xe_engine_get_property) -#define DRM_IOCTL_XE_ENGINE_DESTROY DRM_IOW( DRM_COMMAND_BASE + DRM_XE_ENGINE_DESTROY, struct drm_xe_engine_destroy) -#define DRM_IOCTL_XE_EXEC DRM_IOW( DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec) +#define DRM_IOCTL_XE_ENGINE_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_ENGINE_DESTROY, struct drm_xe_engine_destroy) +#define DRM_IOCTL_XE_EXEC DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)#define DRM_IOCTL_XE_MMIO DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_MMIO, struct drm_xe_mmio) -#define DRM_IOCTL_XE_ENGINE_SET_PROPERTY DRM_IOW( DRM_COMMAND_BASE + DRM_XE_ENGINE_SET_PROPERTY, struct drm_xe_engine_set_property) +#define DRM_IOCTL_XE_ENGINE_SET_PROPERTY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_ENGINE_SET_PROPERTY, struct drm_xe_engine_set_property)#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence) -#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise) +#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise)struct drm_xe_query_mem_usage {/** @num_params: number of memory regions returned in regions */
@@ -156,7 +156,7 @@ struct drm_xe_query_config {#define XE_QUERY_CONFIG_GT_COUNT 4#define XE_QUERY_CONFIG_MEM_REGION_COUNT 5#define XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY 6 -#define XE_QUERY_CONFIG_NUM_PARAM XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY + 1 +#define XE_QUERY_CONFIG_NUM_PARAM (XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY + 1) };struct drm_xe_query_gts {
@@ -415,8 +415,8 @@ struct drm_xe_vm_bind_op {* If this flag is clear and the IOCTL doesn't return an error, in * practice the bind op is good and will complete. * -* If this flag is set and doesn't return return an error, the bind op -* can still fail and recovery is needed. If configured, the bind op that +* If this flag is set and doesn't return an error, the bind op can +* still fail and recovery is needed. If configured, the bind op that * caused the error will be captured in drm_xe_vm_bind_op_error_capture. * Once the user sees the error (via a ufence + * XE_VM_PROPERTY_BIND_OP_ERROR_CAPTURE_ADDRESS), it should free memory
@@ -653,9 +653,9 @@ struct drm_xe_exec {__u64 syncs;/** -* @address: address of batch buffer if num_batch_buffer == 1 or an -* array of batch buffer addresses -*/ +* @address: address of batch buffer if num_batch_buffer == 1 or an +* array of batch buffer addresses +*/ __u64 address;/**
Signature · 1 line
2.34.1
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for drm/xe: uAPI cleanup
In reply to Francois Dugast== Series Details ==
== Series Details ==
Series: drm/xe: uAPI cleanup
URL : https://patchwork.freedesktop.org/series/118447/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 4b72ead33 drm/xe/pvc: Don't try to invalidate AuxCCS TLB === git am output follows ===
error: patch failed: include/uapi/drm/xe_drm.h:294
error: include/uapi/drm/xe_drm.h: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/xe: Use SPDX-License-Identifier instead of license text
Applying: drm/xe: Group engine related structs
Applying: drm/xe: Move defines after relevant fields
Patch failed at 0003 drm/xe: Move defines after relevant fields When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
Quoted 5 lines · Francois Dugast
This series addresses some feedback on
xe_drm.hprovided here:
https://lists.freedesktop.org/archives/intel-xe/2023-May/004704.htmlIt is based on xe-rev1-2023-05-02, not on drm-xe-next, so it will likely break CI.
humn... not sure it's a good approach. we can have it on top and just commit with --fixup, so it will be squashed in the original commit on next rebase.
Lucas De Marchi
Quoted 14 lines
Francois Dugast (5):
drm/xe: Use SPDX-License-Identifier instead of license text drm/xe: Group engine related structs
drm/xe: Move defines after relevant fields drm/xe: Document usage of structdrm_xe_device_querydrm/xe: Fix some formatting issues in uAPI
include/uapi/drm/xe_drm.h| 152 ++++++++++++++++++++------------------1 file changed, 80 insertions(+), 72 deletions(-)Signature · 1 line
2.34.1