drm/i915/pxp: Enable PXP power management

During the power event S3+ sleep/resume, hardware will lose all the
encryption keys for every hardware session, even though the
session state might still be marked as alive after resume. Therefore,
we should consider the session as dead on suspend and invalidate all the
objects. The session will be automatically restarted on the first
protected submission on resume.

v2: runtime suspend also invalidates the keys
v3: fix return codes, simplify rpm ops (Chris), use the new worker func
v4: invalidate the objects on suspend, don't re-create the arb sesson on
resume (delayed to first submission).
v5: move irq changes back to irq patch (Rodrigo)
v6: drop invalidation in runtime suspend (Rodrigo)

Signed-off-by: Huang, Sean Z <sean.z.huang@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210924191452.1539378-13-alan.previn.teres.alexis@intel.com
This commit is contained in:
Huang, Sean Z
2021-09-24 12:14:47 -07:00
committed by Rodrigo Vivi
parent 32271ecd65
commit 0cfab4cb3c
8 changed files with 126 additions and 11 deletions

View File

@@ -0,0 +1,46 @@
// SPDX-License-Identifier: MIT
/*
* Copyright(c) 2020 Intel Corporation.
*/
#include "intel_pxp.h"
#include "intel_pxp_irq.h"
#include "intel_pxp_pm.h"
#include "intel_pxp_session.h"
void intel_pxp_suspend(struct intel_pxp *pxp, bool runtime)
{
if (!intel_pxp_is_enabled(pxp))
return;
pxp->arb_is_valid = false;
/*
* Contexts using protected objects keep a runtime PM reference, so we
* can only runtime suspend when all of them have been either closed
* or banned. Therefore, there is no need to invalidate in that
* scenario.
*/
if (!runtime)
intel_pxp_invalidate(pxp);
intel_pxp_fini_hw(pxp);
pxp->hw_state_invalidated = false;
}
void intel_pxp_resume(struct intel_pxp *pxp)
{
if (!intel_pxp_is_enabled(pxp))
return;
/*
* The PXP component gets automatically unbound when we go into S3 and
* re-bound after we come out, so in that scenario we can defer the
* hw init to the bind call.
*/
if (!pxp->pxp_component)
return;
intel_pxp_init_hw(pxp);
}