From: "Balasubrawmanian, Vivaik" <vivaik.balasubrawmanian@intel.com>
To: <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v5 3/3] drm/i915/lrc: User PXP contexts requires runalone bit in lrc
Date: Thu, 14 Sep 2023 15:51:09 -0700 [thread overview]
Message-ID: <d5094217-2bf8-fa9f-6096-ee6d1da5e877@intel.com> (raw)
In-Reply-To: <20230909223848.427849-4-alan.previn.teres.alexis@intel.com>
On 9/9/2023 3:38 PM, Alan Previn wrote:
> On Meteorlake onwards, HW specs require that all user contexts that
> run on render or compute engines and require PXP must enforce
> run-alone bit in lrc. Add this enforcement for protected contexts.
>
> Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_lrc.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index 967fe4d77a87..3df32177e49e 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -845,6 +845,27 @@ lrc_setup_indirect_ctx(u32 *regs,
> lrc_ring_indirect_offset_default(engine) << 6;
> }
>
> +static bool ctx_needs_runalone(const struct intel_context *ce)
> +{
> + struct i915_gem_context *gem_ctx;
> + bool ctx_is_protected = false;
> +
> + /*
> + * On MTL and newer platforms, protected contexts require setting
> + * the LRC run-alone bit or else the encryption will not happen.
> + */
> + if (GRAPHICS_VER_FULL(ce->engine->i915) >= IP_VER(12, 70) &&
> + (ce->engine->class == COMPUTE_CLASS || ce->engine->class == RENDER_CLASS)) {
> + rcu_read_lock();
> + gem_ctx = rcu_dereference(ce->gem_context);
> + if (gem_ctx)
> + ctx_is_protected = gem_ctx->uses_protected_content;
> + rcu_read_unlock();
> + }
> +
> + return ctx_is_protected;
> +}
> +
> static void init_common_regs(u32 * const regs,
> const struct intel_context *ce,
> const struct intel_engine_cs *engine,
> @@ -860,6 +881,8 @@ static void init_common_regs(u32 * const regs,
> if (GRAPHICS_VER(engine->i915) < 11)
> ctl |= _MASKED_BIT_DISABLE(CTX_CTRL_ENGINE_CTX_SAVE_INHIBIT |
> CTX_CTRL_RS_CTX_ENABLE);
> + if (ctx_needs_runalone(ce))
> + ctl |= _MASKED_BIT_ENABLE(BIT(7));
> regs[CTX_CONTEXT_CONTROL] = ctl;
>
> regs[CTX_TIMESTAMP] = ce->stats.runtime.last;
Can we please get the bit defined in intel_engine_regs.h with a define
instead of a number identification?
Review completed conditional to the above fix.
Reviewed-by: Balasubrawmanian, Vivaik
<vivaik.balasubrawmanian@intel.com>
<mailto:vivaik.balasubrawmanian@intel.com>
next prev parent reply other threads:[~2023-09-14 23:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-09 22:38 [PATCH v5 0/3] drm/i915/pxp/mtl: Update gsc-heci cmd submission to align with fw/hw spec Alan Previn
2023-09-09 22:38 ` [PATCH v5 1/3] drm/i915/pxp/mtl: Update pxp-firmware response timeout Alan Previn
2023-09-14 22:25 ` Balasubrawmanian, Vivaik
2023-09-15 17:30 ` Teres Alexis, Alan Previn
2023-09-15 17:58 ` Teres Alexis, Alan Previn
2023-09-09 22:38 ` [PATCH v5 2/3] drm/i915/pxp/mtl: Update pxp-firmware packet size Alan Previn
2023-09-15 17:28 ` Teres Alexis, Alan Previn
2023-09-15 18:02 ` Teres Alexis, Alan Previn
2023-09-09 22:38 ` [PATCH v5 3/3] drm/i915/lrc: User PXP contexts requires runalone bit in lrc Alan Previn
2023-09-14 22:51 ` Balasubrawmanian, Vivaik [this message]
2023-09-15 18:04 ` Teres Alexis, Alan Previn
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=d5094217-2bf8-fa9f-6096-ee6d1da5e877@intel.com \
--to=vivaik.balasubrawmanian@intel.com \
--cc=dri-devel@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