Commit 66cb3ca9 authored by Michal Wajdeczko's avatar Michal Wajdeczko
Browse files

drm/xe/vf: Mark supported firmwares as preloaded



On current platforms supported firmwares, like GuC and HuC, must
be loaded by the PF driver.  Mark those firmwares as 'preloaded'
so we will skip fetching and loading them on the VF drivers but
still correctly report them as 'running'.

Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: default avatarPiotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240404173814.715-1-michal.wajdeczko@intel.com
parent f2b81483
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "xe_map.h"
#include "xe_mmio.h"
#include "xe_module.h"
#include "xe_sriov.h"
#include "xe_uc_fw.h"

/*
@@ -650,7 +651,17 @@ static int uc_fw_request(struct xe_uc_fw *uc_fw, const struct firmware **firmwar
	xe_assert(xe, !uc_fw->path);

	uc_fw_auto_select(xe, uc_fw);

	if (IS_SRIOV_VF(xe)) {
		/* VF will support only firmwares that driver can autoselect */
		xe_uc_fw_change_status(uc_fw, uc_fw->path ?
				       XE_UC_FIRMWARE_PRELOADED :
				       XE_UC_FIRMWARE_NOT_SUPPORTED);
		return 0;
	}

	uc_fw_override(uc_fw);

	xe_uc_fw_change_status(uc_fw, uc_fw->path ?
			       XE_UC_FIRMWARE_SELECTED :
			       XE_UC_FIRMWARE_NOT_SUPPORTED);
+6 −2
Original line number Diff line number Diff line
@@ -59,6 +59,8 @@ const char *xe_uc_fw_status_repr(enum xe_uc_fw_status status)
		return "TRANSFERRED";
	case XE_UC_FIRMWARE_RUNNING:
		return "RUNNING";
	case XE_UC_FIRMWARE_PRELOADED:
		return "PRELOADED";
	}
	return "<invalid>";
}
@@ -85,6 +87,7 @@ static inline int xe_uc_fw_status_to_error(enum xe_uc_fw_status status)
	case XE_UC_FIRMWARE_LOADABLE:
	case XE_UC_FIRMWARE_TRANSFERRED:
	case XE_UC_FIRMWARE_RUNNING:
	case XE_UC_FIRMWARE_PRELOADED:
		return 0;
	}
	return -EINVAL;
@@ -134,7 +137,8 @@ static inline bool xe_uc_fw_is_available(struct xe_uc_fw *uc_fw)

static inline bool xe_uc_fw_is_loadable(struct xe_uc_fw *uc_fw)
{
	return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_LOADABLE;
	return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_LOADABLE &&
		__xe_uc_fw_status(uc_fw) != XE_UC_FIRMWARE_PRELOADED;
}

static inline bool xe_uc_fw_is_loaded(struct xe_uc_fw *uc_fw)
@@ -144,7 +148,7 @@ static inline bool xe_uc_fw_is_loaded(struct xe_uc_fw *uc_fw)

static inline bool xe_uc_fw_is_running(struct xe_uc_fw *uc_fw)
{
	return __xe_uc_fw_status(uc_fw) == XE_UC_FIRMWARE_RUNNING;
	return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_RUNNING;
}

static inline bool xe_uc_fw_is_overridden(const struct xe_uc_fw *uc_fw)
+2 −1
Original line number Diff line number Diff line
@@ -50,7 +50,8 @@ enum xe_uc_fw_status {
	XE_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */
	XE_UC_FIRMWARE_LOAD_FAIL, /* failed to xfer or init/auth the fw */
	XE_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */
	XE_UC_FIRMWARE_RUNNING /* init/auth done */
	XE_UC_FIRMWARE_RUNNING, /* init/auth done */
	XE_UC_FIRMWARE_PRELOADED, /* preloaded by the PF driver */
};

enum xe_uc_fw_type {