Commit b2121f2b authored by Francois Dugast's avatar Francois Dugast Committed by José Roberto de Souza

drm/xe: Extend uAPI to query HuC micro-controler firmware version

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: default avatarFrancois Dugast <francois.dugast@intel.com>
Signed-off-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240208183539.185095-2-jose.souza@intel.com
parent 17323917
......@@ -540,14 +540,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.branch_ver = 0;
resp.major_ver = version->major;
resp.minor_ver = version->minor;
resp.patch_ver = version->patch;
if (version) {
resp.branch_ver = 0;
resp.major_ver = version->major;
resp.minor_ver = version->minor;
resp.patch_ver = version->patch;
} else {
return -ENODEV;
}
if (copy_to_user(query_ptr, &resp, size))
return -EFAULT;
......
......@@ -583,6 +583,7 @@ struct drm_xe_query_engine_cycles {
struct drm_xe_query_uc_fw_version {
/** @uc_type: 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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment