Skip to content

Commit 2160f6f

Browse files
committed
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: dd0e89e ("drm/xe/gsc: GSC FW load") Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Cc: John Harrison <[email protected]> Cc: Alan Previn <[email protected]> Cc: <[email protected]> # v6.8+ Reviewed-by: Julia Filipchuk <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 87d8ecf commit 2160f6f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

drivers/gpu/drm/xe/xe_gsc.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,22 @@ int xe_gsc_init_post_hwconfig(struct xe_gsc *gsc)
513513
void xe_gsc_load_start(struct xe_gsc *gsc)
514514
{
515515
struct xe_gt *gt = gsc_to_gt(gsc);
516+
struct xe_device *xe = gt_to_xe(gt);
516517

517518
if (!xe_uc_fw_is_loadable(&gsc->fw) || !gsc->q)
518519
return;
519520

521+
/*
522+
* The GSC HW is only reset by driver FLR or D3cold entry. We don't
523+
* support the former at runtime, while the latter is only supported on
524+
* DGFX, for which we don't support GSC. Therefore, if GSC failed to
525+
* load previously there is no need to try again because the HW is
526+
* stuck in the error state.
527+
*/
528+
xe_assert(xe, !IS_DGFX(xe));
529+
if (xe_uc_fw_is_in_error_state(&gsc->fw))
530+
return;
531+
520532
/* GSC FW survives GT reset and D3Hot */
521533
if (gsc_fw_is_loaded(gt)) {
522534
xe_uc_fw_change_status(&gsc->fw, XE_UC_FIRMWARE_TRANSFERRED);

drivers/gpu/drm/xe/xe_uc_fw.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const char *xe_uc_fw_status_repr(enum xe_uc_fw_status status)
6565
return "<invalid>";
6666
}
6767

68-
static inline int xe_uc_fw_status_to_error(enum xe_uc_fw_status status)
68+
static inline int xe_uc_fw_status_to_error(const enum xe_uc_fw_status status)
6969
{
7070
switch (status) {
7171
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)
108108
}
109109

110110
static inline enum xe_uc_fw_status
111-
__xe_uc_fw_status(struct xe_uc_fw *uc_fw)
111+
__xe_uc_fw_status(const struct xe_uc_fw *uc_fw)
112112
{
113113
/* shouldn't call this before checking hw/blob availability */
114114
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)
156156
return uc_fw->user_overridden;
157157
}
158158

159+
static inline bool xe_uc_fw_is_in_error_state(const struct xe_uc_fw *uc_fw)
160+
{
161+
return xe_uc_fw_status_to_error(__xe_uc_fw_status(uc_fw)) < 0;
162+
}
163+
159164
static inline void xe_uc_fw_sanitize(struct xe_uc_fw *uc_fw)
160165
{
161166
if (xe_uc_fw_is_loadable(uc_fw))

0 commit comments

Comments
 (0)