Introduce Intel PXP component - Mesa single session
Subsystems (6)
v11 cover Introduce Intel PXP component - Mesa single session
PXP (Protected Xe Path) is an i915 componment, available on GEN12+ that helps to establish the hardware protected session and manage the status of the alive software session, as well as its life cycle.
This patch series is to allow the kernel space to create and manage a single hardware session (a.k.a default session or arbitrary session). So user can allocate the protected buffer, which is encrypted with the leverage of the arbitrary hardware session.
v2:
- modification based on code reivew feedbacks received
- passing pxp instead of i915 as funciton argument
- remove dead code only for multi-session
- move the pxp init call from i915_drv.c to intel_gt.c
- reove the tautology naming
v3:
- rebase to latest drm-tip
v4:
- Append the split non-mesa patch sereis (commit #14 - #21) into this patch series
v5:
- include "intel_pxp.h" in intel_pxp_sm.h at commit #14 to fix the build problem.
v6:
- Fix the null pointer arb_session access bug in intel_pxp_arb.c in "04 [RFC-v5] drm/i915/pxp: Create the arbitrary session after boot"
v7:
- Use list_for_each_entry_safe instead of list_for_each_entry
v8:
- Add MEI vtag support for PXP multi-session usage
v9:
- Fix error handling bug in commit #5 "Func to send hardware session termination". In intel_pxp_cmd.c, we should properly assign "err = PTR_ERR(x)" if hitting the error case "IS_ERR(x)", this is the only change in v9.
v10
- Remove the multi session commits #14-#21, for now we would like to keep the multi session patches as downstream.
- Adopt the code review suggestion from Wilson in commit #1
v11
- In commit #05 "drm/i915/pxp: Func to send hardware session termination", we should not assume VCS0 is always on. Instead we use available VCS#, could be VCS0, VCS2, etc.
Anshuman Gupta (1):
drm/i915/pxp: Add plane decryption support
Bommu Krishnaiah (2):
drm/i915/uapi: introduce drm_i915_gem_create_ext drm/i915/pxp: User interface for Protected buffer
Huang, Sean Z (9):
drm/i915/pxp: Introduce Intel PXP component drm/i915/pxp: set KCR reg init during the boot time drm/i915/pxp: Implement funcs to create the TEE channel drm/i915/pxp: Create the arbitrary session after boot drm/i915/pxp: Func to send hardware session termination drm/i915/pxp: Enable PXP irq worker and callback stub drm/i915/pxp: Destroy arb session upon teardown drm/i915/pxp: Enable PXP power management drm/i915/pxp: Expose session state for display protection flip
Vitaly Lubart (1):
mei: pxp: export pavp client to me client bus
drivers/gpu/drm/i915/Kconfig | 22 ++ drivers/gpu/drm/i915/Makefile | 9 + drivers/gpu/drm/i915/display/intel_sprite.c | 21 +- drivers/gpu/drm/i915/gem/i915_gem_context.c | 15 +- drivers/gpu/drm/i915/gem/i915_gem_context.h | 10 + .../gpu/drm/i915/gem/i915_gem_context_types.h | 2 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 5 + drivers/gpu/drm/i915/gt/intel_gt.c | 4 + drivers/gpu/drm/i915/gt/intel_gt_irq.c | 4 + drivers/gpu/drm/i915/gt/intel_gt_pm.c | 4 + drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 + drivers/gpu/drm/i915/i915_drv.c | 7 +- drivers/gpu/drm/i915/i915_drv.h | 6 + drivers/gpu/drm/i915/i915_gem.c | 63 +++- drivers/gpu/drm/i915/i915_reg.h | 4 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 151 ++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 71 +++++ drivers/gpu/drm/i915/pxp/intel_pxp_arb.c | 209 +++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_arb.h | 16 + drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 279 ++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h | 20 ++ drivers/gpu/drm/i915/pxp/intel_pxp_context.c | 28 ++ drivers/gpu/drm/i915/pxp/intel_pxp_context.h | 15 + drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 65 ++++ drivers/gpu/drm/i915/pxp/intel_pxp_pm.h | 31 ++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 170 +++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.h | 20 ++ drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 55 ++++ drivers/misc/mei/Kconfig | 2 + drivers/misc/mei/Makefile | 1 + drivers/misc/mei/pxp/Kconfig | 13 + drivers/misc/mei/pxp/Makefile | 7 + drivers/misc/mei/pxp/mei_pxp.c | 230 +++++++++++++++ drivers/misc/mei/pxp/mei_pxp.h | 18 ++ include/drm/i915_component.h | 1 + include/drm/i915_pxp_tee_interface.h | 45 +++ include/uapi/drm/i915_drm.h | 66 +++++ 37 files changed, 1680 insertions(+), 12 deletions(-) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_arb.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_arb.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_pm.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_tee.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_types.h create mode 100644 drivers/misc/mei/pxp/Kconfig create mode 100644 drivers/misc/mei/pxp/Makefile create mode 100644 drivers/misc/mei/pxp/mei_pxp.c create mode 100644 drivers/misc/mei/pxp/mei_pxp.h create mode 100644 include/drm/i915_pxp_tee_interface.h
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 1/13 drm/i915/pxp: Introduce Intel PXP component
PXP (Protected Xe Path) is an i915 componment, available on GEN12+, that helps to establish the hardware protected session and manage the status of the alive software session, as well as its life cycle.
This patch series is to allow the kernel space to create and manage a single hardware session (a.k.a default session or arbitrary session). So Mesa can allocate the protected buffer, which is encrypted with the leverage of the arbitrary hardware session.
--- drivers/gpu/drm/i915/Kconfig | 22 +++++++++++++++++ drivers/gpu/drm/i915/Makefile | 5 ++++ drivers/gpu/drm/i915/gt/intel_gt.c | 4 ++++ drivers/gpu/drm/i915/gt/intel_gt_types.h | 3 +++ drivers/gpu/drm/i915/pxp/intel_pxp.c | 24 +++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 25 ++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_context.c | 25 ++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_context.h | 15 ++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 21 ++++++++++++++++ 9 files changed, 144 insertions(+) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.h create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_types.h
drivers/gpu/drm/i915/Kconfig +22 -0
@@ -130,6 +130,28 @@ config DRM_I915_GVT_KVMGT Choose this option if you want to enable KVMGT support for Intel GVT-g. +config DRM_I915_PXP + bool "Enable Intel PXP support for Intel Gen12+ platform" + depends on DRM_I915 + select INTEL_MEI + select INTEL_MEI_ME + select INTEL_MEI_TXE + select INTEL_MEI_PXP + default y + help + This option selects INTEL_MEI_ME if it isn't already selected to + enabled full PXP Services on Intel platforms. + + PXP (Protected Xe Path) is an i915 componment, available on GEN12+, + that helps to establish the hardware protected session and manage + the status of the alive software session, as well as its life cycle. + + This patch series is to allow the kernel space to create and + manage a single hardware session (a.k.a default session or + arbitrary session). So Mesa can allocate the protected buffer, + which is encrypted with the leverage of the arbitrary hardware + session. + menu "drm/i915 Debugging" depends on DRM_I915 depends on EXPERT
drivers/gpu/drm/i915/Makefile +5 -0
@@ -255,6 +255,11 @@ i915-y += \ i915-y += i915_perf.o +# Protected execution platform (PXP) support +i915-$(CONFIG_DRM_I915_PXP) += \ + pxp/intel_pxp.o \ + pxp/intel_pxp_context.o + # Post-mortem debug and GPU hang state capture i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o i915-$(CONFIG_DRM_I915_SELFTEST) += \
drivers/gpu/drm/i915/gt/intel_gt.c +4 -0
@@ -18,6 +18,7 @@#include "intel_uncore.h" #include "intel_pm.h" #include "shmem_utils.h" +#include "pxp/intel_pxp.h" void intel_gt_init_early (struct intel_gt *gt,struct drm_i915_private *i915) {
@@ -584,6 +585,8 @@ int intel_gt_init(struct intel_gt *gt)if (err) goto err_gt; +intel_pxp_init (>->pxp); + goto out_fw; err_gt:__intel_gt_disable (gt);
@@ -638,6 +641,7 @@ void intel_gt_driver_release(struct intel_gt *gt)if (vm)/* FIXME being called twice on error paths :( */ i915_vm_put (vm); +intel_pxp_fini (>->pxp);intel_gt_pm_fini (gt);intel_gt_fini_scratch (gt);intel_gt_fini_buffer_pool (gt);
drivers/gpu/drm/i915/gt/intel_gt_types.h +3 -0
@@ -23,6 +23,7 @@#include "intel_rc6_types.h" #include "intel_rps_types.h" #include "intel_wakeref.h" +#include "pxp/intel_pxp_types.h" struct drm_i915_private ;struct i915_ggtt ;
@@ -120,6 +121,8 @@ struct intel_gt {/* Slice/subslice/EU info */ struct sseu_dev_info sseu; } info; + +struct intel_pxp pxp; };enum intel_gt_scratch_field {
drivers/gpu/drm/i915/pxp/intel_pxp.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright(c) 2020 Intel Corporation. +*/ +#include "i915_drv.h" +#include "intel_pxp.h" +#include "intel_pxp_context.h" + +void intel_pxp_init (struct intel_pxp *pxp) +{ + struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp); + +if (INTEL_GEN (gt->i915) <12 ) +return ; + +intel_pxp_ctx_init (&pxp->ctx); + +drm_info (>->i915->drm,"Protected Xe Path (PXP) protected content support initialized\n" ); +} + +void intel_pxp_fini (struct intel_pxp *pxp) +{ +intel_pxp_ctx_fini (&pxp->ctx); +}
drivers/gpu/drm/i915/pxp/intel_pxp.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_H__ +#define __INTEL_PXP_H__ + +#include "intel_pxp_types.h" + +#ifdef CONFIG_DRM_I915_PXP +void intel_pxp_init (struct intel_pxp *pxp); +void intel_pxp_fini (struct intel_pxp *pxp); +#else +static inline void intel_pxp_init (struct intel_pxp *pxp) +{ +return 0 ; +} + +static inline void intel_pxp_fini (struct intel_pxp *pxp) +{ +} +#endif + +#endif /* __INTEL_PXP_H__ */
drivers/gpu/drm/i915/pxp/intel_pxp_context.c new file +25 -0
@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#include "intel_pxp_context.h" + +/** +* intel_pxp_ctx_init - To init a pxp context. +* @ctx: pointer to ctx structure. +*/ +void intel_pxp_ctx_init (struct pxp_context *ctx) +{ +mutex_init (&ctx->mutex); + ctx->inited = true; +} + +/** +* intel_pxp_ctx_fini - To finish the pxp context. +* @ctx: pointer to ctx structure. +*/ +void intel_pxp_ctx_fini (struct pxp_context *ctx) +{ + ctx->inited = false; +}
drivers/gpu/drm/i915/pxp/intel_pxp_context.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_CONTEXT_H__ +#define __INTEL_PXP_CONTEXT_H__ + +#include <linux/mutex.h> +#include "intel_pxp_types.h" + +void intel_pxp_ctx_init (struct pxp_context *ctx); +void intel_pxp_ctx_fini (struct pxp_context *ctx); + +#endif /* __INTEL_PXP_CONTEXT_H__ */
drivers/gpu/drm/i915/pxp/intel_pxp_types.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_TYPES_H__ +#define __INTEL_PXP_TYPES_H__ + +/* struct pxp_context - Represents combined view of driver and logical HW states. */ +struct pxp_context { +/** @mutex: mutex to protect the pxp context */ +struct mutex mutex; + +bool inited; +}; + +struct intel_pxp { +struct pxp_context ctx; +}; + +#endif /* __INTEL_PXP_TYPES_H__ */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 2/13 drm/i915/pxp: set KCR reg init during the boot time
In reply to Huang, Sean ZSet 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.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.c +8 -0
@@ -6,6 +6,12 @@#include "intel_pxp.h" #include "intel_pxp_context.h" +/* KCR register definitions */ +#define KCR_INIT _MMIO(0x320f0) +#define KCR_INIT_MASK_SHIFT (16) +/* Setting KCR Init bit is required after system boot */ +#define KCR_INIT_ALLOW_DISPLAY_ME_WRITES (BIT(14) | (BIT(14) << KCR_INIT_MASK_SHIFT)) +void intel_pxp_init (struct intel_pxp *pxp) { struct intel_gt *gt = container_of(pxp, struct intel_gt, pxp);
@@ -15,6 +21,8 @@ void intel_pxp_init(struct intel_pxp *pxp)intel_pxp_ctx_init (&pxp->ctx); +intel_uncore_write (gt->uncore,KCR_INIT ,KCR_INIT_ALLOW_DISPLAY_ME_WRITES ); +drm_info (>->i915->drm,"Protected Xe Path (PXP) protected content support initialized\n" ); }
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 3/13 drm/i915/pxp: Implement funcs to create the TEE channel
In reply to Huang, Sean ZImplement the funcs to create the TEE channel, so kernel can send the TEE commands directly to TEE for creating the arbitrary (defualt) session.
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 6 ++ drivers/gpu/drm/i915/pxp/intel_pxp.c | 5 + drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 132 +++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.h | 14 +++ include/drm/i915_component.h | 1 + include/drm/i915_pxp_tee_interface.h | 45 ++++++++ 8 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_tee.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_tee.h create mode 100644 include/drm/i915_pxp_tee_interface.h
drivers/gpu/drm/i915/Makefile +2 -1
@@ -258,7 +258,8 @@ i915-y += i915_perf.o # Protected execution platform (PXP) support i915-$(CONFIG_DRM_I915_PXP) += \ pxp/intel_pxp.o \ - pxp/intel_pxp_context.o + pxp/intel_pxp_context.o \ + pxp/intel_pxp_tee.o # Post-mortem debug and GPU hang state capture i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -322,6 +322,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)mutex_init (&dev_priv->wm.wm_mutex);mutex_init (&dev_priv->pps_mutex);mutex_init (&dev_priv->hdcp_comp_mutex); +mutex_init (&dev_priv->pxp_tee_comp_mutex);i915_memcpy_init_early (dev_priv);intel_runtime_pm_init_early (&dev_priv->runtime_pm);
drivers/gpu/drm/i915/i915_drv.h +6 -0
@@ -1212,6 +1212,12 @@ struct drm_i915_private {/* Mutex to protect the above hdcp component related values. */ struct mutex hdcp_comp_mutex; +struct i915_pxp_comp_master *pxp_tee_master; +bool pxp_tee_comp_added; + +/* Mutex to protect the above pxp_tee component related values. */ +struct mutex pxp_tee_comp_mutex; + I915_SELFTEST_DECLARE(struct i915_selftest_stash selftest;)/*
drivers/gpu/drm/i915/pxp/intel_pxp.c +5 -0
@@ -5,6 +5,7 @@#include "i915_drv.h" #include "intel_pxp.h" #include "intel_pxp_context.h" +#include "intel_pxp_tee.h" /* KCR register definitions */ #define KCR_INIT _MMIO(0x320f0)
@@ -23,10 +24,14 @@ void intel_pxp_init(struct intel_pxp *pxp)intel_uncore_write (gt->uncore,KCR_INIT ,KCR_INIT_ALLOW_DISPLAY_ME_WRITES ); +intel_pxp_tee_component_init (pxp); +drm_info (>->i915->drm,"Protected Xe Path (PXP) protected content support initialized\n" ); }void intel_pxp_fini (struct intel_pxp *pxp) { +intel_pxp_tee_component_fini (pxp); +intel_pxp_ctx_fini (&pxp->ctx); }
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c new file +132 -0
132 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_tee.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_TEE_H__ +#define __INTEL_PXP_TEE_H__ + +#include "intel_pxp.h" + +void intel_pxp_tee_component_init (struct intel_pxp *pxp); +void intel_pxp_tee_component_fini (struct intel_pxp *pxp); + +#endif /* __INTEL_PXP_TEE_H__ */
include/drm/i915_component.h +1 -0
@@ -29,6 +29,7 @@enum i915_component_type {I915_COMPONENT_AUDIO =1 ,I915_COMPONENT_HDCP , +I915_COMPONENT_PXP };/* MAX_PORT is the number of port
include/drm/i915_pxp_tee_interface.h new file +45 -0
45 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 4/13 drm/i915/pxp: Create the arbitrary session after boot
In reply to Huang, Sean ZCreate the arbitrary session, with the fixed session id 0xf, after system boot, for the case that application allocates the protected buffer without establishing any protection session. Because the hardware requires at least one alive session for protected buffer creation. This arbitrary session needs to be re-created after teardown or power event because hardware encryption key won't be valid after such cases.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/pxp/intel_pxp.c | 1 + drivers/gpu/drm/i915/pxp/intel_pxp.h | 16 +++ drivers/gpu/drm/i915/pxp/intel_pxp_arb.c | 133 +++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_arb.h | 15 +++ drivers/gpu/drm/i915/pxp/intel_pxp_context.h | 1 + drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 38 ++++++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.h | 6 + drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 26 ++++ 9 files changed, 237 insertions(+) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_arb.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_arb.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -258,6 +258,7 @@ i915-y += i915_perf.o # Protected execution platform (PXP) support i915-$(CONFIG_DRM_I915_PXP) += \ pxp/intel_pxp.o \ + pxp/intel_pxp_arb.o \ pxp/intel_pxp_context.o \ pxp/intel_pxp_tee.o
drivers/gpu/drm/i915/pxp/intel_pxp.c +1 -0
@@ -6,6 +6,7 @@#include "intel_pxp.h" #include "intel_pxp_context.h" #include "intel_pxp_tee.h" +#include "intel_pxp_arb.h" /* KCR register definitions */ #define KCR_INIT _MMIO(0x320f0)
drivers/gpu/drm/i915/pxp/intel_pxp.h +16 -0
@@ -8,6 +8,22 @@#include "intel_pxp_types.h" +enum pxp_session_types { +SESSION_TYPE_TYPE0 =0 , +SESSION_TYPE_TYPE1 =1 , + +SESSION_TYPE_MAX +}; + +enum pxp_protection_modes { +PROTECTION_MODE_NONE =0 , +PROTECTION_MODE_LM =2 , +PROTECTION_MODE_HM =3 , +PROTECTION_MODE_SM =6 , + +PROTECTION_MODE_ALL +}; +#ifdef CONFIG_DRM_I915_PXP void intel_pxp_init (struct intel_pxp *pxp);void intel_pxp_fini (struct intel_pxp *pxp);
drivers/gpu/drm/i915/pxp/intel_pxp_arb.c new file +133 -0
133 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_arb.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_ARB_H__ +#define __INTEL_PXP_ARB_H__ + +#include <linux/types.h> + +struct intel_pxp ; + +int intel_pxp_arb_create_session (struct intel_pxp *pxp); + +#endif /* __INTEL_PXP_ARB_H__ */
drivers/gpu/drm/i915/pxp/intel_pxp_context.h +1 -0
@@ -8,6 +8,7 @@#include <linux/mutex.h> #include "intel_pxp_types.h" +#include "intel_pxp_arb.h" void intel_pxp_ctx_init (struct pxp_context *ctx);void intel_pxp_ctx_fini (struct pxp_context *ctx);
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +38 -0
@@ -10,6 +10,7 @@#include "intel_pxp.h" #include "intel_pxp_context.h" #include "intel_pxp_tee.h" +#include "intel_pxp_arb.h" static int intel_pxp_tee_io_message(struct intel_pxp *pxp, void *msg_in, u32 msg_in_size,
@@ -70,7 +71,9 @@ static int intel_pxp_tee_io_message(struct intel_pxp *pxp,static int i915_pxp_tee_component_bind (struct device *i915_kdev,struct device *tee_kdev,void *data) { +int ret;struct drm_i915_private *i915 =kdev_to_i915 (i915_kdev); +struct intel_pxp *pxp = &i915->gt.pxp;if (!i915 || !tee_kdev || !data)return -EPERM ;
@@ -80,6 +83,16 @@ static int i915_pxp_tee_component_bind(struct device *i915_kdev, i915->pxp_tee_master->tee_dev = tee_kdev;mutex_unlock (&i915->pxp_tee_comp_mutex); +mutex_lock (&pxp->ctx.mutex); +/* Create arb session only if tee is ready, during system boot or sleep/resume */ + ret =intel_pxp_arb_create_session (pxp); +mutex_unlock (&pxp->ctx.mutex); + +if (ret) { +drm_err (&i915->drm,"Failed to create arb session ret=[%d]\n" , ret); +return ret; + } +return 0 ; }
@@ -130,3 +143,28 @@ void intel_pxp_tee_component_fini(struct intel_pxp *pxp)component_del (i915->drm.dev, &i915_pxp_tee_component_ops); } + +int intel_pxp_tee_cmd_create_arb_session (struct intel_pxp *pxp) +{ +int ret; +u32 msg_out_size_received =0 ; +u32 msg_in[PXP_TEE_ARB_CMD_DW_LEN ] =PXP_TEE_ARB_CMD_BIN ; +u32 msg_out[PXP_TEE_ARB_CMD_DW_LEN ] = {0 }; +struct intel_gt *gt =container_of (pxp,typeof (*gt), pxp); +struct drm_i915_private *i915 = gt->i915; + +mutex_lock (&i915->pxp_tee_comp_mutex); + + ret =intel_pxp_tee_io_message (pxp, + &msg_in, +sizeof (msg_in), + &msg_out, &msg_out_size_received, +sizeof (msg_out)); + +mutex_unlock (&i915->pxp_tee_comp_mutex); + +if (ret) +drm_err (&i915->drm,"Failed to send/receive tee message\n" ); + +return ret; +}
drivers/gpu/drm/i915/pxp/intel_pxp_tee.h +6 -0
@@ -11,4 +11,10 @@void intel_pxp_tee_component_init (struct intel_pxp *pxp);void intel_pxp_tee_component_fini (struct intel_pxp *pxp); +int intel_pxp_tee_cmd_create_arb_session (struct intel_pxp *pxp); + +/* TEE command to create the arbitrary session */ +#define PXP_TEE_ARB_CMD_BIN {0x00040000, 0x0000001e, 0x00000000, 0x00000008, 0x00000002, 0x0000000f} +#define PXP_TEE_ARB_CMD_DW_LEN (6) +#endif /* __INTEL_PXP_TEE_H__ */
drivers/gpu/drm/i915/pxp/intel_pxp_types.h +26 -0
@@ -6,12 +6,38 @@#ifndef __INTEL_PXP_TYPES_H__#define __INTEL_PXP_TYPES_H__ +/** +* struct pxp_protected_session - structure to track all active sessions. +*/ +struct pxp_protected_session { +/** @index: Numeric identifier for this protected session */ +int index; +/** @type: Type of session */ +int type; +/** @protection_mode: mode of protection requested */ +int protection_mode; + +/** +* @is_in_play: indicates whether the session has been established +* in the HW root of trust if this flag is false, it +* indicates an application has reserved this session, +* but has not * established the session in the +* hardware yet. +*/ +bool is_in_play; +}; +/* struct pxp_context - Represents combined view of driver and logical HW states. */ struct pxp_context {/** @mutex: mutex to protect the pxp context */ struct mutex mutex;bool inited; + +struct pxp_protected_session arb_session; +u32 arb_session_pxp_tag; + +bool flag_display_hm_surface_keys; }; struct intel_pxp {
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 5/13 drm/i915/pxp: Func to send hardware session termination
In reply to Huang, Sean ZImplement the functions to allow PXP to send a GPU command, in order to terminate the hardware session, so hardware can recycle this session slot for the next usage.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 159 +++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h | 18 +++ 3 files changed, 178 insertions(+) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -259,6 +259,7 @@ i915-y += i915_perf.o i915-$(CONFIG_DRM_I915_PXP) += \ pxp/intel_pxp.o \ pxp/intel_pxp_arb.o \ + pxp/intel_pxp_cmd.o \ pxp/intel_pxp_context.o \ pxp/intel_pxp_tee.o
drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c new file +159 -0
159 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_CMD_H__ +#define __INTEL_PXP_CMD_H__ + +#include "gt/intel_gt_buffer_pool.h" +#include "intel_pxp.h" + +struct i915_vma *intel_pxp_cmd_get_batch (struct intel_pxp *pxp, +struct intel_context *ce, +struct intel_gt_buffer_pool_node *pool, +u32 *cmd_buf,int cmd_size_in_dw); + +int intel_pxp_cmd_submit (struct intel_pxp *pxp,u32 *cmd,int cmd_size_in_dw); +#endif /* __INTEL_PXP_SM_H__ */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 6/13 drm/i915/pxp: Enable PXP irq worker and callback stub
In reply to Huang, Sean ZCreate the irq worker that serves as callback handler, those callback stubs should be called while the hardware key teardown occurs.
--- drivers/gpu/drm/i915/gt/intel_gt_irq.c | 4 + drivers/gpu/drm/i915/i915_reg.h | 3 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 101 +++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 24 ++++- drivers/gpu/drm/i915/pxp/intel_pxp_context.c | 3 + drivers/gpu/drm/i915/pxp/intel_pxp_context.h | 1 - drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 7 ++ 7 files changed, 140 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt_irq.c +4 -0
@@ -14,6 +14,7 @@#include "intel_lrc_reg.h" #include "intel_uncore.h" #include "intel_rps.h" +#include "pxp/intel_pxp.h" static void guc_irq_handler (struct intel_guc *guc,u16 iir) {
@@ -107,6 +108,9 @@ gen11_other_irq_handler(struct intel_gt *gt, const u8 instance,if (instance ==OTHER_GTPM_INSTANCE )return gen11_rps_irq_handler (>->rps, iir); +if (instance ==OTHER_KCR_INSTANCE ) +return intel_pxp_irq_handler (>->pxp, iir); +WARN_ONCE (1 ,"unhandled other interrupt instance=0x%x, iir=0x%x\n" , instance, iir); }
drivers/gpu/drm/i915/i915_reg.h +2 -1
@@ -7944,6 +7944,7 @@ enum {/* irq instances for OTHER_CLASS */ #define OTHER_GUC_INSTANCE 0#define OTHER_GTPM_INSTANCE 1 +#define OTHER_KCR_INSTANCE 4#define GEN11_INTR_IDENTITY_REG (x) _MMIO(0x190060 + ((x) * 4))
@@ -7966,7 +7967,7 @@ enum {#define GEN11_VECS0_VECS1_INTR_MASK _MMIO(0x1900d0)#define GEN11_GUC_SG_INTR_MASK _MMIO(0x1900e8)#define GEN11_GPM_WGBOXPERF_INTR_MASK _MMIO(0x1900ec) -#define GEN11_CRYPTO_RSVD_INTR_MASK _MMIO(0x1900f0) +#define GEN11_CRYPTO_INTR_MASK _MMIO(0x1900f0)/* crypto mask is in bit31-16 (Engine1 Interrupt Mask) */ #define GEN11_GUNIT_CSME_INTR_MASK _MMIO(0x1900f4)#define ENGINE1_MASK REG_GENMASK(31, 16)
drivers/gpu/drm/i915/pxp/intel_pxp.c +101 -0
116 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp.h +23 -1
@@ -6,8 +6,13 @@#ifndef __INTEL_PXP_H__#define __INTEL_PXP_H__ +#include <linux/workqueue.h> #include "intel_pxp_types.h" +#define PXP_IRQ_VECTOR_DISPLAY_PXP_STATE_TERMINATED BIT(1) +#define PXP_IRQ_VECTOR_DISPLAY_APP_TERM_PER_FW_REQ BIT(2) +#define PXP_IRQ_VECTOR_PXP_DISP_STATE_RESET_COMPLETE BIT(3) +enum pxp_session_types {SESSION_TYPE_TYPE0 =0 , SESSION_TYPE_TYPE1 = 1,
@@ -25,14 +30,31 @@ enum pxp_protection_modes { };#ifdef CONFIG_DRM_I915_PXP +void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir); +int i915_pxp_teardown_required_callback (struct intel_pxp *pxp); +int i915_pxp_global_terminate_complete_callback (struct intel_pxp *pxp); +void intel_pxp_init (struct intel_pxp *pxp);void intel_pxp_fini (struct intel_pxp *pxp);#else -static inline void intel_pxp_init (struct intel_pxp *pxp) +static inline void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir) +{ +} + +static inline int i915_pxp_teardown_required_callback (struct intel_pxp *pxp) +{ +return 0 ; +} + +static inline int i915_pxp_global_terminate_complete_callback (struct intel_pxp *pxp) {return 0 ; } +static inline void intel_pxp_init (struct intel_pxp *pxp) +{ +} +static inline void intel_pxp_fini (struct intel_pxp *pxp) { }
drivers/gpu/drm/i915/pxp/intel_pxp_context.c +3 -0
@@ -11,7 +11,10 @@*/ void intel_pxp_ctx_init (struct pxp_context *ctx) { + ctx->global_state_attacked = false; +mutex_init (&ctx->mutex); + ctx->inited = true; }
drivers/gpu/drm/i915/pxp/intel_pxp_context.h +0 -1
@@ -8,7 +8,6 @@#include <linux/mutex.h> #include "intel_pxp_types.h" -#include "intel_pxp_arb.h" void intel_pxp_ctx_init (struct pxp_context *ctx);void intel_pxp_ctx_fini (struct pxp_context *ctx);
drivers/gpu/drm/i915/pxp/intel_pxp_types.h +7 -0
@@ -6,6 +6,8 @@#ifndef __INTEL_PXP_TYPES_H__#define __INTEL_PXP_TYPES_H__ +#include <linux/workqueue.h> +/** * struct pxp_protected_session - structure to track all active sessions. */
@@ -38,9 +40,14 @@ struct pxp_context {u32 arb_session_pxp_tag;bool flag_display_hm_surface_keys; +bool global_state_attacked; };struct intel_pxp { +struct work_struct irq_work; +u32 handled_irr; +u32 current_events; +struct pxp_context ctx; };
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 7/13 drm/i915/pxp: Destroy arb session upon teardown
In reply to Huang, Sean ZTeardown is triggered when the display topology changes and no long meets the secure playback requirement, and hardware trashes all the encryption keys for display. So as a result, PXP should handle such case and terminate the type0 sessions, which including arb session
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 3 + drivers/gpu/drm/i915/pxp/intel_pxp_arb.c | 76 +++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_arb.h | 1 + drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c | 130 ++++++++++++++++++++++- drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h | 12 ++- 5 files changed, 212 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/pxp/intel_pxp.c +3 -0
@@ -28,6 +28,9 @@ static int intel_pxp_teardown_required_callback(struct intel_pxp *pxp)mutex_lock (&pxp->ctx.mutex); pxp->ctx.global_state_attacked = true; + pxp->ctx.flag_display_hm_surface_keys = false; + + ret =intel_pxp_arb_terminate_session (pxp);mutex_unlock (&pxp->ctx.mutex);
drivers/gpu/drm/i915/pxp/intel_pxp_arb.c +76 -0
85 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_arb.h +1 -0
@@ -11,5 +11,6 @@struct intel_pxp ;int intel_pxp_arb_create_session (struct intel_pxp *pxp); +int intel_pxp_arb_terminate_session (struct intel_pxp *pxp);#endif /* __INTEL_PXP_ARB_H__ */
drivers/gpu/drm/i915/pxp/intel_pxp_cmd.c +125 -5
148 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_cmd.h +7 -5
@@ -9,10 +9,12 @@#include "gt/intel_gt_buffer_pool.h" #include "intel_pxp.h" -struct i915_vma *intel_pxp_cmd_get_batch (struct intel_pxp *pxp, -struct intel_context *ce, -struct intel_gt_buffer_pool_node *pool, -u32 *cmd_buf,int cmd_size_in_dw); +int intel_pxp_cmd_submit (struct intel_pxp *pxp,u32 *cmd, +int cmd_size_in_dw); +int intel_pxp_cmd_add_prolog (struct intel_pxp *pxp,u32 *cmd, +int session_type, +int session_index); +int intel_pxp_cmd_add_epilog (u32 *cmd); +int intel_pxp_cmd_add_inline_termination (u32 *cmd); -int intel_pxp_cmd_submit (struct intel_pxp *pxp,u32 *cmd,int cmd_size_in_dw);#endif /* __INTEL_PXP_SM_H__ */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 8/13 drm/i915/pxp: Enable PXP power management
In reply to Huang, Sean ZDuring the power event S3+ sleep/resume, hardware will lose all the encryption keys for every hardware session, even though the software session state was marked as alive after resume. So to handle such case, PXP should terminate all the hardware sessions and cleanup all the software states after the power cycle.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gt/intel_gt_pm.c | 4 ++ drivers/gpu/drm/i915/i915_drv.c | 4 ++ drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 65 ++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_pm.h | 31 +++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_types.h | 1 + 6 files changed, 106 insertions(+) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_pm.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_pm.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -261,6 +261,7 @@ i915-$(CONFIG_DRM_I915_PXP) += \ pxp/intel_pxp_arb.o \ pxp/intel_pxp_cmd.o \ pxp/intel_pxp_context.o \ + pxp/intel_pxp_pm.o \ pxp/intel_pxp_tee.o # Post-mortem debug and GPU hang state capture
drivers/gpu/drm/i915/gt/intel_gt_pm.c +4 -0
@@ -20,6 +20,7 @@#include "intel_rc6.h" #include "intel_rps.h" #include "intel_wakeref.h" +#include "pxp/intel_pxp_pm.h" static void user_forcewake (struct intel_gt *gt,bool suspend) {
@@ -241,6 +242,8 @@ int intel_gt_resume(struct intel_gt *gt)intel_uc_resume (>->uc); +intel_pxp_pm_resume (>->pxp); +user_forcewake (gt, false); out_fw:
@@ -275,6 +278,7 @@ void intel_gt_suspend_prepare(struct intel_gt *gt)user_forcewake (gt, true);wait_for_suspend (gt); +intel_pxp_pm_prepare_suspend (>->pxp);intel_uc_suspend (>->uc); }
drivers/gpu/drm/i915/i915_drv.c +4 -0
@@ -68,6 +68,8 @@#include "gt/intel_gt_pm.h" #include "gt/intel_rc6.h" +#include "pxp/intel_pxp_pm.h" +#include "i915_debugfs.h" #include "i915_drv.h" #include "i915_ioc32.h"
@@ -1344,6 +1346,8 @@ static int i915_drm_resume_early(struct drm_device *dev)intel_power_domains_resume (dev_priv); +intel_pxp_pm_resume_early (&dev_priv->gt.pxp); +enable_rpm_wakeref_asserts (&dev_priv->runtime_pm);return ret;
drivers/gpu/drm/i915/pxp/intel_pxp_pm.c new file +65 -0
65 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_pm.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_PM_H__ +#define __INTEL_PXP_PM_H__ + +#include "i915_drv.h" + +#ifdef CONFIG_DRM_I915_PXP +void intel_pxp_pm_prepare_suspend (struct intel_pxp *pxp); + +void intel_pxp_pm_resume_early (struct intel_pxp *pxp); +int intel_pxp_pm_resume (struct intel_pxp *pxp); +#else +static inline void intel_pxp_pm_prepare_suspend (struct intel_pxp *pxp) +{ +} + +static inline void intel_pxp_pm_resume_early (struct intel_pxp *pxp) +{ +} + +static inline int intel_pxp_pm_resume (struct intel_pxp *pxp) +{ +return 0 ; +} +#endif + +#endif /* __INTEL_PXP_PM_H__ */
drivers/gpu/drm/i915/pxp/intel_pxp_types.h +1 -0
@@ -41,6 +41,7 @@ struct pxp_context {bool flag_display_hm_surface_keys;bool global_state_attacked; +bool global_state_in_suspend; };struct intel_pxp {
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 9/13 drm/i915/pxp: Expose session state for display protection flip
In reply to Huang, Sean ZImplement the intel_pxp_gem_object_status() to allow i915 display querying the current PXP session state. In the design, display should not perform protection flip on the protected buffers if there is no PXP session alive.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 9 +++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 8 ++++++++ 2 files changed, 17 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.c +9 -0
@@ -140,3 +140,12 @@ void intel_pxp_irq_handler(struct intel_pxp *pxp, u16 iir) pxp->current_events |= events;schedule_work (&pxp->irq_work); } + +bool intel_pxp_gem_object_status (struct drm_i915_private *i915) +{ +if (i915->gt.pxp.ctx.inited && + i915->gt.pxp.ctx.flag_display_hm_surface_keys) +return true; +else +return false; +}
drivers/gpu/drm/i915/pxp/intel_pxp.h +8 -0
@@ -29,6 +29,8 @@ enum pxp_protection_modes { PROTECTION_MODE_ALL }; +struct drm_i915_private ; +#ifdef CONFIG_DRM_I915_PXP void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir);int i915_pxp_teardown_required_callback (struct intel_pxp *pxp);
@@ -36,6 +38,7 @@ int i915_pxp_global_terminate_complete_callback(struct intel_pxp *pxp);void intel_pxp_init (struct intel_pxp *pxp);void intel_pxp_fini (struct intel_pxp *pxp); +bool intel_pxp_gem_object_status (struct drm_i915_private *i915);#else static inline void intel_pxp_irq_handler (struct intel_pxp *pxp,u16 iir) {
@@ -58,6 +61,11 @@ static inline void intel_pxp_init(struct intel_pxp *pxp)static inline void intel_pxp_fini (struct intel_pxp *pxp) { } + +static inline bool intel_pxp_gem_object_status (struct drm_i915_private *i915) +{ +return false; +}#endif #endif /* __INTEL_PXP_H__ */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 10/13 mei: pxp: export pavp client to me client bus
In reply to Huang, Sean ZFrom: Vitaly Lubart <[email protected]>
Export PAVP client to work with i915_cp driver,
for binding it uses kernel component framework.
--- drivers/misc/mei/Kconfig | 2 + drivers/misc/mei/Makefile | 1 + drivers/misc/mei/pxp/Kconfig | 13 ++ drivers/misc/mei/pxp/Makefile | 7 + drivers/misc/mei/pxp/mei_pxp.c | 230 +++++++++++++++++++++++++++++++++ drivers/misc/mei/pxp/mei_pxp.h | 18 +++ 6 files changed, 271 insertions(+) create mode 100644 drivers/misc/mei/pxp/Kconfig create mode 100644 drivers/misc/mei/pxp/Makefile create mode 100644 drivers/misc/mei/pxp/mei_pxp.c create mode 100644 drivers/misc/mei/pxp/mei_pxp.h
drivers/misc/mei/Kconfig +2 -0
@@ -47,3 +47,5 @@ config INTEL_MEI_TXE Intel Bay Trail source "drivers/misc/mei/hdcp/Kconfig" +source "drivers/misc/mei/pxp/Kconfig" +
drivers/misc/mei/Makefile +1 -0
@@ -26,3 +26,4 @@ mei-$(CONFIG_EVENT_TRACING) += mei-trace.o CFLAGS_mei-trace.o = -I$(src) obj-$(CONFIG_INTEL_MEI_HDCP) += hdcp/ +obj-$(CONFIG_INTEL_MEI_PXP) += pxp/
drivers/misc/mei/pxp/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020, Intel Corporation. All rights reserved. +# +config INTEL_MEI_PXP + tristate "Intel PXP services of ME Interface" + select INTEL_MEI_ME + depends on DRM_I915 + help + MEI Support for PXP Services on Intel platforms. + + Enables the ME FW services required for PXP support through + I915 display driver of Intel.
drivers/misc/mei/pxp/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2020, Intel Corporation. All rights reserved. +# +# Makefile - PXP client driver for Intel MEI Bus Driver. + +obj-$(CONFIG_INTEL_MEI_PXP) += mei_pxp.o
drivers/misc/mei/pxp/mei_pxp.c new file +230 -0
230 lines not on this page · raw message
drivers/misc/mei/pxp/mei_pxp.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright © 2020 Intel Corporation +* +* Authors: +* Vitaly Lubart <[email protected]> +*/ + +#ifndef __MEI_PXP_H__ +#define __MEI_PXP_H__ + +/* me_pxp_status: Enumeration of all PXP Status Codes */ +enum me_pxp_status { +ME_PXP_STATUS_SUCCESS =0x0000 , + +}; + +#endif /* __MEI_PXP_H__ */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 11/13 drm/i915/uapi: introduce drm_i915_gem_create_ext
In reply to Huang, Sean ZFrom: Bommu Krishnaiah <[email protected]>
Same old gem_create but with now with extensions support. This is needed to support various upcoming usecases. For now we use the extensions mechanism to support PAVP.
--- drivers/gpu/drm/i915/i915_drv.c | 2 +- drivers/gpu/drm/i915/i915_gem.c | 42 ++++++++++++++++++++++++++++- include/uapi/drm/i915_drm.h | 47 +++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +1 -1
@@ -1733,7 +1733,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {DRM_IOCTL_DEF_DRV (I915_GEM_THROTTLE , i915_gem_throttle_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_ENTERVT , drm_noop,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ),DRM_IOCTL_DEF_DRV (I915_GEM_LEAVEVT , drm_noop,DRM_AUTH |DRM_MASTER |DRM_ROOT_ONLY ), -DRM_IOCTL_DEF_DRV (I915_GEM_CREATE , i915_gem_create_ioctl,DRM_RENDER_ALLOW ), +DRM_IOCTL_DEF_DRV (I915_GEM_CREATE_EXT , i915_gem_create_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_PREAD , i915_gem_pread_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_PWRITE , i915_gem_pwrite_ioctl,DRM_RENDER_ALLOW ), DRM_IOCTL_DEF_DRV(I915_GEM_MMAP, i915_gem_mmap_ioctl, DRM_RENDER_ALLOW),
drivers/gpu/drm/i915/i915_gem.c +41 -1
63 lines not on this page · raw message
include/uapi/drm/i915_drm.h +47 -0
65 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 12/13 drm/i915/pxp: User interface for Protected buffer
In reply to Huang, Sean ZFrom: Bommu Krishnaiah <[email protected]>
This api allow user mode to create Protected buffer and context creation.
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 15 ++++++++++-- drivers/gpu/drm/i915/gem/i915_gem_context.h | 10 ++++++++ .../gpu/drm/i915/gem/i915_gem_context_types.h | 2 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 5 ++++ drivers/gpu/drm/i915/i915_gem.c | 23 +++++++++++++++---- include/uapi/drm/i915_drm.h | 19 +++++++++++++++ 6 files changed, 67 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +13 -2
@@ -2019,12 +2019,23 @@ static int ctx_setparam(struct drm_i915_file_private *fpriv,case I915_CONTEXT_PARAM_RECOVERABLE :if (args->size) ret = -EINVAL ; -else if (args->value) -i915_gem_context_set_recoverable (ctx); +else if (args->value) { +if (!i915_gem_context_is_protected (ctx)) +i915_gem_context_set_recoverable (ctx); +else + ret = -EPERM ; + }else i915_gem_context_clear_recoverable (ctx);break ; +case I915_CONTEXT_PARAM_PROTECTED_CONTENT : +if (args->size) + ret = -EINVAL ; +else if (args->value) +i915_gem_context_set_protected (ctx); +break ; +case I915_CONTEXT_PARAM_PRIORITY : ret =set_priority (ctx, args);break ;
drivers/gpu/drm/i915/gem/i915_gem_context.h +10 -0
@@ -70,6 +70,16 @@ static inline void i915_gem_context_set_recoverable(struct i915_gem_context *ctxset_bit (UCONTEXT_RECOVERABLE , &ctx->user_flags); } +static inline void i915_gem_context_set_protected (struct i915_gem_context *ctx) +{ +set_bit (UCONTEXT_PROTECTED , &ctx->user_flags); +} + +static inline bool i915_gem_context_is_protected (struct i915_gem_context *ctx) +{ +return test_bit (UCONTEXT_PROTECTED , &ctx->user_flags); +} +static inline void i915_gem_context_clear_recoverable (struct i915_gem_context *ctx) {clear_bit (UCONTEXT_RECOVERABLE , &ctx->user_flags);
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +1 -1
@@ -134,7 +134,7 @@ struct i915_gem_context {#define UCONTEXT_BANNABLE 2#define UCONTEXT_RECOVERABLE 3#define UCONTEXT_PERSISTENCE 4 - +#define UCONTEXT_PROTECTED 5/** * @flags: small set of booleans */
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +5 -0
@@ -161,6 +161,11 @@ struct drm_i915_gem_object { } mmo; I915_SELFTEST_DECLARE(struct list_head st_link); +/** +* @user_flags: small set of booleans set by the user +*/ +unsigned long user_flags; +#define I915_BO_PROTECTED BIT(0)unsigned long flags;#define I915_BO_ALLOC_CONTIGUOUS BIT(0)
drivers/gpu/drm/i915/i915_gem.c +19 -4
@@ -184,7 +184,8 @@ static int i915_gem_create(struct drm_file *file, struct intel_memory_region *mr, u64 *size_p, - u32 *handle_p) + u32 *handle_p, + u64 user_flags) { struct drm_i915_gem_object *obj;u32 handle;
@@ -204,6 +205,8 @@ i915_gem_create(struct drm_file *file,if (IS_ERR (obj))return PTR_ERR (obj); + obj->user_flags = user_flags; + ret =drm_gem_handle_create (file, &obj->base, &handle);/* drop reference from allocate - handle holds it now */ i915_gem_object_put (obj);
@@ -258,11 +261,12 @@ i915_gem_dumb_create(struct drm_file *file,return i915_gem_create (file,intel_memory_region_by_type (to_i915 (dev), mem_type), - &args->size, &args->handle); + &args->size, &args->handle,0 ); }struct create_ext { -struct drm_i915_private *i915; +struct drm_i915_private *i915; +unsigned long user_flags; }; static int __create_setparam(struct drm_i915_gem_object_param *args,
@@ -273,6 +277,17 @@ static int __create_setparam(struct drm_i915_gem_object_param *args,return -EINVAL ; } +switch (lower_32_bits (args->param)) { +case I915_PARAM_PROTECTED_CONTENT : +if (args->size) { +return -EINVAL ; + }else if (args->data) { + ext_data->user_flags = args->data; +return 0 ; + } +break ; + } +return -EINVAL ; }
@@ -318,7 +333,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data,return i915_gem_create (file,intel_memory_region_by_type (i915,INTEL_MEMORY_SYSTEM ), - &args->size, &args->handle); + &args->size, &args->handle, ext_data.user_flags); } static int
include/uapi/drm/i915_drm.h +19 -0
@@ -1715,6 +1715,15 @@ struct drm_i915_gem_context_param {* Default is 16 KiB. */ #define I915_CONTEXT_PARAM_RINGSIZE 0xc + +/* +* I915_CONTEXT_PARAM_PROTECTED_CONTENT: +* +* If set to true (1) PAVP content protection is enabled. +* When enabled, the context is marked unrecoverable and may +* become invalid due to PAVP teardown event or other error. +*/ +#define I915_CONTEXT_PARAM_PROTECTED_CONTENT 0xd/* Must be kept compact -- no holes and well documented */ __u64 value;
@@ -1734,6 +1743,16 @@ struct drm_i915_gem_object_param {*/ #define I915_OBJECT_PARAM (1ull<<32) +/* +* I915_PARAM_PROTECTED_CONTENT: +* +* If set to true (1) buffer contents is expected to be protected by +* PAVP encryption and requires decryption for scan out and processing. +* Protected buffers can only be used in PAVP protected contexts. +* A protected buffer may become invalid as a result of PAVP teardown. +*/ +#define I915_PARAM_PROTECTED_CONTENT 0x1 +__u64 param;/* Data value or pointer */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC v11 13/13 drm/i915/pxp: Add plane decryption support
In reply to Huang, Sean ZFrom: Anshuman Gupta <[email protected]>
Add support to enable/disable PLANE_SURF Decryption Request bit. It requires only to enable plane decryption support when following condition met.
1. PAVP session is enabled.
2. Buffer object is protected.
v2:
- Rebased to libva_cp-drm-tip_tgl_cp tree.
- Used gen fb obj user_flags instead gem_object_metadata. [Krishna]
--- drivers/gpu/drm/i915/display/intel_sprite.c | 21 ++++++++++++++++++--- drivers/gpu/drm/i915/i915_reg.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_sprite.c +18 -3
@@ -39,6 +39,8 @@#include <drm/drm_plane_helper.h> #include <drm/drm_rect.h> +#include "pxp/intel_pxp.h" +#include "i915_drv.h" #include "i915_trace.h" #include "i915_vgpu.h"
@@ -767,6 +769,11 @@ icl_program_input_csc(struct intel_plane *plane, PLANE_INPUT_CSC_POSTOFF(pipe, plane_id, 2), 0x0); } +static bool intel_fb_obj_protected (const struct drm_i915_gem_object *obj) +{ +return obj->user_flags &I915_BO_PROTECTED ? true : false; +} + static void skl_plane_async_flip(struct intel_plane *plane, const struct intel_crtc_state *crtc_state,
@@ -803,6 +810,7 @@ skl_program_plane(struct intel_plane *plane,u32 surf_addr = plane_state->color_plane[color_plane].offset;u32 stride =skl_plane_stride (plane_state, color_plane);const struct drm_framebuffer *fb = plane_state->hw.fb; +const struct drm_i915_gem_object *obj =intel_fb_obj (fb);int aux_plane =intel_main_to_aux_plane (fb, color_plane);int crtc_x = plane_state->uapi.dst.x1;int crtc_y = plane_state->uapi.dst.y1;
@@ -813,7 +821,7 @@ skl_program_plane(struct intel_plane *plane,u8 alpha = plane_state->hw.alpha >>8 ;u32 plane_color_ctl =0 , aux_dist =0 ;unsigned long irqflags; -u32 keymsk, keymax; +u32 keymsk, keymax, plane_surf;u32 plane_ctl = plane_state->ctl; plane_ctl |=skl_plane_ctl_crtc (crtc_state);
@@ -889,8 +897,15 @@ skl_program_plane(struct intel_plane *plane,* the control register just before the surface register. */ intel_de_write_fw (dev_priv,PLANE_CTL (pipe, plane_id), plane_ctl); -intel_de_write_fw (dev_priv,PLANE_SURF (pipe, plane_id), -intel_plane_ggtt_offset (plane_state) + surf_addr); + plane_surf =intel_plane_ggtt_offset (plane_state) + surf_addr; + +if (intel_pxp_gem_object_status (dev_priv) && +intel_fb_obj_protected (obj)) + plane_surf |=PLANE_SURF_DECRYPTION_ENABLED ; +else + plane_surf &= ~PLANE_SURF_DECRYPTION_ENABLED ; + +intel_de_write_fw (dev_priv,PLANE_SURF (pipe, plane_id), plane_surf);if (plane_state->scaler_id >=0 )skl_program_scaler (plane, crtc_state, plane_state);
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -7209,6 +7209,7 @@ enum {#define _PLANE_SURF_3 (pipe) _PIPE(pipe, _PLANE_SURF_3_A, _PLANE_SURF_3_B)#define PLANE_SURF (pipe, plane) \ _MMIO_PLANE(plane, _PLANE_SURF_1(pipe), _PLANE_SURF_2(pipe)) +#define PLANE_SURF_DECRYPTION_ENABLED REG_BIT(2)#define _PLANE_OFFSET_1_B 0x711a4#define _PLANE_OFFSET_2_B 0x712a4
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for Introduce Intel PXP component - Mesa single session (rev11)
In reply to Huang, Sean Z== Series Details ==
== Series Details ==
Series: Introduce Intel PXP component - Mesa single session (rev11)
URL : https://patchwork.freedesktop.org/series/84620/
State : failure
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
HDRTEST drivers/gpu/drm/i915/pxp/intel_pxp_types.h
In file included from <command-line>:./drivers/gpu/drm/i915/pxp/intel_pxp_types.h:35:15: error: field ‘mutex’ has incomplete type
struct mutex mutex;
^~~~~drivers/gpu/drm/i915/Makefile:314: recipe for target 'drivers/gpu/drm/i915/pxp/intel_pxp_types.hdrtest' failed make[4]: *** [drivers/gpu/drm/i915/pxp/intel_pxp_types.hdrtest] Error 1 scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2scripts/Makefile.build:496: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2scripts/Makefile.build:496: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1805: recipe for target 'drivers' failed
make: *** [drivers] Error 2
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx