drm/xe: Add uAPI to query micro-controler firmware version
Subsystems (3)
PATCH v2 1/1 drm/xe: Add uAPI to query micro-controler firmware version
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
--- drivers/gpu/drm/xe/xe_query.c | 40 ++++++++++++++++++++++++++++++++ include/uapi/drm/xe_drm.h | 43 ++++++++++++++++++++++++++++++----- 2 files changed, 77 insertions(+), 6 deletions(-)
drivers/gpu/drm/xe/xe_query.c +40 -0
@@ -361,6 +361,45 @@ 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,
@@ -369,6 +408,7 @@ static int (* const xe_query_funcs[])(struct xe_device *xe, query_gts, query_hwconfig, query_gt_topology, + query_uc_fw_version, };int xe_query_ioctl (struct drm_device *dev,void *data,struct drm_file *file)
include/uapi/drm/xe_drm.h +37 -6
55 lines not on this page · raw message
Signature · 1 line
2.42.0
Patchwork
CI[Intel-xe] ✓ CI.Patch_applied: success for drm/xe: Add uAPI to query micro-controler firmware version
== Series Details ==
== Series Details ==
Series: drm/xe: Add uAPI to query micro-controler firmware version
URL : https://patchwork.freedesktop.org/series/123779/
State : success
== Summary ==
=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 4a9681392 drm/xe/pmu: Enable PMU interface === git am output follows ===
Applying: drm/xe: Add uAPI to query micro-controler firmware version
Patchwork
CI[Intel-xe] ✗ CI.checkpatch: warning for drm/xe: Add uAPI to query micro-controler firmware version
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: drm/xe: Add uAPI to query micro-controler firmware version
URL : https://patchwork.freedesktop.org/series/123779/
State : warning
== Summary ==
+ KERNEL=/kernel
+ git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt Cloning into 'mt'...
warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
+ git -C mt rev-list -n1 origin/master 63c2b6b160bca2df6efc7bc4cea6f442097d7854
+ cd /kernel
+ git config --global --add safe.directory /kernel
+ git log -n1
commit 9f34bb456bfbac104f8b4da73c8b409828277bd8
Author: José Roberto de Souza <[email protected]> Date: Fri Sep 15 07:39:58 2023 -0700
drm/xe: Add uAPI to query micro-controler firmware version
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
+ /mt/dim checkpatch 4a9681392cecd56a372d06b648f7b3a37fdd5c63 drm-intel9f34bb456 drm/xe: Add uAPI to query micro-controler firmware version
-:18: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #18:
More information: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23661
total: 0 errors, 1 warnings, 0 checks, 107 lines checked
Patchwork
CI[Intel-xe] ✗ CI.KUnit: failure for drm/xe: Add uAPI to query micro-controler firmware version
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: drm/xe: Add uAPI to query micro-controler firmware version
URL : https://patchwork.freedesktop.org/series/123779/
State : failure
== Summary ==
+ trap cleanup EXIT
+ /kernel/tools/testing/kunit/kunit.py run --kunitconfig /kernel/drivers/gpu/drm/xe/.kunitconfig ERROR:root:../drivers/gpu/drm/xe/xe_query.c: In function ‘query_uc_fw_version’:../drivers/gpu/drm/xe/xe_query.c:386:3: error: a label can only be part of a statement and a declaration is not a statement
386 | struct xe_guc *guc = &xe->tiles[0].primary_gt->uc.guc;
| ^~~~~~make[7]: *** [../scripts/Makefile.build:243: drivers/gpu/drm/xe/xe_query.o] Error 1 make[7]: *** Waiting for unfinished jobs....
make[6]: *** [../scripts/Makefile.build:480: drivers/gpu/drm/xe] Error 2 make[6]: *** Waiting for unfinished jobs....
make[5]: *** [../scripts/Makefile.build:480: drivers/gpu/drm] Error 2 make[4]: *** [../scripts/Makefile.build:480: drivers/gpu] Error 2 make[3]: *** [../scripts/Makefile.build:480: drivers] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/kernel/Makefile:2032: .] Error 2
make[1]: *** [/kernel/Makefile:234: __sub-make] Error 2
make: *** [Makefile:234: __sub-make] Error 2
[15:06:57] Configuring KUnit Kernel ...
Generating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig [15:07:01] Building KUnit Kernel ... Populating config with: $ make ARCH=um O=.kunit olddefconfig Building with: $ make ARCH=um O=.kunit --jobs=48 + cleanup ++ stat -c %u:%g /kernel + chown -R 1003:1003 /kernel