[Intel-gfx] [PATCH v2 05/16] drm/i915/pxp: set KCR reg init during the boot time
Daniele Ceraolo Spurio
daniele.ceraolospurio at intel.com
Mon Mar 1 19:31:49 UTC 2021
Set the KCR init during the boot time, which is required by hardware,
to allow us doing further protection operation such as sending commands
to GPU or TEE.
Signed-off-by: Huang, Sean Z <sean.z.huang at intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
drivers/gpu/drm/i915/pxp/intel_pxp.c | 29 +++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/pxp/intel_pxp.c b/drivers/gpu/drm/i915/pxp/intel_pxp.c
index c2b1c8ff845d..9b2a67f8ab8e 100644
--- a/drivers/gpu/drm/i915/pxp/intel_pxp.c
+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c
@@ -6,6 +6,24 @@
#include "gt/intel_context.h"
#include "i915_drv.h"
+/* KCR register definitions */
+#define KCR_INIT _MMIO(0x320f0)
+
+/* Setting KCR Init bit is required after system boot */
+#define KCR_INIT_ALLOW_DISPLAY_ME_WRITES REG_BIT(14)
+
+static void kcr_pxp_enable(struct intel_gt *gt)
+{
+ intel_uncore_write(gt->uncore, KCR_INIT,
+ _MASKED_BIT_ENABLE(KCR_INIT_ALLOW_DISPLAY_ME_WRITES));
+}
+
+static void kcr_pxp_disable(struct intel_gt *gt)
+{
+ intel_uncore_write(gt->uncore, KCR_INIT,
+ _MASKED_BIT_DISABLE(KCR_INIT_ALLOW_DISPLAY_ME_WRITES));
+}
+
static int create_vcs_context(struct intel_pxp *pxp)
{
static struct lock_class_key pxp_lock;
@@ -46,19 +64,28 @@ void intel_pxp_init(struct intel_pxp *pxp)
if (!HAS_PXP(gt->i915))
return;
+ kcr_pxp_enable(gt);
+
ret = create_vcs_context(pxp);
if (ret)
- return;
+ goto out_kcr;
drm_info(>->i915->drm, "Protected Xe Path (PXP) protected content support initialized\n");
return;
+
+out_kcr:
+ kcr_pxp_disable(gt);
}
void intel_pxp_fini(struct intel_pxp *pxp)
{
+ struct intel_gt *gt = pxp_to_gt(pxp);
+
if (!intel_pxp_is_enabled(pxp))
return;
destroy_vcs_context(pxp);
+
+ kcr_pxp_disable(gt);
}
--
2.29.2
More information about the Intel-gfx
mailing list