Skip to content

Commit e4731b5

Browse files
committed
drm/i915/huc: check HuC and GuC version compatibility on MTL
Due to a change in the auth flow on MTL, GuC 70.7.0 and newer will only be able to authenticate HuC 8.5.1 and newer. The plan is to update the 2 binaries synchronously in linux-firmware so that the fw repo always has a matching pair that works; still, it's better to check in the kernel so we can print an error message and abort HuC loading if the binaries are out of sync instead of failing the authentication. v2: Add clarification comment, fix typo in commit msg, clean up variable declaration (John) Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Cc: John Harrison <[email protected]> Reviewed-by: Andrzej Hajda <[email protected]> #v1 Reviewed-by: John Harrison <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d84990a commit e4731b5

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,11 +787,57 @@ static int try_firmware_load(struct intel_uc_fw *uc_fw, const struct firmware **
787787
return 0;
788788
}
789789

790+
static int check_mtl_huc_guc_compatibility(struct intel_gt *gt,
791+
struct intel_uc_fw_file *huc_selected)
792+
{
793+
struct intel_uc_fw_file *guc_selected = &gt->uc.guc.fw.file_selected;
794+
struct intel_uc_fw_ver *huc_ver = &huc_selected->ver;
795+
struct intel_uc_fw_ver *guc_ver = &guc_selected->ver;
796+
bool new_huc, new_guc;
797+
798+
/* we can only do this check after having fetched both GuC and HuC */
799+
GEM_BUG_ON(!huc_selected->path || !guc_selected->path);
800+
801+
/*
802+
* Due to changes in the authentication flow for MTL, HuC 8.5.1 or newer
803+
* requires GuC 70.7.0 or newer. Older HuC binaries will instead require
804+
* GuC < 70.7.0.
805+
*/
806+
new_huc = huc_ver->major > 8 ||
807+
(huc_ver->major == 8 && huc_ver->minor > 5) ||
808+
(huc_ver->major == 8 && huc_ver->minor == 5 && huc_ver->patch >= 1);
809+
810+
new_guc = guc_ver->major > 70 ||
811+
(guc_ver->major == 70 && guc_ver->minor >= 7);
812+
813+
if (new_huc != new_guc) {
814+
UNEXPECTED(gt, "HuC %u.%u.%u is incompatible with GuC %u.%u.%u\n",
815+
huc_ver->major, huc_ver->minor, huc_ver->patch,
816+
guc_ver->major, guc_ver->minor, guc_ver->patch);
817+
gt_info(gt, "MTL GuC 70.7.0+ and HuC 8.5.1+ don't work with older releases\n");
818+
return -ENOEXEC;
819+
}
820+
821+
return 0;
822+
}
823+
790824
int intel_uc_check_file_version(struct intel_uc_fw *uc_fw, bool *old_ver)
791825
{
792826
struct intel_gt *gt = __uc_fw_to_gt(uc_fw);
793827
struct intel_uc_fw_file *wanted = &uc_fw->file_wanted;
794828
struct intel_uc_fw_file *selected = &uc_fw->file_selected;
829+
int ret;
830+
831+
/*
832+
* MTL has some compatibility issues with early GuC/HuC binaries
833+
* not working with newer ones. This is specific to MTL and we
834+
* don't expect it to extend to other platforms.
835+
*/
836+
if (IS_METEORLAKE(gt->i915) && uc_fw->type == INTEL_UC_FW_TYPE_HUC) {
837+
ret = check_mtl_huc_guc_compatibility(gt, selected);
838+
if (ret)
839+
return ret;
840+
}
795841

796842
if (!wanted->ver.major || !selected->ver.major)
797843
return 0;

0 commit comments

Comments
 (0)