Skip to content

Commit 66cb3ca

Browse files
committed
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: Michal Wajdeczko <[email protected]> Reviewed-by: Piotr Piórkowski <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent f2b8148 commit 66cb3ca

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

drivers/gpu/drm/xe/xe_uc_fw.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "xe_map.h"
1818
#include "xe_mmio.h"
1919
#include "xe_module.h"
20+
#include "xe_sriov.h"
2021
#include "xe_uc_fw.h"
2122

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

652653
uc_fw_auto_select(xe, uc_fw);
654+
655+
if (IS_SRIOV_VF(xe)) {
656+
/* VF will support only firmwares that driver can autoselect */
657+
xe_uc_fw_change_status(uc_fw, uc_fw->path ?
658+
XE_UC_FIRMWARE_PRELOADED :
659+
XE_UC_FIRMWARE_NOT_SUPPORTED);
660+
return 0;
661+
}
662+
653663
uc_fw_override(uc_fw);
664+
654665
xe_uc_fw_change_status(uc_fw, uc_fw->path ?
655666
XE_UC_FIRMWARE_SELECTED :
656667
XE_UC_FIRMWARE_NOT_SUPPORTED);

drivers/gpu/drm/xe/xe_uc_fw.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ const char *xe_uc_fw_status_repr(enum xe_uc_fw_status status)
5959
return "TRANSFERRED";
6060
case XE_UC_FIRMWARE_RUNNING:
6161
return "RUNNING";
62+
case XE_UC_FIRMWARE_PRELOADED:
63+
return "PRELOADED";
6264
}
6365
return "<invalid>";
6466
}
@@ -85,6 +87,7 @@ static inline int xe_uc_fw_status_to_error(enum xe_uc_fw_status status)
8587
case XE_UC_FIRMWARE_LOADABLE:
8688
case XE_UC_FIRMWARE_TRANSFERRED:
8789
case XE_UC_FIRMWARE_RUNNING:
90+
case XE_UC_FIRMWARE_PRELOADED:
8891
return 0;
8992
}
9093
return -EINVAL;
@@ -134,7 +137,8 @@ static inline bool xe_uc_fw_is_available(struct xe_uc_fw *uc_fw)
134137

135138
static inline bool xe_uc_fw_is_loadable(struct xe_uc_fw *uc_fw)
136139
{
137-
return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_LOADABLE;
140+
return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_LOADABLE &&
141+
__xe_uc_fw_status(uc_fw) != XE_UC_FIRMWARE_PRELOADED;
138142
}
139143

140144
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)
144148

145149
static inline bool xe_uc_fw_is_running(struct xe_uc_fw *uc_fw)
146150
{
147-
return __xe_uc_fw_status(uc_fw) == XE_UC_FIRMWARE_RUNNING;
151+
return __xe_uc_fw_status(uc_fw) >= XE_UC_FIRMWARE_RUNNING;
148152
}
149153

150154
static inline bool xe_uc_fw_is_overridden(const struct xe_uc_fw *uc_fw)

drivers/gpu/drm/xe/xe_uc_fw_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ enum xe_uc_fw_status {
5050
XE_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */
5151
XE_UC_FIRMWARE_LOAD_FAIL, /* failed to xfer or init/auth the fw */
5252
XE_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */
53-
XE_UC_FIRMWARE_RUNNING /* init/auth done */
53+
XE_UC_FIRMWARE_RUNNING, /* init/auth done */
54+
XE_UC_FIRMWARE_PRELOADED, /* preloaded by the PF driver */
5455
};
5556

5657
enum xe_uc_fw_type {

0 commit comments

Comments
 (0)