1dd08ebf6SMatthew Brost // SPDX-License-Identifier: MIT 2dd08ebf6SMatthew Brost /* 3dd08ebf6SMatthew Brost * Copyright © 2022 Intel Corporation 4dd08ebf6SMatthew Brost */ 5dd08ebf6SMatthew Brost 6dd08ebf6SMatthew Brost #include <linux/bitfield.h> 7dd08ebf6SMatthew Brost #include <linux/firmware.h> 8dd08ebf6SMatthew Brost 9dd08ebf6SMatthew Brost #include <drm/drm_managed.h> 10dd08ebf6SMatthew Brost 11a9b1a136SLucas De Marchi #include "regs/xe_guc_regs.h" 12dd08ebf6SMatthew Brost #include "xe_bo.h" 13dd08ebf6SMatthew Brost #include "xe_device_types.h" 14dd08ebf6SMatthew Brost #include "xe_force_wake.h" 15985d5a49SDaniele Ceraolo Spurio #include "xe_gsc.h" 16dd08ebf6SMatthew Brost #include "xe_gt.h" 1726a22952SMichal Wajdeczko #include "xe_gt_printk.h" 184eb0aab6SJulia Filipchuk #include "xe_guc.h" 19dd08ebf6SMatthew Brost #include "xe_map.h" 20dd08ebf6SMatthew Brost #include "xe_mmio.h" 21a455ed04SDaniele Ceraolo Spurio #include "xe_module.h" 2266cb3ca9SMichal Wajdeczko #include "xe_sriov.h" 23dd08ebf6SMatthew Brost #include "xe_uc_fw.h" 24dd08ebf6SMatthew Brost 25ad55ead7SLucas De Marchi /* 26ad55ead7SLucas De Marchi * List of required GuC and HuC binaries per-platform. They must be ordered 27ad55ead7SLucas De Marchi * based on platform, from newer to older. 28ad55ead7SLucas De Marchi * 29ad55ead7SLucas De Marchi * Versioning follows the guidelines from 30ad55ead7SLucas De Marchi * Documentation/driver-api/firmware/firmware-usage-guidelines.rst. There is a 31ad55ead7SLucas De Marchi * distinction for platforms being officially supported by the driver or not. 32ad55ead7SLucas De Marchi * Platforms not available publicly or not yet officially supported by the 33ad55ead7SLucas De Marchi * driver (under force-probe), use the mmp_ver(): the firmware autoselect logic 34ad55ead7SLucas De Marchi * will select the firmware from disk with filename that matches the full 35ad55ead7SLucas De Marchi * "mpp version", i.e. major.minor.patch. mmp_ver() should only be used for 36ad55ead7SLucas De Marchi * this case. 37ad55ead7SLucas De Marchi * 38ad55ead7SLucas De Marchi * For platforms officially supported by the driver, the filename always only 39ad55ead7SLucas De Marchi * ever contains the major version (GuC) or no version at all (HuC). 40ad55ead7SLucas De Marchi * 41ad55ead7SLucas De Marchi * After loading the file, the driver parses the versions embedded in the blob. 42ad55ead7SLucas De Marchi * The major version needs to match a major version supported by the driver (if 43ad55ead7SLucas De Marchi * any). The minor version is also checked and a notice emitted to the log if 44ad55ead7SLucas De Marchi * the version found is smaller than the version wanted. This is done only for 45ad55ead7SLucas De Marchi * informational purposes so users may have a chance to upgrade, but the driver 46ad55ead7SLucas De Marchi * still loads and use the older firmware. 47ad55ead7SLucas De Marchi * 48ad55ead7SLucas De Marchi * Examples: 49ad55ead7SLucas De Marchi * 50ad55ead7SLucas De Marchi * 1) Platform officially supported by i915 - using Tigerlake as example. 51ad55ead7SLucas De Marchi * Driver loads the following firmware blobs from disk: 52ad55ead7SLucas De Marchi * 53ad55ead7SLucas De Marchi * - i915/tgl_guc_<major>.bin 54ad55ead7SLucas De Marchi * - i915/tgl_huc.bin 55ad55ead7SLucas De Marchi * 56ad55ead7SLucas De Marchi * <major> number for GuC is checked that it matches the version inside 57ad55ead7SLucas De Marchi * the blob. <minor> version is checked and if smaller than the expected 58ad55ead7SLucas De Marchi * an info message is emitted about that. 59ad55ead7SLucas De Marchi * 60ad55ead7SLucas De Marchi * 1) XE_<FUTUREINTELPLATFORM>, still under require_force_probe. Using 61ad55ead7SLucas De Marchi * "wipplat" as a short-name. Driver loads the following firmware blobs 62ad55ead7SLucas De Marchi * from disk: 63ad55ead7SLucas De Marchi * 64ad55ead7SLucas De Marchi * - xe/wipplat_guc_<major>.<minor>.<patch>.bin 65ad55ead7SLucas De Marchi * - xe/wipplat_huc_<major>.<minor>.<patch>.bin 66ad55ead7SLucas De Marchi * 67ad55ead7SLucas De Marchi * <major> and <minor> are checked that they match the version inside 68ad55ead7SLucas De Marchi * the blob. Both of them need to match exactly what the driver is 69ad55ead7SLucas De Marchi * expecting, otherwise it fails. 70ad55ead7SLucas De Marchi * 71ad55ead7SLucas De Marchi * 3) Platform officially supported by xe and out of force-probe. Using 72ad55ead7SLucas De Marchi * "plat" as a short-name. Except for the different directory, the 73ad55ead7SLucas De Marchi * behavior is the same as (1). Driver loads the following firmware 74ad55ead7SLucas De Marchi * blobs from disk: 75ad55ead7SLucas De Marchi * 76ad55ead7SLucas De Marchi * - xe/plat_guc_<major>.bin 77ad55ead7SLucas De Marchi * - xe/plat_huc.bin 78ad55ead7SLucas De Marchi * 79ad55ead7SLucas De Marchi * <major> number for GuC is checked that it matches the version inside 80ad55ead7SLucas De Marchi * the blob. <minor> version is checked and if smaller than the expected 81ad55ead7SLucas De Marchi * an info message is emitted about that. 82ad55ead7SLucas De Marchi * 83ad55ead7SLucas De Marchi * For the platforms already released with a major version, they should never be 84ad55ead7SLucas De Marchi * removed from the table. Instead new entries with newer versions may be added 85ad55ead7SLucas De Marchi * before them, so they take precedence. 86ad55ead7SLucas De Marchi * 87ad55ead7SLucas De Marchi * TODO: Currently there's no fallback on major version. That's because xe 88ad55ead7SLucas De Marchi * driver only supports the one major version of each firmware in the table. 89ad55ead7SLucas De Marchi * This needs to be fixed when the major version of GuC is updated. 90ad55ead7SLucas De Marchi */ 91ad55ead7SLucas De Marchi 92ad55ead7SLucas De Marchi struct uc_fw_entry { 93ad55ead7SLucas De Marchi enum xe_platform platform; 94ad55ead7SLucas De Marchi struct { 95ad55ead7SLucas De Marchi const char *path; 96ad55ead7SLucas De Marchi u16 major; 97ad55ead7SLucas De Marchi u16 minor; 986650ad3eSJohn Harrison u16 patch; 99ad55ead7SLucas De Marchi bool full_ver_required; 100ad55ead7SLucas De Marchi }; 101ad55ead7SLucas De Marchi }; 102ad55ead7SLucas De Marchi 103ad55ead7SLucas De Marchi struct fw_blobs_by_type { 104ad55ead7SLucas De Marchi const struct uc_fw_entry *entries; 105ad55ead7SLucas De Marchi u32 count; 106ad55ead7SLucas De Marchi }; 107ad55ead7SLucas De Marchi 108ad55ead7SLucas De Marchi #define XE_GUC_FIRMWARE_DEFS(fw_def, mmp_ver, major_ver) \ 109*9cc033e0SJulia Filipchuk fw_def(BATTLEMAGE, major_ver(xe, guc, bmg, 70, 29, 2)) \ 1104eb0aab6SJulia Filipchuk fw_def(LUNARLAKE, major_ver(xe, guc, lnl, 70, 29, 2)) \ 1114eb0aab6SJulia Filipchuk fw_def(METEORLAKE, major_ver(i915, guc, mtl, 70, 29, 2)) \ 1124eb0aab6SJulia Filipchuk fw_def(DG2, major_ver(i915, guc, dg2, 70, 29, 2)) \ 1134eb0aab6SJulia Filipchuk fw_def(DG1, major_ver(i915, guc, dg1, 70, 29, 2)) \ 1144eb0aab6SJulia Filipchuk fw_def(ALDERLAKE_N, major_ver(i915, guc, tgl, 70, 29, 2)) \ 1154eb0aab6SJulia Filipchuk fw_def(ALDERLAKE_P, major_ver(i915, guc, adlp, 70, 29, 2)) \ 1164eb0aab6SJulia Filipchuk fw_def(ALDERLAKE_S, major_ver(i915, guc, tgl, 70, 29, 2)) \ 1174eb0aab6SJulia Filipchuk fw_def(ROCKETLAKE, major_ver(i915, guc, tgl, 70, 29, 2)) \ 1184eb0aab6SJulia Filipchuk fw_def(TIGERLAKE, major_ver(i915, guc, tgl, 70, 29, 2)) 119ad55ead7SLucas De Marchi 120ad55ead7SLucas De Marchi #define XE_HUC_FIRMWARE_DEFS(fw_def, mmp_ver, no_ver) \ 121351a8871SDaniele Ceraolo Spurio fw_def(BATTLEMAGE, no_ver(xe, huc, bmg)) \ 122e8149028SDaniele Ceraolo Spurio fw_def(LUNARLAKE, no_ver(xe, huc, lnl)) \ 123bfeb4ac5SDaniele Ceraolo Spurio fw_def(METEORLAKE, no_ver(i915, huc_gsc, mtl)) \ 124420c6a6fSDaniele Ceraolo Spurio fw_def(DG1, no_ver(i915, huc, dg1)) \ 12585635f5dSLucas De Marchi fw_def(ALDERLAKE_P, no_ver(i915, huc, tgl)) \ 126ad55ead7SLucas De Marchi fw_def(ALDERLAKE_S, no_ver(i915, huc, tgl)) \ 12794324e6bSAnusha Srivatsa fw_def(ROCKETLAKE, no_ver(i915, huc, tgl)) \ 128ad55ead7SLucas De Marchi fw_def(TIGERLAKE, no_ver(i915, huc, tgl)) 129ad55ead7SLucas De Marchi 1305152234eSDaniele Ceraolo Spurio /* for the GSC FW we match the compatibility version and not the release one */ 1315152234eSDaniele Ceraolo Spurio #define XE_GSC_FIRMWARE_DEFS(fw_def, major_ver) \ 132f4aa02c4SDaniele Ceraolo Spurio fw_def(LUNARLAKE, major_ver(xe, gsc, lnl, 1, 0, 0)) \ 1336650ad3eSJohn Harrison fw_def(METEORLAKE, major_ver(i915, gsc, mtl, 1, 0, 0)) 1345152234eSDaniele Ceraolo Spurio 135ad55ead7SLucas De Marchi #define MAKE_FW_PATH(dir__, uc__, shortname__, version__) \ 136ad55ead7SLucas De Marchi __stringify(dir__) "/" __stringify(shortname__) "_" __stringify(uc__) version__ ".bin" 137ad55ead7SLucas De Marchi 138ad55ead7SLucas De Marchi #define fw_filename_mmp_ver(dir_, uc_, shortname_, a, b, c) \ 139ad55ead7SLucas De Marchi MAKE_FW_PATH(dir_, uc_, shortname_, "_" __stringify(a ## . ## b ## . ## c)) 1406650ad3eSJohn Harrison #define fw_filename_major_ver(dir_, uc_, shortname_, a, b, c) \ 141ad55ead7SLucas De Marchi MAKE_FW_PATH(dir_, uc_, shortname_, "_" __stringify(a)) 142ad55ead7SLucas De Marchi #define fw_filename_no_ver(dir_, uc_, shortname_) \ 143ad55ead7SLucas De Marchi MAKE_FW_PATH(dir_, uc_, shortname_, "") 144ad55ead7SLucas De Marchi 145ad55ead7SLucas De Marchi #define uc_fw_entry_mmp_ver(dir_, uc_, shortname_, a, b, c) \ 146ad55ead7SLucas De Marchi { fw_filename_mmp_ver(dir_, uc_, shortname_, a, b, c), \ 1476650ad3eSJohn Harrison a, b, c, true } 1486650ad3eSJohn Harrison #define uc_fw_entry_major_ver(dir_, uc_, shortname_, a, b, c) \ 1496650ad3eSJohn Harrison { fw_filename_major_ver(dir_, uc_, shortname_, a, b, c), \ 1506650ad3eSJohn Harrison a, b, c } 151ad55ead7SLucas De Marchi #define uc_fw_entry_no_ver(dir_, uc_, shortname_) \ 152ad55ead7SLucas De Marchi { fw_filename_no_ver(dir_, uc_, shortname_), \ 153ad55ead7SLucas De Marchi 0, 0 } 154ad55ead7SLucas De Marchi 155ad55ead7SLucas De Marchi /* All blobs need to be declared via MODULE_FIRMWARE() */ 156ad55ead7SLucas De Marchi #define XE_UC_MODULE_FIRMWARE(platform__, fw_filename) \ 157ad55ead7SLucas De Marchi MODULE_FIRMWARE(fw_filename); 158ad55ead7SLucas De Marchi 159ad55ead7SLucas De Marchi #define XE_UC_FW_ENTRY(platform__, entry__) \ 160ad55ead7SLucas De Marchi { \ 161ad55ead7SLucas De Marchi .platform = XE_ ## platform__, \ 162ad55ead7SLucas De Marchi entry__, \ 163ad55ead7SLucas De Marchi }, 164ad55ead7SLucas De Marchi 1653e8e7ee6SFrancois Dugast XE_GUC_FIRMWARE_DEFS(XE_UC_MODULE_FIRMWARE, 166ad55ead7SLucas De Marchi fw_filename_mmp_ver, fw_filename_major_ver) 1673e8e7ee6SFrancois Dugast XE_HUC_FIRMWARE_DEFS(XE_UC_MODULE_FIRMWARE, 168ad55ead7SLucas De Marchi fw_filename_mmp_ver, fw_filename_no_ver) 1695152234eSDaniele Ceraolo Spurio XE_GSC_FIRMWARE_DEFS(XE_UC_MODULE_FIRMWARE, fw_filename_major_ver) 170ad55ead7SLucas De Marchi 171dd08ebf6SMatthew Brost static struct xe_gt * 172dd08ebf6SMatthew Brost __uc_fw_to_gt(struct xe_uc_fw *uc_fw, enum xe_uc_fw_type type) 173dd08ebf6SMatthew Brost { 1740d1caff4SDaniele Ceraolo Spurio XE_WARN_ON(type >= XE_UC_FW_NUM_TYPES); 175dd08ebf6SMatthew Brost 1760d1caff4SDaniele Ceraolo Spurio switch (type) { 1770d1caff4SDaniele Ceraolo Spurio case XE_UC_FW_TYPE_GUC: 1780d1caff4SDaniele Ceraolo Spurio return container_of(uc_fw, struct xe_gt, uc.guc.fw); 1790d1caff4SDaniele Ceraolo Spurio case XE_UC_FW_TYPE_HUC: 180dd08ebf6SMatthew Brost return container_of(uc_fw, struct xe_gt, uc.huc.fw); 1810d1caff4SDaniele Ceraolo Spurio case XE_UC_FW_TYPE_GSC: 1820d1caff4SDaniele Ceraolo Spurio return container_of(uc_fw, struct xe_gt, uc.gsc.fw); 1830d1caff4SDaniele Ceraolo Spurio default: 1840d1caff4SDaniele Ceraolo Spurio return NULL; 1850d1caff4SDaniele Ceraolo Spurio } 186dd08ebf6SMatthew Brost } 187dd08ebf6SMatthew Brost 188dd08ebf6SMatthew Brost static struct xe_gt *uc_fw_to_gt(struct xe_uc_fw *uc_fw) 189dd08ebf6SMatthew Brost { 190dd08ebf6SMatthew Brost return __uc_fw_to_gt(uc_fw, uc_fw->type); 191dd08ebf6SMatthew Brost } 192dd08ebf6SMatthew Brost 193dd08ebf6SMatthew Brost static struct xe_device *uc_fw_to_xe(struct xe_uc_fw *uc_fw) 194dd08ebf6SMatthew Brost { 195dd08ebf6SMatthew Brost return gt_to_xe(uc_fw_to_gt(uc_fw)); 196dd08ebf6SMatthew Brost } 197dd08ebf6SMatthew Brost 198dd08ebf6SMatthew Brost static void 199dd08ebf6SMatthew Brost uc_fw_auto_select(struct xe_device *xe, struct xe_uc_fw *uc_fw) 200dd08ebf6SMatthew Brost { 201ad55ead7SLucas De Marchi static const struct uc_fw_entry entries_guc[] = { 202ad55ead7SLucas De Marchi XE_GUC_FIRMWARE_DEFS(XE_UC_FW_ENTRY, 203ad55ead7SLucas De Marchi uc_fw_entry_mmp_ver, 204ad55ead7SLucas De Marchi uc_fw_entry_major_ver) 205dd08ebf6SMatthew Brost }; 206ad55ead7SLucas De Marchi static const struct uc_fw_entry entries_huc[] = { 207ad55ead7SLucas De Marchi XE_HUC_FIRMWARE_DEFS(XE_UC_FW_ENTRY, 208ad55ead7SLucas De Marchi uc_fw_entry_mmp_ver, 209ad55ead7SLucas De Marchi uc_fw_entry_no_ver) 210dd08ebf6SMatthew Brost }; 2115152234eSDaniele Ceraolo Spurio static const struct uc_fw_entry entries_gsc[] = { 2125152234eSDaniele Ceraolo Spurio XE_GSC_FIRMWARE_DEFS(XE_UC_FW_ENTRY, uc_fw_entry_major_ver) 2135152234eSDaniele Ceraolo Spurio }; 214dd08ebf6SMatthew Brost static const struct fw_blobs_by_type blobs_all[XE_UC_FW_NUM_TYPES] = { 215ad55ead7SLucas De Marchi [XE_UC_FW_TYPE_GUC] = { entries_guc, ARRAY_SIZE(entries_guc) }, 216ad55ead7SLucas De Marchi [XE_UC_FW_TYPE_HUC] = { entries_huc, ARRAY_SIZE(entries_huc) }, 2175152234eSDaniele Ceraolo Spurio [XE_UC_FW_TYPE_GSC] = { entries_gsc, ARRAY_SIZE(entries_gsc) }, 218dd08ebf6SMatthew Brost }; 219ad55ead7SLucas De Marchi static const struct uc_fw_entry *entries; 220dd08ebf6SMatthew Brost enum xe_platform p = xe->info.platform; 221ad55ead7SLucas De Marchi u32 count; 222dd08ebf6SMatthew Brost int i; 223dd08ebf6SMatthew Brost 224c73acc1eSFrancois Dugast xe_assert(xe, uc_fw->type < ARRAY_SIZE(blobs_all)); 225ad55ead7SLucas De Marchi entries = blobs_all[uc_fw->type].entries; 226ad55ead7SLucas De Marchi count = blobs_all[uc_fw->type].count; 227dd08ebf6SMatthew Brost 228ad55ead7SLucas De Marchi for (i = 0; i < count && p <= entries[i].platform; i++) { 229ad55ead7SLucas De Marchi if (p == entries[i].platform) { 230ad55ead7SLucas De Marchi uc_fw->path = entries[i].path; 2312e7227b4SDaniele Ceraolo Spurio uc_fw->versions.wanted.major = entries[i].major; 2322e7227b4SDaniele Ceraolo Spurio uc_fw->versions.wanted.minor = entries[i].minor; 2336650ad3eSJohn Harrison uc_fw->versions.wanted.patch = entries[i].patch; 234ad55ead7SLucas De Marchi uc_fw->full_ver_required = entries[i].full_ver_required; 2352e7227b4SDaniele Ceraolo Spurio 2360881cbe0SDaniele Ceraolo Spurio if (uc_fw->type == XE_UC_FW_TYPE_GSC) 2370881cbe0SDaniele Ceraolo Spurio uc_fw->versions.wanted_type = XE_UC_FW_VER_COMPATIBILITY; 2380881cbe0SDaniele Ceraolo Spurio else 2392e7227b4SDaniele Ceraolo Spurio uc_fw->versions.wanted_type = XE_UC_FW_VER_RELEASE; 2400881cbe0SDaniele Ceraolo Spurio 241dd08ebf6SMatthew Brost break; 242dd08ebf6SMatthew Brost } 243dd08ebf6SMatthew Brost } 244dd08ebf6SMatthew Brost } 245dd08ebf6SMatthew Brost 246a455ed04SDaniele Ceraolo Spurio static void 247a455ed04SDaniele Ceraolo Spurio uc_fw_override(struct xe_uc_fw *uc_fw) 248a455ed04SDaniele Ceraolo Spurio { 249a455ed04SDaniele Ceraolo Spurio char *path_override = NULL; 250a455ed04SDaniele Ceraolo Spurio 251a455ed04SDaniele Ceraolo Spurio /* empty string disables, but it's not allowed for GuC */ 252a455ed04SDaniele Ceraolo Spurio switch (uc_fw->type) { 253a455ed04SDaniele Ceraolo Spurio case XE_UC_FW_TYPE_GUC: 254adce1b39SBommithi Sakeena if (xe_modparam.guc_firmware_path && *xe_modparam.guc_firmware_path) 255adce1b39SBommithi Sakeena path_override = xe_modparam.guc_firmware_path; 256a455ed04SDaniele Ceraolo Spurio break; 257a455ed04SDaniele Ceraolo Spurio case XE_UC_FW_TYPE_HUC: 258adce1b39SBommithi Sakeena path_override = xe_modparam.huc_firmware_path; 259a455ed04SDaniele Ceraolo Spurio break; 2605152234eSDaniele Ceraolo Spurio case XE_UC_FW_TYPE_GSC: 2615152234eSDaniele Ceraolo Spurio path_override = xe_modparam.gsc_firmware_path; 2625152234eSDaniele Ceraolo Spurio break; 263a455ed04SDaniele Ceraolo Spurio default: 264a455ed04SDaniele Ceraolo Spurio break; 265a455ed04SDaniele Ceraolo Spurio } 266a455ed04SDaniele Ceraolo Spurio 267a455ed04SDaniele Ceraolo Spurio if (path_override) { 268a455ed04SDaniele Ceraolo Spurio uc_fw->path = path_override; 269a455ed04SDaniele Ceraolo Spurio uc_fw->user_overridden = true; 270a455ed04SDaniele Ceraolo Spurio } 271a455ed04SDaniele Ceraolo Spurio } 272a455ed04SDaniele Ceraolo Spurio 273dd08ebf6SMatthew Brost /** 274dd08ebf6SMatthew Brost * xe_uc_fw_copy_rsa - copy fw RSA to buffer 275dd08ebf6SMatthew Brost * 276dd08ebf6SMatthew Brost * @uc_fw: uC firmware 277dd08ebf6SMatthew Brost * @dst: dst buffer 278dd08ebf6SMatthew Brost * @max_len: max number of bytes to copy 279dd08ebf6SMatthew Brost * 280dd08ebf6SMatthew Brost * Return: number of copied bytes. 281dd08ebf6SMatthew Brost */ 282dd08ebf6SMatthew Brost size_t xe_uc_fw_copy_rsa(struct xe_uc_fw *uc_fw, void *dst, u32 max_len) 283dd08ebf6SMatthew Brost { 284dd08ebf6SMatthew Brost struct xe_device *xe = uc_fw_to_xe(uc_fw); 285dd08ebf6SMatthew Brost u32 size = min_t(u32, uc_fw->rsa_size, max_len); 286dd08ebf6SMatthew Brost 287c73acc1eSFrancois Dugast xe_assert(xe, !(size % 4)); 288c73acc1eSFrancois Dugast xe_assert(xe, xe_uc_fw_is_available(uc_fw)); 289dd08ebf6SMatthew Brost 290dd08ebf6SMatthew Brost xe_map_memcpy_from(xe, dst, &uc_fw->bo->vmap, 291dd08ebf6SMatthew Brost xe_uc_fw_rsa_offset(uc_fw), size); 292dd08ebf6SMatthew Brost 293dd08ebf6SMatthew Brost return size; 294dd08ebf6SMatthew Brost } 295dd08ebf6SMatthew Brost 296dd08ebf6SMatthew Brost static void uc_fw_fini(struct drm_device *drm, void *arg) 297dd08ebf6SMatthew Brost { 298dd08ebf6SMatthew Brost struct xe_uc_fw *uc_fw = arg; 299dd08ebf6SMatthew Brost 300dd08ebf6SMatthew Brost if (!xe_uc_fw_is_available(uc_fw)) 301dd08ebf6SMatthew Brost return; 302dd08ebf6SMatthew Brost 303dd08ebf6SMatthew Brost xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_SELECTED); 304dd08ebf6SMatthew Brost } 305dd08ebf6SMatthew Brost 30643c4ff3cSDaniele Ceraolo Spurio static int guc_read_css_info(struct xe_uc_fw *uc_fw, struct uc_css_header *css) 30799c821b0SMatthew Brost { 30899c821b0SMatthew Brost struct xe_gt *gt = uc_fw_to_gt(uc_fw); 3092e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *release = &uc_fw->versions.found[XE_UC_FW_VER_RELEASE]; 3102e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *compatibility = &uc_fw->versions.found[XE_UC_FW_VER_COMPATIBILITY]; 31199c821b0SMatthew Brost 312c73acc1eSFrancois Dugast xe_gt_assert(gt, uc_fw->type == XE_UC_FW_TYPE_GUC); 31399c821b0SMatthew Brost 3144eb0aab6SJulia Filipchuk /* We don't support GuC releases older than 70.29.2 */ 3154eb0aab6SJulia Filipchuk if (MAKE_GUC_VER_STRUCT(*release) < MAKE_GUC_VER(70, 29, 2)) { 3164eb0aab6SJulia Filipchuk xe_gt_err(gt, "Unsupported GuC v%u.%u.%u! v70.29.2 or newer is required\n", 3174eb0aab6SJulia Filipchuk release->major, release->minor, release->patch); 31843c4ff3cSDaniele Ceraolo Spurio return -EINVAL; 31999c821b0SMatthew Brost } 32099c821b0SMatthew Brost 32143c4ff3cSDaniele Ceraolo Spurio compatibility->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, css->submission_version); 32243c4ff3cSDaniele Ceraolo Spurio compatibility->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, css->submission_version); 32343c4ff3cSDaniele Ceraolo Spurio compatibility->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, css->submission_version); 32443c4ff3cSDaniele Ceraolo Spurio 32599c821b0SMatthew Brost uc_fw->private_data_size = css->private_data_size; 32643c4ff3cSDaniele Ceraolo Spurio 32743c4ff3cSDaniele Ceraolo Spurio return 0; 32899c821b0SMatthew Brost } 32999c821b0SMatthew Brost 3300881cbe0SDaniele Ceraolo Spurio int xe_uc_fw_check_version_requirements(struct xe_uc_fw *uc_fw) 331ad55ead7SLucas De Marchi { 332ad55ead7SLucas De Marchi struct xe_device *xe = uc_fw_to_xe(uc_fw); 3332e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *wanted = &uc_fw->versions.wanted; 3342e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *found = &uc_fw->versions.found[uc_fw->versions.wanted_type]; 335ad55ead7SLucas De Marchi 336ad55ead7SLucas De Marchi /* Driver has no requirement on any version, any is good. */ 3372e7227b4SDaniele Ceraolo Spurio if (!wanted->major) 338ad55ead7SLucas De Marchi return 0; 339ad55ead7SLucas De Marchi 340ad55ead7SLucas De Marchi /* 341ad55ead7SLucas De Marchi * If full version is required, both major and minor should match. 342ad55ead7SLucas De Marchi * Otherwise, at least the major version. 343ad55ead7SLucas De Marchi */ 3442e7227b4SDaniele Ceraolo Spurio if (wanted->major != found->major || 3456650ad3eSJohn Harrison (uc_fw->full_ver_required && 3466650ad3eSJohn Harrison ((wanted->minor != found->minor) || 3476650ad3eSJohn Harrison (wanted->patch != found->patch)))) { 3486650ad3eSJohn Harrison drm_notice(&xe->drm, "%s firmware %s: unexpected version: %u.%u.%u != %u.%u.%u\n", 349ad55ead7SLucas De Marchi xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, 3506650ad3eSJohn Harrison found->major, found->minor, found->patch, 3516650ad3eSJohn Harrison wanted->major, wanted->minor, wanted->patch); 352ad55ead7SLucas De Marchi goto fail; 353ad55ead7SLucas De Marchi } 354ad55ead7SLucas De Marchi 3556650ad3eSJohn Harrison if (wanted->minor > found->minor || 3566650ad3eSJohn Harrison (wanted->minor == found->minor && wanted->patch > found->patch)) { 3576650ad3eSJohn Harrison drm_notice(&xe->drm, "%s firmware (%u.%u.%u) is recommended, but only (%u.%u.%u) was found in %s\n", 358ad55ead7SLucas De Marchi xe_uc_fw_type_repr(uc_fw->type), 3596650ad3eSJohn Harrison wanted->major, wanted->minor, wanted->patch, 3606650ad3eSJohn Harrison found->major, found->minor, found->patch, 361ad55ead7SLucas De Marchi uc_fw->path); 362ad55ead7SLucas De Marchi drm_info(&xe->drm, "Consider updating your linux-firmware pkg or downloading from %s\n", 363ad55ead7SLucas De Marchi XE_UC_FIRMWARE_URL); 364ad55ead7SLucas De Marchi } 365ad55ead7SLucas De Marchi 366ad55ead7SLucas De Marchi return 0; 367ad55ead7SLucas De Marchi 368ad55ead7SLucas De Marchi fail: 369ad55ead7SLucas De Marchi if (xe_uc_fw_is_overridden(uc_fw)) 370ad55ead7SLucas De Marchi return 0; 371ad55ead7SLucas De Marchi 372ad55ead7SLucas De Marchi return -ENOEXEC; 373ad55ead7SLucas De Marchi } 374ad55ead7SLucas De Marchi 375a9a95523SDaniele Ceraolo Spurio /* Refer to the "CSS-based Firmware Layout" documentation entry for details */ 376a9a95523SDaniele Ceraolo Spurio static int parse_css_header(struct xe_uc_fw *uc_fw, const void *fw_data, size_t fw_size) 377a9a95523SDaniele Ceraolo Spurio { 378a9a95523SDaniele Ceraolo Spurio struct xe_device *xe = uc_fw_to_xe(uc_fw); 3792e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *release = &uc_fw->versions.found[XE_UC_FW_VER_RELEASE]; 380a9a95523SDaniele Ceraolo Spurio struct uc_css_header *css; 381a9a95523SDaniele Ceraolo Spurio size_t size; 382a9a95523SDaniele Ceraolo Spurio 383a9a95523SDaniele Ceraolo Spurio /* Check the size of the blob before examining buffer contents */ 384a9a95523SDaniele Ceraolo Spurio if (unlikely(fw_size < sizeof(struct uc_css_header))) { 385a9a95523SDaniele Ceraolo Spurio drm_warn(&xe->drm, "%s firmware %s: invalid size: %zu < %zu\n", 386a9a95523SDaniele Ceraolo Spurio xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, 387a9a95523SDaniele Ceraolo Spurio fw_size, sizeof(struct uc_css_header)); 388a9a95523SDaniele Ceraolo Spurio return -ENODATA; 389a9a95523SDaniele Ceraolo Spurio } 390a9a95523SDaniele Ceraolo Spurio 391a9a95523SDaniele Ceraolo Spurio css = (struct uc_css_header *)fw_data; 392a9a95523SDaniele Ceraolo Spurio 393a9a95523SDaniele Ceraolo Spurio /* Check integrity of size values inside CSS header */ 394a9a95523SDaniele Ceraolo Spurio size = (css->header_size_dw - css->key_size_dw - css->modulus_size_dw - 395a9a95523SDaniele Ceraolo Spurio css->exponent_size_dw) * sizeof(u32); 396a9a95523SDaniele Ceraolo Spurio if (unlikely(size != sizeof(struct uc_css_header))) { 397a9a95523SDaniele Ceraolo Spurio drm_warn(&xe->drm, 398a9a95523SDaniele Ceraolo Spurio "%s firmware %s: unexpected header size: %zu != %zu\n", 399a9a95523SDaniele Ceraolo Spurio xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, 400a9a95523SDaniele Ceraolo Spurio fw_size, sizeof(struct uc_css_header)); 401a9a95523SDaniele Ceraolo Spurio return -EPROTO; 402a9a95523SDaniele Ceraolo Spurio } 403a9a95523SDaniele Ceraolo Spurio 404a9a95523SDaniele Ceraolo Spurio /* uCode size must calculated from other sizes */ 405a9a95523SDaniele Ceraolo Spurio uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32); 406a9a95523SDaniele Ceraolo Spurio 407a9a95523SDaniele Ceraolo Spurio /* now RSA */ 408a9a95523SDaniele Ceraolo Spurio uc_fw->rsa_size = css->key_size_dw * sizeof(u32); 409a9a95523SDaniele Ceraolo Spurio 410a9a95523SDaniele Ceraolo Spurio /* At least, it should have header, uCode and RSA. Size of all three. */ 411a9a95523SDaniele Ceraolo Spurio size = sizeof(struct uc_css_header) + uc_fw->ucode_size + 412a9a95523SDaniele Ceraolo Spurio uc_fw->rsa_size; 413a9a95523SDaniele Ceraolo Spurio if (unlikely(fw_size < size)) { 414a9a95523SDaniele Ceraolo Spurio drm_warn(&xe->drm, "%s firmware %s: invalid size: %zu < %zu\n", 415a9a95523SDaniele Ceraolo Spurio xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, 416a9a95523SDaniele Ceraolo Spurio fw_size, size); 417a9a95523SDaniele Ceraolo Spurio return -ENOEXEC; 418a9a95523SDaniele Ceraolo Spurio } 419a9a95523SDaniele Ceraolo Spurio 420a9a95523SDaniele Ceraolo Spurio /* Get version numbers from the CSS header */ 4212e7227b4SDaniele Ceraolo Spurio release->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, css->sw_version); 4222e7227b4SDaniele Ceraolo Spurio release->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, css->sw_version); 4232e7227b4SDaniele Ceraolo Spurio release->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, css->sw_version); 424a9a95523SDaniele Ceraolo Spurio 425a9a95523SDaniele Ceraolo Spurio if (uc_fw->type == XE_UC_FW_TYPE_GUC) 42643c4ff3cSDaniele Ceraolo Spurio return guc_read_css_info(uc_fw, css); 427a9a95523SDaniele Ceraolo Spurio 428a9a95523SDaniele Ceraolo Spurio return 0; 429a9a95523SDaniele Ceraolo Spurio } 430a9a95523SDaniele Ceraolo Spurio 431484ecffaSDaniele Ceraolo Spurio static bool is_cpd_header(const void *data) 432484ecffaSDaniele Ceraolo Spurio { 433484ecffaSDaniele Ceraolo Spurio const u32 *marker = data; 434484ecffaSDaniele Ceraolo Spurio 435484ecffaSDaniele Ceraolo Spurio return *marker == GSC_CPD_HEADER_MARKER; 436484ecffaSDaniele Ceraolo Spurio } 437484ecffaSDaniele Ceraolo Spurio 438484ecffaSDaniele Ceraolo Spurio static u32 entry_offset(const struct gsc_cpd_header_v2 *header, const char *name) 439484ecffaSDaniele Ceraolo Spurio { 440484ecffaSDaniele Ceraolo Spurio const struct gsc_cpd_entry *entry; 441484ecffaSDaniele Ceraolo Spurio int i; 442484ecffaSDaniele Ceraolo Spurio 443484ecffaSDaniele Ceraolo Spurio entry = (void *)header + header->header_length; 444484ecffaSDaniele Ceraolo Spurio 445484ecffaSDaniele Ceraolo Spurio for (i = 0; i < header->num_of_entries; i++, entry++) 446484ecffaSDaniele Ceraolo Spurio if (strcmp(entry->name, name) == 0) 447484ecffaSDaniele Ceraolo Spurio return entry->offset & GSC_CPD_ENTRY_OFFSET_MASK; 448484ecffaSDaniele Ceraolo Spurio 449484ecffaSDaniele Ceraolo Spurio return 0; 450484ecffaSDaniele Ceraolo Spurio } 451484ecffaSDaniele Ceraolo Spurio 452484ecffaSDaniele Ceraolo Spurio /* Refer to the "GSC-based Firmware Layout" documentation entry for details */ 453484ecffaSDaniele Ceraolo Spurio static int parse_cpd_header(struct xe_uc_fw *uc_fw, const void *data, size_t size, 454484ecffaSDaniele Ceraolo Spurio const char *manifest_entry, const char *css_entry) 455484ecffaSDaniele Ceraolo Spurio { 456484ecffaSDaniele Ceraolo Spurio struct xe_gt *gt = uc_fw_to_gt(uc_fw); 457484ecffaSDaniele Ceraolo Spurio struct xe_device *xe = gt_to_xe(gt); 458484ecffaSDaniele Ceraolo Spurio const struct gsc_cpd_header_v2 *header = data; 4592e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *release = &uc_fw->versions.found[XE_UC_FW_VER_RELEASE]; 460484ecffaSDaniele Ceraolo Spurio const struct gsc_manifest_header *manifest; 461484ecffaSDaniele Ceraolo Spurio size_t min_size = sizeof(*header); 462484ecffaSDaniele Ceraolo Spurio u32 offset; 463484ecffaSDaniele Ceraolo Spurio 464484ecffaSDaniele Ceraolo Spurio /* manifest_entry is mandatory, css_entry is optional */ 465484ecffaSDaniele Ceraolo Spurio xe_assert(xe, manifest_entry); 466484ecffaSDaniele Ceraolo Spurio 467484ecffaSDaniele Ceraolo Spurio if (size < min_size || !is_cpd_header(header)) 468484ecffaSDaniele Ceraolo Spurio return -ENOENT; 469484ecffaSDaniele Ceraolo Spurio 470484ecffaSDaniele Ceraolo Spurio if (header->header_length < sizeof(struct gsc_cpd_header_v2)) { 471484ecffaSDaniele Ceraolo Spurio xe_gt_err(gt, "invalid CPD header length %u!\n", header->header_length); 472484ecffaSDaniele Ceraolo Spurio return -EINVAL; 473484ecffaSDaniele Ceraolo Spurio } 474484ecffaSDaniele Ceraolo Spurio 475484ecffaSDaniele Ceraolo Spurio min_size = header->header_length + sizeof(struct gsc_cpd_entry) * header->num_of_entries; 476484ecffaSDaniele Ceraolo Spurio if (size < min_size) { 477484ecffaSDaniele Ceraolo Spurio xe_gt_err(gt, "FW too small! %zu < %zu\n", size, min_size); 478484ecffaSDaniele Ceraolo Spurio return -ENODATA; 479484ecffaSDaniele Ceraolo Spurio } 480484ecffaSDaniele Ceraolo Spurio 481484ecffaSDaniele Ceraolo Spurio /* Look for the manifest first */ 482484ecffaSDaniele Ceraolo Spurio offset = entry_offset(header, manifest_entry); 483484ecffaSDaniele Ceraolo Spurio if (!offset) { 484484ecffaSDaniele Ceraolo Spurio xe_gt_err(gt, "Failed to find %s manifest!\n", 485484ecffaSDaniele Ceraolo Spurio xe_uc_fw_type_repr(uc_fw->type)); 486484ecffaSDaniele Ceraolo Spurio return -ENODATA; 487484ecffaSDaniele Ceraolo Spurio } 488484ecffaSDaniele Ceraolo Spurio 489484ecffaSDaniele Ceraolo Spurio min_size = offset + sizeof(struct gsc_manifest_header); 490484ecffaSDaniele Ceraolo Spurio if (size < min_size) { 491484ecffaSDaniele Ceraolo Spurio xe_gt_err(gt, "FW too small! %zu < %zu\n", size, min_size); 492484ecffaSDaniele Ceraolo Spurio return -ENODATA; 493484ecffaSDaniele Ceraolo Spurio } 494484ecffaSDaniele Ceraolo Spurio 495484ecffaSDaniele Ceraolo Spurio manifest = data + offset; 496484ecffaSDaniele Ceraolo Spurio 4972e7227b4SDaniele Ceraolo Spurio release->major = manifest->fw_version.major; 4982e7227b4SDaniele Ceraolo Spurio release->minor = manifest->fw_version.minor; 4992e7227b4SDaniele Ceraolo Spurio release->patch = manifest->fw_version.hotfix; 500484ecffaSDaniele Ceraolo Spurio 501985d5a49SDaniele Ceraolo Spurio if (uc_fw->type == XE_UC_FW_TYPE_GSC) { 502985d5a49SDaniele Ceraolo Spurio struct xe_gsc *gsc = container_of(uc_fw, struct xe_gsc, fw); 503985d5a49SDaniele Ceraolo Spurio 504985d5a49SDaniele Ceraolo Spurio release->build = manifest->fw_version.build; 505985d5a49SDaniele Ceraolo Spurio gsc->security_version = manifest->security_version; 506985d5a49SDaniele Ceraolo Spurio } 507985d5a49SDaniele Ceraolo Spurio 508484ecffaSDaniele Ceraolo Spurio /* then optionally look for the css header */ 509484ecffaSDaniele Ceraolo Spurio if (css_entry) { 510484ecffaSDaniele Ceraolo Spurio int ret; 511484ecffaSDaniele Ceraolo Spurio 512484ecffaSDaniele Ceraolo Spurio /* 513484ecffaSDaniele Ceraolo Spurio * This section does not contain a CSS entry on DG2. We 514484ecffaSDaniele Ceraolo Spurio * don't support DG2 HuC right now, so no need to handle 515484ecffaSDaniele Ceraolo Spurio * it, just add a reminder in case that changes. 516484ecffaSDaniele Ceraolo Spurio */ 517484ecffaSDaniele Ceraolo Spurio xe_assert(xe, xe->info.platform != XE_DG2); 518484ecffaSDaniele Ceraolo Spurio 519484ecffaSDaniele Ceraolo Spurio offset = entry_offset(header, css_entry); 520484ecffaSDaniele Ceraolo Spurio 521484ecffaSDaniele Ceraolo Spurio /* the CSS header parser will check that the CSS header fits */ 522484ecffaSDaniele Ceraolo Spurio if (offset > size) { 523484ecffaSDaniele Ceraolo Spurio xe_gt_err(gt, "FW too small! %zu < %u\n", size, offset); 524484ecffaSDaniele Ceraolo Spurio return -ENODATA; 525484ecffaSDaniele Ceraolo Spurio } 526484ecffaSDaniele Ceraolo Spurio 527484ecffaSDaniele Ceraolo Spurio ret = parse_css_header(uc_fw, data + offset, size - offset); 528484ecffaSDaniele Ceraolo Spurio if (ret) 529484ecffaSDaniele Ceraolo Spurio return ret; 530484ecffaSDaniele Ceraolo Spurio 531484ecffaSDaniele Ceraolo Spurio uc_fw->css_offset = offset; 532484ecffaSDaniele Ceraolo Spurio } 533484ecffaSDaniele Ceraolo Spurio 534d8b15713SDaniele Ceraolo Spurio uc_fw->has_gsc_headers = true; 535d8b15713SDaniele Ceraolo Spurio 536484ecffaSDaniele Ceraolo Spurio return 0; 537484ecffaSDaniele Ceraolo Spurio } 538484ecffaSDaniele Ceraolo Spurio 539985d5a49SDaniele Ceraolo Spurio static int parse_gsc_layout(struct xe_uc_fw *uc_fw, const void *data, size_t size) 540985d5a49SDaniele Ceraolo Spurio { 541985d5a49SDaniele Ceraolo Spurio struct xe_gt *gt = uc_fw_to_gt(uc_fw); 542985d5a49SDaniele Ceraolo Spurio const struct gsc_layout_pointers *layout = data; 543985d5a49SDaniele Ceraolo Spurio const struct gsc_bpdt_header *bpdt_header = NULL; 544985d5a49SDaniele Ceraolo Spurio const struct gsc_bpdt_entry *bpdt_entry = NULL; 545985d5a49SDaniele Ceraolo Spurio size_t min_size = sizeof(*layout); 546985d5a49SDaniele Ceraolo Spurio int i; 547985d5a49SDaniele Ceraolo Spurio 548985d5a49SDaniele Ceraolo Spurio if (size < min_size) { 549985d5a49SDaniele Ceraolo Spurio xe_gt_err(gt, "GSC FW too small! %zu < %zu\n", size, min_size); 550985d5a49SDaniele Ceraolo Spurio return -ENODATA; 551985d5a49SDaniele Ceraolo Spurio } 552985d5a49SDaniele Ceraolo Spurio 553985d5a49SDaniele Ceraolo Spurio min_size = layout->boot1.offset + layout->boot1.size; 554985d5a49SDaniele Ceraolo Spurio if (size < min_size) { 555985d5a49SDaniele Ceraolo Spurio xe_gt_err(gt, "GSC FW too small for boot section! %zu < %zu\n", 556985d5a49SDaniele Ceraolo Spurio size, min_size); 557985d5a49SDaniele Ceraolo Spurio return -ENODATA; 558985d5a49SDaniele Ceraolo Spurio } 559985d5a49SDaniele Ceraolo Spurio 560985d5a49SDaniele Ceraolo Spurio min_size = sizeof(*bpdt_header); 561985d5a49SDaniele Ceraolo Spurio if (layout->boot1.size < min_size) { 562985d5a49SDaniele Ceraolo Spurio xe_gt_err(gt, "GSC FW boot section too small for BPDT header: %u < %zu\n", 563985d5a49SDaniele Ceraolo Spurio layout->boot1.size, min_size); 564985d5a49SDaniele Ceraolo Spurio return -ENODATA; 565985d5a49SDaniele Ceraolo Spurio } 566985d5a49SDaniele Ceraolo Spurio 567985d5a49SDaniele Ceraolo Spurio bpdt_header = data + layout->boot1.offset; 568985d5a49SDaniele Ceraolo Spurio if (bpdt_header->signature != GSC_BPDT_HEADER_SIGNATURE) { 569985d5a49SDaniele Ceraolo Spurio xe_gt_err(gt, "invalid signature for BPDT header: 0x%08x!\n", 570985d5a49SDaniele Ceraolo Spurio bpdt_header->signature); 571985d5a49SDaniele Ceraolo Spurio return -EINVAL; 572985d5a49SDaniele Ceraolo Spurio } 573985d5a49SDaniele Ceraolo Spurio 574985d5a49SDaniele Ceraolo Spurio min_size += sizeof(*bpdt_entry) * bpdt_header->descriptor_count; 575985d5a49SDaniele Ceraolo Spurio if (layout->boot1.size < min_size) { 576985d5a49SDaniele Ceraolo Spurio xe_gt_err(gt, "GSC FW boot section too small for BPDT entries: %u < %zu\n", 577985d5a49SDaniele Ceraolo Spurio layout->boot1.size, min_size); 578985d5a49SDaniele Ceraolo Spurio return -ENODATA; 579985d5a49SDaniele Ceraolo Spurio } 580985d5a49SDaniele Ceraolo Spurio 581985d5a49SDaniele Ceraolo Spurio bpdt_entry = (void *)bpdt_header + sizeof(*bpdt_header); 582985d5a49SDaniele Ceraolo Spurio for (i = 0; i < bpdt_header->descriptor_count; i++, bpdt_entry++) { 583985d5a49SDaniele Ceraolo Spurio if ((bpdt_entry->type & GSC_BPDT_ENTRY_TYPE_MASK) != 584985d5a49SDaniele Ceraolo Spurio GSC_BPDT_ENTRY_TYPE_GSC_RBE) 585985d5a49SDaniele Ceraolo Spurio continue; 586985d5a49SDaniele Ceraolo Spurio 587985d5a49SDaniele Ceraolo Spurio min_size = bpdt_entry->sub_partition_offset; 588985d5a49SDaniele Ceraolo Spurio 589985d5a49SDaniele Ceraolo Spurio /* the CPD header parser will check that the CPD header fits */ 590985d5a49SDaniele Ceraolo Spurio if (layout->boot1.size < min_size) { 591985d5a49SDaniele Ceraolo Spurio xe_gt_err(gt, "GSC FW boot section too small for CPD offset: %u < %zu\n", 592985d5a49SDaniele Ceraolo Spurio layout->boot1.size, min_size); 593985d5a49SDaniele Ceraolo Spurio return -ENODATA; 594985d5a49SDaniele Ceraolo Spurio } 595985d5a49SDaniele Ceraolo Spurio 596985d5a49SDaniele Ceraolo Spurio return parse_cpd_header(uc_fw, 597985d5a49SDaniele Ceraolo Spurio (void *)bpdt_header + min_size, 598985d5a49SDaniele Ceraolo Spurio layout->boot1.size - min_size, 599985d5a49SDaniele Ceraolo Spurio "RBEP.man", NULL); 600985d5a49SDaniele Ceraolo Spurio } 601985d5a49SDaniele Ceraolo Spurio 602985d5a49SDaniele Ceraolo Spurio xe_gt_err(gt, "couldn't find CPD header in GSC binary!\n"); 603985d5a49SDaniele Ceraolo Spurio return -ENODATA; 604985d5a49SDaniele Ceraolo Spurio } 605985d5a49SDaniele Ceraolo Spurio 606a9a95523SDaniele Ceraolo Spurio static int parse_headers(struct xe_uc_fw *uc_fw, const struct firmware *fw) 607a9a95523SDaniele Ceraolo Spurio { 608484ecffaSDaniele Ceraolo Spurio int ret; 609484ecffaSDaniele Ceraolo Spurio 610484ecffaSDaniele Ceraolo Spurio /* 611484ecffaSDaniele Ceraolo Spurio * All GuC releases and older HuC ones use CSS headers, while newer HuC 612484ecffaSDaniele Ceraolo Spurio * releases use GSC CPD headers. 613484ecffaSDaniele Ceraolo Spurio */ 614484ecffaSDaniele Ceraolo Spurio switch (uc_fw->type) { 615985d5a49SDaniele Ceraolo Spurio case XE_UC_FW_TYPE_GSC: 616985d5a49SDaniele Ceraolo Spurio return parse_gsc_layout(uc_fw, fw->data, fw->size); 617484ecffaSDaniele Ceraolo Spurio case XE_UC_FW_TYPE_HUC: 618484ecffaSDaniele Ceraolo Spurio ret = parse_cpd_header(uc_fw, fw->data, fw->size, "HUCP.man", "huc_fw"); 619484ecffaSDaniele Ceraolo Spurio if (!ret || ret != -ENOENT) 620484ecffaSDaniele Ceraolo Spurio return ret; 621484ecffaSDaniele Ceraolo Spurio fallthrough; 622484ecffaSDaniele Ceraolo Spurio case XE_UC_FW_TYPE_GUC: 623a9a95523SDaniele Ceraolo Spurio return parse_css_header(uc_fw, fw->data, fw->size); 624484ecffaSDaniele Ceraolo Spurio default: 625484ecffaSDaniele Ceraolo Spurio return -EINVAL; 626484ecffaSDaniele Ceraolo Spurio } 627484ecffaSDaniele Ceraolo Spurio 628484ecffaSDaniele Ceraolo Spurio return 0; 629a9a95523SDaniele Ceraolo Spurio } 630a9a95523SDaniele Ceraolo Spurio 6312e7227b4SDaniele Ceraolo Spurio #define print_uc_fw_version(p_, version_, prefix_, ...) \ 6322e7227b4SDaniele Ceraolo Spurio do { \ 6332e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *ver_ = (version_); \ 6342e7227b4SDaniele Ceraolo Spurio if (ver_->build) \ 6352e7227b4SDaniele Ceraolo Spurio drm_printf(p_, prefix_ " version %u.%u.%u.%u\n", ##__VA_ARGS__, \ 6362e7227b4SDaniele Ceraolo Spurio ver_->major, ver_->minor, \ 6372e7227b4SDaniele Ceraolo Spurio ver_->patch, ver_->build); \ 6382e7227b4SDaniele Ceraolo Spurio else \ 6392e7227b4SDaniele Ceraolo Spurio drm_printf(p_, prefix_ " version %u.%u.%u\n", ##__VA_ARGS__, \ 6402e7227b4SDaniele Ceraolo Spurio ver_->major, ver_->minor, ver_->patch); \ 6412e7227b4SDaniele Ceraolo Spurio } while (0) 6422e7227b4SDaniele Ceraolo Spurio 643c93ea051SMichał Winiarski static int uc_fw_request(struct xe_uc_fw *uc_fw, const struct firmware **firmware_p) 644dd08ebf6SMatthew Brost { 645dd08ebf6SMatthew Brost struct xe_device *xe = uc_fw_to_xe(uc_fw); 646dd08ebf6SMatthew Brost struct device *dev = xe->drm.dev; 6472e7227b4SDaniele Ceraolo Spurio struct drm_printer p = drm_info_printer(dev); 648dd08ebf6SMatthew Brost const struct firmware *fw = NULL; 649dd08ebf6SMatthew Brost int err; 650dd08ebf6SMatthew Brost 651dd08ebf6SMatthew Brost /* 652dd08ebf6SMatthew Brost * we use FIRMWARE_UNINITIALIZED to detect checks against uc_fw->status 653dd08ebf6SMatthew Brost * before we're looked at the HW caps to see if we have uc support 654dd08ebf6SMatthew Brost */ 655dd08ebf6SMatthew Brost BUILD_BUG_ON(XE_UC_FIRMWARE_UNINITIALIZED); 656c73acc1eSFrancois Dugast xe_assert(xe, !uc_fw->status); 657c73acc1eSFrancois Dugast xe_assert(xe, !uc_fw->path); 658dd08ebf6SMatthew Brost 659dd08ebf6SMatthew Brost uc_fw_auto_select(xe, uc_fw); 66066cb3ca9SMichal Wajdeczko 66166cb3ca9SMichal Wajdeczko if (IS_SRIOV_VF(xe)) { 66205e49e0cSMichal Wajdeczko /* Only GuC/HuC are supported */ 66305e49e0cSMichal Wajdeczko if (uc_fw->type != XE_UC_FW_TYPE_GUC && 66405e49e0cSMichal Wajdeczko uc_fw->type != XE_UC_FW_TYPE_HUC) 66505e49e0cSMichal Wajdeczko uc_fw->path = NULL; 66666cb3ca9SMichal Wajdeczko /* VF will support only firmwares that driver can autoselect */ 66766cb3ca9SMichal Wajdeczko xe_uc_fw_change_status(uc_fw, uc_fw->path ? 66866cb3ca9SMichal Wajdeczko XE_UC_FIRMWARE_PRELOADED : 66966cb3ca9SMichal Wajdeczko XE_UC_FIRMWARE_NOT_SUPPORTED); 67066cb3ca9SMichal Wajdeczko return 0; 67166cb3ca9SMichal Wajdeczko } 67266cb3ca9SMichal Wajdeczko 67345883418SLucas De Marchi uc_fw_override(uc_fw); 67466cb3ca9SMichal Wajdeczko 67575730847SDaniele Ceraolo Spurio xe_uc_fw_change_status(uc_fw, uc_fw->path ? 676dd08ebf6SMatthew Brost XE_UC_FIRMWARE_SELECTED : 677dd08ebf6SMatthew Brost XE_UC_FIRMWARE_NOT_SUPPORTED); 678dd08ebf6SMatthew Brost 6796badfc46SLucas De Marchi if (!xe_uc_fw_is_supported(uc_fw)) { 6806badfc46SLucas De Marchi if (uc_fw->type == XE_UC_FW_TYPE_GUC) { 6816badfc46SLucas De Marchi drm_err(&xe->drm, "No GuC firmware defined for platform\n"); 6826badfc46SLucas De Marchi return -ENOENT; 6836badfc46SLucas De Marchi } 68475730847SDaniele Ceraolo Spurio return 0; 6856badfc46SLucas De Marchi } 68675730847SDaniele Ceraolo Spurio 687a455ed04SDaniele Ceraolo Spurio /* an empty path means the firmware is disabled */ 688a455ed04SDaniele Ceraolo Spurio if (!xe_device_uc_enabled(xe) || !(*uc_fw->path)) { 689dd08ebf6SMatthew Brost xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_DISABLED); 69075730847SDaniele Ceraolo Spurio drm_dbg(&xe->drm, "%s disabled", xe_uc_fw_type_repr(uc_fw->type)); 69175730847SDaniele Ceraolo Spurio return 0; 692dd08ebf6SMatthew Brost } 69375730847SDaniele Ceraolo Spurio 694dd08ebf6SMatthew Brost err = request_firmware(&fw, uc_fw->path, dev); 695dd08ebf6SMatthew Brost if (err) 696dd08ebf6SMatthew Brost goto fail; 697dd08ebf6SMatthew Brost 698a9a95523SDaniele Ceraolo Spurio err = parse_headers(uc_fw, fw); 699a9a95523SDaniele Ceraolo Spurio if (err) 700dd08ebf6SMatthew Brost goto fail; 701dd08ebf6SMatthew Brost 7022e7227b4SDaniele Ceraolo Spurio print_uc_fw_version(&p, 7032e7227b4SDaniele Ceraolo Spurio &uc_fw->versions.found[XE_UC_FW_VER_RELEASE], 7042e7227b4SDaniele Ceraolo Spurio "Using %s firmware from %s", 7052e7227b4SDaniele Ceraolo Spurio xe_uc_fw_type_repr(uc_fw->type), uc_fw->path); 70661e72e77SLucas De Marchi 7070881cbe0SDaniele Ceraolo Spurio /* for GSC FW we want the compatibility version, which we query after load */ 7080881cbe0SDaniele Ceraolo Spurio if (uc_fw->type != XE_UC_FW_TYPE_GSC) { 7090881cbe0SDaniele Ceraolo Spurio err = xe_uc_fw_check_version_requirements(uc_fw); 710ad55ead7SLucas De Marchi if (err) 711dd08ebf6SMatthew Brost goto fail; 7120881cbe0SDaniele Ceraolo Spurio } 713dd08ebf6SMatthew Brost 714c93ea051SMichał Winiarski *firmware_p = fw; 715dd08ebf6SMatthew Brost 716dd08ebf6SMatthew Brost return 0; 717dd08ebf6SMatthew Brost 718dd08ebf6SMatthew Brost fail: 719dd08ebf6SMatthew Brost xe_uc_fw_change_status(uc_fw, err == -ENOENT ? 720dd08ebf6SMatthew Brost XE_UC_FIRMWARE_MISSING : 721dd08ebf6SMatthew Brost XE_UC_FIRMWARE_ERROR); 722dd08ebf6SMatthew Brost 723dd08ebf6SMatthew Brost drm_notice(&xe->drm, "%s firmware %s: fetch failed with error %d\n", 724dd08ebf6SMatthew Brost xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); 725dd08ebf6SMatthew Brost drm_info(&xe->drm, "%s firmware(s) can be downloaded from %s\n", 726dd08ebf6SMatthew Brost xe_uc_fw_type_repr(uc_fw->type), XE_UC_FIRMWARE_URL); 727dd08ebf6SMatthew Brost 728dd08ebf6SMatthew Brost release_firmware(fw); /* OK even if fw is NULL */ 7290e1a47fcSMichał Winiarski 730dd08ebf6SMatthew Brost return err; 731dd08ebf6SMatthew Brost } 732dd08ebf6SMatthew Brost 733c93ea051SMichał Winiarski static void uc_fw_release(const struct firmware *fw) 734c93ea051SMichał Winiarski { 735c93ea051SMichał Winiarski release_firmware(fw); 736c93ea051SMichał Winiarski } 737c93ea051SMichał Winiarski 738c93ea051SMichał Winiarski static int uc_fw_copy(struct xe_uc_fw *uc_fw, const void *data, size_t size, u32 flags) 739c93ea051SMichał Winiarski { 740c93ea051SMichał Winiarski struct xe_device *xe = uc_fw_to_xe(uc_fw); 741c93ea051SMichał Winiarski struct xe_gt *gt = uc_fw_to_gt(uc_fw); 742c93ea051SMichał Winiarski struct xe_tile *tile = gt_to_tile(gt); 743c93ea051SMichał Winiarski struct xe_bo *obj; 744c93ea051SMichał Winiarski int err; 745c93ea051SMichał Winiarski 746c93ea051SMichał Winiarski obj = xe_managed_bo_create_from_data(xe, tile, data, size, flags); 747c93ea051SMichał Winiarski if (IS_ERR(obj)) { 748c93ea051SMichał Winiarski drm_notice(&xe->drm, "%s firmware %s: failed to create / populate bo", 749c93ea051SMichał Winiarski xe_uc_fw_type_repr(uc_fw->type), uc_fw->path); 750c93ea051SMichał Winiarski err = PTR_ERR(obj); 751c93ea051SMichał Winiarski goto fail; 752c93ea051SMichał Winiarski } 753c93ea051SMichał Winiarski 754c93ea051SMichał Winiarski uc_fw->bo = obj; 755c93ea051SMichał Winiarski uc_fw->size = size; 756c93ea051SMichał Winiarski 757c93ea051SMichał Winiarski xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_AVAILABLE); 758c93ea051SMichał Winiarski 759c93ea051SMichał Winiarski err = drmm_add_action_or_reset(&xe->drm, uc_fw_fini, uc_fw); 760c93ea051SMichał Winiarski if (err) 761c93ea051SMichał Winiarski goto fail; 762c93ea051SMichał Winiarski 763c93ea051SMichał Winiarski return 0; 764c93ea051SMichał Winiarski 765c93ea051SMichał Winiarski fail: 766c93ea051SMichał Winiarski xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_ERROR); 767c93ea051SMichał Winiarski drm_notice(&xe->drm, "%s firmware %s: copy failed with error %d\n", 768c93ea051SMichał Winiarski xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); 769c93ea051SMichał Winiarski 770c93ea051SMichał Winiarski return err; 771c93ea051SMichał Winiarski } 772c93ea051SMichał Winiarski 773c93ea051SMichał Winiarski int xe_uc_fw_init(struct xe_uc_fw *uc_fw) 774c93ea051SMichał Winiarski { 775c93ea051SMichał Winiarski const struct firmware *fw = NULL; 776c93ea051SMichał Winiarski int err; 777c93ea051SMichał Winiarski 778c93ea051SMichał Winiarski err = uc_fw_request(uc_fw, &fw); 779c93ea051SMichał Winiarski if (err) 780c93ea051SMichał Winiarski return err; 781c93ea051SMichał Winiarski 782c93ea051SMichał Winiarski /* no error and no firmware means nothing to copy */ 783c93ea051SMichał Winiarski if (!fw) 784c93ea051SMichał Winiarski return 0; 785c93ea051SMichał Winiarski 786c93ea051SMichał Winiarski err = uc_fw_copy(uc_fw, fw->data, fw->size, 78762742d12SLucas De Marchi XE_BO_FLAG_SYSTEM | XE_BO_FLAG_GGTT | 78862742d12SLucas De Marchi XE_BO_FLAG_GGTT_INVALIDATE); 789c93ea051SMichał Winiarski 790c93ea051SMichał Winiarski uc_fw_release(fw); 791c93ea051SMichał Winiarski 792c93ea051SMichał Winiarski return err; 793c93ea051SMichał Winiarski } 794c93ea051SMichał Winiarski 795dd08ebf6SMatthew Brost static u32 uc_fw_ggtt_offset(struct xe_uc_fw *uc_fw) 796dd08ebf6SMatthew Brost { 797dd08ebf6SMatthew Brost return xe_bo_ggtt_addr(uc_fw->bo); 798dd08ebf6SMatthew Brost } 799dd08ebf6SMatthew Brost 800dd08ebf6SMatthew Brost static int uc_fw_xfer(struct xe_uc_fw *uc_fw, u32 offset, u32 dma_flags) 801dd08ebf6SMatthew Brost { 802dd08ebf6SMatthew Brost struct xe_device *xe = uc_fw_to_xe(uc_fw); 803dd08ebf6SMatthew Brost struct xe_gt *gt = uc_fw_to_gt(uc_fw); 8044c15a6dcSDaniele Ceraolo Spurio u64 src_offset; 8054c15a6dcSDaniele Ceraolo Spurio u32 dma_ctrl; 806dd08ebf6SMatthew Brost int ret; 807dd08ebf6SMatthew Brost 808dd08ebf6SMatthew Brost xe_force_wake_assert_held(gt_to_fw(gt), XE_FW_GT); 809dd08ebf6SMatthew Brost 810dd08ebf6SMatthew Brost /* Set the source address for the uCode */ 811484ecffaSDaniele Ceraolo Spurio src_offset = uc_fw_ggtt_offset(uc_fw) + uc_fw->css_offset; 812ce8bf5bdSLucas De Marchi xe_mmio_write32(gt, DMA_ADDR_0_LOW, lower_32_bits(src_offset)); 813473b6276SFei Yang xe_mmio_write32(gt, DMA_ADDR_0_HIGH, 814473b6276SFei Yang upper_32_bits(src_offset) | DMA_ADDRESS_SPACE_GGTT); 815dd08ebf6SMatthew Brost 816dd08ebf6SMatthew Brost /* Set the DMA destination */ 817ce8bf5bdSLucas De Marchi xe_mmio_write32(gt, DMA_ADDR_1_LOW, offset); 818ce8bf5bdSLucas De Marchi xe_mmio_write32(gt, DMA_ADDR_1_HIGH, DMA_ADDRESS_SPACE_WOPCM); 819dd08ebf6SMatthew Brost 820dd08ebf6SMatthew Brost /* 821dd08ebf6SMatthew Brost * Set the transfer size. The header plus uCode will be copied to WOPCM 822dd08ebf6SMatthew Brost * via DMA, excluding any other components 823dd08ebf6SMatthew Brost */ 824ce8bf5bdSLucas De Marchi xe_mmio_write32(gt, DMA_COPY_SIZE, 825dd08ebf6SMatthew Brost sizeof(struct uc_css_header) + uc_fw->ucode_size); 826dd08ebf6SMatthew Brost 827dd08ebf6SMatthew Brost /* Start the DMA */ 828ce8bf5bdSLucas De Marchi xe_mmio_write32(gt, DMA_CTRL, 829dd08ebf6SMatthew Brost _MASKED_BIT_ENABLE(dma_flags | START_DMA)); 830dd08ebf6SMatthew Brost 831dd08ebf6SMatthew Brost /* Wait for DMA to finish */ 832063e09afSRodrigo Vivi ret = xe_mmio_wait32(gt, DMA_CTRL, START_DMA, 0, 100000, &dma_ctrl, 8337dc9b92dSRodrigo Vivi false); 834dd08ebf6SMatthew Brost if (ret) 835dd08ebf6SMatthew Brost drm_err(&xe->drm, "DMA for %s fw failed, DMA_CTRL=%u\n", 8367aaec3a6SRodrigo Vivi xe_uc_fw_type_repr(uc_fw->type), dma_ctrl); 837dd08ebf6SMatthew Brost 838dd08ebf6SMatthew Brost /* Disable the bits once DMA is over */ 839ce8bf5bdSLucas De Marchi xe_mmio_write32(gt, DMA_CTRL, _MASKED_BIT_DISABLE(dma_flags)); 840dd08ebf6SMatthew Brost 841dd08ebf6SMatthew Brost return ret; 842dd08ebf6SMatthew Brost } 843dd08ebf6SMatthew Brost 844dd08ebf6SMatthew Brost int xe_uc_fw_upload(struct xe_uc_fw *uc_fw, u32 offset, u32 dma_flags) 845dd08ebf6SMatthew Brost { 846dd08ebf6SMatthew Brost struct xe_device *xe = uc_fw_to_xe(uc_fw); 847dd08ebf6SMatthew Brost int err; 848dd08ebf6SMatthew Brost 849dd08ebf6SMatthew Brost /* make sure the status was cleared the last time we reset the uc */ 850c73acc1eSFrancois Dugast xe_assert(xe, !xe_uc_fw_is_loaded(uc_fw)); 851dd08ebf6SMatthew Brost 852dd08ebf6SMatthew Brost if (!xe_uc_fw_is_loadable(uc_fw)) 853dd08ebf6SMatthew Brost return -ENOEXEC; 854dd08ebf6SMatthew Brost 855dd08ebf6SMatthew Brost /* Call custom loader */ 856dd08ebf6SMatthew Brost err = uc_fw_xfer(uc_fw, offset, dma_flags); 857dd08ebf6SMatthew Brost if (err) 858dd08ebf6SMatthew Brost goto fail; 859dd08ebf6SMatthew Brost 860dd08ebf6SMatthew Brost xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_TRANSFERRED); 861dd08ebf6SMatthew Brost return 0; 862dd08ebf6SMatthew Brost 863dd08ebf6SMatthew Brost fail: 864dd08ebf6SMatthew Brost drm_err(&xe->drm, "Failed to load %s firmware %s (%d)\n", 865dd08ebf6SMatthew Brost xe_uc_fw_type_repr(uc_fw->type), uc_fw->path, 866dd08ebf6SMatthew Brost err); 867dd08ebf6SMatthew Brost xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_LOAD_FAIL); 868dd08ebf6SMatthew Brost return err; 869dd08ebf6SMatthew Brost } 870dd08ebf6SMatthew Brost 8712e7227b4SDaniele Ceraolo Spurio static const char *version_type_repr(enum xe_uc_fw_version_types type) 8722e7227b4SDaniele Ceraolo Spurio { 8732e7227b4SDaniele Ceraolo Spurio switch (type) { 8742e7227b4SDaniele Ceraolo Spurio case XE_UC_FW_VER_RELEASE: 8752e7227b4SDaniele Ceraolo Spurio return "release"; 8762e7227b4SDaniele Ceraolo Spurio case XE_UC_FW_VER_COMPATIBILITY: 8772e7227b4SDaniele Ceraolo Spurio return "compatibility"; 8782e7227b4SDaniele Ceraolo Spurio default: 8792e7227b4SDaniele Ceraolo Spurio return "Unknown version type"; 8802e7227b4SDaniele Ceraolo Spurio } 8812e7227b4SDaniele Ceraolo Spurio } 882dd08ebf6SMatthew Brost 883dd08ebf6SMatthew Brost void xe_uc_fw_print(struct xe_uc_fw *uc_fw, struct drm_printer *p) 884dd08ebf6SMatthew Brost { 8852e7227b4SDaniele Ceraolo Spurio int i; 8862e7227b4SDaniele Ceraolo Spurio 887dd08ebf6SMatthew Brost drm_printf(p, "%s firmware: %s\n", 888dd08ebf6SMatthew Brost xe_uc_fw_type_repr(uc_fw->type), uc_fw->path); 889dd08ebf6SMatthew Brost drm_printf(p, "\tstatus: %s\n", 890dd08ebf6SMatthew Brost xe_uc_fw_status_repr(uc_fw->status)); 89199c821b0SMatthew Brost 8922e7227b4SDaniele Ceraolo Spurio print_uc_fw_version(p, &uc_fw->versions.wanted, "\twanted %s", 8932e7227b4SDaniele Ceraolo Spurio version_type_repr(uc_fw->versions.wanted_type)); 89499c821b0SMatthew Brost 8952e7227b4SDaniele Ceraolo Spurio for (i = 0; i < XE_UC_FW_VER_TYPE_COUNT; i++) { 8962e7227b4SDaniele Ceraolo Spurio struct xe_uc_fw_version *ver = &uc_fw->versions.found[i]; 8972e7227b4SDaniele Ceraolo Spurio 8982e7227b4SDaniele Ceraolo Spurio if (ver->major) 8992e7227b4SDaniele Ceraolo Spurio print_uc_fw_version(p, ver, "\tfound %s", 9002e7227b4SDaniele Ceraolo Spurio version_type_repr(i)); 90199c821b0SMatthew Brost } 9022e7227b4SDaniele Ceraolo Spurio 9032e7227b4SDaniele Ceraolo Spurio if (uc_fw->ucode_size) 9042e7227b4SDaniele Ceraolo Spurio drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size); 9052e7227b4SDaniele Ceraolo Spurio if (uc_fw->rsa_size) 9062e7227b4SDaniele Ceraolo Spurio drm_printf(p, "\tRSA: %u bytes\n", uc_fw->rsa_size); 907dd08ebf6SMatthew Brost } 908