drm/xe/gsc: Do not attempt to load the GSC multiple times

The GSC HW is only reset by driver FLR or D3cold entry. We don't support
the former at runtime, while the latter is only supported on DGFX, for
which we don't support GSC. Therefore, if GSC failed to load previously
there is no need to try again because the HW is stuck in the error state.

An assert has been added so that if we ever add DGFX support we'll know
we need to handle the D3 case.

v2: use "< 0" instead of "!= 0" in the FW state error check (Julia).

Fixes: dd0e89e5 ("drm/xe/gsc: GSC FW load")
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Cc: Alan Previn <alan.previn.teres.alexis@intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
Reviewed-by: default avatarJulia Filipchuk <julia.filipchuk@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240828215158.2743994-2-daniele.ceraolospurio@intel.com
parent 87d8ecf0
...@@ -513,10 +513,22 @@ int xe_gsc_init_post_hwconfig(struct xe_gsc *gsc) ...@@ -513,10 +513,22 @@ int xe_gsc_init_post_hwconfig(struct xe_gsc *gsc)
void xe_gsc_load_start(struct xe_gsc *gsc) void xe_gsc_load_start(struct xe_gsc *gsc)
{ {
struct xe_gt *gt = gsc_to_gt(gsc); struct xe_gt *gt = gsc_to_gt(gsc);
struct xe_device *xe = gt_to_xe(gt);
if (!xe_uc_fw_is_loadable(&gsc->fw) || !gsc->q) if (!xe_uc_fw_is_loadable(&gsc->fw) || !gsc->q)
return; return;
/*
* The GSC HW is only reset by driver FLR or D3cold entry. We don't
* support the former at runtime, while the latter is only supported on
* DGFX, for which we don't support GSC. Therefore, if GSC failed to
* load previously there is no need to try again because the HW is
* stuck in the error state.
*/
xe_assert(xe, !IS_DGFX(xe));
if (xe_uc_fw_is_in_error_state(&gsc->fw))
return;
/* GSC FW survives GT reset and D3Hot */ /* GSC FW survives GT reset and D3Hot */
if (gsc_fw_is_loaded(gt)) { if (gsc_fw_is_loaded(gt)) {
xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_TRANSFERRED); xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_TRANSFERRED);
......
...@@ -65,7 +65,7 @@ const char *xe_uc_fw_status_repr(enum xe_uc_fw_status status) ...@@ -65,7 +65,7 @@ const char *xe_uc_fw_status_repr(enum xe_uc_fw_status status)
return "<invalid>"; return "<invalid>";
} }
static inline int xe_uc_fw_status_to_error(enum xe_uc_fw_status status) static inline int xe_uc_fw_status_to_error(const enum xe_uc_fw_status status)
{ {
switch (status) { switch (status) {
case XE_UC_FIRMWARE_NOT_SUPPORTED: case XE_UC_FIRMWARE_NOT_SUPPORTED:
...@@ -108,7 +108,7 @@ static inline const char *xe_uc_fw_type_repr(enum xe_uc_fw_type type) ...@@ -108,7 +108,7 @@ static inline const char *xe_uc_fw_type_repr(enum xe_uc_fw_type type)
} }
static inline enum xe_uc_fw_status static inline enum xe_uc_fw_status
__xe_uc_fw_status(struct xe_uc_fw *uc_fw) __xe_uc_fw_status(const struct xe_uc_fw *uc_fw)
{ {
/* shouldn't call this before checking hw/blob availability */ /* shouldn't call this before checking hw/blob availability */
XE_WARN_ON(uc_fw->status == XE_UC_FIRMWARE_UNINITIALIZED); XE_WARN_ON(uc_fw->status == XE_UC_FIRMWARE_UNINITIALIZED);
...@@ -156,6 +156,11 @@ static inline bool xe_uc_fw_is_overridden(const struct xe_uc_fw *uc_fw) ...@@ -156,6 +156,11 @@ static inline bool xe_uc_fw_is_overridden(const struct xe_uc_fw *uc_fw)
return uc_fw->user_overridden; return uc_fw->user_overridden;
} }
static inline bool xe_uc_fw_is_in_error_state(const struct xe_uc_fw *uc_fw)
{
return xe_uc_fw_status_to_error(__xe_uc_fw_status(uc_fw)) < 0;
}
static inline void xe_uc_fw_sanitize(struct xe_uc_fw *uc_fw) static inline void xe_uc_fw_sanitize(struct xe_uc_fw *uc_fw)
{ {
if (xe_uc_fw_is_loadable(uc_fw)) if (xe_uc_fw_is_loadable(uc_fw))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment