From: "José Roberto de Souza" <jose.souza@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "John Harrison" <John.C.Harrison@Intel.com>,
"Francois Dugast" <francois.dugast@intel.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"José Roberto de Souza" <jose.souza@intel.com>
Subject: [PATCH 2/2] drm/xe: Extend uAPI to query HuC micro-controler firmware version
Date: Wed, 7 Feb 2024 10:14:12 -0800 [thread overview]
Message-ID: <20240207181412.96548-2-jose.souza@intel.com> (raw)
In-Reply-To: <20240207181412.96548-1-jose.souza@intel.com>
From: Francois Dugast <francois.dugast@intel.com>
The 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.
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
drivers/gpu/drm/xe/xe_query.c | 38 +++++++++++++++++++++++++++++++----
include/uapi/drm/xe_drm.h | 1 +
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
index a912ba58eeb8a..a8b927fc8c7d0 100644
--- a/drivers/gpu/drm/xe/xe_query.c
+++ b/drivers/gpu/drm/xe/xe_query.c
@@ -544,14 +544,44 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
version = &guc->fw.versions.found[XE_UC_FW_VER_COMPATIBILITY];
break;
}
+ case XE_QUERY_UC_TYPE_HUC: {
+ struct xe_gt *media_gt = NULL;
+ struct xe_huc *huc;
+
+ if (MEDIA_VER(xe) >= 13) {
+ struct xe_tile *tile;
+ u8 gt_id;
+
+ for_each_tile(tile, xe, gt_id) {
+ if (tile->media_gt) {
+ media_gt = tile->media_gt;
+ break;
+ }
+ }
+ } else {
+ media_gt = xe->tiles[0].primary_gt;
+ }
+
+ if (!media_gt)
+ break;
+
+ huc = &media_gt->uc.huc;
+ if (huc->fw.status == XE_UC_FIRMWARE_RUNNING)
+ version = &huc->fw.versions.found[XE_UC_FW_VER_RELEASE];
+ break;
+ }
default:
return -EINVAL;
}
- resp.major_ver = version->major;
- resp.minor_ver = version->minor;
- resp.patch_ver = version->patch;
- resp.branch_ver = 0;
+ if (version) {
+ resp.major_ver = version->major;
+ resp.minor_ver = version->minor;
+ resp.patch_ver = version->patch;
+ resp.branch_ver = 0;
+ } else {
+ return -ENODEV;
+ }
if (copy_to_user(query_ptr, &resp, size))
return -EFAULT;
diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
index 52a69a6f327e0..e4293104e377d 100644
--- a/include/uapi/drm/xe_drm.h
+++ b/include/uapi/drm/xe_drm.h
@@ -583,6 +583,7 @@ struct drm_xe_query_engine_cycles {
struct drm_xe_query_uc_fw_version {
/** @uc: The micro-controller type to query firmware version */
#define XE_QUERY_UC_TYPE_GUC_SUBMISSION 0
+#define XE_QUERY_UC_TYPE_HUC 1
__u16 uc_type;
/** @pad: MBZ */
--
2.43.0
next prev parent reply other threads:[~2024-02-07 18:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 18:14 [PATCH 1/2] drm/xe: Add uAPI to query GuC firmware submission version José Roberto de Souza
2024-02-07 18:14 ` José Roberto de Souza [this message]
2024-02-07 18:17 ` ✓ CI.Patch_applied: success for series starting with [1/2] " Patchwork
2024-02-07 18:17 ` ✓ CI.checkpatch: " Patchwork
2024-02-07 18:18 ` ✓ CI.KUnit: " Patchwork
2024-02-07 18:25 ` ✓ CI.Build: " Patchwork
2024-02-07 18:25 ` ✗ CI.Hooks: failure " Patchwork
2024-02-07 18:27 ` ✓ CI.checksparse: success " Patchwork
2024-02-07 19:04 ` ✓ CI.BAT: " Patchwork
2024-02-08 18:06 ` [PATCH 1/2] " John Harrison
2024-02-08 18:19 ` Souza, Jose
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240207181412.96548-2-jose.souza@intel.com \
--to=jose.souza@intel.com \
--cc=John.C.Harrison@Intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox