Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ceraolo Spurio, Daniele" <daniele.ceraolospurio@intel.com>
To: Alan Previn <alan.previn.teres.alexis@intel.com>,
	<intel-gfx@lists.freedesktop.org>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v1] drm/i915/gsc: take a wakeref for the proxy-init-completion check
Date: Thu, 8 Jun 2023 11:19:48 -0700	[thread overview]
Message-ID: <0c7cb50b-413d-c63a-985d-79e5b19bf016@intel.com> (raw)
In-Reply-To: <20230608180405.3059026-1-alan.previn.teres.alexis@intel.com>



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


  reply	other threads:[~2023-06-08 18:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 18:04 [Intel-gfx] [PATCH v1] drm/i915/gsc: take a wakeref for the proxy-init-completion check Alan Previn
2023-06-08 18:19 ` Ceraolo Spurio, Daniele [this message]
2023-06-08 22:48   ` Teres Alexis, Alan Previn
2023-06-08 19:49 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c7cb50b-413d-c63a-985d-79e5b19bf016@intel.com \
    --to=daniele.ceraolospurio@intel.com \
    --cc=alan.previn.teres.alexis@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox