Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe/guc: Update CSS header structures

Rework the CSS header structure according to recent updates to the GuC
API spec. Also include more field definitions.

v2: Also pass the new GuC specific structure to a GuC specific
function instead of the higher level, generic structure (review
feedback from Daniele).
Also correct naming of CSS_TIME_* fields.

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://lore.kernel.org/r/20250910210237.603576-2-John.C.Harrison@Intel.com

+53 -35
+12 -12
drivers/gpu/drm/xe/xe_uc_fw.c
··· 328 328 xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_SELECTED); 329 329 } 330 330 331 - static int guc_read_css_info(struct xe_uc_fw *uc_fw, struct uc_css_header *css) 331 + static int guc_read_css_info(struct xe_uc_fw *uc_fw, struct uc_css_guc_info *guc_info) 332 332 { 333 333 struct xe_gt *gt = uc_fw_to_gt(uc_fw); 334 334 struct xe_uc_fw_version *release = &uc_fw->versions.found[XE_UC_FW_VER_RELEASE]; ··· 343 343 return -EINVAL; 344 344 } 345 345 346 - compatibility->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, css->submission_version); 347 - compatibility->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, css->submission_version); 348 - compatibility->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, css->submission_version); 346 + compatibility->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, guc_info->submission_version); 347 + compatibility->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, guc_info->submission_version); 348 + compatibility->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, guc_info->submission_version); 349 349 350 - uc_fw->private_data_size = css->private_data_size; 350 + uc_fw->private_data_size = guc_info->private_data_size; 351 351 352 352 return 0; 353 353 } ··· 416 416 css = (struct uc_css_header *)fw_data; 417 417 418 418 /* Check integrity of size values inside CSS header */ 419 - size = (css->header_size_dw - css->key_size_dw - css->modulus_size_dw - 420 - css->exponent_size_dw) * sizeof(u32); 419 + size = (css->header_size_dw - css->rsa_info.key_size_dw - css->rsa_info.modulus_size_dw - 420 + css->rsa_info.exponent_size_dw) * sizeof(u32); 421 421 if (unlikely(size != sizeof(struct uc_css_header))) { 422 422 drm_warn(&xe->drm, 423 423 "%s firmware %s: unexpected header size: %zu != %zu\n", ··· 430 430 uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32); 431 431 432 432 /* now RSA */ 433 - uc_fw->rsa_size = css->key_size_dw * sizeof(u32); 433 + uc_fw->rsa_size = css->rsa_info.key_size_dw * sizeof(u32); 434 434 435 435 /* At least, it should have header, uCode and RSA. Size of all three. */ 436 436 size = sizeof(struct uc_css_header) + uc_fw->ucode_size + ··· 443 443 } 444 444 445 445 /* Get version numbers from the CSS header */ 446 - release->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, css->sw_version); 447 - release->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, css->sw_version); 448 - release->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, css->sw_version); 446 + release->major = FIELD_GET(CSS_SW_VERSION_UC_MAJOR, css->guc_info.sw_version); 447 + release->minor = FIELD_GET(CSS_SW_VERSION_UC_MINOR, css->guc_info.sw_version); 448 + release->patch = FIELD_GET(CSS_SW_VERSION_UC_PATCH, css->guc_info.sw_version); 449 449 450 450 if (uc_fw->type == XE_UC_FW_TYPE_GUC) 451 - return guc_read_css_info(uc_fw, css); 451 + return guc_read_css_info(uc_fw, &css->guc_info); 452 452 453 453 return 0; 454 454 }
+41 -23
drivers/gpu/drm/xe/xe_uc_fw_abi.h
··· 44 44 * in fw. So driver will load a truncated firmware in this case. 45 45 */ 46 46 47 + struct uc_css_rsa_info { 48 + u32 key_size_dw; 49 + u32 modulus_size_dw; 50 + u32 exponent_size_dw; 51 + } __packed; 52 + 53 + struct uc_css_guc_info { 54 + u32 time; 55 + #define CSS_TIME_HOUR (0xFF << 0) 56 + #define CSS_TIME_MIN (0xFF << 8) 57 + #define CSS_TIME_SEC (0xFFFF << 16) 58 + u32 reserved0[5]; 59 + u32 sw_version; 60 + #define CSS_SW_VERSION_UC_MAJOR (0xFF << 16) 61 + #define CSS_SW_VERSION_UC_MINOR (0xFF << 8) 62 + #define CSS_SW_VERSION_UC_PATCH (0xFF << 0) 63 + u32 submission_version; 64 + u32 reserved1[11]; 65 + u32 header_info; 66 + #define CSS_HEADER_INFO_SVN (0xFF) 67 + #define CSS_HEADER_INFO_COPY_VALID (0x1 << 31) 68 + u32 private_data_size; 69 + u32 ukernel_info; 70 + #define CSS_UKERNEL_INFO_DEVICEID (0xFFFF << 16) 71 + #define CSS_UKERNEL_INFO_PRODKEY (0xFF << 8) 72 + #define CSS_UKERNEL_INFO_BUILDTYPE (0x3 << 2) 73 + #define CSS_UKERNEL_INFO_BUILDTYPE_PROD 0 74 + #define CSS_UKERNEL_INFO_BUILDTYPE_PREPROD 1 75 + #define CSS_UKERNEL_INFO_BUILDTYPE_DEBUG 2 76 + #define CSS_UKERNEL_INFO_ENCSTATUS (0x1 << 1) 77 + #define CSS_UKERNEL_INFO_COPY_VALID (0x1 << 0) 78 + } __packed; 79 + 47 80 struct uc_css_header { 48 81 u32 module_type; 49 82 /* ··· 85 52 */ 86 53 u32 header_size_dw; 87 54 u32 header_version; 88 - u32 module_id; 55 + u32 reserved0; 89 56 u32 module_vendor; 90 57 u32 date; 91 - #define CSS_DATE_DAY (0xFF << 0) 92 - #define CSS_DATE_MONTH (0xFF << 8) 93 - #define CSS_DATE_YEAR (0xFFFF << 16) 58 + #define CSS_DATE_DAY (0xFF << 0) 59 + #define CSS_DATE_MONTH (0xFF << 8) 60 + #define CSS_DATE_YEAR (0xFFFF << 16) 94 61 u32 size_dw; /* uCode plus header_size_dw */ 95 - u32 key_size_dw; 96 - u32 modulus_size_dw; 97 - u32 exponent_size_dw; 98 - u32 time; 99 - #define CSS_TIME_HOUR (0xFF << 0) 100 - #define CSS_DATE_MIN (0xFF << 8) 101 - #define CSS_DATE_SEC (0xFFFF << 16) 102 - char username[8]; 103 - char buildnumber[12]; 104 - u32 sw_version; 105 - #define CSS_SW_VERSION_UC_MAJOR (0xFF << 16) 106 - #define CSS_SW_VERSION_UC_MINOR (0xFF << 8) 107 - #define CSS_SW_VERSION_UC_PATCH (0xFF << 0) 108 62 union { 109 - u32 submission_version; /* only applies to GuC */ 110 - u32 reserved2; 63 + u32 reserved1[3]; 64 + struct uc_css_rsa_info rsa_info; 111 65 }; 112 - u32 reserved0[12]; 113 66 union { 114 - u32 private_data_size; /* only applies to GuC */ 115 - u32 reserved1; 67 + u32 reserved2[22]; 68 + struct uc_css_guc_info guc_info; 116 69 }; 117 - u32 header_info; 118 70 } __packed; 119 71 static_assert(sizeof(struct uc_css_header) == 128); 120 72