uAPI Alignment - take 2
Subsystems (3)
cover uAPI Alignment - take 2
This is the second take of uAPI updates that would lead to breakage in the compatibility, which it is not acceptable after we are merged upstream. So, let's break it before it is too late, and start upstreaming a good, reliable and clean uapi.
This series is not complete yet but it is sent for early review as some patches are already a few weeks old.
It series is intended to be applied after take 1 [1] which is not merged yet, so it will break CI.
[1] https://patchwork.freedesktop.org/series/124710/
Francois Dugast (10):
fixup! drm/xe: Correlate engine and cpu timestamps with better
accuracy
drm/xe/uapi: Add documentation for query
drm/xe/uapi: Document DRM_XE_DEVICE_QUERY_HWCONFIG drm/xe: Extend uAPI to query HuC micro-controler firmware version drm/xe: Remove useless query config num_params drm/xe/uapi: Add missing DRM_ prefix in uAPI constants drm/xe/uapi: Add _FLAG to uAPI constants usable for flags fixup! drm/xe: Add uAPI to query micro-controler firmware version drm/xe/uapi: Make constant comments visible in kernel doc drm/xe/uapi: Remove unused inaccessible memory region
José Roberto de Souza (1):
drm/xe: Add uAPI to query micro-controler firmware version
Mika Kuoppala (1):
drm/xe: Extend drm_xe_vm_bind_op
Rodrigo Vivi (4):
drm/xe/uapi: Remove GT_TYPE_REMOTE drm/xe/uapi: Kill VM_MADVISE IOCTL drm/xe/uapi: Separate bo_create placement from flags drm/xe/uapi: Be more specific around GuC Version Type
Umesh Nerlige Ramappa (1):
fixup! drm/xe: Correlate engine and cpu timestamps with better
accuracy
drivers/gpu/drm/xe/Makefile | 1 - drivers/gpu/drm/xe/xe_bo.c | 27 +- drivers/gpu/drm/xe/xe_bo_types.h | 3 + drivers/gpu/drm/xe/xe_device.c | 8 +- drivers/gpu/drm/xe/xe_exec_queue.c | 20 +- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_pmu.c | 20 +- drivers/gpu/drm/xe/xe_query.c | 95 +++-- drivers/gpu/drm/xe/xe_sync.c | 16 +- drivers/gpu/drm/xe/xe_vm.c | 86 ++--- drivers/gpu/drm/xe/xe_vm_doc.h | 14 +- drivers/gpu/drm/xe/xe_vm_madvise.c | 299 --------------- drivers/gpu/drm/xe/xe_vm_madvise.h | 15 - drivers/gpu/drm/xe/xe_wait_user_fence.c | 10 +- include/uapi/drm/xe_drm.h | 478 +++++++++++++----------- 15 files changed, 435 insertions(+), 659 deletions(-) delete mode 100644 drivers/gpu/drm/xe/xe_vm_madvise.c delete mode 100644 drivers/gpu/drm/xe/xe_vm_madvise.h
Signature · 1 line
2.34.1
RFC 1/17 fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy
Remove checkpatch warning:
-:126: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #126: FILE: drivers/gpu/drm/xe/xe_query.c:108:
+query_engine_cycles(struct xe_device *xe,
+ struct drm_xe_device_query *query)
--- drivers/gpu/drm/xe/xe_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_query.c +1 -1
@@ -105,7 +105,7 @@ __read_timestamps(struct xe_gt *gt,static int query_engine_cycles (struct xe_device *xe, -struct drm_xe_device_query *query) +struct drm_xe_device_query *query) {struct drm_xe_query_engine_cycles __user *query_ptr;struct drm_xe_engine_class_instance *eci;
Signature · 1 line
2.34.1
RFC 2/17 drm/xe/uapi: Add documentation for query
In reply to Francois DugastProvide a description of the keys used the struct drm_xe_query_config info array. Document the behavior of the driver for IOCTL DRM_IOCTL_XE_DEVICE_QUERY depending on the size value provided in struct drm_xe_device_query.
--- include/uapi/drm/xe_drm.h | 41 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-)
include/uapi/drm/xe_drm.h +38 -3
@@ -321,14 +321,43 @@ struct drm_xe_query_config {/** @pad: MBZ */ __u32 pad; +/* +* Device ID (lower 16 bits) and the device revision (next +* 8 bits) +*/ #define XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0 +/* +* Flags describing the device configuration, see list below +*/ #define XE_QUERY_CONFIG_FLAGS 1 +/* +* Flag is set if the device has usable VRAM +*/ #define XE_QUERY_CONFIG_FLAGS_HAS_VRAM (0x1 << 0) +/* +* Minimal memory alignment required by this device, +* typically SZ_4K or SZ_64K +*/ #define XE_QUERY_CONFIG_MIN_ALIGNMENT 2 +/* +* Maximum bits of a virtual address +*/ #define XE_QUERY_CONFIG_VA_BITS 3 +/* +* Total number of GTs for the entire device +*/ #define XE_QUERY_CONFIG_GT_COUNT 4 +/* +* Total number of accessible memory regions +*/ #define XE_QUERY_CONFIG_MEM_REGION_COUNT 5 +/* +* Value of the highest available exec queue priority +*/ #define XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY 6 +/* +* Number of elements in the info array +*/ #define XE_QUERY_CONFIG_NUM_PARAM (XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)/** @info: array of elements containing the config info */ __u64 info[];
@@ -440,9 +469,15 @@ struct drm_xe_query_topology_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. +* The user selects the type of data to query among DRM_XE_DEVICE_QUERY_* +* and sets the value in the query member. This determines the type of +* the structure provided by the driver in data, among struct drm_xe_query_*. +* +* 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. If size is set to +* a value different from 0 and different from the required size, the +* IOCTL call returns -EINVAL. * * For example the following code snippet allows retrieving and printing * information about the device engines with DRM_XE_DEVICE_QUERY_ENGINES:
Signature · 1 line
2.34.1
RFC 3/17 drm/xe: Extend drm_xe_vm_bind_op
In reply to Francois DugastFrom: Mika Kuoppala <[email protected]>
The bind api is extensible but for a single bind op, there is not a mechanism to extend. Add extensions field to struct drm_xe_vm_bind_op.
--- include/uapi/drm/xe_drm.h | 3 +++ 1 file changed, 3 insertions(+)
include/uapi/drm/xe_drm.h +3 -0
@@ -656,6 +656,9 @@ struct drm_xe_vm_destroy { };struct drm_xe_vm_bind_op { +/** @extensions: Pointer to the first extension struct, if any */ +__u64 extensions; +/** * @obj: GEM object to operate on, MBZ for MAP_USERPTR, MBZ for UNMAP */
Signature · 1 line
2.34.1
RFC 4/17 drm/xe: Add uAPI to query micro-controler firmware version
In reply to Francois DugastFrom: José Roberto de Souza <[email protected]>
Due to a bug in GuC firmware, Mesa can't enable by default the usage of compute engines in DG2 and newer.
A new GuC firmware fixed the issue but until now there was no way for Mesa to know if KMD was running with the fixed GuC version or not, so this uAPI is required.
It may be expanded in future to query other firmware versions too.
More information: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23661
Mesa usage: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25233
v2:
- changed to submission version
- added branch version to be future proof
- checking if pads and reserved are zero
v3:
- add braces around case XE_QUERY_UC_TYPE_GUC to make CI happy
--- drivers/gpu/drm/xe/xe_query.c | 41 +++++++++++++++++++++++++++++++++++ include/uapi/drm/xe_drm.h | 31 ++++++++++++++++++++++++++ 2 files changed, 72 insertions(+)
drivers/gpu/drm/xe/xe_query.c +41 -0
@@ -498,6 +498,46 @@ static int query_gt_topology(struct xe_device *xe,return 0 ; } +static int +query_uc_fw_version (struct xe_device *xe,struct drm_xe_device_query *query) +{ +struct drm_xe_query_uc_fw_version __user *query_ptr =u64_to_user_ptr (query->data); +size_t size =sizeof (struct drm_xe_query_uc_fw_version ); +struct drm_xe_query_uc_fw_version resp; + +if (query->size ==0 ) { + query->size = size; +return 0 ; + }else if (XE_IOCTL_DBG (xe, query->size != size)) { +return -EINVAL ; + } + +if (copy_from_user (&resp, query_ptr, size)) +return -EFAULT ; + +if (XE_IOCTL_DBG (xe, resp.pad || resp.pad2 || resp.reserved)) +return -EINVAL ; + +switch (resp.uc_type) { +case XE_QUERY_UC_TYPE_GUC : { +struct xe_guc *guc = &xe->tiles[0 ].primary_gt->uc.guc; + + resp.major_ver = guc->submission_state.version.major; + resp.minor_ver = guc->submission_state.version.minor; + resp.patch_ver = guc->submission_state.version.patch; + resp.branch_ver =0 ; +break ; + } +default : +return -EINVAL ; + } + +if (copy_to_user (query_ptr, &resp, size)) +return -EFAULT ; + +return 0 ; +} +static int (*const xe_query_funcs[])(struct xe_device *xe,struct drm_xe_device_query *query) = { query_engines,
@@ -507,6 +547,7 @@ static int (* const xe_query_funcs[])(struct xe_device *xe, query_hwconfig, query_gt_topology, query_engine_cycles, + query_uc_fw_version, };int xe_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file)
include/uapi/drm/xe_drm.h +31 -0
@@ -466,6 +466,36 @@ struct drm_xe_query_topology_mask {__u8 mask[]; }; +/** +* struct drm_xe_query_uc_fw_version - query a micro-controller firmware version +* +* Given a uc_type this will return the major, minor, patch and branch version +* of the micro-controller firmware. +*/ +struct drm_xe_query_uc_fw_version { +/** @uc: The micro-controller type to query firmware version */ +#define XE_QUERY_UC_TYPE_GUC 0 +__u16 uc_type; + +/** @pad: MBZ */ +__u16 pad; + +/* @major_ver: major uc fw version */ +__u32 major_ver; +/* @minor_ver: minor uc fw version */ +__u32 minor_ver; +/* @patch_ver: patch uc fw version */ +__u32 patch_ver; +/* @branch_ver: branch uc fw version */ +__u32 branch_ver; + +/** @pad2: MBZ */ +__u32 pad2; + +/** @reserved: Reserved */ +__u64 reserved; +}; +/** * struct drm_xe_device_query - main structure to query device information *
@@ -518,6 +548,7 @@ struct drm_xe_device_query {#define DRM_XE_DEVICE_QUERY_HWCONFIG 4#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6 +#define DRM_XE_DEVICE_QUERY_UC_FW_VERSION 7/** @query: The type of data to query */ __u32 query;
Signature · 1 line
2.34.1
Re: [Intel-xe] [RFC v1 04/17] drm/xe: Add uAPI to query micro-controler firmware version
Quoted 95 lines · Francois Dugast
From: José Roberto de Souza <[email protected]>
Due to a bug in GuC firmware, Mesa can't enable by default the usage of compute engines in DG2 and newer.
A new GuC firmware fixed the issue but until now there was no way for Mesa to know if KMD was running with the fixed GuC version or not, so this uAPI is required.
It may be expanded in future to query other firmware versions too.
More information: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23661
Mesa usage: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25233v2:
- changed to submission version
- added branch version to be future proof
- checking if pads and reserved are zerov3:
- add braces around caseXE_QUERY_UC_TYPE_GUCto make CI happyCc John Harrison <[email protected]>Signed-off-by José Roberto de Souza <[email protected]>--- drivers/gpu/drm/xe/xe_query.c | 41 +++++++++++++++++++++++++++++++++++ include/uapi/drm/xe_drm.h | 31 ++++++++++++++++++++++++++ 2 files changed, 72 insertions(+)drivers/gpu/drm/xe/xe_query.c +41
-0@@ -498,6 +498,46 @@ static int query_gt_topology(struct xe_device *xe,return 0 ; } +static int +query_uc_fw_version (struct xe_device *xe,struct drm_xe_device_query *query) +{ +struct drm_xe_query_uc_fw_version __user *query_ptr =u64_to_user_ptr (query->data); +size_t size =sizeof (struct drm_xe_query_uc_fw_version ); +struct drm_xe_query_uc_fw_version resp; + +if (query->size ==0 ) { + query->size = size; +return 0 ; + }else if (XE_IOCTL_DBG (xe, query->size != size)) { +return -EINVAL ; + } + +if (copy_from_user (&resp, query_ptr, size)) +return -EFAULT ; + +if (XE_IOCTL_DBG (xe, resp.pad || resp.pad2 || resp.reserved)) +return -EINVAL ; + +switch (resp.uc_type) { +case XE_QUERY_UC_TYPE_GUC : { +struct xe_guc *guc = &xe->tiles[0 ].primary_gt->uc.guc; + + resp.major_ver = guc->submission_state.version.major; + resp.minor_ver = guc->submission_state.version.minor; + resp.patch_ver = guc->submission_state.version.patch; + resp.branch_ver =0 ; +break ; + } +default : +return -EINVAL ; + } + +if (copy_to_user (query_ptr, &resp, size)) +return -EFAULT ; + +return 0 ; +} +static int (*const xe_query_funcs[])(struct xe_device *xe,struct drm_xe_device_query *query) = { query_engines,@@ -507,6 +547,7 @@ static int (* const xe_query_funcs[])(struct xe_device *xe, query_hwconfig, query_gt_topology, query_engine_cycles, + query_uc_fw_version, };int xe_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file)include/uapi/drm/xe_drm.h +0
-0@@ -466,6 +466,36 @@ struct drm_xe_query_topology_mask {__u8 mask[]; };
include/uapi/drm/xe_drm.h struct drm_xe_query_topology_mask { · line 477
Quoted 10 lines
include/uapi/drm/xe_drm.h +9
-0+/** +* struct drm_xe_query_uc_fw_version - query a micro-controller firmware version +* +* Given a uc_type this will return the major, minor, patch and branch version +* of the micro-controller firmware. +*/ +struct drm_xe_query_uc_fw_version { +/** @uc: The micro-controller type to query firmware version */ +#define XE_QUERY_UC_TYPE_GUC 0
I thought it was agreed to use TYPE_GUC_SUBMISSION to differentiate from the file version which may need to be added at some point (e.g. for reporting status in a control panel or something).
include/uapi/drm/xe_drm.h struct drm_xe_query_topology_mask { · line 481
Quoted 4 lines
include/uapi/drm/xe_drm.h +4
-0+__u16 uc_type; + +/** @pad: MBZ */ +__u16 pad;
And wasn't there a comment about just using a u32 for the type? What is the advantage to splitting it into two u16 values?
John.
Quoted 28 lines
include/uapi/drm/xe_drm.h +18
-0+ +/* @major_ver: major uc fw version */ +__u32 major_ver; +/* @minor_ver: minor uc fw version */ +__u32 minor_ver; +/* @patch_ver: patch uc fw version */ +__u32 patch_ver; +/* @branch_ver: branch uc fw version */ +__u32 branch_ver; + +/** @pad2: MBZ */ +__u32 pad2; + +/** @reserved: Reserved */ +__u64 reserved; +}; +/** * struct drm_xe_device_query - main structure to query device information * @@ -518,6 +548,7 @@ struct drm_xe_device_query {#define DRM_XE_DEVICE_QUERY_HWCONFIG 4#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6 +#define DRM_XE_DEVICE_QUERY_UC_FW_VERSION 7/** @query: The type of data to query */ __u32 query;
Re: [Intel-xe] [RFC v1 04/17] drm/xe: Add uAPI to query micro-controler firmware version
Quoted 97 lines · John Harrison
Quoted 96 lines · Francois Dugast
From: José Roberto de Souza <[email protected]>
Due to a bug in GuC firmware, Mesa can't enable by default the usage of compute engines in DG2 and newer.
A new GuC firmware fixed the issue but until now there was no way for Mesa to know if KMD was running with the fixed GuC version or not, so this uAPI is required.
It may be expanded in future to query other firmware versions too.
More information: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23661
Mesa usage: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25233v2:
- changed to submission version
- added branch version to be future proof
- checking if pads and reserved are zerov3:
- add braces around caseXE_QUERY_UC_TYPE_GUCto make CI happyCc John Harrison <[email protected]>Signed-off-by José Roberto de Souza <[email protected]>--- drivers/gpu/drm/xe/xe_query.c | 41 +++++++++++++++++++++++++++++++++++ include/uapi/drm/xe_drm.h | 31 ++++++++++++++++++++++++++ 2 files changed, 72 insertions(+)drivers/gpu/drm/xe/xe_query.c +41
-0@@ -498,6 +498,46 @@ static int query_gt_topology(struct xe_device *xe,return 0 ; } +static int +query_uc_fw_version (struct xe_device *xe,struct drm_xe_device_query *query) +{ +struct drm_xe_query_uc_fw_version __user *query_ptr =u64_to_user_ptr (query->data); +size_t size =sizeof (struct drm_xe_query_uc_fw_version ); +struct drm_xe_query_uc_fw_version resp; + +if (query->size ==0 ) { + query->size = size; +return 0 ; + }else if (XE_IOCTL_DBG (xe, query->size != size)) { +return -EINVAL ; + } + +if (copy_from_user (&resp, query_ptr, size)) +return -EFAULT ; + +if (XE_IOCTL_DBG (xe, resp.pad || resp.pad2 || resp.reserved)) +return -EINVAL ; + +switch (resp.uc_type) { +case XE_QUERY_UC_TYPE_GUC : { +struct xe_guc *guc = &xe->tiles[0 ].primary_gt->uc.guc; + + resp.major_ver = guc->submission_state.version.major; + resp.minor_ver = guc->submission_state.version.minor; + resp.patch_ver = guc->submission_state.version.patch; + resp.branch_ver =0 ; +break ; + } +default : +return -EINVAL ; + } + +if (copy_to_user (query_ptr, &resp, size)) +return -EFAULT ; + +return 0 ; +} +static int (*const xe_query_funcs[])(struct xe_device *xe,struct drm_xe_device_query *query) = { query_engines,@@ -507,6 +547,7 @@ static int (* const xe_query_funcs[])(struct xe_device *xe, query_hwconfig, query_gt_topology, query_engine_cycles, + query_uc_fw_version, };int xe_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file)include/uapi/drm/xe_drm.h +0
-0@@ -466,6 +466,36 @@ struct drm_xe_query_topology_mask {__u8 mask[]; };
Quoted 12 lines
include/uapi/drm/xe_drm.h struct drm_xe_query_topology_mask { · line 477
Quoted 9 lines
include/uapi/drm/xe_drm.h +9
-0+/** +* struct drm_xe_query_uc_fw_version - query a micro-controller firmware version +* +* Given a uc_type this will return the major, minor, patch and branch version +* of the micro-controller firmware. +*/ +struct drm_xe_query_uc_fw_version { +/** @uc: The micro-controller type to query firmware version */ +#define XE_QUERY_UC_TYPE_GUC 0I thought it was agreed to use
TYPE_GUC_SUBMISSIONto differentiate from the file version which may need to be added at some point (e.g. for reporting status in a control panel or something).
It is being renamed in '[RFC v1 16/17] drm/xe/uapi: Be more specific around GuC Version Type'
In my opinion it should be squashed but up to Francois and Rodrigo.
Quoted 7 lines
include/uapi/drm/xe_drm.h struct drm_xe_query_topology_mask { · line 481
Quoted 5 lines
include/uapi/drm/xe_drm.h +4
-0+__u16 uc_type; + +/** @pad: MBZ */ +__u16 pad;And wasn't there a comment about just using a u32 for the type? What is the advantage to splitting it into two u16 values?
yeah good point or rename to rsvd so it can be used in future.
Quoted 32 lines
John.
Quoted 28 lines
include/uapi/drm/xe_drm.h +18
-0+ +/* @major_ver: major uc fw version */ +__u32 major_ver; +/* @minor_ver: minor uc fw version */ +__u32 minor_ver; +/* @patch_ver: patch uc fw version */ +__u32 patch_ver; +/* @branch_ver: branch uc fw version */ +__u32 branch_ver; + +/** @pad2: MBZ */ +__u32 pad2; + +/** @reserved: Reserved */ +__u64 reserved; +}; +/** * struct drm_xe_device_query - main structure to query device information * @@ -518,6 +548,7 @@ struct drm_xe_device_query {#define DRM_XE_DEVICE_QUERY_HWCONFIG 4#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6 +#define DRM_XE_DEVICE_QUERY_UC_FW_VERSION 7/** @query: The type of data to query */ __u32 query;
Re: [Intel-xe] [RFC v1 04/17] drm/xe: Add uAPI to query micro-controler firmware version
Quoted 116 lines · Jose
Quoted 97 lines · John Harrison
Quoted 96 lines · Francois Dugast
From: José Roberto de Souza <[email protected]>
Due to a bug in GuC firmware, Mesa can't enable by default the usage of compute engines in DG2 and newer.
A new GuC firmware fixed the issue but until now there was no way for Mesa to know if KMD was running with the fixed GuC version or not, so this uAPI is required.
It may be expanded in future to query other firmware versions too.
More information: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23661
Mesa usage: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25233v2:
- changed to submission version
- added branch version to be future proof
- checking if pads and reserved are zerov3:
- add braces around caseXE_QUERY_UC_TYPE_GUCto make CI happyCc John Harrison <[email protected]>Signed-off-by José Roberto de Souza <[email protected]>--- drivers/gpu/drm/xe/xe_query.c | 41 +++++++++++++++++++++++++++++++++++ include/uapi/drm/xe_drm.h | 31 ++++++++++++++++++++++++++ 2 files changed, 72 insertions(+)drivers/gpu/drm/xe/xe_query.c +41
-0@@ -498,6 +498,46 @@ static int query_gt_topology(struct xe_device *xe,return 0 ; } +static int +query_uc_fw_version (struct xe_device *xe,struct drm_xe_device_query *query) +{ +struct drm_xe_query_uc_fw_version __user *query_ptr =u64_to_user_ptr (query->data); +size_t size =sizeof (struct drm_xe_query_uc_fw_version ); +struct drm_xe_query_uc_fw_version resp; + +if (query->size ==0 ) { + query->size = size; +return 0 ; + }else if (XE_IOCTL_DBG (xe, query->size != size)) { +return -EINVAL ; + } + +if (copy_from_user (&resp, query_ptr, size)) +return -EFAULT ; + +if (XE_IOCTL_DBG (xe, resp.pad || resp.pad2 || resp.reserved)) +return -EINVAL ; + +switch (resp.uc_type) { +case XE_QUERY_UC_TYPE_GUC : { +struct xe_guc *guc = &xe->tiles[0 ].primary_gt->uc.guc; + + resp.major_ver = guc->submission_state.version.major; + resp.minor_ver = guc->submission_state.version.minor; + resp.patch_ver = guc->submission_state.version.patch; + resp.branch_ver =0 ; +break ; + } +default : +return -EINVAL ; + } + +if (copy_to_user (query_ptr, &resp, size)) +return -EFAULT ; + +return 0 ; +} +static int (*const xe_query_funcs[])(struct xe_device *xe,struct drm_xe_device_query *query) = { query_engines,@@ -507,6 +547,7 @@ static int (* const xe_query_funcs[])(struct xe_device *xe, query_hwconfig, query_gt_topology, query_engine_cycles, + query_uc_fw_version, };int xe_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file)include/uapi/drm/xe_drm.h +0
-0@@ -466,6 +466,36 @@ struct drm_xe_query_topology_mask {__u8 mask[]; };Quoted 12 lines
include/uapi/drm/xe_drm.h struct drm_xe_query_topology_mask { · line 477
Quoted 9 lines
include/uapi/drm/xe_drm.h +9
-0+/** +* struct drm_xe_query_uc_fw_version - query a micro-controller firmware version +* +* Given a uc_type this will return the major, minor, patch and branch version +* of the micro-controller firmware. +*/ +struct drm_xe_query_uc_fw_version { +/** @uc: The micro-controller type to query firmware version */ +#define XE_QUERY_UC_TYPE_GUC 0I thought it was agreed to use
TYPE_GUC_SUBMISSIONto differentiate from the file version which may need to be added at some point (e.g. for reporting status in a control panel or something).It is being renamed in '[RFC v1 16/17] drm/xe/uapi: Be more specific around GuC Version Type'
In my opinion it should be squashed but up to Francois and Rodrigo.
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
include/uapi/drm/xe_drm.h struct drm_xe_query_topology_mask { · line 481
Quoted 4 lines
include/uapi/drm/xe_drm.h +4
-0+__u16 uc_type; + +/** @pad: MBZ */ +__u16 pad;And wasn't there a comment about just using a u32 for the type? What is the advantage to splitting it into two u16 values?
yeah good point or rename to rsvd so it can be used in future.
Sure this will be in the next version.
Francois
Quoted 35 lines
Quoted 34 lines
John.
Quoted 28 lines
include/uapi/drm/xe_drm.h +18
-0+ +/* @major_ver: major uc fw version */ +__u32 major_ver; +/* @minor_ver: minor uc fw version */ +__u32 minor_ver; +/* @patch_ver: patch uc fw version */ +__u32 patch_ver; +/* @branch_ver: branch uc fw version */ +__u32 branch_ver; + +/** @pad2: MBZ */ +__u32 pad2; + +/** @reserved: Reserved */ +__u64 reserved; +}; +/** * struct drm_xe_device_query - main structure to query device information * @@ -518,6 +548,7 @@ struct drm_xe_device_query {#define DRM_XE_DEVICE_QUERY_HWCONFIG 4#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6 +#define DRM_XE_DEVICE_QUERY_UC_FW_VERSION 7/** @query: The type of data to query */ __u32 query;
RFC 5/17 drm/xe/uapi: Document DRM_XE_DEVICE_QUERY_HWCONFIG
In reply to Francois DugastAdd a documentation on the content and format of when using query type DRM_XE_DEVICE_QUERY_HWCONFIG. The list of keys can be found in IGT under lib/intel_hwconfig_types.h.
--- include/uapi/drm/xe_drm.h | 5 +++++ 1 file changed, 5 insertions(+)
include/uapi/drm/xe_drm.h +5 -0
@@ -545,6 +545,11 @@ struct drm_xe_device_query {#define DRM_XE_DEVICE_QUERY_MEM_USAGE 1#define DRM_XE_DEVICE_QUERY_CONFIG 2#define DRM_XE_DEVICE_QUERY_GT_LIST 3 +/* +* Query type to retrieve the hardware configuration of the device +* such as information on slices, memory, caches, and so on. It is +* provided as a table of attributes (key / value). +*/ #define DRM_XE_DEVICE_QUERY_HWCONFIG 4#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6
Signature · 1 line
2.34.1
RFC 6/17 drm/xe: Extend uAPI to query HuC micro-controler firmware version
In reply to Francois DugastThe infrastructure to query GuC firmware version is already in place. It is extended with a new micro-controller type to query the HuC firmware version. It can be used from user space to know if HuC is running.
--- drivers/gpu/drm/xe/xe_query.c | 9 +++++++++ include/uapi/drm/xe_drm.h | 1 + 2 files changed, 10 insertions(+)
drivers/gpu/drm/xe/xe_query.c +9 -0
@@ -528,6 +528,15 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query) resp.branch_ver =0 ;break ; } +case XE_QUERY_UC_TYPE_HUC : { +struct xe_huc *huc = &xe->tiles[0 ].primary_gt->uc.huc; + + resp.major_ver = huc->fw.major_ver_found; + resp.minor_ver = huc->fw.minor_ver_found; + resp.patch_ver = huc->fw.patch_ver_found; + resp.branch_ver =0 ; +break ; + }default :return -EINVAL ; }
include/uapi/drm/xe_drm.h +1 -0
@@ -475,6 +475,7 @@ struct drm_xe_query_topology_mask {struct drm_xe_query_uc_fw_version {/** @uc: The micro-controller type to query firmware version */ #define XE_QUERY_UC_TYPE_GUC 0 +#define XE_QUERY_UC_TYPE_HUC 1__u16 uc_type;/** @pad: MBZ */
Signature · 1 line
2.34.1
RFC 7/17 drm/xe: Remove useless query config num_params
In reply to Francois Dugastnum_params is only used to represent the number of query types. Removing it as it is useless and should not be used.
--- drivers/gpu/drm/xe/xe_query.c | 6 +++--- include/uapi/drm/xe_drm.h | 7 ------- 2 files changed, 3 insertions(+), 10 deletions(-)
drivers/gpu/drm/xe/xe_query.c +3 -3
@@ -305,9 +305,10 @@ static int query_memory_usage(struct xe_device *xe,static int query_config (struct xe_device *xe,struct drm_xe_device_query *query) { -u32 num_params =XE_QUERY_CONFIG_NUM_PARAM ; +#define XE_QUERY_CONFIG_NUM_PARAM (XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)size_t size = -sizeof (struct drm_xe_query_config ) + num_params *sizeof (u64); +sizeof (struct drm_xe_query_config ) + +XE_QUERY_CONFIG_NUM_PARAM *sizeof (u64);struct drm_xe_query_config __user *query_ptr =u64_to_user_ptr (query->data);struct drm_xe_query_config *config;
@@ -323,7 +324,6 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)if (!config)return -ENOMEM ; - config->num_params = num_params; config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID ] = xe->info.devid | (xe->info.revid <<16 );if (xe_device_get_root_tile (xe)->mem.vram.usable_size)
include/uapi/drm/xe_drm.h +0 -7
@@ -315,9 +315,6 @@ struct drm_xe_query_mem_usage {* struct drm_xe_query_config in .data. */ struct drm_xe_query_config { -/** @num_params: number of parameters returned in info */ -__u32 num_params; -/** @pad: MBZ */ __u32 pad;
@@ -355,10 +352,6 @@ struct drm_xe_query_config {* Value of the highest available exec queue priority */ #define XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY 6 -/* -* Number of elements in the info array -*/ -#define XE_QUERY_CONFIG_NUM_PARAM (XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)/** @info: array of elements containing the config info */ __u64 info[]; };
Signature · 1 line
2.34.1
RFC 8/17 drm/xe/uapi: Add missing DRM_ prefix in uAPI constants
In reply to Francois DugastMost constants defined in xe_drm.h use DRM_XE_ as prefix which is helpful to identify the name space. Make this systematic and add this prefix where it was missing.
v2:
- fix vertical alignment of define values
- remove double DRM_ in some variables (José Roberto de Souza)
--- drivers/gpu/drm/xe/xe_bo.c | 14 +-- drivers/gpu/drm/xe/xe_exec_queue.c | 20 ++--- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_pmu.c | 20 ++--- drivers/gpu/drm/xe/xe_query.c | 38 ++++---- drivers/gpu/drm/xe/xe_vm.c | 54 +++++------ drivers/gpu/drm/xe/xe_vm_doc.h | 12 +-- drivers/gpu/drm/xe/xe_vm_madvise.c | 8 +- include/uapi/drm/xe_drm.h | 140 ++++++++++++++--------------- 9 files changed, 154 insertions(+), 154 deletions(-)
drivers/gpu/drm/xe/xe_bo.c +7 -7
@@ -208,7 +208,7 @@ static int __xe_bo_placement_for_flags(struct xe_device *xe, struct xe_bo *bo,/* The order of placements should indicate preferred location */ -if (bo->props.preferred_mem_class ==XE_MEM_REGION_CLASS_SYSMEM ) { +if (bo->props.preferred_mem_class ==DRM_XE_MEM_REGION_CLASS_SYSMEM ) {try_add_system (bo, places, bo_flags, &c);try_add_vram (xe, bo, places, bo_flags, &c); }else {
@@ -1773,9 +1773,9 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ;if (XE_IOCTL_DBG (xe, args->flags & - ~(XE_GEM_CREATE_FLAG_DEFER_BACKING | -XE_GEM_CREATE_FLAG_SCANOUT | -XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM | + ~(DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING | +DRM_XE_GEM_CREATE_FLAG_SCANOUT | +DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM | xe->info.mem_region_mask)))return -EINVAL ;
@@ -1795,15 +1795,15 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,if (XE_IOCTL_DBG (xe, args->size & ~PAGE_MASK ))return -EINVAL ; -if (args->flags &XE_GEM_CREATE_FLAG_DEFER_BACKING ) +if (args->flags &DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING ) bo_flags |=XE_BO_DEFER_BACKING ; -if (args->flags &XE_GEM_CREATE_FLAG_SCANOUT ) +if (args->flags &DRM_XE_GEM_CREATE_FLAG_SCANOUT ) bo_flags |=XE_BO_SCANOUT_BIT ; bo_flags |= args->flags << (ffs (XE_BO_CREATE_SYSTEM_BIT ) -1 ); -if (args->flags &XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ) { +if (args->flags &DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ) {if (XE_IOCTL_DBG (xe, !(bo_flags &XE_BO_CREATE_VRAM_MASK )))return -EINVAL ;
drivers/gpu/drm/xe/xe_exec_queue.c +10 -10
@@ -403,14 +403,14 @@ typedef int (*xe_exec_queue_set_property_fn)(struct xe_device *xe, u64 value, bool create);static const xe_exec_queue_set_property_fn exec_queue_set_property_funcs[] = { - [XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY ] = exec_queue_set_priority, - [XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE ] = exec_queue_set_timeslice, - [XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT ] = exec_queue_set_preemption_timeout, - [XE_EXEC_QUEUE_SET_PROPERTY_PERSISTENCE ] = exec_queue_set_persistence, - [XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT ] = exec_queue_set_job_timeout, - [XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER ] = exec_queue_set_acc_trigger, - [XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY ] = exec_queue_set_acc_notify, - [XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY ] = exec_queue_set_acc_granularity, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY ] = exec_queue_set_priority, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE ] = exec_queue_set_timeslice, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT ] = exec_queue_set_preemption_timeout, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_PERSISTENCE ] = exec_queue_set_persistence, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT ] = exec_queue_set_job_timeout, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER ] = exec_queue_set_acc_trigger, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY ] = exec_queue_set_acc_notify, + [DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY ] = exec_queue_set_acc_granularity, }; static int exec_queue_user_ext_set_property(struct xe_device *xe,
@@ -442,7 +442,7 @@ typedef int (*xe_exec_queue_user_extension_fn)(struct xe_device *xe, bool create);static const xe_exec_queue_set_property_fn exec_queue_user_extension_funcs[] = { - [XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY ] = exec_queue_user_ext_set_property, + [DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY ] = exec_queue_user_ext_set_property, };#define MAX_USER_EXTENSIONS 16
@@ -761,7 +761,7 @@ int xe_exec_queue_get_property_ioctl(struct drm_device *dev, void *data,return -ENOENT ;switch (args->property) { -case XE_EXEC_QUEUE_GET_PROPERTY_BAN : +case DRM_XE_EXEC_QUEUE_GET_PROPERTY_BAN : args->value = !!(q->flags &EXEC_QUEUE_FLAG_BANNED ); ret =0 ;break ;
drivers/gpu/drm/xe/xe_gt.c +1 -1
@@ -534,7 +534,7 @@ static void xe_uevent_gt_reset_failure(struct pci_dev *pdev, u8 tile_id, u8 gt_i {char *reset_event[4 ]; - reset_event[0 ] =XE_RESET_FAILED_UEVENT "=NEEDS_RESET" ; + reset_event[0 ] =DRM_XE_RESET_FAILED_UEVENT "=NEEDS_RESET" ; reset_event[1 ] =kasprintf (GFP_KERNEL ,"TILE_ID=%d" , tile_id); reset_event[2 ] =kasprintf (GFP_KERNEL ,"GT_ID=%d" , gt_id); reset_event[3 ] =NULL ;
drivers/gpu/drm/xe/xe_pmu.c +10 -10
@@ -114,17 +114,17 @@ config_status(struct xe_device *xe, u64 config)return -ENOENT ;switch (config_counter (config)) { -case XE_PMU_INTERRUPTS (0 ): +case DRM_XE_PMU_INTERRUPTS (0 ):if (gt_id)return -ENOENT ;break ; -case XE_PMU_RENDER_GROUP_BUSY (0 ): -case XE_PMU_COPY_GROUP_BUSY (0 ): -case XE_PMU_ANY_ENGINE_GROUP_BUSY (0 ): +case DRM_XE_PMU_RENDER_GROUP_BUSY (0 ): +case DRM_XE_PMU_COPY_GROUP_BUSY (0 ): +case DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY (0 ):if (gt->info.type ==XE_GT_TYPE_MEDIA )return -ENOENT ;break ; -case XE_PMU_MEDIA_GROUP_BUSY (0 ): +case DRM_XE_PMU_MEDIA_GROUP_BUSY (0 ):if (!(gt->info.engine_mask & (BIT (XE_HW_ENGINE_VCS0 ) |BIT (XE_HW_ENGINE_VECS0 ))))return -ENOENT ;break ;
@@ -185,13 +185,13 @@ static u64 __xe_pmu_event_read(struct perf_event *event)u64 val;switch (config_counter (config)) { -case XE_PMU_INTERRUPTS (0 ): +case DRM_XE_PMU_INTERRUPTS (0 ): val =READ_ONCE (pmu->irq_count);break ; -case XE_PMU_RENDER_GROUP_BUSY (0 ): -case XE_PMU_COPY_GROUP_BUSY (0 ): -case XE_PMU_ANY_ENGINE_GROUP_BUSY (0 ): -case XE_PMU_MEDIA_GROUP_BUSY (0 ): +case DRM_XE_PMU_RENDER_GROUP_BUSY (0 ): +case DRM_XE_PMU_COPY_GROUP_BUSY (0 ): +case DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY (0 ): +case DRM_XE_PMU_MEDIA_GROUP_BUSY (0 ): val =engine_group_busyness_read (gt, config);break ;default :
drivers/gpu/drm/xe/xe_query.c +19 -19
@@ -261,7 +261,7 @@ static int query_memory_usage(struct xe_device *xe,return -ENOMEM ; man =ttm_manager_type (&xe->ttm,XE_PL_TT ); - usage->regions[0 ].mem_class =XE_MEM_REGION_CLASS_SYSMEM ; + usage->regions[0 ].mem_class =DRM_XE_MEM_REGION_CLASS_SYSMEM ; usage->regions[0 ].instance =0 ; usage->regions[0 ].min_page_size =PAGE_SIZE ; usage->regions[0 ].total_size = man->size <<PAGE_SHIFT ;
@@ -273,7 +273,7 @@ static int query_memory_usage(struct xe_device *xe, man =ttm_manager_type (&xe->ttm, i);if (man) { usage->regions[usage->num_regions].mem_class = -XE_MEM_REGION_CLASS_VRAM ; +DRM_XE_MEM_REGION_CLASS_VRAM ; usage->regions[usage->num_regions].instance = usage->num_regions; usage->regions[usage->num_regions].min_page_size =
@@ -305,7 +305,7 @@ static int query_memory_usage(struct xe_device *xe,static int query_config (struct xe_device *xe,struct drm_xe_device_query *query) { -#define XE_QUERY_CONFIG_NUM_PARAM (XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1) +#define XE_QUERY_CONFIG_NUM_PARAM (DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)size_t size =sizeof (struct drm_xe_query_config ) +XE_QUERY_CONFIG_NUM_PARAM *sizeof (u64);
@@ -324,18 +324,18 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)if (!config)return -ENOMEM ; - config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID ] = + config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID ] = xe->info.devid | (xe->info.revid <<16 );if (xe_device_get_root_tile (xe)->mem.vram.usable_size) - config->info[XE_QUERY_CONFIG_FLAGS ] = -XE_QUERY_CONFIG_FLAGS_HAS_VRAM ; - config->info[XE_QUERY_CONFIG_MIN_ALIGNMENT ] = + config->info[DRM_XE_QUERY_CONFIG_FLAGS ] = +DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM ; + config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT ] = xe->info.vram_flags &XE_VRAM_FLAGS_NEED64K ?SZ_64K :SZ_4K ; - config->info[XE_QUERY_CONFIG_VA_BITS ] = xe->info.va_bits; - config->info[XE_QUERY_CONFIG_GT_COUNT ] = xe->info.gt_count; - config->info[XE_QUERY_CONFIG_MEM_REGION_COUNT ] = + config->info[DRM_XE_QUERY_CONFIG_VA_BITS ] = xe->info.va_bits; + config->info[DRM_XE_QUERY_CONFIG_GT_COUNT ] = xe->info.gt_count; + config->info[DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT ] =hweight_long (xe->info.mem_region_mask); - config->info[XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY ] = + config->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY ] =xe_exec_queue_device_get_max_priority (xe);if (copy_to_user (query_ptr, config, size)) {
@@ -371,11 +371,11 @@ static int query_gt_list(struct xe_device *xe, struct drm_xe_device_query *query gt_list->num_gt = xe->info.gt_count;for_each_gt (gt, xe, id) {if (xe_gt_is_media_type (gt)) - gt_list->gt_list[id].type =XE_QUERY_GT_TYPE_MEDIA ; + gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_MEDIA ;else if (gt_to_tile (gt)->id >0 ) - gt_list->gt_list[id].type =XE_QUERY_GT_TYPE_REMOTE ; + gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_REMOTE ;else - gt_list->gt_list[id].type =XE_QUERY_GT_TYPE_MAIN ; + gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_MAIN ; gt_list->gt_list[id].gt_id = gt->info.id; gt_list->gt_list[id].clock_freq = gt->info.clock_freq;if (!IS_DGFX (xe))
@@ -473,21 +473,21 @@ static int query_gt_topology(struct xe_device *xe,for_each_gt (gt, xe, id) { topo.gt_id = id; - topo.type =XE_TOPO_DSS_GEOMETRY ; + topo.type =DRM_XE_TOPO_DSS_GEOMETRY ; query_ptr =copy_mask (query_ptr, &topo, gt->fuse_topo.g_dss_mask,sizeof (gt->fuse_topo.g_dss_mask));if (IS_ERR (query_ptr))return PTR_ERR (query_ptr); - topo.type =XE_TOPO_DSS_COMPUTE ; + topo.type =DRM_XE_TOPO_DSS_COMPUTE ; query_ptr =copy_mask (query_ptr, &topo, gt->fuse_topo.c_dss_mask,sizeof (gt->fuse_topo.c_dss_mask));if (IS_ERR (query_ptr))return PTR_ERR (query_ptr); - topo.type =XE_TOPO_EU_PER_DSS ; + topo.type =DRM_XE_TOPO_EU_PER_DSS ; query_ptr =copy_mask (query_ptr, &topo, gt->fuse_topo.eu_mask_per_dss,sizeof (gt->fuse_topo.eu_mask_per_dss));
@@ -519,7 +519,7 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)return -EINVAL ;switch (resp.uc_type) { -case XE_QUERY_UC_TYPE_GUC : { +case DRM_XE_QUERY_UC_TYPE_GUC : {struct xe_guc *guc = &xe->tiles[0 ].primary_gt->uc.guc; resp.major_ver = guc->submission_state.version.major;
@@ -528,7 +528,7 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query) resp.branch_ver =0 ;break ; } -case XE_QUERY_UC_TYPE_HUC : { +case DRM_XE_QUERY_UC_TYPE_HUC : {struct xe_huc *huc = &xe->tiles[0 ].primary_gt->uc.huc; resp.major_ver = huc->fw.major_ver_found;
drivers/gpu/drm/xe/xe_vm.c +27 -27
127 lines not on this page · raw message
drivers/gpu/drm/xe/xe_vm_doc.h +6 -6
@@ -32,9 +32,9 @@* Operations * ---------- * -* XE_VM_BIND_OP_MAP - Create mapping for a BO -* XE_VM_BIND_OP_UNMAP - Destroy mapping for a BO / userptr -* XE_VM_BIND_OP_MAP_USERPTR - Create mapping for userptr +* DRM_XE_VM_BIND_OP_MAP - Create mapping for a BO +* DRM_XE_VM_BIND_OP_UNMAP - Destroy mapping for a BO / userptr +* DRM_XE_VM_BIND_OP_MAP_USERPTR - Create mapping for userptr * * Implementation details * ~~~~~~~~~~~~~~~~~~~~~~
@@ -113,7 +113,7 @@* VM uses to report errors to. The ufence wait interface can be used to wait on * a VM going into an error state. Once an error is reported the VM's async * worker is paused. While the VM's async worker is paused sync, -* XE_VM_BIND_OP_UNMAP operations are allowed (this can free memory). Once the +* DRM_XE_VM_BIND_OP_UNMAP operations are allowed (this can free memory). Once the * uses believe the error state is fixed, the async worker can be resumed via * XE_VM_BIND_OP_RESTART operation. When VM async bind work is restarted, the * first operation processed is the operation that caused the original error.
@@ -193,7 +193,7 @@* In a VM is in fault mode (TODO: link to fault mode), new bind operations that * create mappings are by default are deferred to the page fault handler (first * use). This behavior can be overriden by setting the flag -* XE_VM_BIND_FLAG_IMMEDIATE which indicates to creating the mapping +* DRM_XE_VM_BIND_FLAG_IMMEDIATE which indicates to creating the mapping * immediately. * * User pointer
@@ -322,7 +322,7 @@* * By default, on a faulting VM binds just allocate the VMA and the actual * updating of the page tables is defered to the page fault handler. This -* behavior can be overridden by setting the flag XE_VM_BIND_FLAG_IMMEDIATE in +* behavior can be overridden by setting the flag DRM_XE_VM_BIND_FLAG_IMMEDIATE in * the VM bind which will then do the bind immediately. * * Page fault handler
drivers/gpu/drm/xe/xe_vm_madvise.c +4 -4
@@ -19,10 +19,10 @@ static int madvise_preferred_mem_class(struct xe_device *xe, struct xe_vm *vm, {int i, err; -if (XE_IOCTL_DBG (xe, value >XE_MEM_REGION_CLASS_VRAM )) +if (XE_IOCTL_DBG (xe, value >DRM_XE_MEM_REGION_CLASS_VRAM ))return -EINVAL ; -if (XE_IOCTL_DBG (xe, value ==XE_MEM_REGION_CLASS_VRAM && +if (XE_IOCTL_DBG (xe, value ==DRM_XE_MEM_REGION_CLASS_VRAM && !xe->info.is_dgfx))return -EINVAL ;
@@ -75,10 +75,10 @@ static int madvise_preferred_mem_class_gt(struct xe_device *xe,u32 gt_id =upper_32_bits (value);u32 mem_class =lower_32_bits (value); -if (XE_IOCTL_DBG (xe, mem_class >XE_MEM_REGION_CLASS_VRAM )) +if (XE_IOCTL_DBG (xe, mem_class >DRM_XE_MEM_REGION_CLASS_VRAM ))return -EINVAL ; -if (XE_IOCTL_DBG (xe, mem_class ==XE_MEM_REGION_CLASS_VRAM && +if (XE_IOCTL_DBG (xe, mem_class ==DRM_XE_MEM_REGION_CLASS_VRAM && !xe->info.is_dgfx))return -EINVAL ;
include/uapi/drm/xe_drm.h +70 -70
336 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC 9/17 drm/xe/uapi: Add _FLAG to uAPI constants usable for flags
In reply to Francois DugastMost constants defined in xe_drm.h which can be used for flags are named DRM_XE_*_FLAG_*, which is helpful to identify them. Make this systematic and add _FLAG where it was missing.
--- drivers/gpu/drm/xe/xe_sync.c | 16 ++++++------- drivers/gpu/drm/xe/xe_vm.c | 32 ++++++++++++------------- drivers/gpu/drm/xe/xe_vm_doc.h | 2 +- drivers/gpu/drm/xe/xe_wait_user_fence.c | 10 ++++---- include/uapi/drm/xe_drm.h | 30 +++++++++++------------ 5 files changed, 45 insertions(+), 45 deletions(-)
drivers/gpu/drm/xe/xe_sync.c +8 -8
@@ -110,14 +110,14 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef,return -EFAULT ;if (XE_IOCTL_DBG (xe, sync_in.flags & - ~(SYNC_FLAGS_TYPE_MASK |DRM_XE_SYNC_SIGNAL )) || + ~(SYNC_FLAGS_TYPE_MASK |DRM_XE_SYNC_FLAG_SIGNAL )) ||XE_IOCTL_DBG (xe, sync_in.pad) ||XE_IOCTL_DBG (xe, sync_in.reserved[0 ] || sync_in.reserved[1 ]))return -EINVAL ; - signal = sync_in.flags &DRM_XE_SYNC_SIGNAL ; + signal = sync_in.flags &DRM_XE_SYNC_FLAG_SIGNAL ;switch (sync_in.flags &SYNC_FLAGS_TYPE_MASK ) { -case DRM_XE_SYNC_SYNCOBJ : +case DRM_XE_SYNC_FLAG_SYNCOBJ :if (XE_IOCTL_DBG (xe, no_dma_fences && signal))return -EOPNOTSUPP ;
@@ -135,7 +135,7 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef, }break ; -case DRM_XE_SYNC_TIMELINE_SYNCOBJ : +case DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ :if (XE_IOCTL_DBG (xe, no_dma_fences && signal))return -EOPNOTSUPP ;
@@ -165,12 +165,12 @@ int xe_sync_entry_parse(struct xe_device *xe, struct xe_file *xef, }break ; -case DRM_XE_SYNC_DMA_BUF : +case DRM_XE_SYNC_FLAG_DMA_BUF :if (XE_IOCTL_DBG (xe,"TODO" ))return -EINVAL ;break ; -case DRM_XE_SYNC_USER_FENCE : +case DRM_XE_SYNC_FLAG_USER_FENCE :if (XE_IOCTL_DBG (xe, !signal))return -EOPNOTSUPP ;
@@ -225,7 +225,7 @@ int xe_sync_entry_add_deps(struct xe_sync_entry *sync, struct xe_sched_job *job)void xe_sync_entry_signal (struct xe_sync_entry *sync,struct xe_sched_job *job,struct dma_fence *fence) { -if (!(sync->flags &DRM_XE_SYNC_SIGNAL )) +if (!(sync->flags &DRM_XE_SYNC_FLAG_SIGNAL ))return ;if (sync->chain_fence) {
@@ -253,7 +253,7 @@ void xe_sync_entry_signal(struct xe_sync_entry *sync, struct xe_sched_job *job,dma_fence_put (fence); } }else if ((sync->flags &SYNC_FLAGS_TYPE_MASK ) == -DRM_XE_SYNC_USER_FENCE ) { +DRM_XE_SYNC_FLAG_USER_FENCE ) { job->user_fence.used = true; job->user_fence.addr = sync->addr; job->user_fence.value = sync->timeline_value;
drivers/gpu/drm/xe/xe_vm.c +16 -16
@@ -1911,10 +1911,10 @@ static int xe_vm_unbind(struct xe_vm *vm, struct xe_vma *vma,return 0 ; } -#define ALL_DRM_XE_VM_CREATE_FLAGS (DRM_XE_VM_CREATE_SCRATCH_PAGE | \ - DRM_XE_VM_CREATE_COMPUTE_MODE | \ - DRM_XE_VM_CREATE_ASYNC_DEFAULT | \ - DRM_XE_VM_CREATE_FAULT_MODE) +#define ALL_DRM_XE_VM_CREATE_FLAGS (DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE | \ + DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE | \ + DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT | \ + DRM_XE_VM_CREATE_FLAG_FAULT_MODE)int xe_vm_create_ioctl (struct drm_device *dev,void *data,struct drm_file *file)
@@ -1932,9 +1932,9 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ;if (XE_WA (xe_root_mmio_gt (xe),14016763929 )) - args->flags |=DRM_XE_VM_CREATE_SCRATCH_PAGE ; + args->flags |=DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE ; -if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_FAULT_MODE && +if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_FLAG_FAULT_MODE && !xe->info.supports_usm))return -EINVAL ;
@@ -1944,32 +1944,32 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data,if (XE_IOCTL_DBG (xe, args->flags & ~ALL_DRM_XE_VM_CREATE_FLAGS ))return -EINVAL ; -if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_SCRATCH_PAGE && - args->flags &DRM_XE_VM_CREATE_FAULT_MODE )) +if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE && + args->flags &DRM_XE_VM_CREATE_FLAG_FAULT_MODE ))return -EINVAL ; -if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_COMPUTE_MODE && - args->flags &DRM_XE_VM_CREATE_FAULT_MODE )) +if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE && + args->flags &DRM_XE_VM_CREATE_FLAG_FAULT_MODE ))return -EINVAL ; -if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_FAULT_MODE && +if (XE_IOCTL_DBG (xe, args->flags &DRM_XE_VM_CREATE_FLAG_FAULT_MODE &&xe_device_in_non_fault_mode (xe)))return -EINVAL ; -if (XE_IOCTL_DBG (xe, !(args->flags &DRM_XE_VM_CREATE_FAULT_MODE ) && +if (XE_IOCTL_DBG (xe, !(args->flags &DRM_XE_VM_CREATE_FLAG_FAULT_MODE ) &&xe_device_in_fault_mode (xe)))return -EINVAL ;if (XE_IOCTL_DBG (xe, args->extensions))return -EINVAL ; -if (args->flags &DRM_XE_VM_CREATE_SCRATCH_PAGE ) +if (args->flags &DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE ) flags |=XE_VM_FLAG_SCRATCH_PAGE ; -if (args->flags &DRM_XE_VM_CREATE_COMPUTE_MODE ) +if (args->flags &DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE ) flags |=XE_VM_FLAG_COMPUTE_MODE ; -if (args->flags &DRM_XE_VM_CREATE_ASYNC_DEFAULT ) +if (args->flags &DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT ) flags |=XE_VM_FLAG_ASYNC_DEFAULT ; -if (args->flags &DRM_XE_VM_CREATE_FAULT_MODE ) +if (args->flags &DRM_XE_VM_CREATE_FLAG_FAULT_MODE ) flags |=XE_VM_FLAG_FAULT_MODE ; vm =xe_vm_create (xe, flags);
drivers/gpu/drm/xe/xe_vm_doc.h +1 -1
@@ -18,7 +18,7 @@* Scratch page * ------------ * -* If the VM is created with the flag, DRM_XE_VM_CREATE_SCRATCH_PAGE, set the +* If the VM is created with the flag, DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE, set the * entire page table structure defaults pointing to blank page allocated by the * VM. Invalid memory access rather than fault just read / write to this page. *
drivers/gpu/drm/xe/xe_wait_user_fence.c +5 -5
@@ -79,8 +79,8 @@ static int check_hw_engines(struct xe_device *xe,return 0 ; } -#define VALID_FLAGS (DRM_XE_UFENCE_WAIT_SOFT_OP | \ - DRM_XE_UFENCE_WAIT_ABSTIME) +#define VALID_FLAGS (DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP | \ + DRM_XE_UFENCE_WAIT_FLAG_ABSTIME)#define MAX_OP DRM_XE_UFENCE_WAIT_LTE static long to_jiffies_timeout(struct xe_device *xe,
@@ -107,7 +107,7 @@ static long to_jiffies_timeout(struct xe_device *xe,* Save the timeout to an u64 variable because nsecs_to_jiffies * might return a value that overflows s32 variable. */ -if (args->flags &DRM_XE_UFENCE_WAIT_ABSTIME ) +if (args->flags &DRM_XE_UFENCE_WAIT_FLAG_ABSTIME ) t =drm_timeout_abs_to_jiffies (args->timeout);else t =nsecs_to_jiffies (args->timeout);
@@ -137,7 +137,7 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data,u64_to_user_ptr (args->instances);u64 addr = args->addr;int err; -bool no_engines = args->flags &DRM_XE_UFENCE_WAIT_SOFT_OP ; +bool no_engines = args->flags &DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP ;long timeout;ktime_t start;
@@ -206,7 +206,7 @@ int xe_wait_user_fence_ioctl(struct drm_device *dev, void *data, }remove_wait_queue (&xe->ufence_wq, &w_wait); -if (!(args->flags &DRM_XE_UFENCE_WAIT_ABSTIME )) { +if (!(args->flags &DRM_XE_UFENCE_WAIT_FLAG_ABSTIME )) { args->timeout -=ktime_to_ns (ktime_sub (ktime_get (), start));if (args->timeout <0 ) args->timeout =0 ;
include/uapi/drm/xe_drm.h +15 -15
@@ -660,10 +660,10 @@ struct drm_xe_vm_create {/** @extensions: Pointer to the first extension struct, if any */ __u64 extensions; -#define DRM_XE_VM_CREATE_SCRATCH_PAGE (0x1 << 0) -#define DRM_XE_VM_CREATE_COMPUTE_MODE (0x1 << 1) -#define DRM_XE_VM_CREATE_ASYNC_DEFAULT (0x1 << 2) -#define DRM_XE_VM_CREATE_FAULT_MODE (0x1 << 3) +#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE (0x1 << 0) +#define DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE (0x1 << 1) +#define DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT (0x1 << 2) +#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE (0x1 << 3)/** @flags: Flags */ __u32 flags;
@@ -895,11 +895,11 @@ struct drm_xe_sync {/** @extensions: Pointer to the first extension struct, if any */ __u64 extensions; -#define DRM_XE_SYNC_SYNCOBJ 0x0 -#define DRM_XE_SYNC_TIMELINE_SYNCOBJ 0x1 -#define DRM_XE_SYNC_DMA_BUF 0x2 -#define DRM_XE_SYNC_USER_FENCE 0x3 -#define DRM_XE_SYNC_SIGNAL 0x10 +#define DRM_XE_SYNC_FLAG_SYNCOBJ 0x0 +#define DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ 0x1 +#define DRM_XE_SYNC_FLAG_DMA_BUF 0x2 +#define DRM_XE_SYNC_FLAG_USER_FENCE 0x3 +#define DRM_XE_SYNC_FLAG_SIGNAL 0x10__u32 flags;/** @pad: MBZ */
@@ -985,8 +985,8 @@ struct drm_xe_wait_user_fence {/** @op: wait operation (type of comparison) */ __u16 op; -#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_FLAG_SOFT_OP (1 << 0)/* e.g. Wait on VM bind */ +#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME (1 << 1)/** @flags: wait flags */ __u16 flags;
@@ -1004,10 +1004,10 @@ struct drm_xe_wait_user_fence {__u64 mask;/** * @timeout: how long to wait before bailing, value in nanoseconds. -* Without DRM_XE_UFENCE_WAIT_ABSTIME flag set (relative timeout) +* Without DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flag set (relative timeout) * it contains timeout expressed in nanoseconds to wait (fence will * expire at now() + timeout). -* When DRM_XE_UFENCE_WAIT_ABSTIME flat is set (absolute timeout) wait +* When DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flat is set (absolute timeout) wait * will end at timeout (uses system MONOTONIC_CLOCK). * Passing negative timeout leads to neverending wait. *
@@ -1020,13 +1020,13 @@ struct drm_xe_wait_user_fence {/** * @num_engines: number of engine instances to wait on, must be zero -* when DRM_XE_UFENCE_WAIT_SOFT_OP set +* when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set */ __u64 num_engines;/** * @instances: user pointer to array of drm_xe_engine_class_instance to -* wait on, must be NULL when DRM_XE_UFENCE_WAIT_SOFT_OP set +* wait on, must be NULL when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set */ __u64 instances;
Signature · 1 line
2.34.1
RFC 10/17 fixup! drm/xe: Add uAPI to query micro-controler firmware version
In reply to Francois DugastRemove warnings below when building documentation:
./include/uapi/drm/xe_drm.h:491: warning: Function parameter or member 'uc_type' not described in 'drm_xe_query_uc_fw_version' ./include/uapi/drm/xe_drm.h:491: warning: Function parameter or member 'major_ver' not described in 'drm_xe_query_uc_fw_version' ./include/uapi/drm/xe_drm.h:491: warning: Function parameter or member 'minor_ver' not described in 'drm_xe_query_uc_fw_version' ./include/uapi/drm/xe_drm.h:491: warning: Function parameter or member 'patch_ver' not described in 'drm_xe_query_uc_fw_version' ./include/uapi/drm/xe_drm.h:491: warning: Function parameter or member 'branch_ver' not described in 'drm_xe_query_uc_fw_version'
--- include/uapi/drm/xe_drm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
include/uapi/drm/xe_drm.h +5 -5
@@ -466,7 +466,7 @@ struct drm_xe_query_topology_mask {* of the micro-controller firmware. */ struct drm_xe_query_uc_fw_version { -/** @uc: The micro-controller type to query firmware version */ +/** @uc_type: The micro-controller type to query firmware version */ #define DRM_XE_QUERY_UC_TYPE_GUC 0#define DRM_XE_QUERY_UC_TYPE_HUC 1__u16 uc_type;
@@ -474,13 +474,13 @@ struct drm_xe_query_uc_fw_version {/** @pad: MBZ */ __u16 pad; -/* @major_ver: major uc fw version */ +/** @major_ver: major uc fw version */ __u32 major_ver; -/* @minor_ver: minor uc fw version */ +/** @minor_ver: minor uc fw version */ __u32 minor_ver; -/* @patch_ver: patch uc fw version */ +/** @patch_ver: patch uc fw version */ __u32 patch_ver; -/* @branch_ver: branch uc fw version */ +/** @branch_ver: branch uc fw version */ __u32 branch_ver;/** @pad2: MBZ */
Signature · 1 line
2.34.1
RFC 11/17 drm/xe/uapi: Make constant comments visible in kernel doc
In reply to Francois DugastAs there is no direct way to make comments of constants directly visible in the kernel doc, move them to the description of the structure where they can be used. By doing so they appear in the "Description" section of the struct documentation.
--- include/uapi/drm/xe_drm.h | 264 ++++++++++++++++++++++---------------- 1 file changed, 150 insertions(+), 114 deletions(-)
include/uapi/drm/xe_drm.h +150 -114
@@ -126,23 +126,40 @@ 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 - instance of an engine class */ +/** +* struct drm_xe_engine_class_instance - instance of an engine class +* +* The @engine_class can be: +* - %DRM_XE_ENGINE_CLASS_RENDER +* - %DRM_XE_ENGINE_CLASS_COPY +* - %DRM_XE_ENGINE_CLASS_VIDEO_DECODE +* - %DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE +* - %DRM_XE_ENGINE_CLASS_COMPUTE +* - %DRM_XE_ENGINE_CLASS_VM_BIND_ASYNC - Kernel only class (not actual +* hardware engine class) used for creating ordered queues of +* asynchronous VM bind operations. +* - %DRM_XE_ENGINE_CLASS_VM_BIND_SYNC - Kernel only class (not actual +* synchronous VM bind operations. +* +*/ struct drm_xe_engine_class_instance {#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 classes (not actual hardware engine class). Used for -* creating ordered queues of VM bind operations. -*/ #define DRM_XE_ENGINE_CLASS_VM_BIND_ASYNC 5#define DRM_XE_ENGINE_CLASS_VM_BIND_SYNC 6 +/** +* @engine_class: Class of this instance among possible +* DRM_XE_ENGINE_CLASS_* +*/ __u16 engine_class; - +/** @engine_instance: Engine instance */ __u16 engine_instance; +/** @gt_id: GT ID the instance is associated with */ __u16 gt_id; +/** @rsvd: Reserved */ __u16 rsvd; };
@@ -313,44 +330,36 @@ struct drm_xe_query_mem_usage {* If a query is made with a struct drm_xe_device_query where .query * is equal to DRM_XE_DEVICE_QUERY_CONFIG, then the reply uses * struct drm_xe_query_config in .data. +* +* The index in @info can be: +* - %DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID - Device ID (lower 16 bits) +* and the device revision (next 8 bits) +* - %DRM_XE_QUERY_CONFIG_FLAGS - Flags describing the device +* configuration, see list below +* +* - %DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM - Flag is set if the device +* has usable VRAM +* - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment +* required by this device, typically SZ_4K or SZ_64K +* - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address +* - %DRM_XE_QUERY_CONFIG_GT_COUNT - Total number of GTs for the entire +* device +* - %DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT - Total number of accessible +* memory regions +* - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest +* available exec queue priority */ struct drm_xe_query_config {/** @pad: MBZ */ __u32 pad; -/* -* Device ID (lower 16 bits) and the device revision (next -* 8 bits) -*/ #define DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0 -/* -* Flags describing the device configuration, see list below -*/ #define DRM_XE_QUERY_CONFIG_FLAGS 1 -/* -* Flag is set if the device has usable VRAM -*/ #define DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM (0x1 << 0) -/* -* Minimal memory alignment required by this device, -* typically SZ_4K or SZ_64K -*/ #define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT 2 -/* -* Maximum bits of a virtual address -*/ #define DRM_XE_QUERY_CONFIG_VA_BITS 3 -/* -* Total number of GTs for the entire device -*/ #define DRM_XE_QUERY_CONFIG_GT_COUNT 4 -/* -* Total number of accessible memory regions -*/ #define DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT 5 -/* -* Value of the highest available exec queue priority -*/ #define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY 6/** @info: array of elements containing the config info */ __u64 info[];
@@ -363,6 +372,7 @@ struct drm_xe_query_config {* existing GT individual descriptions. * Graphics Technology (GT) is a subset of a GPU/tile that is responsible for * implementing graphics and/or media operations. +* */ struct drm_xe_query_gt {#define DRM_XE_QUERY_GT_TYPE_MAIN 0
@@ -420,34 +430,31 @@ struct drm_xe_query_gt_list {* If a query is made with a struct drm_xe_device_query where .query * is equal to DRM_XE_DEVICE_QUERY_GT_TOPOLOGY, then the reply uses * struct drm_xe_query_topology_mask in .data. +* +* The @type can be: +* - %DRM_XE_TOPO_DSS_GEOMETRY - To query the mask of Dual Sub Slices +* (DSS) available for geometry operations. For example a query response +* containing the following in mask: +* ``DSS_GEOMETRY ff ff ff ff 00 00 00 00`` +* means 32 DSS are available for geometry. +* - %DRM_XE_TOPO_DSS_COMPUTE - To query the mask of Dual Sub Slices +* (DSS) available for compute operations. For example a query response +* containing the following in mask: +* ``DSS_COMPUTE ff ff ff ff 00 00 00 00`` +* means 32 DSS are available for compute. +* - %DRM_XE_TOPO_EU_PER_DSS - To query the mask of Execution Units (EU) +* available per Dual Sub Slices (DSS). For example a query response +* containing the following in mask: +* ``EU_PER_DSS ff ff 00 00 00 00 00 00`` +* means each DSS has 16 EU. +* */ struct drm_xe_query_topology_mask {/** @gt_id: GT ID the mask is associated with */ __u16 gt_id; -/* -* To query the mask of Dual Sub Slices (DSS) available for geometry -* operations. For example a query response containing the following -* in mask: -* DSS_GEOMETRY ff ff ff ff 00 00 00 00 -* means 32 DSS are available for geometry. -*/ #define DRM_XE_TOPO_DSS_GEOMETRY (1 << 0) -/* -* To query the mask of Dual Sub Slices (DSS) available for compute -* operations. For example a query response containing the following -* in mask: -* DSS_COMPUTE ff ff ff ff 00 00 00 00 -* means 32 DSS are available for compute. -*/ #define DRM_XE_TOPO_DSS_COMPUTE (1 << 1) -/* -* To query the mask of Execution Units (EU) available per Dual Sub -* Slices (DSS). For example a query response containing the following -* in mask: -* EU_PER_DSS ff ff 00 00 00 00 00 00 -* means each DSS has 16 EU. -*/ #define DRM_XE_TOPO_EU_PER_DSS (1 << 2)/** @type: type of mask */ __u16 type;
@@ -497,6 +504,19 @@ struct drm_xe_query_uc_fw_version {* and sets the value in the query member. This determines the type of * the structure provided by the driver in data, among struct drm_xe_query_*. * +* The @query can be: +* - %DRM_XE_DEVICE_QUERY_ENGINES +* - %DRM_XE_DEVICE_QUERY_MEM_USAGE +* - %DRM_XE_DEVICE_QUERY_CONFIG +* - %DRM_XE_DEVICE_QUERY_GT_LIST - Query type to retrieve the hardware +* configuration of the device such as information on slices, memory, +* caches, and so on. It is provided as a table of key / value +* attributes. +* - %DRM_XE_DEVICE_QUERY_HWCONFIG +* - %DRM_XE_DEVICE_QUERY_GT_TOPOLOGY +* - %DRM_XE_DEVICE_QUERY_ENGINE_CYCLES +* - %DRM_XE_DEVICE_QUERY_UC_FW_VERSION +* * 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. If size is set to
@@ -539,11 +559,6 @@ struct drm_xe_device_query {#define DRM_XE_DEVICE_QUERY_MEM_USAGE 1#define DRM_XE_DEVICE_QUERY_CONFIG 2#define DRM_XE_DEVICE_QUERY_GT_LIST 3 -/* -* Query type to retrieve the hardware configuration of the device -* such as information on slices, memory, caches, and so on. It is -* provided as a table of attributes (key / value). -*/ #define DRM_XE_DEVICE_QUERY_HWCONFIG 4#define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5#define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6
@@ -561,6 +576,29 @@ struct drm_xe_device_query {__u64 reserved[2 ]; }; +/** +* struct drm_xe_gem_create - structure for gem creation +* +* The @flags can be: +* - %DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING +* - %DRM_XE_GEM_CREATE_FLAG_SCANOUT +* - %DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM - When using VRAM as a +* possible placement, ensure that the corresponding VRAM allocation +* will always use the CPU accessible part of VRAM. This is important +* for small-bar systems (on full-bar systems this gets turned into a +* noop). +* Note1: System memory can be used as an extra placement if the kernel +* should spill the allocation to system memory, if space can't be made +* available in the CPU accessible part of VRAM (giving the same +* behaviour as the i915 interface, see +* I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS). +* Note2: For clear-color CCS surfaces the kernel needs to read the +* clear-color value stored in the buffer, and on discrete platforms we +* need to use VRAM for display surfaces, therefore the kernel requires +* setting this flag for such objects, otherwise an error is thrown on +* small-bar systems. +* +*/ struct drm_xe_gem_create {/** @extensions: Pointer to the first extension struct, if any */ __u64 extensions;
@@ -574,21 +612,6 @@ struct drm_xe_gem_create {#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (0x1 << 24)#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (0x1 << 25) -/* -* When using VRAM as a possible placement, ensure that the corresponding VRAM -* allocation will always use the CPU accessible part of VRAM. This is important -* for small-bar systems (on full-bar systems this gets turned into a noop). -* -* Note: System memory can be used as an extra placement if the kernel should -* spill the allocation to system memory, if space can't be made available in -* the CPU accessible part of VRAM (giving the same behaviour as the i915 -* interface, see I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS). -* -* Note: For clear-color CCS surfaces the kernel needs to read the clear-color -* value stored in the buffer, and on discrete platforms we need to use VRAM for -* display surfaces, therefore the kernel requires setting this flag for such -* objects, otherwise an error is thrown on small-bar systems. -*/ #define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (0x1 << 26)/** * @flags: Flags, currently a mask of memory instances of where BO can
@@ -685,6 +708,30 @@ struct drm_xe_vm_destroy {__u64 reserved[2 ]; }; +/** +* struct drm_xe_vm_bind_op - run bind operations +* +* The @op can be: +* - %DRM_XE_VM_BIND_OP_MAP +* - %DRM_XE_VM_BIND_OP_UNMAP +* - %DRM_XE_VM_BIND_OP_MAP_USERPTR +* - %DRM_XE_VM_BIND_OP_UNMAP_ALL +* - %DRM_XE_VM_BIND_OP_PREFETCH +* +* and the @flags can be: +* - %DRM_XE_VM_BIND_FLAG_READONLY +* - %DRM_XE_VM_BIND_FLAG_ASYNC +* - %DRM_XE_VM_BIND_FLAG_IMMEDIATE - Valid on a faulting VM only, do the +* MAP operation immediately rather than deferring the MAP to the page +* fault handler. +* - %DRM_XE_VM_BIND_FLAG_NULL - When the NULL flag is set, the page +* tables are setup with a special bit which indicates writes are +* dropped and all reads return zero. In the future, the NULL flags +* will only be valid for DRM_XE_VM_BIND_OP_MAP operations, the BO +* handle MBZ, and the BO offset MBZ. This flag is intended to +* implement VK sparse bindings. +* +*/ struct drm_xe_vm_bind_op {/** @extensions: Pointer to the first extension struct, if any */ __u64 extensions;
@@ -732,23 +779,12 @@ struct drm_xe_vm_bind_op {#define DRM_XE_VM_BIND_FLAG_READONLY (0x1 << 0)#define DRM_XE_VM_BIND_FLAG_ASYNC (0x1 << 1) -/* -* Valid on a faulting VM only, do the MAP operation immediately rather -* than deferring the MAP to the page fault handler. -*/ #define DRM_XE_VM_BIND_FLAG_IMMEDIATE (0x1 << 2) -/* -* When the NULL flag is set, the page tables are setup with a special -* bit which indicates writes are dropped and all reads return zero. In -* the future, the NULL flags will only be valid for DRM_XE_VM_BIND_OP_MAP -* operations, the BO handle MBZ, and the BO offset MBZ. This flag is -* intended to implement VK sparse bindings. -*/ #define DRM_XE_VM_BIND_FLAG_NULL (0x1 << 3)/** @flags: Bind flags */ __u32 flags; -/** @mem_region: Memory region to prefetch VMA to, instance not a mask */ +/** @region: Memory region to prefetch VMA to, instance not a mask */ __u32 region;/** @reserved: Reserved */
@@ -1034,6 +1070,35 @@ struct drm_xe_wait_user_fence {__u64 reserved[2 ]; }; +/** +* struct drm_xe_vm_madvise - give advice about use of memory +* +* The @property can be: +* - %DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS - Setting the preferred +* location will trigger a migrate of the VMA backing store to new +* location if the backing store is already allocated. +* For DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS usage, see enum +* drm_xe_memory_class. +* - %DRM_XE_VM_MADVISE_PREFERRED_GT +* - %DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT - In this case lower 32 bits +* are mem class, upper 32 are GT. Combination provides a single IOCTL +* plus migrate VMA to preferred location. +* - %DRM_XE_VM_MADVISE_CPU_ATOMIC - The CPU will do atomic memory +* operations to this VMA. Must be set on some devices for atomics to +* behave correctly. +* - %DRM_XE_VM_MADVISE_DEVICE_ATOMIC - The device will do atomic memory +* operations to this VMA. Must be set on some devices for atomics to +* behave correctly. +* - %DRM_XE_VM_MADVISE_PRIORITY - Priority WRT to eviction (moving from +* preferred memory location due to memory pressure). The lower the +* priority, the more likely to be evicted. +* +* - %DRM_XE_VMA_PRIORITY_LOW +* - %DRM_XE_VMA_PRIORITY_NORMAL - Default +* - %DRM_XE_VMA_PRIORITY_HIGH - Must be user with elevated privileges +* - %DRM_XE_VM_MADVISE_PIN - Pin the VMA in memory, must be user with +* elevated privileges +*/ struct drm_xe_vm_madvise {/** @extensions: Pointer to the first extension struct, if any */ __u64 extensions;
@@ -1050,44 +1115,15 @@ struct drm_xe_vm_madvise {/** @addr: Address of the VMA to operation on */ __u64 addr; -/* -* Setting the preferred location will trigger a migrate of the VMA -* backing store to new location if the backing store is already -* allocated. -* -* For DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS usage, see enum -* drm_xe_memory_class. -*/ #define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS 0#define DRM_XE_VM_MADVISE_PREFERRED_GT 1 -/* -* In this case lower 32 bits are mem class, upper 32 are GT. -* Combination provides a single IOCTL plus migrate VMA to preferred -* location. -*/ #define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT 2 -/* -* The CPU will do atomic memory operations to this VMA. Must be set on -* some devices for atomics to behave correctly. -*/ #define DRM_XE_VM_MADVISE_CPU_ATOMIC 3 -/* -* The device will do atomic memory operations to this VMA. Must be set -* on some devices for atomics to behave correctly. -*/ #define DRM_XE_VM_MADVISE_DEVICE_ATOMIC 4 -/* -* Priority WRT to eviction (moving from preferred memory location due -* to memory pressure). The lower the priority, the more likely to be -* evicted. -*/ #define DRM_XE_VM_MADVISE_PRIORITY 5#define DRM_XE_VMA_PRIORITY_LOW 0 -/* Default */ #define DRM_XE_VMA_PRIORITY_NORMAL 1 -/* Must be user with elevated privileges */ #define DRM_XE_VMA_PRIORITY_HIGH 2 -/* Pin the VMA in memory, must be user with elevated privileges */ #define DRM_XE_VM_MADVISE_PIN 6/** @property: property to set */ __u32 property;
Signature · 1 line
2.34.1
RFC 12/17 fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy
In reply to Francois DugastFrom: Umesh Nerlige Ramappa <[email protected]>
Change rsvd to pad in struct drm_xe_class_instance to prevent the field from being used in future.
--- drivers/gpu/drm/xe/xe_query.c | 5 ++++- include/uapi/drm/xe_drm.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_query.c +4 -1
@@ -215,7 +215,10 @@ static int query_engines(struct xe_device *xe, xe_to_user_engine_class[hwe->class]; hw_engine_info[i].engine_instance = hwe->logical_instance; - hw_engine_info[i++].gt_id = gt->info.id; + hw_engine_info[i].gt_id = gt->info.id; + hw_engine_info[i].pad =0 ; + + i++; }if (copy_to_user (query_ptr, hw_engine_info, size)) {
include/uapi/drm/xe_drm.h +2 -2
@@ -159,8 +159,8 @@ struct drm_xe_engine_class_instance {__u16 engine_instance;/** @gt_id: GT ID the instance is associated with */ __u16 gt_id; -/** @rsvd: Reserved */ -__u16 rsvd; +/** @pad: MBZ */ +__u16 pad; };/**
Signature · 1 line
2.34.1
RFC 13/17 drm/xe/uapi: Remove GT_TYPE_REMOTE
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
With the split between tile and gt, this is currently unused. Also it is bringing confusion because main vs remote would be more a concept of the tile itself and not about GT.
So, the MAIN one is the traditional GT used for every operation in older platforms, and for render/graphics and compute on platforms that contains the stand-alone Media GT.
--- drivers/gpu/drm/xe/xe_query.c | 2 -- include/uapi/drm/xe_drm.h | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/xe/xe_query.c +0 -2
@@ -375,8 +375,6 @@ static int query_gt_list(struct xe_device *xe, struct drm_xe_device_query *queryfor_each_gt (gt, xe, id) {if (xe_gt_is_media_type (gt)) gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_MEDIA ; -else if (gt_to_tile (gt)->id >0 ) - gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_REMOTE ;else gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_MAIN ; gt_list->gt_list[id].gt_id = gt->info.id;
include/uapi/drm/xe_drm.h +2 -3
@@ -376,9 +376,8 @@ struct drm_xe_query_config {*/ struct drm_xe_query_gt {#define DRM_XE_QUERY_GT_TYPE_MAIN 0 -#define DRM_XE_QUERY_GT_TYPE_REMOTE 1 -#define DRM_XE_QUERY_GT_TYPE_MEDIA 2 -/** @type: GT type: Main, Remote, or Media */ +#define DRM_XE_QUERY_GT_TYPE_MEDIA 1 +/** @type: GT type: Main or Media */ __u16 type;/** @gt_id: Unique ID of this GT within the PCI Device */ __u16 gt_id;
Signature · 1 line
2.34.1
Re: [Intel-xe] [RFC v1 13/17] drm/xe/uapi: Remove GT_TYPE_REMOTE
Quoted 10 lines · Francois Dugast
From: Rodrigo Vivi <[email protected]>
With the split between tile and gt, this is currently unused. Also it is bringing confusion because main vs remote would be more a concept of the tile itself and not about GT.
So, the MAIN one is the traditional GT used for every operation in older platforms, and for render/graphics and compute on platforms that contains the stand-alone Media GT.
Quoted 5 lines
Cc Matt Roper <[email protected]>Cc Francois Dugast <[email protected]>Cc Carl Zhang <[email protected]>Cc José Roberto de Souza <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>
Quoted 37 lines
--- drivers/gpu/drm/xe/xe_query.c | 2 -- include/uapi/drm/xe_drm.h | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-)drivers/gpu/drm/xe/xe_query.c +0
-2@@ -375,8 +375,6 @@ static int query_gt_list(struct xe_device *xe, struct drm_xe_device_query *queryfor_each_gt (gt, xe, id) {if (xe_gt_is_media_type (gt)) gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_MEDIA ; -else if (gt_to_tile (gt)->id >0 ) - gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_REMOTE ;else gt_list->gt_list[id].type =DRM_XE_QUERY_GT_TYPE_MAIN ; gt_list->gt_list[id].gt_id = gt->info.id;include/uapi/drm/xe_drm.h +2
-3@@ -376,9 +376,8 @@ struct drm_xe_query_config {*/ struct drm_xe_query_gt {#define DRM_XE_QUERY_GT_TYPE_MAIN 0 -#define DRM_XE_QUERY_GT_TYPE_REMOTE 1 -#define DRM_XE_QUERY_GT_TYPE_MEDIA 2 -/** @type: GT type: Main, Remote, or Media */ +#define DRM_XE_QUERY_GT_TYPE_MEDIA 1 +/** @type: GT type: Main or Media */ __u16 type;/** @gt_id: Unique ID of this GT within the PCI Device */ __u16 gt_id;Signature · 1 line
2.34.1
Signature · 4 lines
Matt Roper Graphics Software Engineer Linux GPU Platform Enablement Intel Corporation
RFC 14/17 drm/xe/uapi: Kill VM_MADVISE IOCTL
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Remove unused IOCTL.
Without any userspace using it we need to remove before we can be accepted upstream.
At this point we are breaking the compatibility for good, so we don't need to break when we are in-tree. So, let's also use this breakage to sort out the IOCTL entries and fix all the small indentation and line issues.
--- drivers/gpu/drm/xe/Makefile | 1 - drivers/gpu/drm/xe/xe_bo.c | 2 +- drivers/gpu/drm/xe/xe_bo_types.h | 3 + drivers/gpu/drm/xe/xe_device.c | 8 +- drivers/gpu/drm/xe/xe_vm_madvise.c | 299 ----------------------------- drivers/gpu/drm/xe/xe_vm_madvise.h | 15 -- include/uapi/drm/xe_drm.h | 92 ++------- 7 files changed, 18 insertions(+), 402 deletions(-) delete mode 100644 drivers/gpu/drm/xe/xe_vm_madvise.c delete mode 100644 drivers/gpu/drm/xe/xe_vm_madvise.h
drivers/gpu/drm/xe/Makefile +0 -1
@@ -113,7 +113,6 @@ xe-y += xe_bb.o \ xe_uc_debugfs.o \ xe_uc_fw.o \ xe_vm.o \ - xe_vm_madvise.o \ xe_wait_user_fence.o \ xe_wa.o \ xe_wopcm.o
drivers/gpu/drm/xe/xe_bo.c +1 -1
@@ -1235,7 +1235,7 @@ struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo, bo->props.preferred_mem_class =XE_BO_PROPS_INVALID ; bo->props.preferred_gt =XE_BO_PROPS_INVALID ; bo->props.preferred_mem_type =XE_BO_PROPS_INVALID ; - bo->ttm.priority =DRM_XE_VMA_PRIORITY_NORMAL ; + bo->ttm.priority =XE_BO_PRIORITY_NORMAL ;INIT_LIST_HEAD (&bo->pinned_link);#ifdef CONFIG_PROC_FS INIT_LIST_HEAD (&bo->client_link);
drivers/gpu/drm/xe/xe_bo_types.h +3 -0
@@ -19,6 +19,9 @@ struct xe_vm;#define XE_BO_MAX_PLACEMENTS 3 +/* TODO: To be selected with VM_MADVISE */ +#define XE_BO_PRIORITY_NORMAL 1 +/** @xe_bo: XE buffer object */ struct xe_bo {/** @ttm: TTM base buffer object */
drivers/gpu/drm/xe/xe_device.c +3 -5
@@ -34,7 +34,6 @@#include "xe_ttm_stolen_mgr.h" #include "xe_ttm_sys_mgr.h" #include "xe_vm.h" -#include "xe_vm_madvise.h" #include "xe_wait_user_fence.h" #include "xe_hwmon.h"
@@ -115,18 +114,17 @@ static const struct drm_ioctl_desc xe_ioctls[] = {DRM_IOCTL_DEF_DRV (XE_VM_CREATE , xe_vm_create_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (XE_VM_DESTROY , xe_vm_destroy_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (XE_VM_BIND , xe_vm_bind_ioctl,DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (XE_EXEC , xe_exec_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (XE_EXEC_QUEUE_CREATE , xe_exec_queue_create_ioctl,DRM_RENDER_ALLOW ), -DRM_IOCTL_DEF_DRV (XE_EXEC_QUEUE_GET_PROPERTY , xe_exec_queue_get_property_ioctl, -DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (XE_EXEC_QUEUE_DESTROY , xe_exec_queue_destroy_ioctl,DRM_RENDER_ALLOW ), -DRM_IOCTL_DEF_DRV (XE_EXEC , xe_exec_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (XE_EXEC_QUEUE_SET_PROPERTY , xe_exec_queue_set_property_ioctl,DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (XE_EXEC_QUEUE_GET_PROPERTY , xe_exec_queue_get_property_ioctl, +DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (XE_WAIT_USER_FENCE , xe_wait_user_fence_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(XE_VM_MADVISE, xe_vm_madvise_ioctl, DRM_RENDER_ALLOW), }; static const struct file_operations xe_driver_fops = {
drivers/gpu/drm/xe/xe_vm_madvise.c deleted +0 -299
299 lines not on this page · raw message
drivers/gpu/drm/xe/xe_vm_madvise.h deleted +0 -15
@@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: MIT */ -/* -* Copyright © 2021 Intel Corporation -*/ - -#ifndef _XE_VM_MADVISE_H_ -#define _XE_VM_MADVISE_H_ - -struct drm_device ; -struct drm_file ; - -int xe_vm_madvise_ioctl (struct drm_device *dev,void *data, -struct drm_file *file); - -#endif
include/uapi/drm/xe_drm.h +11 -81
113 lines not on this page · raw message
Signature · 1 line
2.34.1
RFC 15/17 drm/xe/uapi: Separate bo_create placement from flags
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Although the flags are about the creation, the memory placement of the BO deserves a proper dedicated field in the uapi.
Besides getting more clear, it also allows to remove the 'magic' shifts from the flags that was a concern during the uapi reviews.
--- drivers/gpu/drm/xe/xe_bo.c | 15 +++++++-------- include/uapi/drm/xe_drm.h | 12 ++++++------ 2 files changed, 13 insertions(+), 14 deletions(-)
drivers/gpu/drm/xe/xe_bo.c +7 -8
@@ -1768,19 +1768,18 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,u32 handle;int err; -if (XE_IOCTL_DBG (xe, args->extensions) ||XE_IOCTL_DBG (xe, args->pad) || +if (XE_IOCTL_DBG (xe, args->extensions) ||XE_IOCTL_DBG (xe, args->reserved[0 ] || args->reserved[1 ]))return -EINVAL ; +/* at least one valid memory placement must be specified */ +if (XE_IOCTL_DBG (xe, !(args->placement & xe->info.mem_region_mask))) +return -EINVAL ; +if (XE_IOCTL_DBG (xe, args->flags & ~(DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING |DRM_XE_GEM_CREATE_FLAG_SCANOUT | -DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM | - xe->info.mem_region_mask))) -return -EINVAL ; - -/* at least one memory type must be specified */ -if (XE_IOCTL_DBG (xe, !(args->flags & xe->info.mem_region_mask))) +DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM )))return -EINVAL ;if (XE_IOCTL_DBG (xe, args->handle))
@@ -1801,7 +1800,7 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,if (args->flags &DRM_XE_GEM_CREATE_FLAG_SCANOUT ) bo_flags |=XE_BO_SCANOUT_BIT ; - bo_flags |= args->flags << (ffs (XE_BO_CREATE_SYSTEM_BIT ) -1 ); + bo_flags |= args->placement << (ffs (XE_BO_CREATE_SYSTEM_BIT ) -1 );if (args->flags &DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ) {if (XE_IOCTL_DBG (xe, !(bo_flags &XE_BO_CREATE_VRAM_MASK )))
include/uapi/drm/xe_drm.h +6 -6
@@ -607,9 +607,12 @@ struct drm_xe_gem_create {*/ __u64 size; -#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (0x1 << 24) -#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (0x1 << 25) -#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (0x1 << 26) +/** @placement: A mask of memory instances of where BO can be placed. */ +__u32 placement; + +#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (1 << 0) +#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (1 << 1) +#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (1 << 2)/** * @flags: Flags, currently a mask of memory instances of where BO can * be placed
@@ -633,9 +636,6 @@ struct drm_xe_gem_create {*/ __u32 handle; -/** @pad: MBZ */ -__u32 pad; -/** @reserved: Reserved */ __u64 reserved[2 ]; };
Signature · 1 line
2.34.1
Re: [Intel-xe] [RFC v1 15/17] drm/xe/uapi: Separate bo_create placement from flags
Quoted 61 lines · Francois Dugast
From: Rodrigo Vivi <[email protected]>
Although the flags are about the creation, the memory placement of the BO deserves a proper dedicated field in the uapi.
Besides getting more clear, it also allows to remove the 'magic' shifts from the flags that was a concern during the uapi reviews.
Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/xe_bo.c | 15 +++++++-------- include/uapi/drm/xe_drm.h | 12 ++++++------ 2 files changed, 13 insertions(+), 14 deletions(-)drivers/gpu/drm/xe/xe_bo.c +7
-8@@ -1768,19 +1768,18 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,u32 handle;int err; -if (XE_IOCTL_DBG (xe, args->extensions) ||XE_IOCTL_DBG (xe, args->pad) || +if (XE_IOCTL_DBG (xe, args->extensions) ||XE_IOCTL_DBG (xe, args->reserved[0 ] || args->reserved[1 ]))return -EINVAL ; +/* at least one valid memory placement must be specified */ +if (XE_IOCTL_DBG (xe, !(args->placement & xe->info.mem_region_mask))) +return -EINVAL ; +if (XE_IOCTL_DBG (xe, args->flags & ~(DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING |DRM_XE_GEM_CREATE_FLAG_SCANOUT | -DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM | - xe->info.mem_region_mask))) -return -EINVAL ; - -/* at least one memory type must be specified */ -if (XE_IOCTL_DBG (xe, !(args->flags & xe->info.mem_region_mask))) +DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM )))return -EINVAL ;if (XE_IOCTL_DBG (xe, args->handle))@@ -1801,7 +1800,7 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,if (args->flags &DRM_XE_GEM_CREATE_FLAG_SCANOUT ) bo_flags |=XE_BO_SCANOUT_BIT ; - bo_flags |= args->flags << (ffs (XE_BO_CREATE_SYSTEM_BIT ) -1 ); + bo_flags |= args->placement << (ffs (XE_BO_CREATE_SYSTEM_BIT ) -1 );if (args->flags &DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ) {if (XE_IOCTL_DBG (xe, !(bo_flags &XE_BO_CREATE_VRAM_MASK )))include/uapi/drm/xe_drm.h +0
-0@@ -607,9 +607,12 @@ struct drm_xe_gem_create {*/ __u64 size;
include/uapi/drm/xe_drm.h struct drm_xe_gem_create { · line 615
Quoted 10 lines
include/uapi/drm/xe_drm.h +6
-3-#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (0x1 << 24) -#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (0x1 << 25) -#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (0x1 << 26) +/** @placement: A mask of memory instances of where BO can be placed. */ +__u32 placement; + +#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (1 << 0) +#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (1 << 1) +#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (1 << 2)
#define DRM_XE_GEM_CREATE_PLACEMENT_FLAG_DEFER_BACKING...
also this 3 flags should be define above the __u32 placement; like all other flags in xe_drm.h
Quoted 13 lines
include/uapi/drm/xe_drm.h +0
-3/** * @flags: Flags, currently a mask of memory instances of where BO can * be placed @@ -633,9 +636,6 @@ struct drm_xe_gem_create {*/ __u32 handle; -/** @pad: MBZ */ -__u32 pad; -/** @reserved: Reserved */ __u64 reserved[2 ]; };
Re: [Intel-xe] [RFC v1 15/17] drm/xe/uapi: Separate bo_create placement from flags
Quoted 75 lines · Jose
Quoted 61 lines · Francois Dugast
From: Rodrigo Vivi <[email protected]>
Although the flags are about the creation, the memory placement of the BO deserves a proper dedicated field in the uapi.
Besides getting more clear, it also allows to remove the 'magic' shifts from the flags that was a concern during the uapi reviews.
Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/xe_bo.c | 15 +++++++-------- include/uapi/drm/xe_drm.h | 12 ++++++------ 2 files changed, 13 insertions(+), 14 deletions(-)drivers/gpu/drm/xe/xe_bo.c +7
-8@@ -1768,19 +1768,18 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,u32 handle;int err; -if (XE_IOCTL_DBG (xe, args->extensions) ||XE_IOCTL_DBG (xe, args->pad) || +if (XE_IOCTL_DBG (xe, args->extensions) ||XE_IOCTL_DBG (xe, args->reserved[0 ] || args->reserved[1 ]))return -EINVAL ; +/* at least one valid memory placement must be specified */ +if (XE_IOCTL_DBG (xe, !(args->placement & xe->info.mem_region_mask))) +return -EINVAL ; +if (XE_IOCTL_DBG (xe, args->flags & ~(DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING |DRM_XE_GEM_CREATE_FLAG_SCANOUT | -DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM | - xe->info.mem_region_mask))) -return -EINVAL ; - -/* at least one memory type must be specified */ -if (XE_IOCTL_DBG (xe, !(args->flags & xe->info.mem_region_mask))) +DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM )))return -EINVAL ;if (XE_IOCTL_DBG (xe, args->handle))@@ -1801,7 +1800,7 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,if (args->flags &DRM_XE_GEM_CREATE_FLAG_SCANOUT ) bo_flags |=XE_BO_SCANOUT_BIT ; - bo_flags |= args->flags << (ffs (XE_BO_CREATE_SYSTEM_BIT ) -1 ); + bo_flags |= args->placement << (ffs (XE_BO_CREATE_SYSTEM_BIT ) -1 );if (args->flags &DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM ) {if (XE_IOCTL_DBG (xe, !(bo_flags &XE_BO_CREATE_VRAM_MASK )))include/uapi/drm/xe_drm.h +0
-0@@ -607,9 +607,12 @@ struct drm_xe_gem_create {*/ __u64 size;include/uapi/drm/xe_drm.h struct drm_xe_gem_create { · line 615
Quoted 10 lines
include/uapi/drm/xe_drm.h +6
-3-#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (0x1 << 24) -#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (0x1 << 25) -#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (0x1 << 26) +/** @placement: A mask of memory instances of where BO can be placed. */ +__u32 placement; + +#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING (1 << 0) +#define DRM_XE_GEM_CREATE_FLAG_SCANOUT (1 << 1) +#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM (1 << 2)#define
DRM_XE_GEM_CREATE_PLACEMENT_FLAG_DEFER_BACKING...
Quoted 2 lines
also this 3 flags should be define above the
__u32placement; like all other flags inxe_drm.h
At first I also read it like you did because placement and the new constant values come next to each other in the diff but actually those constants are meant to be used as flags, not as placement.
This means the naming DRM_XE_GEM_CREATE_FLAG_* is consistent and the define location is correct, it follows the same rules as for other defines:
#define ...
#define ...
/** @flags ...
__u32 flags;Francois
Quoted 16 lines
Quoted 15 lines
include/uapi/drm/xe_drm.h +0
-3/** * @flags: Flags, currently a mask of memory instances of where BO can * be placed @@ -633,9 +636,6 @@ struct drm_xe_gem_create {*/ __u32 handle; -/** @pad: MBZ */ -__u32 pad; -/** @reserved: Reserved */ __u64 reserved[2 ]; };
RFC 16/17 drm/xe/uapi: Be more specific around GuC Version Type
In reply to Francois DugastFrom: Rodrigo Vivi <[email protected]>
Make it very clear and documented that it is about the submission version, and also what that actually means.
--- drivers/gpu/drm/xe/xe_query.c | 2 +- include/uapi/drm/xe_drm.h | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/xe/xe_query.c +1 -1
@@ -520,7 +520,7 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)return -EINVAL ;switch (resp.uc_type) { -case DRM_XE_QUERY_UC_TYPE_GUC : { +case DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION : {struct xe_guc *guc = &xe->tiles[0 ].primary_gt->uc.guc; resp.major_ver = guc->submission_state.version.major;
include/uapi/drm/xe_drm.h +14 -2
@@ -468,11 +468,23 @@ struct drm_xe_query_topology_mask {* * Given a uc_type this will return the major, minor, patch and branch version * of the micro-controller firmware. +* +* The @uc_type can be: +* - %DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION - This is the GuC Submission Version, +* a.k.a 'VF version'. It is not the actual GuC blob version. A running GuC can +* support multiple VF APIs with different Submission Versions. This version is +* negotiated by the VF KMD with GuC during VF initialization. In most of the +* current available GuC blobs, this is a 1-1 relationship where the Submission +* version could be inferred from the running version and vice-versa. However, +* the submission version is the most useful information for the user space +* perspective and needs. +* - %DRM_XE_QUERY_TYPE_HUC - The actual HuC blob that is currently running +* in the platform. It returns 0 when HuC is not currently loaded. */ struct drm_xe_query_uc_fw_version {/** @uc_type: The micro-controller type to query firmware version */ -#define DRM_XE_QUERY_UC_TYPE_GUC 0 -#define DRM_XE_QUERY_UC_TYPE_HUC 1 +#define DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION 0 +#define DRM_XE_QUERY_UC_TYPE_HUC 1__u16 uc_type;/** @pad: MBZ */
Signature · 1 line
2.34.1
Re: [Intel-xe] [RFC v1 16/17] drm/xe/uapi: Be more specific around GuC Version Type
Quoted 4 lines · Francois Dugast
From: Rodrigo Vivi <[email protected]>
Make it very clear and documented that it is about the submission version, and also what that actually means.
Quoted 50 lines
Signed-off-by Rodrigo Vivi <[email protected]>--- drivers/gpu/drm/xe/xe_query.c | 2 +- include/uapi/drm/xe_drm.h | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/xe/xe_query.c +1
-1@@ -520,7 +520,7 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)return -EINVAL ;switch (resp.uc_type) { -case DRM_XE_QUERY_UC_TYPE_GUC : { +case DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION : {struct xe_guc *guc = &xe->tiles[0 ].primary_gt->uc.guc; resp.major_ver = guc->submission_state.version.major;include/uapi/drm/xe_drm.h +14
-2@@ -468,11 +468,23 @@ struct drm_xe_query_topology_mask {* * Given a uc_type this will return the major, minor, patch and branch version * of the micro-controller firmware. +* +* The @uc_type can be: +* - %DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION - This is the GuC Submission Version, +* a.k.a 'VF version'. It is not the actual GuC blob version. A running GuC can +* support multiple VF APIs with different Submission Versions. This version is +* negotiated by the VF KMD with GuC during VF initialization. In most of the +* current available GuC blobs, this is a 1-1 relationship where the Submission +* version could be inferred from the running version and vice-versa. However, +* the submission version is the most useful information for the user space +* perspective and needs. +* - %DRM_XE_QUERY_TYPE_HUC - The actual HuC blob that is currently running +* in the platform. It returns 0 when HuC is not currently loaded. */ struct drm_xe_query_uc_fw_version {/** @uc_type: The micro-controller type to query firmware version */ -#define DRM_XE_QUERY_UC_TYPE_GUC 0 -#define DRM_XE_QUERY_UC_TYPE_HUC 1 +#define DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION 0 +#define DRM_XE_QUERY_UC_TYPE_HUC 1__u16 uc_type;/** @pad: MBZ */
RFC 17/17 drm/xe/uapi: Remove unused inaccessible memory region
In reply to Francois DugastThis is not used and also the negative of the other 2 regions:native_mem_regions and slow_mem_regions.
--- include/uapi/drm/xe_drm.h | 5 ----- 1 file changed, 5 deletions(-)
include/uapi/drm/xe_drm.h +0 -5
@@ -393,11 +393,6 @@ struct drm_xe_query_gt {* they live on a different GPU/Tile. */ __u64 slow_mem_regions; -/** -* @inaccessible_mem_regions: Bit mask of instances from -* drm_xe_query_mem_usage that is not accessible by this GT at all. -*/ -__u64 inaccessible_mem_regions;/** @reserved: Reserved */ __u64 reserved[8 ]; };
Signature · 1 line
2.34.1
Re: [Intel-xe] [RFC v1 17/17] drm/xe/uapi: Remove unused inaccessible memory region
Quoted 2 lines · Francois Dugast
This is not used and also the negative of the other 2 regions:
native_mem_regionsandslow_mem_regions.
Quoted 22 lines
Signed-off-by Francois Dugast <[email protected]>--- include/uapi/drm/xe_drm.h | 5 ----- 1 file changed, 5 deletions(-)include/uapi/drm/xe_drm.h +0
-5@@ -393,11 +393,6 @@ struct drm_xe_query_gt {* they live on a different GPU/Tile. */ __u64 slow_mem_regions; -/** -* @inaccessible_mem_regions: Bit mask of instances from -* drm_xe_query_mem_usage that is not accessible by this GT at all. -*/ -__u64 inaccessible_mem_regions;/** @reserved: Reserved */ __u64 reserved[8 ]; };
Quoted 10 lines · Francois Dugast
This is the second take of uAPI updates that would lead to breakage in the compatibility, which it is not acceptable after we are merged upstream. So, let's break it before it is too late, and start upstreaming a good, reliable and clean uapi.
This series is not complete yet but it is sent for early review as some patches are already a few weeks old.
It series is intended to be applied after take 1 [1] which is not merged yet, so it will break CI.
LGTM to me in general.
Ack from Mesa side.
Quoted 51 lines
[1] https://patchwork.freedesktop.org/series/124710/
Francois Dugast (10):
fixup! drm/xe: Correlate engine and cpu timestamps with better
accuracy
drm/xe/uapi: Add documentation for query
drm/xe/uapi: DocumentDRM_XE_DEVICE_QUERY_HWCONFIGdrm/xe: Extend uAPI to query HuC micro-controler firmware version drm/xe: Remove useless query confignum_paramsdrm/xe/uapi: Add missingDRM_prefix in uAPI constants drm/xe/uapi: Add_FLAGto uAPI constants usable for flags fixup! drm/xe: Add uAPI to query micro-controler firmware version drm/xe/uapi: Make constant comments visible in kernel doc drm/xe/uapi: Remove unused inaccessible memory regionJosé Roberto de Souza (1):
drm/xe: Add uAPI to query micro-controler firmware versionMika Kuoppala (1):
drm/xe: Extenddrm_xe_vm_bind_opRodrigo Vivi (4):
drm/xe/uapi: RemoveGT_TYPE_REMOTEdrm/xe/uapi: KillVM_MADVISEIOCTL drm/xe/uapi: Separatebo_createplacement from flags drm/xe/uapi: Be more specific around GuC Version TypeUmesh Nerlige Ramappa (1):
fixup! drm/xe: Correlate engine and cpu timestamps with better
accuracydrivers/gpu/drm/xe/Makefile | 1 - drivers/gpu/drm/xe/xe_bo.c | 27 +- drivers/gpu/drm/xe/xe_bo_types.h | 3 + drivers/gpu/drm/xe/xe_device.c | 8 +- drivers/gpu/drm/xe/xe_exec_queue.c | 20 +- drivers/gpu/drm/xe/xe_gt.c | 2 +- drivers/gpu/drm/xe/xe_pmu.c | 20 +- drivers/gpu/drm/xe/xe_query.c | 95 +++-- drivers/gpu/drm/xe/xe_sync.c | 16 +- drivers/gpu/drm/xe/xe_vm.c | 86 ++--- drivers/gpu/drm/xe/xe_vm_doc.h | 14 +- drivers/gpu/drm/xe/xe_vm_madvise.c | 299 --------------- drivers/gpu/drm/xe/xe_vm_madvise.h | 15 - drivers/gpu/drm/xe/xe_wait_user_fence.c | 10 +- include/uapi/drm/xe_drm.h | 478 +++++++++++++----------- 15 files changed, 435 insertions(+), 659 deletions(-) delete mode 100644 drivers/gpu/drm/xe/xe_vm_madvise.c delete mode 100644 drivers/gpu/drm/xe/xe_vm_madvise.h
Patchwork
CI[Intel-xe] ✗ CI.Patch_applied: failure for uAPI Alignment - take 2
In reply to Francois Dugast== Series Details ==
== Series Details ==
Series: uAPI Alignment - take 2
URL : https://patchwork.freedesktop.org/series/124977/
State : failure
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: ===
Base commit: 81cbfcc83 Revert "drm/i915/display: Fix a use-after-free when intel_edp_init_connector fails" === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/xe_query.c:105
error: drivers/gpu/drm/xe/xe_query.c: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy
Patch failed at 0001 fixup! drm/xe: Correlate engine and cpu timestamps with better accuracy 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".