Message ID | 20230608180405.3059026-1-alan.previn.teres.alexis@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v1] drm/i915/gsc: take a wakeref for the proxy-init-completion check | expand |
On 6/8/2023 11:04 AM, Alan Previn wrote: > 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. > > Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup") > Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com> > --- > drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c > index f46eb17a7a98..1e5a8b2bdac9 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c > @@ -27,7 +27,11 @@ static bool gsc_is_in_reset(struct intel_uncore *uncore) > bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc) > { > struct intel_uncore *uncore = gsc_uc_to_gt(gsc)->uncore; > - u32 fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); > + intel_wakeref_t wakeref; > + u32 fw_status; > + > + with_intel_runtime_pm(uncore->rpm, wakeref) > + fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); I think this could be moved to an helper (gsc_uc_get_fw_status?), so we don't have to re-do the wakeref in all the callers. Daniele > > return REG_FIELD_GET(GSC_FW_CURRENT_STATE, fw_status) == > GSC_FW_PROXY_STATE_NORMAL; > @@ -36,7 +40,11 @@ bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc) > bool intel_gsc_uc_fw_init_done(struct intel_gsc_uc *gsc) > { > struct intel_uncore *uncore = gsc_uc_to_gt(gsc)->uncore; > - u32 fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); > + intel_wakeref_t wakeref; > + u32 fw_status; > + > + with_intel_runtime_pm(uncore->rpm, wakeref) > + fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); > > return fw_status & GSC_FW_INIT_COMPLETE_BIT; > } > > base-commit: 27187d09511e1d47dbaaf91c7332319551a8edab
On Thu, 2023-06-08 at 11:19 -0700, Ceraolo Spurio, Daniele wrote: > On 6/8/2023 11:04 AM, Alan Previn wrote: > > Ensure intel_gsc_uc_fw_init_done and intel_gsc_uc_fw_proxy_init > > takes a wakeref before reading GSC Shim registers. alan:snip > > > bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc) > > { > > struct intel_uncore *uncore = gsc_uc_to_gt(gsc)->uncore; > > - u32 fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); > > + intel_wakeref_t wakeref; > > + u32 fw_status; > > + > > + with_intel_runtime_pm(uncore->rpm, wakeref) > > + fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); > > I think this could be moved to an helper (gsc_uc_get_fw_status?), so we > don't have to re-do the wakeref in all the callers. alan: thanks - will fix.
diff --git a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c index f46eb17a7a98..1e5a8b2bdac9 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c @@ -27,7 +27,11 @@ static bool gsc_is_in_reset(struct intel_uncore *uncore) bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc) { struct intel_uncore *uncore = gsc_uc_to_gt(gsc)->uncore; - u32 fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); + intel_wakeref_t wakeref; + u32 fw_status; + + with_intel_runtime_pm(uncore->rpm, wakeref) + fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); return REG_FIELD_GET(GSC_FW_CURRENT_STATE, fw_status) == GSC_FW_PROXY_STATE_NORMAL; @@ -36,7 +40,11 @@ bool intel_gsc_uc_fw_proxy_init_done(struct intel_gsc_uc *gsc) bool intel_gsc_uc_fw_init_done(struct intel_gsc_uc *gsc) { struct intel_uncore *uncore = gsc_uc_to_gt(gsc)->uncore; - u32 fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); + intel_wakeref_t wakeref; + u32 fw_status; + + with_intel_runtime_pm(uncore->rpm, wakeref) + fw_status = intel_uncore_read(uncore, GSC_FW_STATUS_REG); return fw_status & GSC_FW_INIT_COMPLETE_BIT; }
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. Fixes: 99afb7cc8c44 ("drm/i915/pxp: Add ARB session creation and cleanup") Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com> --- drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) base-commit: 27187d09511e1d47dbaaf91c7332319551a8edab