mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
drm/xe/guc: Introduce GUC_FIRMWARE_VER_AT_LEAST helper
There are already few places in the code where we need to check GuC firmware version. Wrap existing raw conditions into a named helper macro to make it clear and avoid explicit call of the MAKE_GUC_VER. Suggested-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Acked-by: Matthew Brost <matthew.brost@intel.com> Link: https://patch.msgid.link/20251216214902.1429-3-michal.wajdeczko@intel.com
This commit is contained in:
parent
ce59717736
commit
09af64eba6
|
|
@ -1026,7 +1026,7 @@ static void action_ring_cleanup(void *arg)
|
|||
|
||||
static void pf_gt_migration_check_support(struct xe_gt *gt)
|
||||
{
|
||||
if (GUC_FIRMWARE_VER(>->uc.guc) < MAKE_GUC_VER(70, 54, 0))
|
||||
if (!GUC_FIRMWARE_VER_AT_LEAST(>->uc.guc, 70, 54))
|
||||
xe_sriov_pf_migration_disable(gt_to_xe(gt), "requires GuC version >= 70.54.0");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,16 @@
|
|||
*/
|
||||
#define MAKE_GUC_VER(maj, min, pat) (((maj) << 16) | ((min) << 8) | (pat))
|
||||
#define MAKE_GUC_VER_STRUCT(ver) MAKE_GUC_VER((ver).major, (ver).minor, (ver).patch)
|
||||
#define MAKE_GUC_VER_ARGS(ver...) \
|
||||
(BUILD_BUG_ON_ZERO(COUNT_ARGS(ver) < 2 || COUNT_ARGS(ver) > 3) + \
|
||||
MAKE_GUC_VER(PICK_ARG1(ver), PICK_ARG2(ver), IF_ARGS(PICK_ARG3(ver), 0, PICK_ARG3(ver))))
|
||||
|
||||
#define GUC_SUBMIT_VER(guc) \
|
||||
MAKE_GUC_VER_STRUCT((guc)->fw.versions.found[XE_UC_FW_VER_COMPATIBILITY])
|
||||
#define GUC_FIRMWARE_VER(guc) \
|
||||
MAKE_GUC_VER_STRUCT((guc)->fw.versions.found[XE_UC_FW_VER_RELEASE])
|
||||
#define GUC_FIRMWARE_VER_AT_LEAST(guc, ver...) \
|
||||
xe_guc_fw_version_at_least((guc), MAKE_GUC_VER_ARGS(ver))
|
||||
|
||||
struct drm_printer;
|
||||
|
||||
|
|
@ -96,4 +102,19 @@ static inline struct drm_device *guc_to_drm(struct xe_guc *guc)
|
|||
return &guc_to_xe(guc)->drm;
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_guc_fw_version_at_least() - Check if GuC is at least of given version.
|
||||
* @guc: the &xe_guc
|
||||
* @ver: the version to check
|
||||
*
|
||||
* The @ver should be prepared using MAKE_GUC_VER(major, minor, patch).
|
||||
*
|
||||
* Return: true if loaded GuC firmware is at least of given version,
|
||||
* false otherwise.
|
||||
*/
|
||||
static inline bool xe_guc_fw_version_at_least(const struct xe_guc *guc, u32 ver)
|
||||
{
|
||||
return GUC_FIRMWARE_VER(guc) >= ver;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -347,10 +347,10 @@ static void guc_waklv_init(struct xe_guc_ads *ads)
|
|||
guc_waklv_enable(ads, NULL, 0, &offset, &remain,
|
||||
GUC_WORKAROUND_KLV_ID_BACK_TO_BACK_RCS_ENGINE_RESET);
|
||||
|
||||
if (GUC_FIRMWARE_VER(>->uc.guc) >= MAKE_GUC_VER(70, 44, 0) && XE_GT_WA(gt, 16026508708))
|
||||
if (GUC_FIRMWARE_VER_AT_LEAST(>->uc.guc, 70, 44) && XE_GT_WA(gt, 16026508708))
|
||||
guc_waklv_enable(ads, NULL, 0, &offset, &remain,
|
||||
GUC_WA_KLV_RESET_BB_STACK_PTR_ON_VF_SWITCH);
|
||||
if (GUC_FIRMWARE_VER(>->uc.guc) >= MAKE_GUC_VER(70, 47, 0) && XE_GT_WA(gt, 16026007364)) {
|
||||
if (GUC_FIRMWARE_VER_AT_LEAST(>->uc.guc, 70, 47) && XE_GT_WA(gt, 16026007364)) {
|
||||
u32 data[] = {
|
||||
0x0,
|
||||
0xF,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user