Commit 99c821b0 authored by Matthew Brost's avatar Matthew Brost Committed by Rodrigo Vivi
Browse files

drm/xe/guc: Report submission version of GuC firmware



Starting in 70.6.* GuC firmware the CSS header includes the submission
version, pull this from the CSS header. Prior 70.* versions accidentally
omitted this informatio so hard code to the correct values. This
information will be used by VFs when communicating with the PF.

Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarPhilippe Lecluse <philippe.lecluse1@gmail.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent da34c2cf
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -51,6 +51,15 @@ struct xe_guc {
			/** @seqno: suspend fences seqno */
			u32 seqno;
		} suspend;
		/** @version: submission version */
		struct {
			/** @major: major version of GuC submission */
			u32 major;
			/** @minor: minor version of GuC submission */
			u32 minor;
			/** @patch: patch version of GuC submission */
			u32 patch;
		} version;
	} submission_state;
	/** @hwconfig: Hardware config state */
	struct {
+45 −1
Original line number Diff line number Diff line
@@ -184,6 +184,40 @@ static void uc_fw_fini(struct drm_device *drm, void *arg)
	xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_SELECTED);
}

static void guc_read_css_info(struct xe_uc_fw *uc_fw, struct uc_css_header *css)
{
	struct xe_gt *gt = uc_fw_to_gt(uc_fw);
	struct xe_guc *guc = &gt->uc.guc;

	XE_BUG_ON(uc_fw->type != XE_UC_FW_TYPE_GUC);
	XE_WARN_ON(uc_fw->major_ver_found < 70);

	if (uc_fw->major_ver_found > 70 || uc_fw->minor_ver_found >= 6) {
		/* v70.6.0 adds CSS header support */
		guc->submission_state.version.major =
			FIELD_GET(CSS_SW_VERSION_UC_MAJOR,
				  css->submission_version);
		guc->submission_state.version.minor =
			FIELD_GET(CSS_SW_VERSION_UC_MINOR,
				  css->submission_version);
		guc->submission_state.version.patch =
			FIELD_GET(CSS_SW_VERSION_UC_PATCH,
				  css->submission_version);
	} else if (uc_fw->minor_ver_found >= 3) {
		/* v70.3.0 introduced v1.1.0 */
		guc->submission_state.version.major = 1;
		guc->submission_state.version.minor = 1;
		guc->submission_state.version.patch = 0;
	} else {
		/* v70.0.0 introduced v1.0.0 */
		guc->submission_state.version.major = 1;
		guc->submission_state.version.minor = 0;
		guc->submission_state.version.patch = 0;
	}

	uc_fw->private_data_size = css->private_data_size;
}

int xe_uc_fw_init(struct xe_uc_fw *uc_fw)
{
	struct xe_device *xe = uc_fw_to_xe(uc_fw);
@@ -278,7 +312,7 @@ int xe_uc_fw_init(struct xe_uc_fw *uc_fw)
	}

	if (uc_fw->type == XE_UC_FW_TYPE_GUC)
		uc_fw->private_data_size = css->private_data_size;
		guc_read_css_info(uc_fw, css);

	obj = xe_bo_create_from_data(xe, gt, fw->data, fw->size,
				     ttm_bo_type_kernel,
@@ -403,4 +437,14 @@ void xe_uc_fw_print(struct xe_uc_fw *uc_fw, struct drm_printer *p)
		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
	drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size);
	drm_printf(p, "\tRSA: %u bytes\n", uc_fw->rsa_size);

	if (uc_fw->type == XE_UC_FW_TYPE_GUC) {
		struct xe_gt *gt = uc_fw_to_gt(uc_fw);
		struct xe_guc *guc = &gt->uc.guc;

		drm_printf(p, "\tSubmit version: %u.%u.%u\n",
			   guc->submission_state.version.major,
			   guc->submission_state.version.minor,
			   guc->submission_state.version.patch);
	}
}
+5 −1
Original line number Diff line number Diff line
@@ -69,7 +69,11 @@ struct uc_css_header {
#define CSS_SW_VERSION_UC_MAJOR		(0xFF << 16)
#define CSS_SW_VERSION_UC_MINOR		(0xFF << 8)
#define CSS_SW_VERSION_UC_PATCH		(0xFF << 0)
	u32 reserved0[13];
	union {
		u32 submission_version; /* only applies to GuC */
		u32 reserved2;
	};
	u32 reserved0[12];
	union {
		u32 private_data_size; /* only applies to GuC */
		u32 reserved1;