Lines Matching +full:version +full:- +full:minor
1 // SPDX-License-Identifier: MIT
23 * List of required GuC and HuC binaries per-platform. They must be ordered
27 * Documentation/driver-api/firmware/firmware-usage-guidelines.rst. There is a
30 * driver (under force-probe), use the mmp_ver(): the firmware autoselect logic
32 * "mpp version", i.e. major.minor.patch. mmp_ver() should only be used for
36 * ever contains the major version (GuC) or no version at all (HuC).
39 * The major version needs to match a major version supported by the driver (if
40 * any). The minor version is also checked and a notice emitted to the log if
41 * the version found is smaller than the version wanted. This is done only for
47 * 1) Platform officially supported by i915 - using Tigerlake as example.
50 * - i915/tgl_guc_<major>.bin
51 * - i915/tgl_huc.bin
53 * <major> number for GuC is checked that it matches the version inside
54 * the blob. <minor> version is checked and if smaller than the expected
58 * "wipplat" as a short-name. Driver loads the following firmware blobs
61 * - xe/wipplat_guc_<major>.<minor>.<patch>.bin
62 * - xe/wipplat_huc_<major>.<minor>.<patch>.bin
64 * <major> and <minor> are checked that they match the version inside
68 * 3) Platform officially supported by xe and out of force-probe. Using
69 * "plat" as a short-name. Except for the different directory, the
73 * - xe/plat_guc_<major>.bin
74 * - xe/plat_huc.bin
76 * <major> number for GuC is checked that it matches the version inside
77 * the blob. <minor> version is checked and if smaller than the expected
80 * For the platforms already released with a major version, they should never be
84 * TODO: Currently there's no fallback on major version. That's because xe
85 * driver only supports the one major version of each firmware in the table.
86 * This needs to be fixed when the major version of GuC is updated.
94 u16 minor; member
122 /* for the GSC FW we match the compatibility version and not the release one */
181 return __uc_fw_to_gt(uc_fw, uc_fw->type); in uc_fw_to_gt()
211 enum xe_platform p = xe->info.platform; in uc_fw_auto_select()
215 xe_assert(xe, uc_fw->type < ARRAY_SIZE(blobs_all)); in uc_fw_auto_select()
216 entries = blobs_all[uc_fw->type].entries; in uc_fw_auto_select()
217 count = blobs_all[uc_fw->type].count; in uc_fw_auto_select()
221 uc_fw->path = entries[i].path; in uc_fw_auto_select()
222 uc_fw->versions.wanted.major = entries[i].major; in uc_fw_auto_select()
223 uc_fw->versions.wanted.minor = entries[i].minor; in uc_fw_auto_select()
224 uc_fw->full_ver_required = entries[i].full_ver_required; in uc_fw_auto_select()
226 if (uc_fw->type == XE_UC_FW_TYPE_GSC) in uc_fw_auto_select()
227 uc_fw->versions.wanted_type = XE_UC_FW_VER_COMPATIBILITY; in uc_fw_auto_select()
229 uc_fw->versions.wanted_type = XE_UC_FW_VER_RELEASE; in uc_fw_auto_select()
242 switch (uc_fw->type) { in uc_fw_override()
258 uc_fw->path = path_override; in uc_fw_override()
259 uc_fw->user_overridden = true; in uc_fw_override()
264 * xe_uc_fw_copy_rsa - copy fw RSA to buffer
275 u32 size = min_t(u32, uc_fw->rsa_size, max_len); in xe_uc_fw_copy_rsa()
280 xe_map_memcpy_from(xe, dst, &uc_fw->bo->vmap, in xe_uc_fw_copy_rsa()
299 struct xe_uc_fw_version *release = &uc_fw->versions.found[XE_UC_FW_VER_RELEASE]; in guc_read_css_info()
300 struct xe_uc_fw_version *compatibility = &uc_fw->versions.found[XE_UC_FW_VER_COMPATIBILITY]; in guc_read_css_info()
302 xe_gt_assert(gt, uc_fw->type == XE_UC_FW_TYPE_GUC); in guc_read_css_info()
303 xe_gt_assert(gt, release->major >= 70); in guc_read_css_info()
305 if (release->major > 70 || release->minor >= 6) { in guc_read_css_info()
307 compatibility->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, in guc_read_css_info()
308 css->submission_version); in guc_read_css_info()
309 compatibility->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, in guc_read_css_info()
310 css->submission_version); in guc_read_css_info()
311 compatibility->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, in guc_read_css_info()
312 css->submission_version); in guc_read_css_info()
313 } else if (release->minor >= 3) { in guc_read_css_info()
315 compatibility->major = 1; in guc_read_css_info()
316 compatibility->minor = 1; in guc_read_css_info()
317 compatibility->patch = 0; in guc_read_css_info()
320 compatibility->major = 1; in guc_read_css_info()
321 compatibility->minor = 0; in guc_read_css_info()
322 compatibility->patch = 0; in guc_read_css_info()
325 uc_fw->private_data_size = css->private_data_size; in guc_read_css_info()
331 struct xe_uc_fw_version *wanted = &uc_fw->versions.wanted; in xe_uc_fw_check_version_requirements()
332 struct xe_uc_fw_version *found = &uc_fw->versions.found[uc_fw->versions.wanted_type]; in xe_uc_fw_check_version_requirements()
334 /* Driver has no requirement on any version, any is good. */ in xe_uc_fw_check_version_requirements()
335 if (!wanted->major) in xe_uc_fw_check_version_requirements()
339 * If full version is required, both major and minor should match. in xe_uc_fw_check_version_requirements()
340 * Otherwise, at least the major version. in xe_uc_fw_check_version_requirements()
342 if (wanted->major != found->major || in xe_uc_fw_check_version_requirements()
343 (uc_fw->full_ver_required && wanted->minor != found->minor)) { in xe_uc_fw_check_version_requirements()
344 drm_notice(&xe->drm, "%s firmware %s: unexpected version: %u.%u != %u.%u\n", in xe_uc_fw_check_version_requirements()
345 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, in xe_uc_fw_check_version_requirements()
346 found->major, found->minor, in xe_uc_fw_check_version_requirements()
347 wanted->major, wanted->minor); in xe_uc_fw_check_version_requirements()
351 if (wanted->minor > found->minor) { in xe_uc_fw_check_version_requirements()
352 drm_notice(&xe->drm, "%s firmware (%u.%u) is recommended, but only (%u.%u) was found in %s\n", in xe_uc_fw_check_version_requirements()
353 xe_uc_fw_type_repr(uc_fw->type), in xe_uc_fw_check_version_requirements()
354 wanted->major, wanted->minor, in xe_uc_fw_check_version_requirements()
355 found->major, found->minor, in xe_uc_fw_check_version_requirements()
356 uc_fw->path); in xe_uc_fw_check_version_requirements()
357 drm_info(&xe->drm, "Consider updating your linux-firmware pkg or downloading from %s\n", in xe_uc_fw_check_version_requirements()
367 return -ENOEXEC; in xe_uc_fw_check_version_requirements()
370 /* Refer to the "CSS-based Firmware Layout" documentation entry for details */
374 struct xe_uc_fw_version *release = &uc_fw->versions.found[XE_UC_FW_VER_RELEASE]; in parse_css_header()
380 drm_warn(&xe->drm, "%s firmware %s: invalid size: %zu < %zu\n", in parse_css_header()
381 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, in parse_css_header()
383 return -ENODATA; in parse_css_header()
389 size = (css->header_size_dw - css->key_size_dw - css->modulus_size_dw - in parse_css_header()
390 css->exponent_size_dw) * sizeof(u32); in parse_css_header()
392 drm_warn(&xe->drm, in parse_css_header()
394 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, in parse_css_header()
396 return -EPROTO; in parse_css_header()
400 uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32); in parse_css_header()
403 uc_fw->rsa_size = css->key_size_dw * sizeof(u32); in parse_css_header()
406 size = sizeof(struct uc_css_header) + uc_fw->ucode_size + in parse_css_header()
407 uc_fw->rsa_size; in parse_css_header()
409 drm_warn(&xe->drm, "%s firmware %s: invalid size: %zu < %zu\n", in parse_css_header()
410 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, in parse_css_header()
412 return -ENOEXEC; in parse_css_header()
415 /* Get version numbers from the CSS header */ in parse_css_header()
416 release->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, css->sw_version); in parse_css_header()
417 release->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, css->sw_version); in parse_css_header()
418 release->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, css->sw_version); in parse_css_header()
420 if (uc_fw->type == XE_UC_FW_TYPE_GUC) in parse_css_header()
438 entry = (void *)header + header->header_length; in entry_offset()
440 for (i = 0; i < header->num_of_entries; i++, entry++) in entry_offset()
441 if (strcmp(entry->name, name) == 0) in entry_offset()
442 return entry->offset & GSC_CPD_ENTRY_OFFSET_MASK; in entry_offset()
447 /* Refer to the "GSC-based Firmware Layout" documentation entry for details */
454 struct xe_uc_fw_version *release = &uc_fw->versions.found[XE_UC_FW_VER_RELEASE]; in parse_cpd_header()
463 return -ENOENT; in parse_cpd_header()
465 if (header->header_length < sizeof(struct gsc_cpd_header_v2)) { in parse_cpd_header()
466 xe_gt_err(gt, "invalid CPD header length %u!\n", header->header_length); in parse_cpd_header()
467 return -EINVAL; in parse_cpd_header()
470 min_size = header->header_length + sizeof(struct gsc_cpd_entry) * header->num_of_entries; in parse_cpd_header()
473 return -ENODATA; in parse_cpd_header()
480 xe_uc_fw_type_repr(uc_fw->type)); in parse_cpd_header()
481 return -ENODATA; in parse_cpd_header()
487 return -ENODATA; in parse_cpd_header()
492 release->major = manifest->fw_version.major; in parse_cpd_header()
493 release->minor = manifest->fw_version.minor; in parse_cpd_header()
494 release->patch = manifest->fw_version.hotfix; in parse_cpd_header()
496 if (uc_fw->type == XE_UC_FW_TYPE_GSC) { in parse_cpd_header()
499 release->build = manifest->fw_version.build; in parse_cpd_header()
500 gsc->security_version = manifest->security_version; in parse_cpd_header()
512 xe_assert(xe, xe->info.platform != XE_DG2); in parse_cpd_header()
519 return -ENODATA; in parse_cpd_header()
522 ret = parse_css_header(uc_fw, data + offset, size - offset); in parse_cpd_header()
526 uc_fw->css_offset = offset; in parse_cpd_header()
529 uc_fw->has_gsc_headers = true; in parse_cpd_header()
545 return -ENODATA; in parse_gsc_layout()
548 min_size = layout->boot1.offset + layout->boot1.size; in parse_gsc_layout()
552 return -ENODATA; in parse_gsc_layout()
556 if (layout->boot1.size < min_size) { in parse_gsc_layout()
558 layout->boot1.size, min_size); in parse_gsc_layout()
559 return -ENODATA; in parse_gsc_layout()
562 bpdt_header = data + layout->boot1.offset; in parse_gsc_layout()
563 if (bpdt_header->signature != GSC_BPDT_HEADER_SIGNATURE) { in parse_gsc_layout()
565 bpdt_header->signature); in parse_gsc_layout()
566 return -EINVAL; in parse_gsc_layout()
569 min_size += sizeof(*bpdt_entry) * bpdt_header->descriptor_count; in parse_gsc_layout()
570 if (layout->boot1.size < min_size) { in parse_gsc_layout()
572 layout->boot1.size, min_size); in parse_gsc_layout()
573 return -ENODATA; in parse_gsc_layout()
577 for (i = 0; i < bpdt_header->descriptor_count; i++, bpdt_entry++) { in parse_gsc_layout()
578 if ((bpdt_entry->type & GSC_BPDT_ENTRY_TYPE_MASK) != in parse_gsc_layout()
582 min_size = bpdt_entry->sub_partition_offset; in parse_gsc_layout()
585 if (layout->boot1.size < min_size) { in parse_gsc_layout()
587 layout->boot1.size, min_size); in parse_gsc_layout()
588 return -ENODATA; in parse_gsc_layout()
593 layout->boot1.size - min_size, in parse_gsc_layout()
598 return -ENODATA; in parse_gsc_layout()
609 switch (uc_fw->type) { in parse_headers()
611 return parse_gsc_layout(uc_fw, fw->data, fw->size); in parse_headers()
613 ret = parse_cpd_header(uc_fw, fw->data, fw->size, "HUCP.man", "huc_fw"); in parse_headers()
614 if (!ret || ret != -ENOENT) in parse_headers()
618 return parse_css_header(uc_fw, fw->data, fw->size); in parse_headers()
620 return -EINVAL; in parse_headers()
629 if (ver_->build) \
630 drm_printf(p_, prefix_ " version %u.%u.%u.%u\n", ##__VA_ARGS__, \
631 ver_->major, ver_->minor, \
632 ver_->patch, ver_->build); \
634 drm_printf(p_, prefix_ " version %u.%u.%u\n", ##__VA_ARGS__, \
635 ver_->major, ver_->minor, ver_->patch); \
641 struct device *dev = xe->drm.dev; in uc_fw_request()
647 * we use FIRMWARE_UNINITIALIZED to detect checks against uc_fw->status in uc_fw_request()
651 xe_assert(xe, !uc_fw->status); in uc_fw_request()
652 xe_assert(xe, !uc_fw->path); in uc_fw_request()
655 xe_uc_fw_change_status(uc_fw, uc_fw->path ? in uc_fw_request()
665 if (!xe_device_uc_enabled(xe) || !(*uc_fw->path)) { in uc_fw_request()
667 drm_dbg(&xe->drm, "%s disabled", xe_uc_fw_type_repr(uc_fw->type)); in uc_fw_request()
671 err = request_firmware(&fw, uc_fw->path, dev); in uc_fw_request()
680 &uc_fw->versions.found[XE_UC_FW_VER_RELEASE], in uc_fw_request()
682 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path); in uc_fw_request()
684 /* for GSC FW we want the compatibility version, which we query after load */ in uc_fw_request()
685 if (uc_fw->type != XE_UC_FW_TYPE_GSC) { in uc_fw_request()
696 xe_uc_fw_change_status(uc_fw, err == -ENOENT ? in uc_fw_request()
700 drm_notice(&xe->drm, "%s firmware %s: fetch failed with error %d\n", in uc_fw_request()
701 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); in uc_fw_request()
702 drm_info(&xe->drm, "%s firmware(s) can be downloaded from %s\n", in uc_fw_request()
703 xe_uc_fw_type_repr(uc_fw->type), XE_UC_FIRMWARE_URL); in uc_fw_request()
725 drm_notice(&xe->drm, "%s firmware %s: failed to create / populate bo", in uc_fw_copy()
726 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path); in uc_fw_copy()
731 uc_fw->bo = obj; in uc_fw_copy()
732 uc_fw->size = size; in uc_fw_copy()
736 err = drmm_add_action_or_reset(&xe->drm, uc_fw_fini, uc_fw); in uc_fw_copy()
744 drm_notice(&xe->drm, "%s firmware %s: copy failed with error %d\n", in uc_fw_copy()
745 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); in uc_fw_copy()
763 err = uc_fw_copy(uc_fw, fw->data, fw->size, in xe_uc_fw_init()
773 return xe_bo_ggtt_addr(uc_fw->bo); in uc_fw_ggtt_offset()
786 src_offset = uc_fw_ggtt_offset(uc_fw) + uc_fw->css_offset; in uc_fw_xfer()
800 sizeof(struct uc_css_header) + uc_fw->ucode_size); in uc_fw_xfer()
810 drm_err(&xe->drm, "DMA for %s fw failed, DMA_CTRL=%u\n", in uc_fw_xfer()
811 xe_uc_fw_type_repr(uc_fw->type), dma_ctrl); in uc_fw_xfer()
828 return -ENOEXEC; in xe_uc_fw_upload()
839 drm_err(&xe->drm, "Failed to load %s firmware %s (%d)\n", in xe_uc_fw_upload()
840 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, in xe_uc_fw_upload()
854 return "Unknown version type"; in version_type_repr()
863 xe_uc_fw_type_repr(uc_fw->type), uc_fw->path); in xe_uc_fw_print()
865 xe_uc_fw_status_repr(uc_fw->status)); in xe_uc_fw_print()
867 print_uc_fw_version(p, &uc_fw->versions.wanted, "\twanted %s", in xe_uc_fw_print()
868 version_type_repr(uc_fw->versions.wanted_type)); in xe_uc_fw_print()
871 struct xe_uc_fw_version *ver = &uc_fw->versions.found[i]; in xe_uc_fw_print()
873 if (ver->major) in xe_uc_fw_print()
878 if (uc_fw->ucode_size) in xe_uc_fw_print()
879 drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size); in xe_uc_fw_print()
880 if (uc_fw->rsa_size) in xe_uc_fw_print()
881 drm_printf(p, "\tRSA: %u bytes\n", uc_fw->rsa_size); in xe_uc_fw_print()