intel/common: Implement xe_engines_is_guc_semaphore_functional()

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25233>
This commit is contained in:
José Roberto de Souza
2024-02-07 07:34:50 -08:00
committed by Marge Bot
parent ac941b13f1
commit 4423454daa
+31 -2
View File
@@ -106,6 +106,35 @@ error_free_xe_engines:
bool
xe_engines_is_guc_semaphore_functional(int fd, const struct intel_device_info *info)
{
/* TODO */
return false;
struct drm_xe_query_uc_fw_version uc_fw_version = {
.uc_type = XE_QUERY_UC_TYPE_GUC_SUBMISSION,
};
struct drm_xe_device_query query = {
.query = DRM_XE_DEVICE_QUERY_UC_FW_VERSION,
.data = (uintptr_t)&uc_fw_version,
.size = sizeof(uc_fw_version)
};
uint32_t read_ver, min_ver;
if (intel_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query))
return false;
/* branch == 0 is mainline branch, any other branch value indicates that
* other version numbers cannot be used to infer whether features or fixes
* are present in the release.
*
* major, minor and patch are u8 for GuC, uAPI have it as u32 because of HuC.
*/
if (uc_fw_version.branch_ver == 0) {
read_ver = uc_fw_version.major_ver << 16;
read_ver |= uc_fw_version.minor_ver << 8;
read_ver |= uc_fw_version.patch_ver;
} else {
read_ver = 0;
}
/* Requires at least GuC submission version 1.1.3 */
min_ver = 1ULL << 16 | 1ULL << 8 | 3;
return read_ver >= min_ver;
}