mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
drm/xe/uc: Fix uC status tracking
The current uC status tracking has a few issues: 1) the HuC is moved to "disabled" instead of "not supported" 2) the status is left uninitialized instead of "disabled" when the modparam is used to disable support 3) due to #1, a number of checks are done against "disabled" instead of the appropriate status. Address all of those by making sure to follow the appropriate state transition and checking against the required state. v2: rebase on s/guc_submission_enabled/uc_enabled/ Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: John Harrison <John.C.Harrison@Intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: John Harrison <John.C.Harrison@Intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
c4991ee01d
commit
757308471d
|
|
@ -242,6 +242,9 @@ int xe_guc_init(struct xe_guc *guc)
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (!xe_uc_fw_is_enabled(&guc->fw))
|
||||
return 0;
|
||||
|
||||
ret = xe_guc_log_init(&guc->log);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -43,22 +43,21 @@ int xe_huc_init(struct xe_huc *huc)
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (!xe_uc_fw_is_enabled(&huc->fw))
|
||||
return 0;
|
||||
|
||||
xe_uc_fw_change_status(&huc->fw, XE_UC_FIRMWARE_LOADABLE);
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
if (xe_uc_fw_is_disabled(&huc->fw)) {
|
||||
drm_info(&xe->drm, "HuC disabled\n");
|
||||
return 0;
|
||||
}
|
||||
drm_err(&xe->drm, "HuC init failed with %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int xe_huc_upload(struct xe_huc *huc)
|
||||
{
|
||||
if (xe_uc_fw_is_disabled(&huc->fw))
|
||||
if (!xe_uc_fw_is_loadable(&huc->fw))
|
||||
return 0;
|
||||
return xe_uc_fw_upload(&huc->fw, 0, HUC_UKERNEL);
|
||||
}
|
||||
|
|
@ -70,7 +69,7 @@ int xe_huc_auth(struct xe_huc *huc)
|
|||
struct xe_guc *guc = huc_to_guc(huc);
|
||||
int ret;
|
||||
|
||||
if (xe_uc_fw_is_disabled(&huc->fw))
|
||||
if (!xe_uc_fw_is_loadable(&huc->fw))
|
||||
return 0;
|
||||
|
||||
xe_assert(xe, !xe_uc_fw_is_running(&huc->fw));
|
||||
|
|
@ -107,7 +106,7 @@ int xe_huc_auth(struct xe_huc *huc)
|
|||
|
||||
void xe_huc_sanitize(struct xe_huc *huc)
|
||||
{
|
||||
if (xe_uc_fw_is_disabled(&huc->fw))
|
||||
if (!xe_uc_fw_is_loadable(&huc->fw))
|
||||
return;
|
||||
xe_uc_fw_change_status(&huc->fw, XE_UC_FIRMWARE_LOADABLE);
|
||||
}
|
||||
|
|
@ -119,7 +118,7 @@ void xe_huc_print_info(struct xe_huc *huc, struct drm_printer *p)
|
|||
|
||||
xe_uc_fw_print(&huc->fw, p);
|
||||
|
||||
if (xe_uc_fw_is_disabled(&huc->fw))
|
||||
if (!xe_uc_fw_is_enabled(&huc->fw))
|
||||
return;
|
||||
|
||||
err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ int xe_uc_init(struct xe_uc *uc)
|
|||
{
|
||||
int ret;
|
||||
|
||||
/* GuC submission not enabled, nothing to do */
|
||||
if (!xe_device_uc_enabled(uc_to_xe(uc)))
|
||||
return 0;
|
||||
/*
|
||||
* We call the GuC/HuC init functions even if GuC submission is off to
|
||||
* correctly move our tracking of the FW state to "disabled".
|
||||
*/
|
||||
|
||||
ret = xe_guc_init(&uc->guc);
|
||||
if (ret)
|
||||
|
|
@ -43,6 +44,9 @@ int xe_uc_init(struct xe_uc *uc)
|
|||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (!xe_device_uc_enabled(uc_to_xe(uc)))
|
||||
return 0;
|
||||
|
||||
ret = xe_wopcm_init(&uc->wopcm);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
|
|
|||
|
|
@ -340,17 +340,19 @@ int xe_uc_fw_init(struct xe_uc_fw *uc_fw)
|
|||
xe_assert(xe, !uc_fw->path);
|
||||
|
||||
uc_fw_auto_select(xe, uc_fw);
|
||||
xe_uc_fw_change_status(uc_fw, uc_fw->path ? *uc_fw->path ?
|
||||
xe_uc_fw_change_status(uc_fw, uc_fw->path ?
|
||||
XE_UC_FIRMWARE_SELECTED :
|
||||
XE_UC_FIRMWARE_DISABLED :
|
||||
XE_UC_FIRMWARE_NOT_SUPPORTED);
|
||||
|
||||
/* Transform no huc in the list into firmware disabled */
|
||||
if (uc_fw->type == XE_UC_FW_TYPE_HUC && !xe_uc_fw_is_supported(uc_fw)) {
|
||||
if (!xe_uc_fw_is_supported(uc_fw))
|
||||
return 0;
|
||||
|
||||
if (!xe_device_uc_enabled(xe)) {
|
||||
xe_uc_fw_change_status(uc_fw, XE_UC_FIRMWARE_DISABLED);
|
||||
err = -ENOPKG;
|
||||
return err;
|
||||
drm_dbg(&xe->drm, "%s disabled", xe_uc_fw_type_repr(uc_fw->type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = request_firmware(&fw, uc_fw->path, dev);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
|
|
|||
|
|
@ -139,8 +139,7 @@ static int __wopcm_init_regs(struct xe_device *xe, struct xe_gt *gt,
|
|||
{
|
||||
u32 base = wopcm->guc.base;
|
||||
u32 size = wopcm->guc.size;
|
||||
u32 huc_agent = xe_uc_fw_is_disabled(>->uc.huc.fw) ? 0 :
|
||||
HUC_LOADING_AGENT_GUC;
|
||||
u32 huc_agent = xe_uc_fw_is_available(>->uc.huc.fw) ? HUC_LOADING_AGENT_GUC : 0;
|
||||
u32 mask;
|
||||
int err;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user