drm/i915/huc: fix leak of debug object in huc load fence on driver unload
The fence is always initialized in huc_init_early, but the cleanup in huc_fini is only being run if HuC is enabled. This causes a leaking of the debug object when HuC is disabled/not supported, which can in turn trigger a warning if we try to register a new debug offset at the same address on driver reload. To fix the issue, make sure to always run the cleanup code. Reported-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Reported-by: Brian Norris <briannorris@chromium.org> Fixes:27536e0327
("drm/i915/huc: track delayed HuC load with a fence") Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> Cc: Brian Norris <briannorris@chromium.org> Cc: Alan Previn <alan.previn.teres.alexis@intel.com> Cc: John Harrison <John.C.Harrison@Intel.com> Tested-by: Brian Norris <briannorris@chromium.org> Reviewed-by: John Harrison <John.C.Harrison@Intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221111005651.4160369-1-daniele.ceraolospurio@intel.com (cherry picked from commit02224691cb
) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
264bc5d3eb
commit
8e5f378281
2 changed files with 8 additions and 5 deletions
|
@ -329,13 +329,15 @@ out:
|
||||||
|
|
||||||
void intel_huc_fini(struct intel_huc *huc)
|
void intel_huc_fini(struct intel_huc *huc)
|
||||||
{
|
{
|
||||||
if (!intel_uc_fw_is_loadable(&huc->fw))
|
/*
|
||||||
return;
|
* the fence is initialized in init_early, so we need to clean it up
|
||||||
|
* even if HuC loading is off.
|
||||||
|
*/
|
||||||
delayed_huc_load_complete(huc);
|
delayed_huc_load_complete(huc);
|
||||||
|
|
||||||
i915_sw_fence_fini(&huc->delayed_load.fence);
|
i915_sw_fence_fini(&huc->delayed_load.fence);
|
||||||
intel_uc_fw_fini(&huc->fw);
|
|
||||||
|
if (intel_uc_fw_is_loadable(&huc->fw))
|
||||||
|
intel_uc_fw_fini(&huc->fw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void intel_huc_suspend(struct intel_huc *huc)
|
void intel_huc_suspend(struct intel_huc *huc)
|
||||||
|
|
|
@ -722,6 +722,7 @@ int intel_uc_runtime_resume(struct intel_uc *uc)
|
||||||
|
|
||||||
static const struct intel_uc_ops uc_ops_off = {
|
static const struct intel_uc_ops uc_ops_off = {
|
||||||
.init_hw = __uc_check_hw,
|
.init_hw = __uc_check_hw,
|
||||||
|
.fini = __uc_fini, /* to clean-up the init_early initialization */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct intel_uc_ops uc_ops_on = {
|
static const struct intel_uc_ops uc_ops_on = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue