Skip to content

Commit 21f7735

Browse files
aalterestursulin
authored andcommitted
drm/i915/gsc: take a wakeref for the proxy-init-completion check
Ensure intel_gsc_uc_fw_init_done and intel_gsc_uc_fw_proxy_init takes a wakeref before reading GSC Shim registers. NOTE: another patch in review also adds a call from selftest to this same function. (https://patchwork.freedesktop.org/series/117713/) which is why i am adding the wakeref inside the callee, not the caller. v2: - add a helper, 'gsc_uc_get_fw_status' for both callers (Daniele Ceraolo) Fixes: 99afb7c ("drm/i915/pxp: Add ARB session creation and cleanup") Signed-off-by: Alan Previn <[email protected]> Reviewed-by: Daniele Ceraolo Spurio <[email protected]> Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 8c33c37) Signed-off-by: Tvrtko Ursulin <[email protected]>
1 parent 2222dcb commit 21f7735

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,27 @@ static bool gsc_is_in_reset(struct intel_uncore *uncore)
2424
GSC_FW_CURRENT_STATE_RESET;
2525
}
2626

27-
bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc)
27+
static u32 gsc_uc_get_fw_status(struct intel_uncore *uncore)
2828
{
29-
struct intel_uncore *uncore = gsc_uc_to_gt(gsc)->uncore;
30-
u32 fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG);
29+
intel_wakeref_t wakeref;
30+
u32 fw_status = 0;
3131

32-
return REG_FIELD_GET(GSC_FW_CURRENT_STATE, fw_status) ==
32+
with_intel_runtime_pm(uncore->rpm, wakeref)
33+
fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG);
34+
35+
return fw_status;
36+
}
37+
38+
bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc)
39+
{
40+
return REG_FIELD_GET(GSC_FW_CURRENT_STATE,
41+
gsc_uc_get_fw_status(gsc_uc_to_gt(gsc)->uncore)) ==
3342
GSC_FW_PROXY_STATE_NORMAL;
3443
}
3544

3645
bool intel_gsc_uc_fw_init_done(struct intel_gsc_uc *gsc)
3746
{
38-
struct intel_uncore *uncore = gsc_uc_to_gt(gsc)->uncore;
39-
u32 fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG);
40-
41-
return fw_status & GSC_FW_INIT_COMPLETE_BIT;
47+
return gsc_uc_get_fw_status(gsc_uc_to_gt(gsc)->uncore) & GSC_FW_INIT_COMPLETE_BIT;
4248
}
4349

4450
static int emit_gsc_fw_load(struct i915_request *rq, struct intel_gsc_uc *gsc)

0 commit comments

Comments
 (0)