Skip to content

Commit afddcbe

Browse files
aalteresjohnharr-intel
authored andcommitted
drm/i915/lrc: User PXP contexts requires runalone bit in lrc
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> Reviewed-by: Vivaik Balasubrawmanian <vivaik.balasubrawmanian@intel.com> Signed-off-by: John Harrison <John.C.Harrison@Intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230917211933.1407559-4-alan.previn.teres.alexis@intel.com
1 parent c14d446 commit afddcbe

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

drivers/gpu/drm/i915/gt/intel_engine_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
#define CTX_CTRL_RS_CTX_ENABLE REG_BIT(1)
178178
#define CTX_CTRL_ENGINE_CTX_SAVE_INHIBIT REG_BIT(2)
179179
#define CTX_CTRL_INHIBIT_SYN_CTX_SWITCH REG_BIT(3)
180+
#define GEN12_CTX_CTRL_RUNALONE_MODE REG_BIT(7)
180181
#define GEN12_CTX_CTRL_OAR_CONTEXT_ENABLE REG_BIT(8)
181182
#define RING_CTX_SR_CTL(base) _MMIO((base) + 0x244)
182183
#define RING_SEMA_WAIT_POLL(base) _MMIO((base) + 0x24c)

drivers/gpu/drm/i915/gt/intel_lrc.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,27 @@ lrc_setup_indirect_ctx(u32 *regs,
845845
lrc_ring_indirect_offset_default(engine) << 6;
846846
}
847847

848+
static bool ctx_needs_runalone(const struct intel_context *ce)
849+
{
850+
struct i915_gem_context *gem_ctx;
851+
bool ctx_is_protected = false;
852+
853+
/*
854+
* On MTL and newer platforms, protected contexts require setting
855+
* the LRC run-alone bit or else the encryption will not happen.
856+
*/
857+
if (GRAPHICS_VER_FULL(ce->engine->i915) >= IP_VER(12, 70) &&
858+
(ce->engine->class == COMPUTE_CLASS || ce->engine->class == RENDER_CLASS)) {
859+
rcu_read_lock();
860+
gem_ctx = rcu_dereference(ce->gem_context);
861+
if (gem_ctx)
862+
ctx_is_protected = gem_ctx->uses_protected_content;
863+
rcu_read_unlock();
864+
}
865+
866+
return ctx_is_protected;
867+
}
868+
848869
static void init_common_regs(u32 * const regs,
849870
const struct intel_context *ce,
850871
const struct intel_engine_cs *engine,
@@ -860,6 +881,8 @@ static void init_common_regs(u32 * const regs,
860881
if (GRAPHICS_VER(engine->i915) < 11)
861882
ctl |= _MASKED_BIT_DISABLE(CTX_CTRL_ENGINE_CTX_SAVE_INHIBIT |
862883
CTX_CTRL_RS_CTX_ENABLE);
884+
if (ctx_needs_runalone(ce))
885+
ctl |= _MASKED_BIT_ENABLE(GEN12_CTX_CTRL_RUNALONE_MODE);
863886
regs[CTX_CONTEXT_CONTROL] = ctl;
864887

865888
regs[CTX_TIMESTAMP] = ce->stats.runtime.last;

0 commit comments

Comments
 (0)