From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Alan Previn <alan.previn.teres.alexis@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v4 3/6] drm/i915/pxp: Make intel_pxp_is_active implicitly sort PXP-owning-GT
Date: Thu, 17 Nov 2022 11:05:00 -0500 [thread overview]
Message-ID: <Y3ZbrD/aCf58QI0+@intel.com> (raw)
In-Reply-To: <20221117003018.1433115-4-alan.previn.teres.alexis@intel.com>
On Wed, Nov 16, 2022 at 04:30:15PM -0800, Alan Previn wrote:
> Make intel_pxp_is_active a global check and implicitly find
> the PXP-owning-GT.
>
> As per prior two patches, callers of this function shall now
> pass in i915 since PXP is a global GPU feature. Make
> intel_pxp_is_active implicitly find the right gt so it's transparent
> for global view callers (like display or gem-exec).
>
> However we also need to expose the per-gt variation of this for internal
> pxp files to use (like what intel_pxp_is_active was prior) so also expose
> a new intel_gtpxp_is_active function for replacement.
>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_context.c | 2 +-
> drivers/gpu/drm/i915/pxp/intel_pxp.c | 14 ++++++++++++--
> drivers/gpu/drm/i915/pxp/intel_pxp.h | 3 ++-
> drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c | 4 ++--
> drivers/gpu/drm/i915/pxp/intel_pxp_irq.c | 2 +-
> 5 files changed, 18 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index c123f4847b19..165be45a3c13 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -271,7 +271,7 @@ static int proto_context_set_protected(struct drm_i915_private *i915,
> */
> pc->pxp_wakeref = intel_runtime_pm_get(&i915->runtime_pm);
>
> - if (!intel_pxp_is_active(&to_gt(i915)->pxp))
> + if (!intel_pxp_is_active(i915))
> ret = intel_pxp_start(&to_gt(i915)->pxp);
> }
>
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c b/drivers/gpu/drm/i915/pxp/intel_pxp.c
> index 88105101af79..76a924587543 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
> @@ -87,11 +87,21 @@ bool intel_pxp_is_enabled(struct drm_i915_private *i915)
> return intel_pxp_is_enabled_on_gt(>->pxp);
> }
>
> -bool intel_pxp_is_active(const struct intel_pxp *pxp)
> +bool intel_pxp_is_active_on_gt(const struct intel_pxp *pxp)
if we are asking about the gt we should pass gt
> {
> return pxp->arb_is_valid;
> }
>
> +bool intel_pxp_is_active(struct drm_i915_private *i915)
> +{
> + struct intel_gt *gt = i915_to_pxp_gt(i915);
> +
> + if (!gt)
> + return false;
> +
> + return intel_pxp_is_active_on_gt(>->pxp);
> +}
> +
> /* KCR register definitions */
> #define KCR_INIT _MMIO(0x320f0)
> /* Setting KCR Init bit is required after system boot */
> @@ -287,7 +297,7 @@ int intel_pxp_key_check(struct intel_pxp *pxp,
> struct drm_i915_gem_object *obj,
> bool assign)
> {
> - if (!intel_pxp_is_active(pxp))
> + if (!intel_pxp_is_active_on_gt(pxp))
> return -ENODEV;
>
> if (!i915_gem_object_is_protected(obj))
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.h b/drivers/gpu/drm/i915/pxp/intel_pxp.h
> index 3f71b1653f74..fe981eebf0ec 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp.h
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp.h
> @@ -19,7 +19,8 @@ bool intel_pxp_supported_on_gt(const struct intel_pxp *pxp);
>
> bool intel_pxp_is_enabled_on_gt(const struct intel_pxp *pxp);
> bool intel_pxp_is_enabled(struct drm_i915_private *i915);
> -bool intel_pxp_is_active(const struct intel_pxp *pxp);
> +bool intel_pxp_is_active_on_gt(const struct intel_pxp *pxp);
> +bool intel_pxp_is_active(struct drm_i915_private *i915);
>
> void intel_pxp_init(struct intel_pxp *pxp);
> void intel_pxp_fini(struct intel_pxp *pxp);
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c b/drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c
> index 4d257055434b..52a808fd4704 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_debugfs.c
> @@ -25,7 +25,7 @@ static int pxp_info_show(struct seq_file *m, void *data)
> return 0;
> }
>
> - drm_printf(&p, "active: %s\n", str_yes_no(intel_pxp_is_active(pxp)));
> + drm_printf(&p, "active: %s\n", str_yes_no(intel_pxp_is_active_on_gt(pxp)));
> drm_printf(&p, "instance counter: %u\n", pxp->key_instance);
>
> return 0;
> @@ -43,7 +43,7 @@ static int pxp_terminate_set(void *data, u64 val)
> struct intel_pxp *pxp = data;
> struct intel_gt *gt = pxp_to_gt(pxp);
>
> - if (!intel_pxp_is_active(pxp))
> + if (!intel_pxp_is_active_on_gt(pxp))
> return -ENODEV;
>
> /* simulate a termination interrupt */
> diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp_irq.c b/drivers/gpu/drm/i915/pxp/intel_pxp_irq.c
> index d3c697bf9aab..c25c1979cccc 100644
> --- a/drivers/gpu/drm/i915/pxp/intel_pxp_irq.c
> +++ b/drivers/gpu/drm/i915/pxp/intel_pxp_irq.c
> @@ -86,7 +86,7 @@ void intel_pxp_irq_disable(struct intel_pxp *pxp)
> * called in a path were the driver consider the session as valid and
> * doesn't call a termination on restart.
> */
> - GEM_WARN_ON(intel_pxp_is_active(pxp));
> + GEM_WARN_ON(intel_pxp_is_active_on_gt(pxp));
>
> spin_lock_irq(gt->irq_lock);
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2022-11-17 16:06 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 0:30 [Intel-gfx] [PATCH v4 0/6] drm/i915/pxp: Prepare intel_pxp entry points for MTL Alan Previn
2022-11-17 0:30 ` [Intel-gfx] [PATCH v4 1/6] drm/i915/pxp: Make gt and pxp init/fini aware of PXP-owning-GT Alan Previn
2022-11-17 16:02 ` Rodrigo Vivi
2022-11-17 22:34 ` Teres Alexis, Alan Previn
2022-11-21 11:39 ` Tvrtko Ursulin
2022-11-21 12:12 ` Jani Nikula
2022-11-21 17:02 ` Teres Alexis, Alan Previn
2022-11-21 14:06 ` Vivi, Rodrigo
2022-11-21 17:51 ` Teres Alexis, Alan Previn
2022-11-22 17:57 ` Rodrigo Vivi
2022-11-22 18:50 ` Teres Alexis, Alan Previn
2022-11-22 20:11 ` Teres Alexis, Alan Previn
2022-11-23 23:22 ` Teres Alexis, Alan Previn
2022-11-22 21:12 ` Rodrigo Vivi
2022-11-21 17:06 ` Teres Alexis, Alan Previn
2022-11-17 0:30 ` [Intel-gfx] [PATCH v4 2/6] drm/i915/pxp: Make intel_pxp_is_enabled implicitly sort PXP-owning-GT Alan Previn
2022-11-17 16:04 ` Rodrigo Vivi
2022-11-17 23:04 ` Teres Alexis, Alan Previn
2022-11-22 11:17 ` Jani Nikula
2022-11-22 20:11 ` Teres Alexis, Alan Previn
2022-11-17 0:30 ` [Intel-gfx] [PATCH v4 3/6] drm/i915/pxp: Make intel_pxp_is_active " Alan Previn
2022-11-17 16:05 ` Rodrigo Vivi [this message]
2022-11-17 0:30 ` [Intel-gfx] [PATCH v4 4/6] drm/i915/pxp: Make PXP tee component bind/unbind aware of PXP-owning-GT Alan Previn
2022-11-17 16:07 ` Rodrigo Vivi
2022-11-17 0:30 ` [Intel-gfx] [PATCH v4 5/6] drm/i915/pxp: Make intel_pxp_start implicitly sort PXP-owning-GT Alan Previn
2022-11-17 0:30 ` [Intel-gfx] [PATCH v4 6/6] drm/i915/pxp: Make intel_pxp_key_check " Alan Previn
2022-11-17 0:51 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/pxp: Prepare intel_pxp entry points for MTL (rev4) Patchwork
2022-11-17 1:15 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-11-17 12:48 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=Y3ZbrD/aCf58QI0+@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=alan.previn.teres.alexis@intel.com \
--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