Skip to content

Commit 529bf8d

Browse files
dceraolorodrigovivi
authored andcommitted
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] (cherry picked from commit 2160f6f) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 431c164 commit 529bf8d

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
@@ -519,10 +519,22 @@ int xe_gsc_init_post_hwconfig(struct xe_gsc *gsc)
519519
void xe_gsc_load_start(struct xe_gsc *gsc)
520520
{
521521
struct xe_gt *gt = gsc_to_gt(gsc);
522+
struct xe_device *xe = gt_to_xe(gt);
522523

523524
if (!xe_uc_fw_is_loadable(&gsc->fw) || !gsc->q)
524525
return;
525526

527+
/*
528+
* The GSC HW is only reset by driver FLR or D3cold entry. We don't
529+
* support the former at runtime, while the latter is only supported on
530+
* DGFX, for which we don't support GSC. Therefore, if GSC failed to
531+
* load previously there is no need to try again because the HW is
532+
* stuck in the error state.
533+
*/
534+
xe_assert(xe, !IS_DGFX(xe));
535+
if (xe_uc_fw_is_in_error_state(&gsc->fw))
536+
return;
537+
526538
/* GSC FW survives GT reset and D3Hot */
527539
if (gsc_fw_is_loaded(gt)) {
528540
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)