drm/i915/pxp: Introduce Intel PXP component
Subsystems (6)
PATCH 1/27 drm/i915/pxp: Introduce Intel PXP component
PXP (Protected Xe Path) is an i915 componment, that helps ring3 to establish the hardware protected session and manage the status of each alive software session, as well as the life cycle of each session.
By design PXP will expose ioctl so allow ring3 to create, set, and destroy each session. It will also provide the communication chanel to TEE (Trusted Execution Environment) for the protected hardware session creation.
--- drivers/gpu/drm/i915/Makefile | 4 ++++ drivers/gpu/drm/i915/i915_drv.c | 4 ++++ drivers/gpu/drm/i915/i915_drv.h | 4 ++++ drivers/gpu/drm/i915/pxp/intel_pxp.c | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 22 ++++++++++++++++++++++ include/uapi/drm/i915_drm.h | 5 +++++ 6 files changed, 59 insertions(+) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp.h
drivers/gpu/drm/i915/Makefile +4 -0
@@ -254,6 +254,10 @@ i915-y += \ i915-y += i915_perf.o +# Protected execution platform (PXP) support +i915-y += \ + pxp/intel_pxp.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/i915_drv.c +4 -0
@@ -889,6 +889,8 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (ret) goto out_cleanup_gem; +intel_pxp_init (i915); +i915_driver_register (i915);enable_rpm_wakeref_asserts (&i915->runtime_pm);
@@ -938,6 +940,8 @@ void i915_driver_remove(struct drm_i915_private *i915)/* Flush any external code that still may be under the RCU lock */ synchronize_rcu (); +intel_pxp_uninit (i915); +i915_gem_suspend (i915);drm_atomic_helper_shutdown (&i915->drm);
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -105,6 +105,8 @@#include "intel_region_lmem.h" +#include "pxp/intel_pxp.h" +/* General customization: */
@@ -1215,6 +1217,8 @@ struct drm_i915_private {/* Mutex to protect the above hdcp component related values. */ struct mutex hdcp_comp_mutex; +struct intel_pxp pxp; + I915_SELFTEST_DECLARE(struct i915_selftest_stash selftest;)/*
drivers/gpu/drm/i915/pxp/intel_pxp.c new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020 Intel Corporation. +*/ + +#include "i915_drv.h" +#include "intel_pxp.h" + +int intel_pxp_init (struct drm_i915_private *i915) +{ +int ret; + +drm_info (&i915->drm,"i915_pxp_init\n" ); + +return ret; +} + +void intel_pxp_uninit (struct drm_i915_private *i915) +{ +}
drivers/gpu/drm/i915/pxp/intel_pxp.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_H__ +#define __INTEL_PXP_H__ + +#include <drm/drm_file.h> + +struct pxp_context ; + +struct intel_pxp { +struct pxp_context *r0ctx; +}; + +struct drm_i915_private ; + +int intel_pxp_init (struct drm_i915_private *i915); +void intel_pxp_uninit (struct drm_i915_private *i915); + +#endif
include/uapi/drm/i915_drm.h +5 -0
@@ -1898,6 +1898,11 @@ struct drm_i915_gem_vm_control {__u32 vm_id; }; +struct drm_i915_pxp_ops { +__u64 pxp_info_ptr; +__u32 pxp_info_size; +}; +struct drm_i915_reg_read {/* * Register offset.
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/27 drm/i915/pxp: Enable PXP irq worker and callback stub
Create 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 | 1 + drivers/gpu/drm/i915/pxp/intel_pxp.c | 95 ++++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 22 ++++++ 4 files changed, 122 insertions(+)
drivers/gpu/drm/i915/gt/intel_gt_irq.c +4 -0
@@ -13,6 +13,7 @@#include "intel_gt_irq.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) {
@@ -106,6 +107,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 (gt, iir); +WARN_ONCE (1 ,"unhandled other interrupt instance=0x%x, iir=0x%x\n" , instance, iir); }
drivers/gpu/drm/i915/i915_reg.h +1 -0
@@ -7941,6 +7941,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))
drivers/gpu/drm/i915/pxp/intel_pxp.c +95 -0
110 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp.h +22 -0
@@ -8,14 +8,36 @@#include <drm/drm_file.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_sm_session_req { +/* Request KMD to allocate session id and move it to IN INIT */ +PXP_SM_REQ_SESSION_ID_INIT =0x0 , +/* Inform KMD that UMD has completed the initialization */ +PXP_SM_REQ_SESSION_IN_PLAY , +/* Request KMD to terminate the session */ +PXP_SM_REQ_SESSION_TERMINATE +}; +struct pxp_context ;struct intel_pxp { +struct work_struct irq_work; +u32 handled_irr; +u32 current_events; +struct pxp_context *r0ctx; }; +struct intel_gt ;struct drm_i915_private ; +void intel_pxp_irq_handler (struct intel_gt *gt,u16 iir); +int i915_pxp_teardown_required_callback (struct drm_i915_private *i915); +int i915_pxp_global_terminate_complete_callback (struct drm_i915_private *i915); +int intel_pxp_init (struct drm_i915_private *i915);void intel_pxp_uninit (struct drm_i915_private *i915);
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/27 drm/i915/pxp: Add PXP context for logical hardware states.
In reply to Huang, Sean ZAdd PXP context which represents combined view
of driver and logical HW states.
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/pxp/intel_pxp.c | 32 ++++++++++-- drivers/gpu/drm/i915/pxp/intel_pxp.h | 3 ++ drivers/gpu/drm/i915/pxp/intel_pxp_context.c | 51 ++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_context.h | 44 +++++++++++++++++ 5 files changed, 128 insertions(+), 5 deletions(-) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_context.h
drivers/gpu/drm/i915/Makefile +2 -1
@@ -256,7 +256,8 @@ i915-y += i915_perf.o # Protected execution platform (PXP) support i915-y += \ - pxp/intel_pxp.o + 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
drivers/gpu/drm/i915/pxp/intel_pxp.c +28 -4
@@ -5,6 +5,7 @@#include "i915_drv.h" #include "intel_pxp.h" +#include "intel_pxp_context.h" static void intel_pxp_write_irq_mask_reg (struct drm_i915_private *i915,u32 mask) {
@@ -32,14 +33,32 @@ static int intel_pxp_teardown_required_callback(struct drm_i915_private *i915) {drm_dbg (&i915->drm,"%s was called\n" , __func__); +mutex_lock (&i915->pxp.r0ctx->ctx_mutex); + + i915->pxp.r0ctx->global_state_attacked = true; + i915->pxp.r0ctx->flag_display_hm_surface_keys = false; + +mutex_unlock (&i915->pxp.r0ctx->ctx_mutex); +return 0 ; }static int intel_pxp_global_terminate_complete_callback (struct drm_i915_private *i915) { +int ret =0 ; +drm_dbg (&i915->drm,">>> %s\n" , __func__); -return 0 ; +mutex_lock (&i915->pxp.r0ctx->ctx_mutex); + +if (i915->pxp.r0ctx->global_state_attacked) + i915->pxp.r0ctx->global_state_attacked = false; + +mutex_unlock (&i915->pxp.r0ctx->ctx_mutex); + +drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret); + +return ret; }static void intel_pxp_irq_work (struct work_struct *work)
@@ -68,21 +87,26 @@ static void intel_pxp_irq_work(struct work_struct *work)int intel_pxp_init (struct drm_i915_private *i915) { -int ret; -drm_info (&i915->drm,"i915_pxp_init\n" ); + i915->pxp.r0ctx =intel_pxp_create_r0ctx (i915); +if (!i915->pxp.r0ctx) { +drm_dbg (&i915->drm,"Failed to create pxp ctx\n" ); +return -EFAULT ; + } +INIT_WORK (&i915->pxp.irq_work, intel_pxp_irq_work); i915->pxp.handled_irr = (PXP_IRQ_VECTOR_DISPLAY_PXP_STATE_TERMINATED |PXP_IRQ_VECTOR_DISPLAY_APP_TERM_PER_FW_REQ |PXP_IRQ_VECTOR_PXP_DISP_STATE_RESET_COMPLETE ); -return ret; +return 0 ; }void intel_pxp_uninit (struct drm_i915_private *i915) { +intel_pxp_destroy_r0ctx (i915); }/**
drivers/gpu/drm/i915/pxp/intel_pxp.h +3 -0
@@ -12,6 +12,9 @@#define PXP_IRQ_VECTOR_DISPLAY_APP_TERM_PER_FW_REQ BIT(2)#define PXP_IRQ_VECTOR_PXP_DISP_STATE_RESET_COMPLETE BIT(3) +#define MAX_TYPE0_SESSIONS 16 +#define MAX_TYPE1_SESSIONS 6 +enum pxp_sm_session_req {/* Request KMD to allocate session id and move it to IN INIT */ PXP_SM_REQ_SESSION_ID_INIT =0x0 ,
drivers/gpu/drm/i915/pxp/intel_pxp_context.c new file +51 -0
51 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_context.h new file +44 -0
44 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
PATCH 4/27 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/Makefile | 1 + drivers/gpu/drm/i915/pxp/intel_pxp.c | 11 ++++++- drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 44 +++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 20 +++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_sm.c create mode 100644 drivers/gpu/drm/i915/pxp/intel_pxp_sm.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -258,6 +258,7 @@ i915-y += i915_perf.o i915-y += \ pxp/intel_pxp.o \ pxp/intel_pxp_context.o \ + pxp/intel_pxp_sm.o # Post-mortem debug and GPU hang state capture i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o
drivers/gpu/drm/i915/pxp/intel_pxp.c +10 -1
@@ -6,6 +6,7 @@#include "i915_drv.h" #include "intel_pxp.h" #include "intel_pxp_context.h" +#include "intel_pxp_sm.h" static void intel_pxp_write_irq_mask_reg (struct drm_i915_private *i915,u32 mask) {
@@ -87,6 +88,8 @@ static void intel_pxp_irq_work(struct work_struct *work)int intel_pxp_init (struct drm_i915_private *i915) { +int ret; +drm_info (&i915->drm,"i915_pxp_init\n" ); i915->pxp.r0ctx =intel_pxp_create_r0ctx (i915);
@@ -95,13 +98,19 @@ int intel_pxp_init(struct drm_i915_private *i915)return -EFAULT ; } + ret =pxp_sm_set_kcr_init_reg (i915); +if (ret) { +drm_dbg (&i915->drm,"Failed to set kcr init reg\n" ); +return ret; + } +INIT_WORK (&i915->pxp.irq_work, intel_pxp_irq_work); i915->pxp.handled_irr = (PXP_IRQ_VECTOR_DISPLAY_PXP_STATE_TERMINATED |PXP_IRQ_VECTOR_DISPLAY_APP_TERM_PER_FW_REQ |PXP_IRQ_VECTOR_PXP_DISP_STATE_RESET_COMPLETE ); -return 0 ; +return ret; }void intel_pxp_uninit (struct drm_i915_private *i915)
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c new file +44 -0
44 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h new file +20 -0
@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020, Intel Corporation. All rights reserved. +*/ + +#ifndef __INTEL_PXP_SM_H__ +#define __INTEL_PXP_SM_H__ + +#include "i915_drv.h" +#include "i915_reg.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)) + +int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915); + +#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
PATCH 5/27 drm/i915/pxp: Enable ioctl action to set the ring3 context
In reply to Huang, Sean ZEnable one ioctl action to allow ring3 driver to set its ring3 context, so ring0 PXP can track the context id through this ring3 context list.
--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/pxp/intel_pxp.c | 59 ++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 16 ++++++ drivers/gpu/drm/i915/pxp/intel_pxp_context.c | 34 +++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_context.h | 3 + include/uapi/drm/i915_drm.h | 2 + 6 files changed, 115 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -1761,6 +1761,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {DRM_IOCTL_DEF_DRV (I915_QUERY , i915_query_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_VM_CREATE , i915_gem_vm_create_ioctl,DRM_RENDER_ALLOW ),DRM_IOCTL_DEF_DRV (I915_GEM_VM_DESTROY , i915_gem_vm_destroy_ioctl,DRM_RENDER_ALLOW ), + DRM_IOCTL_DEF_DRV(I915_PXP_OPS, i915_pxp_ops_ioctl, DRM_RENDER_ALLOW), }; static const struct drm_driver driver = {
drivers/gpu/drm/i915/pxp/intel_pxp.c +59 -0
71 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp.h +16 -0
@@ -24,6 +24,21 @@ enum pxp_sm_session_req {PXP_SM_REQ_SESSION_TERMINATE }; +#define PXP_ACTION_SET_R3_CONTEXT 5 + +enum pxp_sm_status { +PXP_SM_STATUS_SUCCESS , +PXP_SM_STATUS_RETRY_REQUIRED , +PXP_SM_STATUS_SESSION_NOT_AVAILABLE , +PXP_SM_STATUS_ERROR_UNKNOWN +}; + +struct pxp_info { +u32 action; +u32 sm_status; +u32 set_r3ctx; +} __packed; +struct pxp_context ;struct intel_pxp {
@@ -37,6 +52,7 @@ struct intel_pxp {struct intel_gt ;struct drm_i915_private ; +int i915_pxp_ops_ioctl (struct drm_device *dev,void *data,struct drm_file *drmfile);void intel_pxp_irq_handler (struct intel_gt *gt,u16 iir);int i915_pxp_teardown_required_callback (struct drm_i915_private *i915);int i915_pxp_global_terminate_complete_callback (struct drm_i915_private *i915);
drivers/gpu/drm/i915/pxp/intel_pxp_context.c +34 -0
@@ -49,3 +49,37 @@ void intel_pxp_destroy_r0ctx(struct drm_i915_private *i915)kfree (i915->pxp.r0ctx); i915->pxp.r0ctx =NULL ; } + +int intel_pxp_set_r3ctx (struct drm_i915_private *i915,u32 r3ctx_in) +{ +struct pxp_r3ctx *r3ctx; + +drm_dbg (&i915->drm,">>> %s u3ctx_in=[%d]\n" , __func__, r3ctx_in); + + r3ctx =kzalloc (sizeof (*r3ctx),GFP_KERNEL ); +if (!r3ctx) { +drm_dbg (&i915->drm,"Failed to kzalloc()\n" ); +return -ENOMEM ; + } + + r3ctx->r3ctx = r3ctx_in; + +list_add (&r3ctx->listhead, &i915->pxp.r0ctx->r3ctx_list); +return 0 ; +} + +void intel_pxp_destroy_r3ctx_list (struct drm_i915_private *i915) +{ +struct pxp_r3ctx *r3ctx, *n; + +drm_dbg (&i915->drm,">>> %s\n" , __func__); + +list_for_each_entry_safe (r3ctx, n, &i915->pxp.r0ctx->r3ctx_list, listhead) { +drm_dbg (&i915->drm,"Destroy r3ctx_list u3ctx->r3ctx=[%d]\n" , r3ctx->r3ctx); + +list_del (&r3ctx->listhead); +kfree (r3ctx); + } + +drm_dbg (&i915->drm,"<<< %s\n" , __func__); +}
drivers/gpu/drm/i915/pxp/intel_pxp_context.h +3 -0
@@ -41,4 +41,7 @@ struct pxp_r3ctx {struct pxp_context *intel_pxp_create_r0ctx (struct drm_i915_private *i915);void intel_pxp_destroy_r0ctx (struct drm_i915_private *i915); +int intel_pxp_set_r3ctx (struct drm_i915_private *i915,u32 r3ctx); +void intel_pxp_destroy_r3ctx_list (struct drm_i915_private *i915); +#endif /* __INTEL_PXP_CONTEXT_H__ */
include/uapi/drm/i915_drm.h +2 -0
@@ -359,6 +359,7 @@ typedef struct _drm_i915_sarea {#define DRM_I915_QUERY 0x39#define DRM_I915_GEM_VM_CREATE 0x3a#define DRM_I915_GEM_VM_DESTROY 0x3b +#define DRM_I915_PXP_OPS 0x3c/* Must be kept compact -- no holes */ #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
@@ -422,6 +423,7 @@ typedef struct _drm_i915_sarea {#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)#define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)#define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control) +#define DRM_IOCTL_I915_PXP_OPS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_PXP_OPS, struct drm_i915_pxp_ops)/* Allow drivers to submit batchbuffers directly to hardware, relying * on the security mechanisms provided by hardware.
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 05/27] drm/i915/pxp: Enable ioctl action to set the ring3 context
Quoting Huang, Sean Z (2020-11-15 23:07:53)
Quoted 3 lines
Enable one ioctl action to allow ring3 driver to set its ring3 context, so ring0 PXP can track the context id through this ring3 context list.
Overall the patches should refer to "userspace" not "ring3" to avoid confusion. "kernel" vs "user" not ring0 vs ring3.
Quoted 1 line
Signed-off-by Huang, Sean Z <[email protected]>
<SNIP>
Quoted 4 lines
+++
b/drivers/gpu/drm/i915/pxp/intel_pxp.cdrivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0@@ -8,6 +8,63 @@#include "intel_pxp_context.h" #include "intel_pxp_sm.h"
drivers/gpu/drm/i915/pxp/intel_pxp.c line 19
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +9
-0+int i915_pxp_ops_ioctl (struct drm_device *dev,void *data,struct drm_file *drmfile) +{ +int ret; +struct pxp_info pxp_info = {0 }; +struct drm_i915_pxp_ops *pxp_ops = data; +struct drm_i915_private *i915 =to_i915 (dev); + +if (!i915 || !drmfile || !pxp_ops || pxp_ops->pxp_info_size !=sizeof (pxp_info)) +return -EINVAL ;
See below.
Quoted 9 lines
drivers/gpu/drm/i915/pxp/intel_pxp.h +5
-0+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.h@@ -24,6 +24,21 @@ enum pxp_sm_session_req {PXP_SM_REQ_SESSION_TERMINATE }; +#define PXP_ACTION_SET_R3_CONTEXT 5 + +enum pxp_sm_status { +PXP_SM_STATUS_SUCCESS ,
drivers/gpu/drm/i915/pxp/intel_pxp.h enum pxp_sm_session_req { · line 40
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.h +10
-0+PXP_SM_STATUS_RETRY_REQUIRED , +PXP_SM_STATUS_SESSION_NOT_AVAILABLE , + PXP_SM_STATUS_ERROR_UNKNOWN +}; + +struct pxp_info { +u32 action; +u32 sm_status; +u32 set_r3ctx; +} __packed;
These are part of the the uAPI, so it should all be in i915_drm.h. No need to use pointers as that just adds extra layer of indirection. Every added bit needs a link to an Open Source userspace implementation and IGT tests.
After applying the IOCTL-per-action model there needs to be strict rejection of any unrecognized bits in the structs to ensure userspace does not grow to depend on being able to set bits which may be re-purposed in the future.
R3_CONTEXT / set_r3ctx should be using the "user" vs "kernel" naming, and once they are moved into the userspace API header, "user" becomes a tautology.
All the fields added to uAPI need documentation, too.
Quoted 10 lines
include/uapi/drm/i915_drm.h +2
-0+++ b/include/uapi/drm/i915_drm.h@@ -359,6 +359,7 @@ typedef struct _drm_i915_sarea {#define DRM_I915_QUERY 0x39#define DRM_I915_GEM_VM_CREATE 0x3a#define DRM_I915_GEM_VM_DESTROY 0x3b +#define DRM_I915_PXP_OPS 0x3c/* Must be kept compact -- no holes */ #define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
include/uapi/drm/i915_drm.h typedef struct _drm_i915_sarea { · line 426
Quoted 4 lines
include/uapi/drm/i915_drm.h +1
-0@@ -422,6 +423,7 @@ typedef struct _drm_i915_sarea {#define DRM_IOCTL_I915_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_QUERY, struct drm_i915_query)#define DRM_IOCTL_I915_GEM_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_VM_CREATE, struct drm_i915_gem_vm_control)#define DRM_IOCTL_I915_GEM_VM_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_VM_DESTROY, struct drm_i915_gem_vm_control) +#define DRM_IOCTL_I915_PXP_OPS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_PXP_OPS, struct drm_i915_pxp_ops)
Just to repeat: This should only be added in the last patches of the series not to break bisecting. The different actions need to be spelled out, a general purpose IOCTL can't be used.
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/27] drm/i915/pxp: Enable ioctl action to set the ring3 context
Quoting Joonas Lahtinen (2020-11-16 10:22:23)
Quoted 7 lines
Quoting Huang, Sean Z (2020-11-15 23:07:53)
Quoted 3 lines
Enable one ioctl action to allow ring3 driver to set its ring3 context, so ring0 PXP can track the context id through this ring3 context list.
Overall the patches should refer to "userspace" not "ring3" to avoid confusion. "kernel" vs "user" not ring0 vs ring3.
There's also a missing chunk as to why this is not associated with the existing user context, rather than introducing a new incomplete encapsulation.
Overall, you've left in an awful lot of debug code and failed to follow the coding style. A confusion as to whether your hw interactions is on the GT or the whole device (it's GT).
Wrt the flow of the patches, robust setup and termination must be early in the series, not tacked onto the end.
And you seem to confuse the kernel contexts as something special, you use them as non-privileged, just like ordinary userspace. Do not use the engine->kernel_context! You risk breaking (and judging from the waits you do add, it is inevitable that you have broken) power management and heartbeats.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/27 drm/i915: Rename the whitelist to allowlist
In reply to Huang, Sean ZRename the whitelist to allowlist as suggested
--- drivers/gpu/drm/i915/intel_uncore.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +5 -5
@@ -1989,12 +1989,12 @@ void intel_uncore_fini_mmio(struct intel_uncore *uncore)uncore_mmio_cleanup (uncore); } -static const struct reg_whitelist { +static const struct reg_allowlist {i915_reg_t offset_ldw;i915_reg_t offset_udw;u16 gen_mask;u8 size; -} reg_read_whitelist[] = { { +} reg_read_allowlist[] = { { .offset_ldw =RING_TIMESTAMP (RENDER_RING_BASE ), .offset_udw =RING_TIMESTAMP_UDW (RENDER_RING_BASE ), .gen_mask =INTEL_GEN_MASK (4 ,12 ),
@@ -2007,14 +2007,14 @@ int i915_reg_read_ioctl(struct drm_device *dev,struct drm_i915_private *i915 =to_i915 (dev);struct intel_uncore *uncore = &i915->uncore;struct drm_i915_reg_read *reg = data; -struct reg_whitelist const *entry; +struct reg_allowlist const *entry;intel_wakeref_t wakeref;unsigned int flags;int remain;int ret =0 ; - entry = reg_read_whitelist; - remain =ARRAY_SIZE (reg_read_whitelist); + entry = reg_read_allowlist; + remain =ARRAY_SIZE (reg_read_allowlist);while (remain) {u32 entry_offset =i915_mmio_reg_offset (entry->offset_ldw);
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 06/27] drm/i915: Rename the whitelist to allowlist
Quoting Huang, Sean Z (2020-11-15 23:07:54)
Quoted 1 line
Rename the whitelist to allowlist as suggested
This patch should really be a separate series and most likely needs to be done in one go to avoid confusion.
$ git grep -E '(whitelist|blacklist)' | wc -l 173
The next patch also uses "passlist" terminology, highlighting the need to reach an agreement about which term to use.
Regards, Joonas
Quoted 49 lines
Signed-off-by Huang, Sean Z <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/intel_uncore.c +5
-5@@ -1989,12 +1989,12 @@ void intel_uncore_fini_mmio(struct intel_uncore *uncore)uncore_mmio_cleanup (uncore); } -static const struct reg_whitelist { +static const struct reg_allowlist {i915_reg_t offset_ldw;i915_reg_t offset_udw;u16 gen_mask;u8 size; -} reg_read_whitelist[] = { { +} reg_read_allowlist[] = { { .offset_ldw =RING_TIMESTAMP (RENDER_RING_BASE ), .offset_udw =RING_TIMESTAMP_UDW (RENDER_RING_BASE ), .gen_mask =INTEL_GEN_MASK (4 ,12 ),@@ -2007,14 +2007,14 @@ int i915_reg_read_ioctl(struct drm_device *dev,struct drm_i915_private *i915 =to_i915 (dev);struct intel_uncore *uncore = &i915->uncore;struct drm_i915_reg_read *reg = data; -struct reg_whitelist const *entry; +struct reg_allowlist const *entry;intel_wakeref_t wakeref;unsigned int flags;int remain;int ret =0 ; - entry = reg_read_whitelist; - remain =ARRAY_SIZE (reg_read_whitelist); + entry = reg_read_allowlist; + remain =ARRAY_SIZE (reg_read_allowlist);while (remain) {u32 entry_offset =i915_mmio_reg_offset (entry->offset_ldw);Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 06/27] drm/i915: Rename the whitelist to allowlist
Quoting Joonas Lahtinen (2020-11-16 10:26:31)
Quoted 11 lines
Quoting Huang, Sean Z (2020-11-15 23:07:54)
Quoted 1 line
Rename the whitelist to allowlist as suggested
This patch should really be a separate series and most likely needs to be done in one go to avoid confusion.
$ git grep -E '(whitelist|blacklist)' | wc -l 173The next patch also uses "passlist" terminology, highlighting the need to reach an agreement about which term to use.
(allow|deny)list is the trend.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/27 drm/i915/pxp: Add PXP-related registers into allowlist
In reply to Huang, Sean ZAdd several PXP-related reg into allowlist to allow ring3 driver to read the those register values.
--- drivers/gpu/drm/i915/i915_reg.h | 8 ++++ drivers/gpu/drm/i915/intel_uncore.c | 57 +++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +8 -0
@@ -12419,4 +12419,12 @@ enum skl_power_gate {#define TGL_ROOT_DEVICE_SKU_ULX 0x2#define TGL_ROOT_DEVICE_SKU_ULT 0x4 +/* Registers for passlist check */ +#define PXP_REG_01_LOWERBOUND _MMIO(0x32260) +#define PXP_REG_01_UPPERBOUND _MMIO(0x32268) +#define PXP_REG_02_LOWERBOUND _MMIO(0x32670) +#define PXP_REG_02_UPPERBOUND _MMIO(0x32678) +#define PXP_REG_03_LOWERBOUND _MMIO(0x32860) +#define PXP_REG_03_UPPERBOUND _MMIO(0x32c7c) +#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_uncore.c +42 -15
99 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
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 07/27] drm/i915/pxp: Add PXP-related registers into allowlist
Quoting Huang, Sean Z (2020-11-15 23:07:55)
Quoted 2 lines
Add several PXP-related reg into allowlist to allow ring3 driver to read the those register values.
The individual registers need to be spelled out and their usage on the UMD side needs to be documented.
There needs to be a link to the Open Source userspace which requires these registers.
Quoted 1 line
Signed-off-by Huang, Sean Z <[email protected]>
<SNIP>
drivers/gpu/drm/i915/i915_reg.h enum skl_power_gate { · line 12428
Quoted 12 lines
+++
b/drivers/gpu/drm/i915/i915_reg.hdrivers/gpu/drm/i915/i915_reg.h +7
-0@@ -12419,4 +12419,12 @@ enum skl_power_gate {#define TGL_ROOT_DEVICE_SKU_ULX 0x2#define TGL_ROOT_DEVICE_SKU_ULT 0x4 +/* Registers for passlist check */ +#define PXP_REG_01_LOWERBOUND _MMIO(0x32260) +#define PXP_REG_01_UPPERBOUND _MMIO(0x32268) +#define PXP_REG_02_LOWERBOUND _MMIO(0x32670) +#define PXP_REG_02_UPPERBOUND _MMIO(0x32678) +#define PXP_REG_03_LOWERBOUND _MMIO(0x32860) +#define PXP_REG_03_UPPERBOUND _MMIO(0x32c7c)
This is not any more informative than embedding magical values in the code.
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 07/27] drm/i915/pxp: Add PXP-related registers into allowlist
Quoting Joonas Lahtinen (2020-11-16 10:33:07)
Quoted 6 lines
Quoting Huang, Sean Z (2020-11-15 23:07:55)
Quoted 2 lines
Add several PXP-related reg into allowlist to allow ring3 driver to read the those register values.
The individual registers need to be spelled out and their usage on the UMD side needs to be documented.
It's a huge block of registers that we need to manually verify for mistakes. It also does not bode well for the userspace design as probing so many through a single ioctl is going to be ratelimiting, nor why do they need to check a entire kilobyte register file. Hence why the userspace portion is essential to justify this as being the preferred design.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/27 drm/i915/pxp: Read register to check hardware session state
In reply to Huang, Sean ZImplement the functions to check the hardware protected session state via reading the hardware register session in play.
--- drivers/gpu/drm/i915/pxp/intel_pxp.h | 3 + drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 176 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 51 +++++++ 3 files changed, 230 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.h +3 -0
@@ -12,6 +12,9 @@#define PXP_IRQ_VECTOR_DISPLAY_APP_TERM_PER_FW_REQ BIT(2)#define PXP_IRQ_VECTOR_PXP_DISP_STATE_RESET_COMPLETE BIT(3) +#define pxp_session_list (i915, session_type) (((session_type) == SESSION_TYPE_TYPE0) ? \ + &(i915)->pxp.r0ctx->active_pxp_type0_sessions : &(i915)->pxp.r0ctx->active_pxp_type1_sessions) +#define MAX_TYPE0_SESSIONS 16#define MAX_TYPE1_SESSIONS 6
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +176 -0
188 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +51 -0
57 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
PATCH 9/27 drm/i915/pxp: Implement funcs to get/set PXP tag
In reply to Huang, Sean ZImplement the functions to get/set the PXP tag, which is 32-bit bitwise value containing the hardware session info, such as its session id, protection mode or whether it's enabled.
--- drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 105 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 18 ++++ 2 files changed, 123 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +105 -0
@@ -41,6 +41,16 @@ static int pxp_reg_write(struct drm_i915_private *i915, u32 offset, u32 regval)return 0 ; } +static u8 pxp_get_session_id (int session_index,int session_type) +{ +u8 session_id = session_index &SESSION_ID_MASK ; + +if (session_type ==SESSION_TYPE_TYPE1 ) + session_id |=SESSION_TYPE_MASK ; + +return session_id; +} +/** * is_sw_session_active - Check if the given sw session id is active. * @i915: i915 device handle.
@@ -78,6 +88,101 @@ static bool is_sw_session_active(struct drm_i915_private *i915, int session_typereturn false; } +static int pxp_set_pxp_tag (struct drm_i915_private *i915,int session_type, +int session_idx,int protection_mode) +{ +struct pxp_tag *pxp_tag; +int ret; + +if (!i915 || session_type >=SESSION_TYPE_MAX ) { + ret = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s, bad params\n" , __func__); + goto end; + } + +if (session_type ==SESSION_TYPE_TYPE0 && session_idx <MAX_TYPE0_SESSIONS ) { + pxp_tag = (struct pxp_tag *)&i915->pxp.r0ctx->type0_session_pxp_tag[session_idx]; + }else if (session_type ==SESSION_TYPE_TYPE1 && session_idx <MAX_TYPE1_SESSIONS ) { + pxp_tag = (struct pxp_tag *)&i915->pxp.r0ctx->type1_session_pxp_tag[session_idx]; + }else { + ret = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s, bad params session_type=[%d], session_idx=[%d]\n" , + __func__, session_type, session_idx); + goto end; + } + +switch (protection_mode) { +case PROTECTION_MODE_NONE : + { + pxp_tag->enable = false; + pxp_tag->hm = false; + pxp_tag->sm = false; +break ; + } +case PROTECTION_MODE_LM : + { + pxp_tag->enable = true; + pxp_tag->hm = false; + pxp_tag->sm = false; + pxp_tag->instance_id++; +break ; + } +case PROTECTION_MODE_HM : + { + pxp_tag->enable = true; + pxp_tag->hm = true; + pxp_tag->sm = false; + pxp_tag->instance_id++; +break ; + } +case PROTECTION_MODE_SM : + { + pxp_tag->enable = true; + pxp_tag->hm = true; + pxp_tag->sm = true; + pxp_tag->instance_id++; +break ; + } +default : + ret = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s, bad params protection_mode=[%d]\n" , + __func__, protection_mode); + goto end; + } + + pxp_tag->session_id =pxp_get_session_id (session_idx, session_type); + + ret =0 ; +end: +return ret; +} + +u32 intel_pxp_get_pxp_tag (struct drm_i915_private *i915,int session_idx, +int session_type,u32 *session_is_alive) +{ +struct pxp_tag *pxp_tag; + +if (!i915 || session_type >=SESSION_TYPE_MAX ) { +drm_dbg (&i915->drm,"Failed to %s, bad params\n" , __func__); +return -EINVAL ; + } + +if (session_type ==SESSION_TYPE_TYPE0 && session_idx <MAX_TYPE0_SESSIONS ) { + pxp_tag = (struct pxp_tag *)&i915->pxp.r0ctx->type0_session_pxp_tag[session_idx]; + }else if (session_type ==SESSION_TYPE_TYPE1 && session_idx <MAX_TYPE1_SESSIONS ) { + pxp_tag = (struct pxp_tag *)&i915->pxp.r0ctx->type1_session_pxp_tag[session_idx]; + }else { +drm_dbg (&i915->drm,"Failed to %s, bad params session_type=[%d], session_idx=[%d]\n" , + __func__, session_type, session_idx); +return -EINVAL ; + } + +if (session_is_alive) + *session_is_alive = pxp_tag->enable; + +return pxp_tag->value; +} +static bool is_hw_type0_session_in_play (struct drm_i915_private *i915,int session_index) {u32 regval_sip =0 ;
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +18 -0
@@ -20,6 +20,9 @@#define GEN12_KCR_TSIP_LOW _MMIO(0x32264)/* KCR type1 session in play 0-31 */ #define GEN12_KCR_TSIP_HIGH _MMIO(0x32268)/* KCR type1 session in play 32-63 */ +#define SESSION_TYPE_MASK BIT(7) +#define SESSION_ID_MASK (BIT(7) - 1) +enum pxp_session_types {SESSION_TYPE_TYPE0 =0 ,SESSION_TYPE_TYPE1 =1 ,
@@ -36,6 +39,21 @@ enum pxp_protection_modes { PROTECTION_MODE_ALL }; +struct pxp_tag { +union { +u32 value; +struct { +u32 session_id :8 ; +u32 instance_id :8 ; +u32 enable :1 ; +u32 hm :1 ; +u32 reserved_1 :1 ; +u32 sm :1 ; +u32 reserved_2 :12 ; + }; + }; +}; +/** * struct pxp_protected_session - linked list to track all active sessions. */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/27 drm/i915/pxp: Enable ioctl action to reserve session slot
In reply to Huang, Sean ZWith this ioctl action, ring3 driver can reserve a specific session slot/id assigned by ring0 PXP, as the first step of PXP session establishment flow. Ring3 PXP stores the session info in the session list structure.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 20 +++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 24 +++- drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 168 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 3 + 4 files changed, 213 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/pxp/intel_pxp.c +20 -0
@@ -40,6 +40,26 @@ int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmf }switch (pxp_info.action) { +case PXP_ACTION_SET_SESSION_STATUS : + { +struct pxp_sm_set_session_status_params *params = &pxp_info.set_session_status; + +if (params->req_session_state ==PXP_SM_REQ_SESSION_ID_INIT ) { + ret =intel_pxp_sm_reserve_session (i915, drmfile,0 , + params->session_type, + params->session_mode, + ¶ms->pxp_tag); +if (ret ==PXP_SM_STATUS_RETRY_REQUIRED || + ret ==PXP_SM_STATUS_SESSION_NOT_AVAILABLE ) { + pxp_info.sm_status = ret; + ret =0 ; + } + }else { + ret = -EINVAL ; + goto end; + } +break ; + }case PXP_ACTION_SET_R3_CONTEXT : { ret =intel_pxp_set_r3ctx (i915, pxp_info.set_r3ctx);
drivers/gpu/drm/i915/pxp/intel_pxp.h +22 -2
@@ -15,6 +15,9 @@#define pxp_session_list (i915, session_type) (((session_type) == SESSION_TYPE_TYPE0) ? \ &(i915)->pxp.r0ctx->active_pxp_type0_sessions : &(i915)->pxp.r0ctx->active_pxp_type1_sessions) +#define pxp_session_max (session_type) (((session_type) == SESSION_TYPE_TYPE0) ? \ + MAX_TYPE0_SESSIONS : MAX_TYPE1_SESSIONS) +#define MAX_TYPE0_SESSIONS 16#define MAX_TYPE1_SESSIONS 6
@@ -27,7 +30,10 @@ enum pxp_sm_session_req {PXP_SM_REQ_SESSION_TERMINATE }; -#define PXP_ACTION_SET_R3_CONTEXT 5 +enum pxp_ioctl_action { +PXP_ACTION_SET_SESSION_STATUS =1 , +PXP_ACTION_SET_R3_CONTEXT =5 , +};enum pxp_sm_status {PXP_SM_STATUS_SUCCESS ,
@@ -36,10 +42,24 @@ enum pxp_sm_status { PXP_SM_STATUS_ERROR_UNKNOWN }; +struct pxp_sm_set_session_status_params { +/** @pxp_tag: in [optional], for Arbitrator session, out pxp tag */ +u32 pxp_tag; +/** @session_type: in, session type */ +u32 session_type; +/** @session_mode: in, session mode */ +u32 session_mode; +/** @req_session_state: in, new session state */ +u32 req_session_state; +}; +struct pxp_info {u32 action;u32 sm_status; -u32 set_r3ctx; +union { +struct pxp_sm_set_session_status_params set_session_status; +u32 set_r3ctx; + }; } __packed;struct pxp_context ;
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +168 -0
174 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +3 -0
@@ -84,6 +84,9 @@ struct pxp_protected_session { bool session_is_in_play; }; +int intel_pxp_sm_reserve_session (struct drm_i915_private *i915,struct drm_file *drmfile, +int context_id,int session_type,int protection_mode, +u32 *pxp_tag);int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915);#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
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 10/27] drm/i915/pxp: Enable ioctl action to reserve session slot
Quoting Huang, Sean Z (2020-11-15 23:07:58)
Quoted 4 lines
With this ioctl action, ring3 driver can reserve a specific session slot/id assigned by ring0 PXP, as the first step of PXP session establishment flow. Ring3 PXP stores the session info in the session list structure.
The whole suggested userspace<->kernel API surface should be strictly moved into i915_drm.h to make review easier. Now it's hard to tell apart the suggested uAPI from the implementation.
Once the separation is in place, I'll be able to provide more review comments on the rest of the patches.
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/27 drm/i915/pxp: Enable ioctl action to set session in play
In reply to Huang, Sean ZWith this ioctl action, ring3 driver can set the session in state "session in play", after ring3 reserved the session slot/id from ring3 PXP, and sent the TEE commands to activate the corresponding hardware session. Session state "session in play" means this session is ready for secure playback.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 4 ++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 92 +++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 2 + 3 files changed, 98 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.c +4 -0
@@ -54,6 +54,10 @@ int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmf pxp_info.sm_status = ret; ret =0 ; } + }else if (params->req_session_state ==PXP_SM_REQ_SESSION_IN_PLAY ) { + ret =pxp_sm_mark_protected_session_in_play (i915, params->session_type, + params->pxp_tag); + }else { ret = -EINVAL ; goto end;
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +92 -0
104 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +2 -0
@@ -87,6 +87,8 @@ struct pxp_protected_session {int intel_pxp_sm_reserve_session (struct drm_i915_private *i915,struct drm_file *drmfile,int context_id,int session_type,int protection_mode,u32 *pxp_tag); +int pxp_sm_mark_protected_session_in_play (struct drm_i915_private *i915,int session_type, +u32 session_id);int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915);#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
PATCH 12/27 drm/i915/pxp: Func to send hardware session termination
In reply to Huang, Sean ZImplement the functions to allow ring0 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/pxp/intel_pxp_sm.c | 309 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 16 ++ 2 files changed, 325 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +309 -0
@@ -3,13 +3,175 @@* Copyright(c) 2020, Intel Corporation. All rights reserved. */ +#include "gt/intel_gpu_commands.h" +#include "gt/intel_gt.h" #include "gt/intel_context.h" +#include "gt/intel_gt_buffer_pool.h" #include "gt/intel_engine_pm.h" #include "intel_pxp.h" #include "intel_pxp_sm.h" #include "intel_pxp_context.h" +static struct i915_vma *pxp_get_batch (struct drm_i915_private *i915, +struct intel_context *ce, +struct intel_gt_buffer_pool_node *pool, +u32 *cmd_buf,int cmd_size_in_dw) +{ +struct i915_vma *batch =ERR_PTR (-EINVAL ); +u32 *cmd; + +drm_dbg (&i915->drm,">>> %s cmd_buf=[%p] cmd_size_in_dw=[%d]\n" , __func__, cmd_buf, cmd_size_in_dw); + +if (!ce || !ce->engine || !cmd_buf) { +drm_dbg (&i915->drm,"Failed to %s due to nullptr\n" , __func__); + goto end; + } + +if (cmd_size_in_dw *4 >PAGE_SIZE ) { +drm_dbg (&i915->drm,"Failed to %s, invalid cmd_size_id_dw=[%d]\n" , + __func__, cmd_size_in_dw); + goto end; + } + + cmd =i915_gem_object_pin_map (pool->obj,I915_MAP_FORCE_WC ); +if (IS_ERR (cmd)) { +drm_dbg (&i915->drm,"Failed to i915_gem_object_pin_map()\n " ); + goto end; + } + +memcpy (cmd, cmd_buf, cmd_size_in_dw *4 ); + +if (drm_debug_enabled (DRM_UT_DRIVER )) { +print_hex_dump (KERN_DEBUG ,"cmd binaries:" , +DUMP_PREFIX_OFFSET ,4 ,4 , cmd, cmd_size_in_dw *4 , true); + } + +i915_gem_object_unpin_map (pool->obj); + + batch =i915_vma_instance (pool->obj, ce->vm,NULL ); +if (IS_ERR (batch)) { +drm_dbg (&i915->drm,"Failed to i915_vma_instance()\n " ); + goto end; + } + +end: +drm_dbg (&i915->drm,"<<< %s: batch=[%p]\n" , __func__, batch); +return batch; +} + +static int pxp_submit_cmd (struct drm_i915_private *i915,u32 *cmd,int cmd_size_in_dw) +{ +int err = -EINVAL ; +struct i915_vma *batch; +struct i915_request *rq; +struct intel_context *ce =NULL ; +bool is_engine_pm_get = false; +bool is_batch_vma_pin = false; +bool is_skip_req_on_err = false; +bool is_engine_get_pool = false; +struct intel_gt_buffer_pool_node *pool =NULL ; +struct intel_gt *gt =NULL ; + +drm_dbg (&i915->drm,">>> %s: cmd=[%p] cmd_size_in_dw=[%d]\n" , + __func__, cmd, cmd_size_in_dw); + +if (!i915 || !HAS_ENGINE (&i915->gt,VCS0 ) || + !i915->gt.engine[VCS0 ]->kernel_context) { + err = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s bad params\n" , __func__); + goto end; + } + +if (!cmd || (cmd_size_in_dw *4 ) >PAGE_SIZE ) { + err = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s bad params\n" , __func__); + goto end; + } + + gt = &i915->gt; + ce = i915->gt.engine[VCS0 ]->kernel_context; + +intel_engine_pm_get (ce->engine); + is_engine_pm_get = true; + + pool =intel_gt_get_buffer_pool (gt,PAGE_SIZE ); +if (IS_ERR (pool)) { +drm_dbg (&i915->drm,"Failed to intel_engine_get_pool()\n" ); + goto end; + } + is_engine_get_pool = true; + + batch =pxp_get_batch (i915, ce, pool, cmd, cmd_size_in_dw); +if (IS_ERR (batch)) { +drm_dbg (&i915->drm,"Failed to pxp_get_batch()\n" ); + goto end; + } + + err =i915_vma_pin (batch,0 ,0 ,PIN_USER ); +if (err) { +drm_dbg (&i915->drm,"Failed to i915_vma_pin()\n" ); + goto end; + } + is_batch_vma_pin = true; + + rq =intel_context_create_request (ce); +if (IS_ERR (rq)) { +drm_dbg (&i915->drm,"Failed to intel_context_create_request()\n" ); + goto end; + } + is_skip_req_on_err = true; + + err =intel_gt_buffer_pool_mark_active (pool, rq); +if (err) { +drm_dbg (&i915->drm,"Failed to intel_engine_pool_mark_active()\n" ); + goto end; + } + +i915_vma_lock (batch); + err =i915_request_await_object (rq, batch->obj, false); +if (!err) + err =i915_vma_move_to_active (batch, rq,0 ); +i915_vma_unlock (batch); +if (err) { +drm_dbg (&i915->drm,"Failed to i915_request_await_object()\n" ); + goto end; + } + +if (ce->engine->emit_init_breadcrumb) { + err = ce->engine->emit_init_breadcrumb (rq); +if (err) { +drm_dbg (&i915->drm,"Failed to emit_init_breadcrumb()\n" ); + goto end; + } + } + + err = ce->engine->emit_bb_start (rq, batch->node.start, + batch->node.size,0 ); +if (err) { +drm_dbg (&i915->drm,"Failed to emit_bb_start()\n" ); + goto end; + } + +i915_request_add (rq); + +end: +if (unlikely (err) && is_skip_req_on_err) +i915_request_set_error_once (rq, err); + +if (is_batch_vma_pin) +i915_vma_unpin (batch); + +if (is_engine_get_pool) +intel_gt_buffer_pool_put (pool); + +if (is_engine_pm_get) +intel_engine_pm_put (ce->engine); + +drm_dbg (&i915->drm,"<<< %s: err=[%d]\n" , __func__, err); +return err; +} +static int pxp_sm_reg_read (struct drm_i915_private *i915,u32 offset,u32 *regval) {intel_wakeref_t wakeref;
@@ -567,6 +729,153 @@ int pxp_sm_mark_protected_session_in_play(struct drm_i915_private *i915, int sesreturn ret; } +static int add_pxp_prolog (struct drm_i915_private *i915,u32 *cmd,int session_type,int session_index) +{ +u32 increased_size_in_dw =0 ; +u32 *cmd_prolog = cmd; +const int cmd_prolog_size_in_dw =10 ; + +if (!cmd) +return cmd_prolog_size_in_dw; + +/* MFX_WAIT - stall until prior PXP and MFX/HCP/HUC objects are cmopleted */ + *cmd_prolog++ = (MFX_WAIT |MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG |MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG ); + +/* MI_FLUSH_DW - pxp off */ + *cmd_prolog++ =MI_FLUSH_DW ;/* DW0 */ + *cmd_prolog++ =0 ;/* DW1 */ + *cmd_prolog++ =0 ;/* DW2 */ + +/* MI_SET_APPID */ +if (session_type ==SESSION_TYPE_TYPE1 ) { +if (session_index >=MAX_TYPE1_SESSIONS ) { +drm_dbg (&i915->drm,"Failed to %s invalid session_index\n" , __func__); + goto end; + } + + *cmd_prolog++ = (MI_SET_APPID |MI_SET_APPID_TYPE1_APP |MI_SET_APPID_SESSION_ID (session_index)); + }else { +if (session_index >=MAX_TYPE0_SESSIONS ) { +drm_dbg (&i915->drm,"Failed to %s invalid session_index\n" , __func__); + goto end; + } + + *cmd_prolog++ = (MI_SET_APPID |MI_SET_APPID_SESSION_ID (session_index)); + } + +/* MFX_WAIT */ + *cmd_prolog++ = (MFX_WAIT |MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG |MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG ); + +/* MI_FLUSH_DW - pxp on */ + *cmd_prolog++ = (MI_FLUSH_DW |MI_FLUSH_DW_DW0_PROTECTED_MEMORY_ENABLE );/* DW0 */ + *cmd_prolog++ =0 ;/* DW1 */ + *cmd_prolog++ =0 ;/* DW2 */ + +/* MFX_WAIT */ + *cmd_prolog++ = (MFX_WAIT |MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG |MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG ); + + increased_size_in_dw = (cmd_prolog - cmd); +end: +return increased_size_in_dw; +} + +static int add_pxp_epilog (u32 *cmd) +{ +u32 increased_size_in_dw =0 ; +u32 *cmd_epilog = cmd; +const int cmd_epilog_size_in_dw =5 ; + +if (!cmd) +return cmd_epilog_size_in_dw; + +/* MI_FLUSH_DW - pxp off */ + *cmd_epilog++ =MI_FLUSH_DW ;/* DW0 */ + *cmd_epilog++ =0 ;/* DW1 */ + *cmd_epilog++ =0 ;/* DW2 */ + +/* MFX_WAIT - stall until prior PXP and MFX/HCP/HUC objects are cmopleted */ + *cmd_epilog++ = (MFX_WAIT |MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG |MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG ); + +/* MI_BATCH_BUFFER_END */ + *cmd_epilog++ =MI_BATCH_BUFFER_END ; + + increased_size_in_dw = (cmd_epilog - cmd); +return increased_size_in_dw; +} + +static int add_pxp_inline_termination (u32 *cmd) +{ +u32 increased_size_in_dw =0 ; +u32 *cmd_termin = cmd; +const int cmd_termin_size_in_dw =2 ; + +if (!cmd) +return cmd_termin_size_in_dw; + +/* CRYPTO_KEY_EXCHANGE - session inline termination */ + *cmd_termin++ =CRYPTO_KEY_EXCHANGE ;/* DW0 */ + *cmd_termin++ =0 ;/* DW1 */ + + increased_size_in_dw = (cmd_termin - cmd); +return increased_size_in_dw; +} + +static int issue_hw_terminate_for_session (struct drm_i915_private *i915,int session_type, +int session_index) +{ +u32 *cmd =NULL ; +u32 *cmd_ptr =NULL ; +int cmd_size_in_dw =0 ; +int ret; + +drm_dbg (&i915->drm,">>> %s session_type=[%d] session_index=[%d]\n" , __func__, + session_type, session_index); + +if (!i915) { + ret = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s due to bad params\n" , __func__); + goto end; + } + + cmd_size_in_dw +=add_pxp_prolog (i915,NULL , session_type, session_index); + cmd_size_in_dw +=add_pxp_inline_termination (NULL ); + cmd_size_in_dw +=add_pxp_epilog (NULL ); + + cmd =kzalloc (cmd_size_in_dw *4 ,GFP_KERNEL ); +if (!cmd) { + ret = -ENOMEM ; +drm_dbg (&i915->drm,"Failed to kzalloc()\n" ); + goto end; + } + + cmd_ptr = cmd; + cmd_ptr +=add_pxp_prolog (i915, cmd_ptr, session_type, session_index); + cmd_ptr +=add_pxp_inline_termination (cmd_ptr); + cmd_ptr +=add_pxp_epilog (cmd_ptr); + +if (cmd_size_in_dw != (cmd_ptr - cmd)) { + ret = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s\n" , __func__); + goto end; + } + +if (drm_debug_enabled (DRM_UT_DRIVER )) { +print_hex_dump (KERN_DEBUG ,"cmd binaries:" , +DUMP_PREFIX_OFFSET ,4 ,4 , cmd, cmd_size_in_dw *4 , true); + } + + ret =pxp_submit_cmd (i915, cmd, cmd_size_in_dw); +if (ret) { +drm_dbg (&i915->drm,"Failed to pxp_submit_cmd()\n" ); + goto end; + } + +end: +kfree (cmd); +drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret); +return ret; +} +int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915) {int ret;
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +16 -0
@@ -23,6 +23,22 @@#define SESSION_TYPE_MASK BIT(7)#define SESSION_ID_MASK (BIT(7) - 1) +/* PXP GPU command definitions */ + +/* MI_SET_APPID */ +#define MI_SET_APPID_TYPE1_APP BIT(7) +#define MI_SET_APPID_SESSION_ID (x) ((x) << 0) + +/* MI_FLUSH_DW */ +#define MI_FLUSH_DW_DW0_PROTECTED_MEMORY_ENABLE BIT(22) + +/* MI_WAIT */ +#define MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG BIT(9) +#define MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG BIT(8) + +/* CRYPTO_KEY_EXCHANGE */ +#define CRYPTO_KEY_EXCHANGE ((0x3 << 29) | (0x01609 << 16)) +enum pxp_session_types {SESSION_TYPE_TYPE0 =0 ,SESSION_TYPE_TYPE1 =1 ,
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/27 drm/i915/pxp: Enable ioctl action to terminate the session
In reply to Huang, Sean ZEnable the PXP ioctl action to allow ring3 PXP to terminate the hardware session and cleanup its software session state. Ring0 PXP sends the session termination command to GPU once receves this ioctl action.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 7 + drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 205 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 5 + 3 files changed, 217 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.c +7 -0
@@ -58,6 +58,13 @@ int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmf ret =pxp_sm_mark_protected_session_in_play (i915, params->session_type, params->pxp_tag); + }else if (params->req_session_state ==PXP_SM_REQ_SESSION_TERMINATE ) { + ret =pxp_sm_terminate_protected_session_safe (i915,0 , + params->session_type, + params->pxp_tag); + +if (!intel_pxp_sm_is_any_type0_session_in_play (i915,PROTECTION_MODE_ALL )) +intel_pxp_destroy_r3ctx_list (i915); }else { ret = -EINVAL ; goto end;
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +205 -0
214 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +5 -0
@@ -105,6 +105,11 @@ int intel_pxp_sm_reserve_session(struct drm_i915_private *i915, struct drm_file u32 *pxp_tag);int pxp_sm_mark_protected_session_in_play (struct drm_i915_private *i915,int session_type,u32 session_id); +int pxp_sm_terminate_protected_session_safe (struct drm_i915_private *i915,int context_id, +int session_type,int session_id); +int pxp_sm_terminate_protected_session_unsafe (struct drm_i915_private *i915,int session_type, +int session_id);int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915); +bool intel_pxp_sm_is_any_type0_session_in_play (struct drm_i915_private *i915,int protection_mode);#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
PATCH 14/27 drm/i915/pxp: Enable ioctl action to query PXP tag
In reply to Huang, Sean ZEnable the PXP ioctl action to allow ring3 PXP to query the PXP tag, which is a 32-bit bitwise value indicating the current session info, including protection type, session id, and whether the session is enabled.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 7 +++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 7 +++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 28 +++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 3 +++ 4 files changed, 45 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.c +7 -0
@@ -71,6 +71,13 @@ int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmf }break ; } +case PXP_ACTION_QUERY_PXP_TAG : + { +struct pxp_sm_query_pxp_tag *params = &pxp_info.query_pxp_tag; + + ret =pxp_sm_ioctl_query_pxp_tag (i915, ¶ms->session_is_alive, ¶ms->pxp_tag); +break ; + }case PXP_ACTION_SET_R3_CONTEXT : { ret =intel_pxp_set_r3ctx (i915, pxp_info.set_r3ctx);
drivers/gpu/drm/i915/pxp/intel_pxp.h +7 -0
@@ -31,6 +31,7 @@ enum pxp_sm_session_req { };enum pxp_ioctl_action { +PXP_ACTION_QUERY_PXP_TAG =0 ,PXP_ACTION_SET_SESSION_STATUS =1 ,PXP_ACTION_SET_R3_CONTEXT =5 , };
@@ -42,6 +43,11 @@ enum pxp_sm_status {PXP_SM_STATUS_ERROR_UNKNOWN }; +struct pxp_sm_query_pxp_tag { +u32 session_is_alive; +u32 pxp_tag;/* in - Session ID, out pxp tag */ +}; +struct pxp_sm_set_session_status_params {/** @pxp_tag: in [optional], for Arbitrator session, out pxp tag */ u32 pxp_tag;
@@ -57,6 +63,7 @@ struct pxp_info {u32 action;u32 sm_status;union { +struct pxp_sm_query_pxp_tag query_pxp_tag;struct pxp_sm_set_session_status_params set_session_status;u32 set_r3ctx; };
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +28 -0
@@ -1059,6 +1059,34 @@ int pxp_sm_terminate_protected_session_unsafe(struct drm_i915_private *i915, intreturn ret; } +int pxp_sm_ioctl_query_pxp_tag (struct drm_i915_private *i915,u32 *session_is_alive,u32 *pxp_tag) +{ +int session_type =0 ; +int session_index =0 ; +int ret; + +drm_dbg (&i915->drm,">>> %s\n" , __func__); + +if (!session_is_alive || !pxp_tag) { + ret = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s, bad param\n" , __func__); + goto end; + } + + ret =pxp_get_session_index (i915, *pxp_tag, &session_index, &session_type); +if (ret) { +drm_dbg (&i915->drm,"Failed to __pxpsessionid_to_sessionid\n" ); + goto end; + } + + *pxp_tag =intel_pxp_get_pxp_tag (i915, session_index, session_type, session_is_alive); + + ret =0 ; +end: +drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret); +return ret; +} +int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915) {int ret;
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +3 -0
@@ -109,7 +109,10 @@ int pxp_sm_terminate_protected_session_safe(struct drm_i915_private *i915, int c int session_type, int session_id);int pxp_sm_terminate_protected_session_unsafe (struct drm_i915_private *i915,int session_type,int session_id); +int pxp_sm_ioctl_query_pxp_tag (struct drm_i915_private *i915,u32 *session_is_alive,u32 *pxp_tag);int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915); +u32 intel_pxp_get_pxp_tag (struct drm_i915_private *i915,int session_idx, +int session_type,u32 *session_is_alive);bool intel_pxp_sm_is_any_type0_session_in_play (struct drm_i915_private *i915,int protection_mode);#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
PATCH 15/27 drm/i915/pxp: Destroy all type0 sessions 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, ring0 PXP should handle such case and terminate all the type0 sessions.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 6 +- drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 118 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 1 + 3 files changed, 124 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/pxp/intel_pxp.c +5 -1
@@ -127,6 +127,8 @@ static void intel_pxp_mask_irq(struct intel_gt *gt, u32 mask)static int intel_pxp_teardown_required_callback (struct drm_i915_private *i915) { +int ret; +drm_dbg (&i915->drm,"%s was called\n" , __func__);mutex_lock (&i915->pxp.r0ctx->ctx_mutex);
@@ -134,11 +136,13 @@ static int intel_pxp_teardown_required_callback(struct drm_i915_private *i915) i915->pxp.r0ctx->global_state_attacked = true; i915->pxp.r0ctx->flag_display_hm_surface_keys = false; + ret =intel_pxp_sm_terminate_all_active_sessions (i915,SESSION_TYPE_TYPE0 ); +intel_pxp_destroy_r3ctx_list (i915);mutex_unlock (&i915->pxp.r0ctx->ctx_mutex); -return 0 ; +return ret; }static int intel_pxp_global_terminate_complete_callback (struct drm_i915_private *i915)
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +118 -0
130 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +1 -0
@@ -109,6 +109,7 @@ int pxp_sm_terminate_protected_session_safe(struct drm_i915_private *i915, int c int session_type, int session_id);int pxp_sm_terminate_protected_session_unsafe (struct drm_i915_private *i915,int session_type,int session_id); +int intel_pxp_sm_terminate_all_active_sessions (struct drm_i915_private *i915,int session_type);int pxp_sm_ioctl_query_pxp_tag (struct drm_i915_private *i915,u32 *session_is_alive,u32 *pxp_tag);int pxp_sm_set_kcr_init_reg (struct drm_i915_private *i915); u32 intel_pxp_get_pxp_tag(struct drm_i915_private *i915, int session_idx,
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 16/27 drm/i915/pxp: Termiante the session upon app crash
In reply to Huang, Sean ZRing0 PXP should terminate the hardware session and cleanup the software state gracefully when the application has established the protection session, but doesn't close the session correctly due to some cases like application crash.
--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/pxp/intel_pxp.c | 15 +++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 1 + drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 21 +++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 1 + 5 files changed, 40 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -1028,6 +1028,8 @@ static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)/* Catch up with all the deferred frees from "this" client */ i915_gem_flush_free_objects (to_i915 (dev)); + +intel_pxp_close (to_i915 (dev), file); }static void intel_suspend_encoders (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/pxp/intel_pxp.c +15 -0
@@ -103,6 +103,21 @@ int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmfreturn ret; } +int intel_pxp_close (struct drm_i915_private *i915,struct drm_file *drmfile) +{ +int ret; + +drm_dbg (&i915->drm,">>> %s i915=[%p] drmfile=[%p] pid=[%d]\n" , __func__, + i915, drmfile,pid_nr (drmfile->pid)); + +mutex_lock (&i915->pxp.r0ctx->ctx_mutex); + ret =intel_pxp_sm_close (i915, drmfile); +mutex_unlock (&i915->pxp.r0ctx->ctx_mutex); + +drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret); +return ret; +} +static void intel_pxp_write_irq_mask_reg (struct drm_i915_private *i915,u32 mask) {WARN_ON (INTEL_GEN (i915) <11 );
drivers/gpu/drm/i915/pxp/intel_pxp.h +1 -0
@@ -83,6 +83,7 @@ struct intel_gt;struct drm_i915_private ;int i915_pxp_ops_ioctl (struct drm_device *dev,void *data,struct drm_file *drmfile); +int intel_pxp_close (struct drm_i915_private *i915,struct drm_file *drmfile);void intel_pxp_irq_handler (struct intel_gt *gt,u16 iir);int i915_pxp_teardown_required_callback (struct drm_i915_private *i915);int i915_pxp_global_terminate_complete_callback (struct drm_i915_private *i915);
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +21 -0
@@ -1243,3 +1243,24 @@ bool intel_pxp_sm_is_any_type0_session_in_play(struct drm_i915_private *i915, inreturn false; } + +int intel_pxp_sm_close (struct drm_i915_private *i915,struct drm_file *drmfile) +{ +struct pxp_protected_session *s, *n; +int ret =0 ; + +drm_dbg (&i915->drm,">>> %s\n" , __func__); + +list_for_each_entry_safe (s, n,pxp_session_list (i915,SESSION_TYPE_TYPE0 ), session_list) { +if (s->drmfile && s->drmfile == drmfile && s->pid ==pid_nr (drmfile->pid)) { + ret =terminate_protected_session (i915,0 , s->session_type, s->session_index, false); +if (ret) { +drm_dbg (&i915->drm,"Failed to terminate_protected_session()\n" ); +return ret; + } + } + } + +drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret); +return ret; +}
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +1 -0
@@ -115,5 +115,6 @@ int pxp_sm_set_kcr_init_reg(struct drm_i915_private *i915);u32 intel_pxp_get_pxp_tag (struct drm_i915_private *i915,int session_idx,int session_type,u32 *session_is_alive);bool intel_pxp_sm_is_any_type0_session_in_play (struct drm_i915_private *i915,int protection_mode); +int intel_pxp_sm_close (struct drm_i915_private *i915,struct drm_file *drmfile);#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
PATCH 17/27 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, ring0 PXP should terminate all the hardware sessions and cleanup all the software states after the power cycle.
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/i915_drv.c | 8 +++ drivers/gpu/drm/i915/pxp/intel_pxp_pm.c | 82 +++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_pm.h | 16 +++++ 4 files changed, 108 insertions(+), 1 deletion(-) 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 +2 -1
@@ -258,7 +258,8 @@ i915-y += i915_perf.o i915-y += \ pxp/intel_pxp.o \ pxp/intel_pxp_context.o \ - pxp/intel_pxp_sm.o + pxp/intel_pxp_sm.o \ + pxp/intel_pxp_pm.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 +8 -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"
@@ -1094,6 +1096,8 @@ static int i915_drm_prepare(struct drm_device *dev)*/ i915_gem_suspend (i915); +intel_pxp_pm_prepare_suspend (i915); +return 0 ; }
@@ -1277,6 +1281,8 @@ static int i915_drm_resume(struct drm_device *dev)intel_power_domains_enable (dev_priv); +intel_pxp_pm_resume (dev_priv); +enable_rpm_wakeref_asserts (&dev_priv->runtime_pm);return 0 ;
@@ -1348,6 +1354,8 @@ static int i915_drm_resume_early(struct drm_device *dev)intel_power_domains_resume (dev_priv); +intel_pxp_pm_resume_early (dev_priv); +enable_rpm_wakeref_asserts (&dev_priv->runtime_pm);return ret;
drivers/gpu/drm/i915/pxp/intel_pxp_pm.c new file +82 -0
82 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_pm.h new file +16 -0
@@ -0,0 +1,16 @@ +/* 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" + +void intel_pxp_pm_prepare_suspend (struct drm_i915_private *i915); + +void intel_pxp_pm_resume_early (struct drm_i915_private *i915); +int intel_pxp_pm_resume (struct drm_i915_private *i915); + +#endif
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 18/27 drm/i915/pxp: Implement funcs to create the TEE channel
In reply to Huang, Sean ZCurrently ring3 driver sends the TEE commands directly to TEE, but later, as our design, we would like to make ring3 sending the TEE commands via the ring0 PXP ioctl action instead of TEE ioctl, so we can centralize those protection operations at ring0 PXP.
--- drivers/gpu/drm/i915/Makefile | 1 + 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 | 136 +++++++++++++++++++++++ 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, 209 insertions(+) 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 +1 -0
@@ -259,6 +259,7 @@ i915-y += \ pxp/intel_pxp.o \ pxp/intel_pxp_context.o \ pxp/intel_pxp_sm.o \ + pxp/intel_pxp_tee.o \ pxp/intel_pxp_pm.o # Post-mortem debug and GPU hang state capture
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -324,6 +324,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
@@ -1219,6 +1219,12 @@ struct drm_i915_private {struct intel_pxp pxp; +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
@@ -7,6 +7,7 @@#include "intel_pxp.h" #include "intel_pxp_context.h" #include "intel_pxp_sm.h" +#include "intel_pxp_tee.h" int i915_pxp_ops_ioctl (struct drm_device *dev,void *data,struct drm_file *drmfile) {
@@ -220,6 +221,8 @@ int intel_pxp_init(struct drm_i915_private *i915)return ret; } +intel_pxp_tee_component_init (i915); +INIT_WORK (&i915->pxp.irq_work, intel_pxp_irq_work); i915->pxp.handled_irr = (PXP_IRQ_VECTOR_DISPLAY_PXP_STATE_TERMINATED |
@@ -231,6 +234,8 @@ int intel_pxp_init(struct drm_i915_private *i915)void intel_pxp_uninit (struct drm_i915_private *i915) { +intel_pxp_tee_component_fini (i915); +intel_pxp_destroy_r0ctx (i915); }
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c new file +136 -0
136 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 "i915_drv.h" + +void intel_pxp_tee_component_init (struct drm_i915_private *i915); +void intel_pxp_tee_component_fini (struct drm_i915_private *i915); + +#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
PATCH 19/27 drm/i915/pxp: Enable ioctl action to send TEE commands
In reply to Huang, Sean ZEnable the ioctl action to allow ring3 driver sends TEE commands via ring0 PXP ioctl, instead of TEE iotcl. So we can centralize those protection operations at ring0 PXP.
--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 14 +++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 18 +++++++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 65 ++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.h | 5 ++ 4 files changed, 102 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.c +14 -0
@@ -79,6 +79,20 @@ int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmf ret =pxp_sm_ioctl_query_pxp_tag (i915, ¶ms->session_is_alive, ¶ms->pxp_tag);break ; } +case PXP_ACTION_TEE_IO_MESSAGE : + { +struct pxp_tee_io_message_params *params = &pxp_info.tee_io_message; + + ret =pxp_tee_ioctl_io_message (i915, + params->msg_in, params->msg_in_size, + params->msg_out, ¶ms->msg_out_size, + params->msg_out_buf_size); +if (ret) { +drm_dbg (&i915->drm,"Failed to send TEE IO message\n" ); + ret = -EFAULT ; + } +break ; + }case PXP_ACTION_SET_R3_CONTEXT : { ret =intel_pxp_set_r3ctx (i915, pxp_info.set_r3ctx);
drivers/gpu/drm/i915/pxp/intel_pxp.h +18 -0
@@ -33,6 +33,7 @@ enum pxp_sm_session_req {enum pxp_ioctl_action {PXP_ACTION_QUERY_PXP_TAG =0 ,PXP_ACTION_SET_SESSION_STATUS =1 , +PXP_ACTION_TEE_IO_MESSAGE =4 ,PXP_ACTION_SET_R3_CONTEXT =5 , };
@@ -59,12 +60,29 @@ struct pxp_sm_set_session_status_params {u32 req_session_state; }; +/** +* struct pxp_tee_io_message_params - Params to send/receive message to/from TEE. +*/ +struct pxp_tee_io_message_params { +/** @msg_in: in - message input from UMD */ +u8 __user *msg_in; +/** @msg_in_size: in - message input size from UMD */ +u32 msg_in_size; +/** @msg_out: in - message output buffer from UMD */ +u8 __user *msg_out; +/** @msg_out_size: out- message output size from TEE */ +u32 msg_out_size; +/** @msg_out_buf_size: in - message output buffer size from UMD */ +u32 msg_out_buf_size; +}; +struct pxp_info {u32 action;u32 sm_status;union {struct pxp_sm_query_pxp_tag query_pxp_tag;struct pxp_sm_set_session_status_params set_session_status; +struct pxp_tee_io_message_params tee_io_message;u32 set_r3ctx; }; } __packed;
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +65 -0
71 lines not on this page · raw message
drivers/gpu/drm/i915/pxp/intel_pxp_tee.h +5 -0
@@ -11,4 +11,9 @@void intel_pxp_tee_component_init (struct drm_i915_private *i915);void intel_pxp_tee_component_fini (struct drm_i915_private *i915); +int pxp_tee_ioctl_io_message (struct drm_i915_private *i915, +void __user *msg_in_user_ptr,u32 msg_in_size, +void __user *msg_out_user_ptr,u32 *msg_out_size_ptr, +u32 msg_out_buf_size); +#endif /* __INTEL_PXP_TEE_H__ */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 20/27 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/pxp/intel_pxp.c | 50 +++++++++++++++++++++++- drivers/gpu/drm/i915/pxp/intel_pxp.h | 2 + drivers/gpu/drm/i915/pxp/intel_pxp_sm.c | 33 ++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_sm.h | 6 +++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.c | 34 ++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp_tee.h | 6 +++ 6 files changed, 130 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/pxp/intel_pxp.c +49 -1
@@ -133,6 +133,46 @@ int intel_pxp_close(struct drm_i915_private *i915, struct drm_file *drmfile)return ret; } +int intel_pxp_create_arb_session (struct drm_i915_private *i915) +{ +struct pxp_tag pxptag; +int ret; + +drm_dbg (&i915->drm,">>> %s\n" , __func__); + +lockdep_assert_held (&i915->pxp.r0ctx->ctx_mutex); + +if (i915->pxp.r0ctx->flag_display_hm_surface_keys) { +drm_dbg (&i915->drm,"%s: arb session is alive so skipping the creation\n" , + __func__); +return 0 ; + } + + ret =intel_pxp_sm_reserve_arb_session (i915, &pxptag.value); +if (ret) { +drm_dbg (&i915->drm,"Failed to reserve session\n" ); + goto end; + } + + ret =intel_pxp_tee_cmd_create_arb_session (i915); +if (ret) { +drm_dbg (&i915->drm,"Failed to send tee cmd for arb session creation\n" ); + goto end; + } + + ret =pxp_sm_mark_protected_session_in_play (i915,ARB_SESSION_TYPE , pxptag.session_id); +if (ret) { +drm_dbg (&i915->drm,"Failed to mark session status in play\n" ); + goto end; + } + + i915->pxp.r0ctx->flag_display_hm_surface_keys = true; + +end: +drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret); +return ret; +} +static void intel_pxp_write_irq_mask_reg (struct drm_i915_private *i915,u32 mask) {WARN_ON (INTEL_GEN (i915) <11 );
@@ -183,9 +223,17 @@ static int intel_pxp_global_terminate_complete_callback(struct drm_i915_privatemutex_lock (&i915->pxp.r0ctx->ctx_mutex); -if (i915->pxp.r0ctx->global_state_attacked) +if (i915->pxp.r0ctx->global_state_attacked) { i915->pxp.r0ctx->global_state_attacked = false; +/* Re-create the arb session after teardown handle complete */ + ret =intel_pxp_create_arb_session (i915); +if (ret) { +drm_dbg (&i915->drm,"Failed to create arb session\n" ); + goto end; + } + } +end:mutex_unlock (&i915->pxp.r0ctx->ctx_mutex);drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret);
drivers/gpu/drm/i915/pxp/intel_pxp.h +2 -0
@@ -102,6 +102,8 @@ struct drm_i915_private;int i915_pxp_ops_ioctl (struct drm_device *dev,void *data,struct drm_file *drmfile);int intel_pxp_close (struct drm_i915_private *i915,struct drm_file *drmfile); +int intel_pxp_create_arb_session (struct drm_i915_private *i915); +void intel_pxp_irq_handler (struct intel_gt *gt,u16 iir);int i915_pxp_teardown_required_callback (struct drm_i915_private *i915);int i915_pxp_global_terminate_complete_callback (struct drm_i915_private *i915);
drivers/gpu/drm/i915/pxp/intel_pxp_sm.c +33 -0
@@ -656,6 +656,39 @@ int intel_pxp_sm_reserve_session(struct drm_i915_private *i915, struct drm_filereturn ret; } +int intel_pxp_sm_reserve_arb_session (struct drm_i915_private *i915,u32 *pxp_tag) +{ +int ret; + +drm_dbg (&i915->drm,">>> %s\n" , __func__); + +lockdep_assert_held (&i915->pxp.r0ctx->ctx_mutex); + +if (!pxp_tag || !i915) { + ret = -EINVAL ; +drm_dbg (&i915->drm,"Failed to %s, bad params\n" , __func__); + goto end; + } + + ret =sync_hw_sw_state (i915,ARB_SESSION_INDEX ,ARB_SESSION_TYPE ); +if (unlikely (ret)) + goto end; + + ret =create_new_session_entry (i915,NULL ,0 ,ARB_SESSION_TYPE , +ARB_PROTECTION_MODE ,ARB_SESSION_INDEX ); +if (unlikely (ret)) + goto end; + + ret =pxp_set_pxp_tag (i915,ARB_SESSION_TYPE ,ARB_SESSION_INDEX ,ARB_PROTECTION_MODE ); + +end: +if (ret ==0 ) + *pxp_tag =intel_pxp_get_pxp_tag (i915,ARB_SESSION_INDEX ,ARB_SESSION_TYPE ,NULL ); + +drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret); +return ret; +} +/** * pxp_sm_mark_protected_session_in_play - To put an reserved protected session to "in_play" state * @i915: i915 device handle.
drivers/gpu/drm/i915/pxp/intel_pxp_sm.h +6 -0
@@ -39,6 +39,11 @@/* CRYPTO_KEY_EXCHANGE */ #define CRYPTO_KEY_EXCHANGE ((0x3 << 29) | (0x01609 << 16)) +/* Arbitrary session */ +#define ARB_SESSION_INDEX 0xf +#define ARB_SESSION_TYPE SESSION_TYPE_TYPE0 +#define ARB_PROTECTION_MODE PROTECTION_MODE_HM +enum pxp_session_types {SESSION_TYPE_TYPE0 =0 ,SESSION_TYPE_TYPE1 =1 ,
@@ -103,6 +108,7 @@ struct pxp_protected_session {int intel_pxp_sm_reserve_session (struct drm_i915_private *i915,struct drm_file *drmfile,int context_id,int session_type,int protection_mode,u32 *pxp_tag); +int intel_pxp_sm_reserve_arb_session (struct drm_i915_private *i915,u32 *pxp_tag);int pxp_sm_mark_protected_session_in_play (struct drm_i915_private *i915,int session_type,u32 session_id); int pxp_sm_terminate_protected_session_safe(struct drm_i915_private *i915, int context_id,
drivers/gpu/drm/i915/pxp/intel_pxp_tee.c +34 -0
@@ -138,6 +138,7 @@ int pxp_tee_ioctl_io_message(struct drm_i915_private *i915,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);drm_dbg (&i915->drm,"i915 PXP TEE component bind\n" );
@@ -150,6 +151,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 (&i915->pxp.r0ctx->ctx_mutex); +/* Create arb session only if tee is ready, during system boot or sleep/resume */ + ret =intel_pxp_create_arb_session (i915); +mutex_unlock (&i915->pxp.r0ctx->ctx_mutex); + +if (ret) { +drm_dbg (&i915->drm,"Failed to create arb session ret=[%d]\n" , ret); +return ret; + } +return 0 ; }
@@ -199,3 +210,26 @@ void intel_pxp_tee_component_fini(struct drm_i915_private *i915)component_del (i915->drm.dev, &i915_pxp_tee_component_ops); } + +int intel_pxp_tee_cmd_create_arb_session (struct drm_i915_private *i915) +{ +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 }; + +mutex_lock (&i915->pxp_tee_comp_mutex); + + ret =intel_pxp_tee_io_message (i915, + &msg_in, +sizeof (msg_in), + &msg_out, &msg_out_size_received, +sizeof (msg_out)); + +mutex_unlock (&i915->pxp_tee_comp_mutex); + +if (ret) +drm_dbg (&i915->drm,"Failed to send/receive tee message\n" ); + +return ret; +}
drivers/gpu/drm/i915/pxp/intel_pxp_tee.h +6 -0
@@ -16,4 +16,10 @@ int pxp_tee_ioctl_io_message(struct drm_i915_private *i915, void __user *msg_out_user_ptr, u32 *msg_out_size_ptr, u32 msg_out_buf_size); +int intel_pxp_tee_cmd_create_arb_session (struct drm_i915_private *i915); + +/* 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__ */
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 20/27] drm/i915/pxp: Create the arbitrary session after boot
Quoting Huang, Sean Z (2020-11-15 23:08:08)
Quoted 9 lines
Create 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.Signed-off-by Huang, Sean Z <[email protected]>
<SNIP>
drivers/gpu/drm/i915/pxp/intel_pxp_tee.h int pxp_tee_ioctl_io_message(struct drm_i915_private *i915, · line 23
Quoted 10 lines
+++
b/drivers/gpu/drm/i915/pxp/intel_pxp_tee.hdrivers/gpu/drm/i915/pxp/intel_pxp_tee.h +5
-0@@ -16,4 +16,10 @@ int pxp_tee_ioctl_io_message(struct drm_i915_private *i915, void __user *msg_out_user_ptr, u32 *msg_out_size_ptr, u32 msg_out_buf_size); +int intel_pxp_tee_cmd_create_arb_session (struct drm_i915_private *i915); + +/* 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)
This is a BLOB so it doesn't belong to kernel source code. It could be considered in linux-firmware. As it's only an init sequence I'm not sure how that will be perceived.
Probably best to ask.
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 21/27 drm/i915/pxp: Add i915 trace logs for PXP operations
In reply to Huang, Sean ZAdd several i915 trace logs for PXP calls for debugging or performance measurement, including:
(1) PXP ioctl
(2) PXP teardown callbacks
To trun on this feature, we need to set "CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS=y" in .config for compiling the Linux kernel.
--- drivers/gpu/drm/i915/i915_trace.h | 44 ++++++++++++++++++++++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.c | 5 ++++ 2 files changed, 49 insertions(+)
drivers/gpu/drm/i915/i915_trace.h +44 -0
@@ -1031,6 +1031,50 @@ DEFINE_EVENT(i915_context, i915_context_free,TP_ARGS (ctx) ); +TRACE_EVENT (i915_pxp_ops_ioctl, + TP_PROTO(struct drm_device *dev, void *data, struct drm_file *file, u32 action), +TP_ARGS (dev, data, file, action), + +TP_STRUCT__entry ( + __field(struct drm_device *, dev) + __field(void *, data) + __field(struct drm_file *, file) +__field (u32, action) + ), + +TP_fast_assign ( + __entry->dev = dev; + __entry->data = data; + __entry->file = file; + __entry->action = action; + ), + +TP_printk ("dev=%p, data=%p, file=%p, action=%u" , + __entry->dev, __entry->data, __entry->file, __entry->action) +); + +TRACE_EVENT (i915_pxp_teardown_required_callback, + TP_PROTO(bool global_state_attacked), +TP_ARGS (global_state_attacked), + +TP_STRUCT__entry (__field (bool, global_state_attacked)), + + TP_fast_assign(__entry->global_state_attacked = global_state_attacked;), + +TP_printk ("global_state_attacked=%s" ,yesno (__entry->global_state_attacked)) +); + +TRACE_EVENT (i915_pxp_global_terminate_complete_callback, + TP_PROTO(bool global_state_attacked), +TP_ARGS (global_state_attacked), + +TP_STRUCT__entry (__field (bool, global_state_attacked)), + + TP_fast_assign(__entry->global_state_attacked = global_state_attacked;), + +TP_printk ("global_state_attacked=%s" ,yesno (__entry->global_state_attacked)) +); +#endif /* _I915_TRACE_H_ */ /* This part must be outside protection */
drivers/gpu/drm/i915/pxp/intel_pxp.c +5 -0
@@ -8,6 +8,7 @@#include "intel_pxp_context.h" #include "intel_pxp_sm.h" #include "intel_pxp_tee.h" +#include "i915_trace.h" int i915_pxp_ops_ioctl (struct drm_device *dev,void *data,struct drm_file *drmfile) {
@@ -23,6 +24,7 @@ int i915_pxp_ops_ioctl(struct drm_device *dev, void *data, struct drm_file *drmfreturn -EFAULT ;drm_dbg (&i915->drm,"i915 pxp ioctl call with action=[%d]\n" , pxp_info.action); +trace_i915_pxp_ops_ioctl (dev, data, drmfile, pxp_info.action);mutex_lock (&i915->pxp.r0ctx->ctx_mutex);
@@ -212,6 +214,8 @@ static int intel_pxp_teardown_required_callback(struct drm_i915_private *i915)mutex_unlock (&i915->pxp.r0ctx->ctx_mutex); +trace_i915_pxp_teardown_required_callback (i915->pxp.r0ctx->global_state_attacked); +return ret; }
@@ -236,6 +240,7 @@ static int intel_pxp_global_terminate_complete_callback(struct drm_i915_private end:mutex_unlock (&i915->pxp.r0ctx->ctx_mutex); +trace_i915_pxp_global_terminate_complete_callback (i915->pxp.r0ctx->global_state_attacked);drm_dbg (&i915->drm,"<<< %s ret=[%d]\n" , __func__, ret);return ret;
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 22/27 drm/i915/pxp: Expose session state for display protection flip
In reply to Huang, Sean ZImplement the intel_pxp_gem_object_status() to allow ring0 i915 display querying the current PXP session state. In the design, ring0 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 | 8 ++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 2 ++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/pxp/intel_pxp.c +8 -0
@@ -334,3 +334,11 @@ void intel_pxp_irq_handler(struct intel_gt *gt, u16 iir) end:return ; } + +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 gem_object_metadata) +{ +if (i915->pxp.r0ctx && i915->pxp.r0ctx->flag_display_hm_surface_keys) +return true; +else +return false; +}
drivers/gpu/drm/i915/pxp/intel_pxp.h +2 -0
@@ -111,4 +111,6 @@ int i915_pxp_global_terminate_complete_callback(struct drm_i915_private *i915);int intel_pxp_init (struct drm_i915_private *i915);void intel_pxp_uninit (struct drm_i915_private *i915); +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 gem_object_metadata); +#endif
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 22/27] drm/i915/pxp: Expose session state for display protection flip
Quoting Huang, Sean Z (2020-11-15 23:08:10)
Quoted 4 lines
Implement the
intel_pxp_gem_object_status()to allow ring0 i915 display querying the current PXP session state. In the design, ring0 display should not perform protection flip on the protected buffers if there is no PXP session alive.
No users for this code? Dead code should not be included. If this is only to be used by following patches, it should only be included at that point.
It's better to introduce the code in the same patch that uses it, to make review easier.
Regards, Joonas
Quoted 40 lines
Signed-off-by Huang, Sean Z <[email protected]>--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 8 ++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 2 ++ 2 files changed, 10 insertions(+)drivers/gpu/drm/i915/pxp/intel_pxp.c +8
-0@@ -334,3 +334,11 @@ void intel_pxp_irq_handler(struct intel_gt *gt, u16 iir) end:return ; } + +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 gem_object_metadata) +{ +if (i915->pxp.r0ctx && i915->pxp.r0ctx->flag_display_hm_surface_keys) +return true; +else +return false; +}drivers/gpu/drm/i915/pxp/intel_pxp.h +2
-0@@ -111,4 +111,6 @@ int i915_pxp_global_terminate_complete_callback(struct drm_i915_private *i915);int intel_pxp_init (struct drm_i915_private *i915);void intel_pxp_uninit (struct drm_i915_private *i915); +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 gem_object_metadata); +#endif Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 22/27] drm/i915/pxp: Expose session state for display protection flip
Hi Joonas,
Thanks for your feedback!
intel_pxp_gem_object_status() was used in the following commit "[27/27] drm/i915/pxp: Add plane decryption support", which belongs to the i915 display component instead of PXP.
So personally I prefer not to merge this code commit with "[27/27] drm/i915/pxp: Add plane decryption support", and prevent one single code commit from having multiple i915 components change (display and PXP) at the same time.
Best regards,
Sean
-----Original Message-----
From: Joonas Lahtinen <[email protected]>
Sent: Monday, November 16, 2020 2:50 AM
To: Huang, Sean Z <[email protected]>; [email protected]
Subject: Re: [Intel-gfx] [PATCH 22/27] drm/i915/pxp: Expose session state for display protection flip
Quoting Huang, Sean Z (2020-11-15 23:08:10)
Quoted 4 lines
Implement the
intel_pxp_gem_object_status()to allow ring0 i915 display querying the current PXP session state. In the design, ring0 display should not perform protection flip on the protected buffers if there is no PXP session alive.
No users for this code? Dead code should not be included. If this is only to be used by following patches, it should only be included at that point.
It's better to introduce the code in the same patch that uses it, to make review easier.
Regards, Joonas
Quoted 41 lines
Signed-off-by Huang, Sean Z <[email protected]>--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 8 ++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 2 ++ 2 files changed, 10 insertions(+)drivers/gpu/drm/i915/pxp/intel_pxp.c +8
-0@@ -334,3 +334,11 @@ void intel_pxp_irq_handler(struct intel_gt *gt, u16 iir) end: return; } + +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 +gem_object_metadata) { +if (i915->pxp.r0ctx && i915->pxp.r0ctx->flag_display_hm_surface_keys) +return true; +else +return false; +}drivers/gpu/drm/i915/pxp/intel_pxp.h +0
-0@@ -111,4 +111,6 @@ int
i915_pxp_global_terminate_complete_callback(struct drm_i915_private *i915); intintel_pxp_init(struct drm_i915_private *i915); voidintel_pxp_uninit(struct drm_i915_private *i915);drivers/gpu/drm/i915/pxp/intel_pxp.h +3
-1+bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 +gem_object_metadata); +#endif --2.17.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 22/27] drm/i915/pxp: Expose session state for display protection flip
In reply to Huang, Sean ZQuoted 16 lines · Sean Z
Implement the
intel_pxp_gem_object_status()to allow ring0 i915 display querying the current PXP session state. In the design, ring0 display should not perform protection flip on the protected buffers if there is no PXP session alive.Signed-off-by Huang, Sean Z <[email protected]>--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 8 ++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 2 ++ 2 files changed, 10 insertions(+)drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0
drivers/gpu/drm/i915/pxp/intel_pxp.c void intel_pxp_irq_handler(struct intel_gt *gt, u16 iir) · line 338
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +2
-0@@ -334,3 +334,11 @@ void intel_pxp_irq_handler(struct intel_gt *gt, u16 iir) end:return ; } + +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 gem_object_metadata)
Currently this api used by Patch 27 of this series, uses gem object user flag (obj->user_flags) to pass as gem_object_metadata but it is unused ? why do we need this gem_object_metadata ?
Thanks,
Anshuman Gupta.
Quoted 24 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-0+{ +if (i915->pxp.r0ctx && i915->pxp.r0ctx->flag_display_hm_surface_keys) +return true; +else +return false; +}drivers/gpu/drm/i915/pxp/intel_pxp.h +2
-0@@ -111,4 +111,6 @@ int i915_pxp_global_terminate_complete_callback(struct drm_i915_private *i915);int intel_pxp_init (struct drm_i915_private *i915);void intel_pxp_uninit (struct drm_i915_private *i915); +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 gem_object_metadata); +#endif Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 22/27] drm/i915/pxp: Expose session state for display protection flip
Hi Anshuman,
Quoted "Currently this api used by Patch 27 of this series, uses gem object user flag (obj->user_flags) to pass as gem_object_metadata but it is unused ? why do we need this gem_object_metadata ?"
Yes, you are correct, the argument gem_object_metadata of intel_pxp_gem_object_status() isn't required anymore.
This is because the original design is to allow display driver passing the object metadata, so PXP can check if the object is still valid base on the metadata.
But in the current design, we don't need this gem_object_metadata and we should consider to remove it. I will provide an update revision removing this argument, thanks for the feedback!
Best regards,
Sean
-----Original Message-----
From: Anshuman Gupta <[email protected]>
Sent: Tuesday, November 17, 2020 12:39 AM
To: Huang, Sean Z <[email protected]>
Cc: [email protected]; Bommu, Krishnaiah <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 22/27] drm/i915/pxp: Expose session state for display protection flip
Quoted 17 lines · Sean Z
Implement the
intel_pxp_gem_object_status()to allow ring0 i915 display querying the current PXP session state. In the design, ring0 display should not perform protection flip on the protected buffers if there is no PXP session alive.Signed-off-by Huang, Sean Z <[email protected]>--- drivers/gpu/drm/i915/pxp/intel_pxp.c | 8 ++++++++ drivers/gpu/drm/i915/pxp/intel_pxp.h | 2 ++ 2 files changed, 10 insertions(+)drivers/gpu/drm/i915/pxp/intel_pxp.c +0
-0
drivers/gpu/drm/i915/pxp/intel_pxp.c void intel_pxp_irq_handler(struct intel_gt *gt,
Quoted 7 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +3
-0@@ -334,3 +334,11 @@ void intel_pxp_irq_handler(struct intel_gt *gt, u16 iir) end: return; } + +bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 +gem_object_metadata)
Currently this api used by Patch 27 of this series, uses gem object user flag (obj->user_flags) to pass as gem_object_metadata but it is unused ? why do we need this gem_object_metadata ?
Thanks,
Anshuman Gupta.
Quoted 23 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c +6
-0+{ +if (i915->pxp.r0ctx && i915->pxp.r0ctx->flag_display_hm_surface_keys) +return true; +else +return false; +}drivers/gpu/drm/i915/pxp/intel_pxp.h +0
-0@@ -111,4 +111,6 @@ int
i915_pxp_global_terminate_complete_callback(struct drm_i915_private *i915); intintel_pxp_init(struct drm_i915_private *i915); voidintel_pxp_uninit(struct drm_i915_private *i915);drivers/gpu/drm/i915/pxp/intel_pxp.h +3
-1+bool intel_pxp_gem_object_status (struct drm_i915_private *i915,u64 +gem_object_metadata); +#endif --2.17.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 23/27 mei: bus: enable pavp device.
In reply to Huang, Sean ZFrom: Tomas Winkler <[email protected]>
Enable protected audio video path client on mei client bus.
--- drivers/misc/mei/bus-fixup.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/misc/mei/bus-fixup.c +4 -0
@@ -33,6 +33,9 @@ static const uuid_le mei_nfc_info_guid = MEI_UUID_NFC_INFO;#define MEI_UUID_HDCP UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, \ 0xA5, 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04) +#define MEI_UUID_PAVP UUID_LE(0xfbf6fcf1, 0x96cf, 0x4e2e, 0xA6, \ + 0xa6, 0x1b, 0xab, 0x8c, 0xbe, 0x36, 0xb1) +#define MEI_UUID_ANY NULL_UUID_LE/**
@@ -488,6 +491,7 @@ static struct mei_fixup {MEI_FIXUP (MEI_UUID_MKHIF_FIX , mei_mkhi_fix),MEI_FIXUP (MEI_UUID_HDCP , whitelist),MEI_FIXUP (MEI_UUID_ANY , vt_support), + MEI_FIXUP(MEI_UUID_PAVP, whitelist), };/**
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 23/27] mei: bus: enable pavp device.
Obviously needs to be reviewed in the right mailing lists and as there don't seem to be any code dependencies should be merged there too.
Regards, Joonas
Quoting Huang, Sean Z (2020-11-15 23:08:11)
Quoted 39 lines
From: Tomas Winkler <[email protected]>
Enable protected audio video path client on mei client bus.
Signed-off-by Tomas Winkler <[email protected]>--- drivers/misc/mei/bus-fixup.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/misc/mei/bus-fixup.c +4
-0@@ -33,6 +33,9 @@ static const uuid_le mei_nfc_info_guid = MEI_UUID_NFC_INFO;#define MEI_UUID_HDCP UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, \ 0xA5, 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04) +#define MEI_UUID_PAVP UUID_LE(0xfbf6fcf1, 0x96cf, 0x4e2e, 0xA6, \ + 0xa6, 0x1b, 0xab, 0x8c, 0xbe, 0x36, 0xb1) +#define MEI_UUID_ANY NULL_UUID_LE/** @@ -488,6 +491,7 @@ static struct mei_fixup {MEI_FIXUP (MEI_UUID_MKHIF_FIX , mei_mkhi_fix),MEI_FIXUP (MEI_UUID_HDCP , whitelist),MEI_FIXUP (MEI_UUID_ANY , vt_support), + MEI_FIXUP(MEI_UUID_PAVP, whitelist), };/** Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 23/27] mei: bus: enable pavp device.
Quoted 10 lines
-----Original Message-----
From: Joonas Lahtinen <[email protected]>
Sent: Monday, November 16, 2020 11:47
To: Huang, Sean Z <[email protected]>; Intel- [email protected]
Cc: Winkler, Tomas <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 23/27] mei: bus: enable pavp device.
Quoted 4 lines
Obviously needs to be reviewed in the right mailing lists and as there don't seem to be any code dependencies should be merged there too.
Regards, Joonas
I will send my patches via GregKH misc tree, but that might create a bit of disconnection.
Quoted 35 lines
Quoting Huang, Sean Z (2020-11-15 23:08:11)
Quoted 14 lines
From: Tomas Winkler <[email protected]>
Enable protected audio video path client on mei client bus.
Signed-off-by Tomas Winkler <[email protected]>--- drivers/misc/mei/bus-fixup.c | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/drivers/misc/mei/bus-fixup.cindex4e30fa98fe7d..042399b397c9100644drivers/misc/mei/bus-fixup.c static const uuid_le mei_nfc_info_guid = · line 33
Quoted 1 line
drivers/misc/mei/bus-fixup.c +0
-0@@ -33,6 +33,9 @@ static const uuid_le mei_nfc_info_guid =MEI_UUID_NFC_INFO ;#define MEI_UUID_HDCP UUID_LE(0xB638AB7E,
0x94E2,0x4EA2, \Quoted 17 lines
drivers/misc/mei/bus-fixup.c +5
-00xA5, 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04) +#define MEI_UUID_PAVP UUID_LE(0xfbf6fcf1, 0x96cf, 0x4e2e, 0xA6, \ + 0xa6, 0x1b, 0xab, 0x8c, 0xbe, 0x36, +0xb1) +#define MEI_UUID_ANY NULL_UUID_LE/** @@ -488,6 +491,7 @@ static struct mei_fixup {MEI_FIXUP (MEI_UUID_MKHIF_FIX , mei_mkhi_fix),MEI_FIXUP (MEI_UUID_HDCP , whitelist),MEI_FIXUP (MEI_UUID_ANY , vt_support), + MEI_FIXUP(MEI_UUID_PAVP, whitelist), };
Quoted 8 lines
Quoted 8 lines
drivers/misc/mei/bus-fixup.c +0
-1/** -- 2.17.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 23/27] mei: bus: enable pavp device.
Quoting Winkler, Tomas (2020-11-16 12:49:54)
Quoted 10 lines
Quoted 10 lines
-----Original Message-----
From: Joonas Lahtinen <[email protected]>
Sent: Monday, November 16, 2020 11:47
To: Huang, Sean Z <[email protected]>; Intel- [email protected]
Cc: Winkler, Tomas <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 23/27] mei: bus: enable pavp device.
Quoted 6 lines
Quoted 4 lines
Obviously needs to be reviewed in the right mailing lists and as there don't seem to be any code dependencies should be merged there too.
Regards, Joonas
I will send my patches via GregKH misc tree, but that might create a bit of disconnection.
Right, just indicating that these need at least Acked-by to merge through drm. And usually if there are no code-level dependencies it's better to merge directly at the right tree to avoid requiring backmerges.
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 24/27 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
@@ -57,3 +57,5 @@ config INTEL_MEI_VIRTIO device over virtio. source "drivers/misc/mei/hdcp/Kconfig" +source "drivers/misc/mei/pxp/Kconfig" +
drivers/misc/mei/Makefile +1 -0
@@ -29,3 +29,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
PATCH 25/27 drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL
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
@@ -1742,7 +1742,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
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 25/27] drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL
Quoting Huang, Sean Z (2020-11-15 23:08:13)
Quoted 5 lines
From: Bommu Krishnaiah <[email protected]>
Same old
gem_createbut with now with extensions support. This is needed to support various upcoming usecases. For now we use the extensions mechanism to support PAVP.
The uAPI related patches should be self-descriptive so acronyms should be spelled out when initially used. Also, previous series refers to PXP and this to PAVP, difference should be explained somewhere.
Please add the right Signed-off-by lines to this patch, this seems to copy a huge part of Matt's work. It's also good to mention that this patch is "Based on patch by XYZ".
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerRe: [Intel-gfx] [PATCH 25/27] drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL
Forgot to mention, the patch title doesn't make sense.
Quoting Joonas Lahtinen (2020-11-16 12:38:46)
Quoted 11 lines
Quoting Huang, Sean Z (2020-11-15 23:08:13)
Quoted 5 lines
From: Bommu Krishnaiah <[email protected]>
Same old
gem_createbut with now with extensions support. This is needed to support various upcoming usecases. For now we use the extensions mechanism to support PAVP.The uAPI related patches should be self-descriptive so acronyms should be spelled out when initially used. Also, previous series refers to PXP and this to PAVP, difference should be explained somewhere.
Quoted 5 lines
Please add the right Signed-off-by lines to this patch, this seems to copy a huge part of Matt's work. It's also good to mention that this patch is "Based on patch by XYZ".
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 25/27] drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL
In reply to Huang, Sean ZQuoted 161 lines · Sean Z
From: Bommu Krishnaiah <[email protected]>
Same old
gem_createbut with now with extensions support. This is needed to support various upcoming usecases. For now we use the extensions mechanism to support PAVP.Signed-off-by Bommu Krishnaiah <[email protected]>Cc Joonas Lahtinen [email protected]Cc Matthew Auld [email protected]Cc Telukuntla Sreedhar <[email protected]>--- 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@@ -1742,7 +1742,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@@ -53,6 +53,7 @@#include "i915_drv.h" #include "i915_trace.h" #include "i915_vgpu.h" +#include "i915_user_extensions.h" #include "intel_pm.h" @@ -260,6 +261,35 @@ i915_gem_dumb_create(struct drm_file *file, &args->size, &args->handle); } +struct create_ext { +struct drm_i915_private *i915; +}; + +static int __create_setparam (struct drm_i915_gem_object_param *args, +struct create_ext *ext_data) +{ +if (!(args->param &I915_OBJECT_PARAM )) { +DRM_DEBUG ("Missing I915_OBJECT_PARAM namespace\n" ); +return -EINVAL ; + } + +return -EINVAL ; +} + +static int create_setparam (struct i915_user_extension __user *base,void *data) +{ +struct drm_i915_gem_create_ext_setparam ext; + +if (copy_from_user (&ext, base,sizeof (ext))) +return -EFAULT ; + +return __create_setparam (&ext.param, data); +} + +static const i915_user_extension_fn create_extensions[] = { + [I915_GEM_CREATE_EXT_SETPARAM ] = create_setparam, +}; +/** * Creates a new mm object and returns a handle to it. * @dev: drm device pointer @@ -271,10 +301,20 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, struct drm_file *file) {struct drm_i915_private *i915 =to_i915 (dev); -struct drm_i915_gem_create *args = data; +struct create_ext ext_data = { .i915 = i915 }; +struct drm_i915_gem_create_ext *args = data; +int ret;i915_gem_flush_free_objects (i915); + ret =i915_user_extensions (u64_to_user_ptr (args->extensions), + create_extensions, +ARRAY_SIZE (create_extensions), + &ext_data); +if (ret) +return ret; + + return i915_gem_create(file, intel_memory_region_by_type(i915, INTEL_MEMORY_SYSTEM),include/uapi/drm/i915_drm.h +40
-0@@ -392,6 +392,7 @@ typedef struct _drm_i915_sarea {#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create) +#define DRM_IOCTL_I915_GEM_CREATE_EXT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create_ext)#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)@@ -730,6 +731,27 @@ struct drm_i915_gem_create {__u32 pad; }; +struct drm_i915_gem_create_ext { +/** +* Requested size for the object. +* +* The (page-aligned) allocated size for the object will be returned. +*/ +__u64 size; +/** +* Returned handle for the object. +* +* Object handles are nonzero. +*/ +__u32 handle; +__u32 pad; +#define I915_GEM_CREATE_EXT_SETPARAM (1u << 0) +#define I915_GEM_CREATE_EXT_FLAGS_UNKNOWN \ + (-(I915_GEM_CREATE_EXT_SETPARAM << 1)) +__u64 extensions; + +}; +struct drm_i915_gem_pread {/** Handle for the object being read. */ __u32 handle;@@ -1700,6 +1722,31 @@ struct drm_i915_gem_context_param {__u64 value; }; +struct drm_i915_gem_object_param { +/* Object handle (0 for I915_GEM_CREATE_EXT_SETPARAM) */ +__u32 handle; + +/* Data pointer size */ +__u32 size; + +/* +* I915_OBJECT_PARAM: +* +* Select object namespace for the param. +*/ +#define I915_OBJECT_PARAM (1ull<<32) + +__u64 param; + +/* Data value or pointer */ +__u64 data;
include/uapi/drm/i915_drm.h struct drm_i915_gem_context_param { · line 1752
Quoted 10 lines
include/uapi/drm/i915_drm.h +7
-0+}; + +struct drm_i915_gem_create_ext_setparam { +struct i915_user_extension base; +struct drm_i915_gem_object_param param; +}; +/** * Context SSEU programming *
How is userspace supposed to know this feature is supported? Looks like we need a I915_PARAM_HAS_PAVP or something, no?
In the case a buffer is exported/imported from one process to another, is there a way for the receiving process to tell whether the buffer has PAVP enabled?
Thanks,
-Lionel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 26/27 drm/i915/pavp: 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
@@ -2063,12 +2063,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
@@ -135,7 +135,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
@@ -1717,6 +1717,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;
@@ -1736,6 +1745,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
PATCH 27/27 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"
@@ -752,6 +754,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,
@@ -788,6 +795,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;
@@ -798,7 +806,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);
@@ -874,8 +882,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, obj->user_flags) && +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
@@ -7206,6 +7206,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.CHECKPATCH: warning for series starting with [01/27] drm/i915/pxp: Introduce Intel PXP component
In reply to Huang, Sean Z== Series Details ==
== Series Details ==
Series: series starting with [01/27] drm/i915/pxp: Introduce Intel PXP component
URL : https://patchwork.freedesktop.org/series/83863/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip ec0a75ce495b drm/i915/pxp: Introduce Intel PXP component -:78: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #78: new file mode 100644
-:83: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/gpu/drm/i915/pxp/intel_pxp.c', please use '//' instead #83: FILE: drivers/gpu/drm/i915/pxp/intel_pxp.c:1:
+/* SPDX-License-Identifier: MIT */
-:83: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #83: FILE: drivers/gpu/drm/i915/pxp/intel_pxp.c:1:
+/* SPDX-License-Identifier: MIT */
total: 0 errors, 3 warnings, 0 checks, 95 lines checkedcedefd9b5595 drm/i915/pxp: Enable PXP irq worker and callback stub3dce6e2b5551 drm/i915/pxp: Add PXP context for logical hardware states.
-:116: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #116:
new file mode 100644
-:121: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/gpu/drm/i915/pxp/intel_pxp_context.c', please use '//' instead #121: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_context.c:1:
+/* SPDX-License-Identifier: MIT */
-:121: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #121: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_context.c:1:
+/* SPDX-License-Identifier: MIT */
-:142: WARNING:OOM_MESSAGE: Possible unnecessary 'out of memory' message #142: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_context.c:22:
+ if (!new_ctx) {
+ drm_dbg(&i915->drm, "unable to allocate new pxp context!\n");
total: 0 errors, 4 warnings, 0 checks, 182 lines checked1414cf460ee9 drm/i915/pxp: set KCR reg init during the boot time
-:67: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #67:
new file mode 100644
-:72: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/gpu/drm/i915/pxp/intel_pxp_sm.c', please use '//' instead #72: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:1:
+/* SPDX-License-Identifier: MIT */
-:72: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #72: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:1:
+/* SPDX-License-Identifier: MIT */
total: 0 errors, 3 warnings, 0 checks, 106 lines checked 403845f7ffbd drm/i915/pxp: Enable ioctl action to set the ring3 context -:42: WARNING:LONG_LINE: line length of 101 exceeds 100 columns #42: FILE: drivers/gpu/drm/i915/pxp/intel_pxp.c:21:
+ if (copy_from_user(&pxp_info, u64_to_user_ptr(pxp_ops->pxp_info_ptr), sizeof(pxp_info)) != 0)
-:79: WARNING:LONG_LINE: line length of 107 exceeds 100 columns #79: FILE: drivers/gpu/drm/i915/pxp/intel_pxp.c:58:
+ if (copy_to_user(u64_to_user_ptr(pxp_ops->pxp_info_ptr), &pxp_info, sizeof(pxp_info)) != 0)
-:152: WARNING:OOM_MESSAGE: Possible unnecessary 'out of memory' message #152: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_context.c:61:
+ if (!r3ctx) {
+ drm_dbg(&i915->drm, "Failed to kzalloc()\n");
-:205: WARNING:LONG_LINE: line length of 110 exceeds 100 columns #205: FILE: include/uapi/drm/i915_drm.h:426:
+#define DRM_IOCTL_I915_PXP_OPS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_PXP_OPS, struct drm_i915_pxp_ops)
total: 0 errors, 4 warnings, 0 checks, 164 lines checkede45885b5b387 drm/i915: Rename the whitelist to allowlist309be6f34e3c drm/i915/pxp: Add PXP-related registers into allowlist b8289b5f361b drm/i915/pxp: Read register to check hardware session state -:19: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'i915' - possible side-effects? #19: FILE: drivers/gpu/drm/i915/pxp/intel_pxp.h:15:
+#define pxp_session_list(i915, session_type) (((session_type) == SESSION_TYPE_TYPE0) ? \
+ &(i915)->pxp.r0ctx->active_pxp_type0_sessions : &(i915)->pxp.r0ctx->active_pxp_type1_sessions)
-:20: WARNING:LONG_LINE: line length of 102 exceeds 100 columns #20: FILE: drivers/gpu/drm/i915/pxp/intel_pxp.h:16:
+ &(i915)->pxp.r0ctx->active_pxp_type0_sessions : &(i915)->pxp.r0ctx->active_pxp_type1_sessions)
-:155: WARNING:LONG_LINE: line length of 104 exceeds 100 columns #155: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:144:
+ drm_dbg(&i915->drm, "Failed to %s invalid session_type=[%d]\n", __func__, session_type);
total: 0 errors, 2 warnings, 1 checks, 254 lines checked e34ed97f0df9 drm/i915/pxp: Implement funcs to get/set PXP tag 333c15e61776 drm/i915/pxp: Enable ioctl action to reserve session slot -:216: WARNING:LONG_LINE: line length of 108 exceeds 100 columns #216: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:422:
+ drm_dbg(&i915->drm, "Failed to %s, invalid session mode=[%d]\n", __func__, protection_mode);
total: 0 errors, 1 warnings, 0 checks, 254 lines checked 668f4968e125 drm/i915/pxp: Enable ioctl action to set session in play -:98: WARNING:LONG_LINE: line length of 113 exceeds 100 columns #98: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:532:
+ list_for_each_entry(current_session, &i915->pxp.r0ctx->active_pxp_type0_sessions, session_list) {
-:99: WARNING:LONG_LINE: line length of 122 exceeds 100 columns #99: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:533:
+ DRM_DEBUG("Traverse the active type0 list, session_index=[%d]\n", current_session->session_index);
-:100: WARNING:LONG_LINE: line length of 132 exceeds 100 columns #100: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:534:
+ drm_dbg(&i915->drm, "Traverse the active type0 list, session_index=[%d]\n", current_session->session_index);
-:113: WARNING:LONG_LINE: line length of 113 exceeds 100 columns #113: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:547:
+ list_for_each_entry(current_session, &i915->pxp.r0ctx->active_pxp_type1_sessions, session_list) {
-:114: WARNING:LONG_LINE: line length of 132 exceeds 100 columns #114: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:548:
+ drm_dbg(&i915->drm, "Traverse the active type1 list, session_index=[%d]\n", current_session->session_index);
total: 0 errors, 5 warnings, 0 checks, 122 lines checked 429636cac96a drm/i915/pxp: Func to send hardware session termination -:38: WARNING:LONG_LINE: line length of 108 exceeds 100 columns #38: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:24:
+ drm_dbg(&i915->drm, ">>> %s cmd_buf=[%p] cmd_size_in_dw=[%d]\n", __func__, cmd_buf, cmd_size_in_dw);
-:196: WARNING:LONG_LINE: line length of 103 exceeds 100 columns
#196: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:732:
+static int add_pxp_prolog(struct drm_i915_private *i915, u32 *cmd, int session_type, int session_index)
-:206: WARNING:LONG_LINE: line length of 109 exceeds 100 columns #206: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:742:
+ *cmd_prolog++ = (MFX_WAIT | MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG | MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG);
-:220: WARNING:LONG_LINE: line length of 113 exceeds 100 columns #220: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:756:
+ *cmd_prolog++ = (MI_SET_APPID | MI_SET_APPID_TYPE1_APP | MI_SET_APPID_SESSION_ID(session_index));
-:231: WARNING:LONG_LINE: line length of 109 exceeds 100 columns #231: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:767:
+ *cmd_prolog++ = (MFX_WAIT | MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG | MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG);
-:239: WARNING:LONG_LINE: line length of 109 exceeds 100 columns #239: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:775:
+ *cmd_prolog++ = (MFX_WAIT | MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG | MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG);
-:261: WARNING:LONG_LINE: line length of 109 exceeds 100 columns #261: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:797:
+ *cmd_epilog++ = (MFX_WAIT | MFX_WAIT_DW0_PXP_SYNC_CONTROL_FLAG | MFX_WAIT_DW0_MFX_SYNC_CONTROL_FLAG);
total: 0 errors, 7 warnings, 0 checks, 350 lines checked 049827bba4b3 drm/i915/pxp: Enable ioctl action to terminate the session -:65: WARNING:LONG_LINE: line length of 121 exceeds 100 columns #65: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:905:
+ list_for_each_entry_safe(current_session, n, &i915->pxp.r0ctx->active_pxp_type0_sessions, session_list) {
-:69: WARNING:LONG_LINE: line length of 131 exceeds 100 columns #69: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:909:
+ drm_dbg(&i915->drm, "Failed to %s due to invalid context_id=[%d]\n", __func__, context_id);
-:73: WARNING:LONG_LINE: line length of 104 exceeds 100 columns #73: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:913:
+ ret = issue_hw_terminate_for_session(i915, session_type, session_index);
-:79: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #79: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:919:
+ ret = pxp_set_pxp_tag(i915, session_type, session_index, PROTECTION_MODE_NONE);
-:98: WARNING:LONG_LINE: line length of 113 exceeds 100 columns #98: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:938:
+ drm_dbg(&i915->drm, "Warning - Couldn't find the type0 session_index=[0x%08x]\n", session_index);
-:103: WARNING:LONG_LINE: line length of 121 exceeds 100 columns #103: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:943:
+ list_for_each_entry_safe(current_session, n, &i915->pxp.r0ctx->active_pxp_type1_sessions, session_list) {
-:107: WARNING:LONG_LINE: line length of 131 exceeds 100 columns #107: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:947:
+ drm_dbg(&i915->drm, "Failed to %s due to invalid context_id=[%d]\n", __func__, context_id);
-:111: WARNING:LONG_LINE: line length of 104 exceeds 100 columns #111: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:951:
+ ret = issue_hw_terminate_for_session(i915, session_type, session_index);
-:117: WARNING:LONG_LINE: line length of 111 exceeds 100 columns #117: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:957:
+ ret = pxp_set_pxp_tag(i915, session_type, session_index, PROTECTION_MODE_NONE);
-:134: WARNING:LONG_LINE: line length of 113 exceeds 100 columns #134: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:974:
+ drm_dbg(&i915->drm, "Warning - Couldn't find the type1 session_index=[0x%08x]\n", session_index);
-:199: WARNING:LONG_LINE: line length of 110 exceeds 100 columns
#199: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:1039:
+int pxp_sm_terminate_protected_session_unsafe(struct drm_i915_private *i915, int session_type, int session_id)
total: 0 errors, 11 warnings, 0 checks, 238 lines checked 72b155e8c9fa drm/i915/pxp: Enable ioctl action to query PXP tag 2f7b05c73063 drm/i915/pxp: Destroy all type0 sessions upon teardown -:128: WARNING:LONG_LINE: line length of 106 exceeds 100 columns #128: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:1134:
+ list_for_each_entry_safe(current_session, n, pxp_session_list(i915, session_type), session_list) {
-:129: WARNING:LONG_LINE: line length of 112 exceeds 100 columns #129: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:1135:
+ ret = pxp_set_pxp_tag(i915, session_type, current_session->session_index, PROTECTION_MODE_NONE);
total: 0 errors, 2 warnings, 0 checks, 159 lines checked 3270a1c64c4e drm/i915/pxp: Termiante the session upon app crash -:82: WARNING:LONG_LINE: line length of 109 exceeds 100 columns #82: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_sm.c:1256:
+ ret = terminate_protected_session(i915, 0, s->session_type, s->session_index, false);
total: 0 errors, 1 warnings, 0 checks, 66 lines checked3bab939267e5 drm/i915/pxp: Enable PXP power management
-:69: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #69:
new file mode 100644
-:74: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/gpu/drm/i915/pxp/intel_pxp_pm.c', please use '//' instead #74: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_pm.c:1:
+/* SPDX-License-Identifier: MIT */
-:74: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #74: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_pm.c:1:
+/* SPDX-License-Identifier: MIT */
total: 0 errors, 3 warnings, 0 checks, 139 lines checked12a97546fb0c drm/i915/pxp: Implement funcs to create the TEE channel
-:11: WARNING:BAD_SIGN_OFF: Co-developed-by: must be immediately followed by Signed-off-by:
#11:
-:12: WARNING:BAD_SIGN_OFF: Co-developed-by and Signed-off-by: name/email do not match #12:
-:87: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #87:
new file mode 100644
-:92: WARNING:SPDX_LICENSE_TAG: Improper SPDX comment style for 'drivers/gpu/drm/i915/pxp/intel_pxp_tee.c', please use '//' instead #92: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_tee.c:1:
+/* SPDX-License-Identifier: MIT */
-:92: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #92: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_tee.c:1:
+/* SPDX-License-Identifier: MIT */
total: 0 errors, 5 warnings, 0 checks, 251 lines checkedb68da9355145 drm/i915/pxp: Enable ioctl action to send TEE commandsa7c6e8e4af8e drm/i915/pxp: Create the arbitrary session after boot
-:234: WARNING:LONG_LINE: line length of 101 exceeds 100 columns
#234: FILE: drivers/gpu/drm/i915/pxp/intel_pxp_tee.h:22:
+#define PXP_TEE_ARB_CMD_BIN {0x00040000, 0x0000001e, 0x00000000, 0x00000008, 0x00000002, 0x0000000f}
total: 0 errors, 1 warnings, 0 checks, 188 lines checked 3d82e578d4c8 drm/i915/pxp: Add i915 trace logs for PXP operations -:11: WARNING:TYPO_SPELLING: 'trun' may be misspelled - perhaps 'turn'? #11:
To trun on this feature, we need to set
-:29: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #29: FILE: drivers/gpu/drm/i915/i915_trace.h:1038:
+ TP_STRUCT__entry(
-:36: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #36: FILE: drivers/gpu/drm/i915/i915_trace.h:1045:
+ TP_fast_assign(
total: 0 errors, 1 warnings, 2 checks, 79 lines checkeddec5cd52eeda drm/i915/pxp: Expose session state for display protection flip a944bd332fbb mei: bus: enable pavp device.ea45bdd158e3 mei: pxp: export pavp client to me client bus
-:32: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #32:
new file mode 100644
total: 0 errors, 1 warnings, 0 checks, 277 lines checked15401e360d14 drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL
-:11: ERROR:BAD_SIGN_OFF: Unrecognized email address: 'Joonas Lahtinen [email protected]' #11:
Cc: Joonas Lahtinen [email protected]
-:12: ERROR:BAD_SIGN_OFF: Unrecognized email address: 'Matthew Auld [email protected]' #12:
Cc: Matthew Auld [email protected]
-:45: ERROR:CODE_INDENT: code indent should use tabs where possible #45: FILE: drivers/gpu/drm/i915/i915_gem.c:265:
+ struct drm_i915_private *i915;$
-:45: WARNING:LEADING_SPACE: please, no spaces at the start of a line #45: FILE: drivers/gpu/drm/i915/i915_gem.c:265:
+ struct drm_i915_private *i915;$
-:49: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #49: FILE: drivers/gpu/drm/i915/i915_gem.c:269:
+static int __create_setparam(struct drm_i915_gem_object_param *args,
+ struct create_ext *ext_data)
-:94: CHECK:LINE_SPACING: Please don't use multiple blank lines #94: FILE: drivers/gpu/drm/i915/i915_gem.c:317:
+
+
-:106: WARNING:LONG_LINE: line length of 120 exceeds 100 columns #106: FILE: include/uapi/drm/i915_drm.h:395:
+#define DRM_IOCTL_I915_GEM_CREATE_EXT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create_ext)
-:154: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #154: FILE: include/uapi/drm/i915_drm.h:1737:
+#define I915_OBJECT_PARAM (1ull<<32)
^
total: 3 errors, 2 warnings, 3 checks, 136 lines checked 125fd8d725ba drm/i915/pavp: User interface for Protected buffer c968d500ff19 drm/i915/pxp: Add plane decryption support
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [01/27] drm/i915/pxp: Introduce Intel PXP component
In reply to Huang, Sean Z== Series Details ==
== Series Details ==
Series: series starting with [01/27] drm/i915/pxp: Introduce Intel PXP component
URL : https://patchwork.freedesktop.org/series/83863/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_9328 -> Patchwork_18910
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_18910 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_18910, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18910/index.html
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_18910:
### IGT changes ###
#### Possible regressions ####
* igt@core_hotunplug@unbind-rebind:
- fi-kbl-8809g: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9328/fi-kbl-8809g/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18910/fi-kbl-8809g/igt@[email protected]
- fi-bsw-nick: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9328/fi-bsw-nick/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18910/fi-bsw-nick/igt@[email protected]
New tests
---------
New tests have been introduced between CI_DRM_9328 and Patchwork_18910:
### New CI tests (1) ###
* boot:
- Statuses : 5 pass(s)
- Exec time: [0.0] s
Participating hosts (5 -> 5)
------------------------------
No changes in participating hosts
Build changes
-------------
* Linux: CI_DRM_9328 -> Patchwork_18910
CI-20190529: 20190529
CI_DRM_9328: c882f1103d140b7bdbbb7efdd2ca6abd4a3bc4e3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5850: 9748a4a0f93d108955d374a866e60cb962da9b5d @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_18910: c968d500ff194648460637aead37a00ca2f57580 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
c968d500ff19 drm/i915/pxp: Add plane decryption support 125fd8d725ba drm/i915/pavp: User interface for Protected buffer 15401e360d14 drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL ea45bdd158e3 mei: pxp: export pavp client to me client bus a944bd332fbb mei: bus: enable pavp device.dec5cd52eeda drm/i915/pxp: Expose session state for display protection flip 3d82e578d4c8 drm/i915/pxp: Add i915 trace logs for PXP operations a7c6e8e4af8e drm/i915/pxp: Create the arbitrary session after boot b68da9355145 drm/i915/pxp: Enable ioctl action to send TEE commands 12a97546fb0c drm/i915/pxp: Implement funcs to create the TEE channel 3bab939267e5 drm/i915/pxp: Enable PXP power management 3270a1c64c4e drm/i915/pxp: Termiante the session upon app crash 2f7b05c73063 drm/i915/pxp: Destroy all type0 sessions upon teardown 72b155e8c9fa drm/i915/pxp: Enable ioctl action to query PXP tag 049827bba4b3 drm/i915/pxp: Enable ioctl action to terminate the session 429636cac96a drm/i915/pxp: Func to send hardware session termination 668f4968e125 drm/i915/pxp: Enable ioctl action to set session in play 333c15e61776 drm/i915/pxp: Enable ioctl action to reserve session slot e34ed97f0df9 drm/i915/pxp: Implement funcs to get/set PXP tag b8289b5f361b drm/i915/pxp: Read register to check hardware session state 309be6f34e3c drm/i915/pxp: Add PXP-related registers into allowlist e45885b5b387 drm/i915: Rename the whitelist to allowlist 403845f7ffbd drm/i915/pxp: Enable ioctl action to set the ring3 context 1414cf460ee9 drm/i915/pxp: set KCR reg init during the boot time 3dce6e2b5551 drm/i915/pxp: Add PXP context for logical hardware states. cedefd9b5595 drm/i915/pxp: Enable PXP irq worker and callback stub ec0a75ce495b drm/i915/pxp: Introduce Intel PXP component
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_18910/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerQuoting Huang, Sean Z (2020-11-15 23:07:49)
Quoted 9 lines
PXP (Protected Xe Path) is an i915 componment, that helps ring3 to establish the hardware protected session and manage the status of each alive software session, as well as the life cycle of each session.
By design PXP will expose ioctl so allow ring3 to create, set, and destroy each session. It will also provide the communication chanel to TEE (Trusted Execution Environment) for the protected hardware session creation.
We should add a link and/or description here to the Open Source userspace component that will be using this.
Quoted 1 line
Signed-off-by Huang, Sean Z <[email protected]>
<SNIP>
drivers/gpu/drm/i915/Makefile i915-y += \ · line 259
Quoted 8 lines
+++ b/drivers/gpu/drm/i915/Makefile
drivers/gpu/drm/i915/Makefile +3
-0@@ -254,6 +254,10 @@ i915-y += \ i915-y += i915_perf.o +# Protected execution platform (PXP) support +i915-y += \ + pxp/intel_pxp.o
This should be a compile-time option, preferrably a sub-module like GVT is trending.
drivers/gpu/drm/i915/i915_drv.h line 108
Quoted 6 lines
drivers/gpu/drm/i915/i915_drv.h +2
-0+++ b/drivers/gpu/drm/i915/i915_drv.h@@ -105,6 +105,8 @@#include "intel_region_lmem.h" +#include "pxp/intel_pxp.h"
Only include the file in a more scoped fashion where it is needed, we're trying to avoid everything to be included everywhere through i915_drv.h header.
Quoted 5 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c new file +4
-0+++ b/drivers/gpu/drm/i915/pxp/intel_pxp.c@@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2020 Intel Corporation.
drivers/gpu/drm/i915/pxp/intel_pxp.c line 13
Quoted 10 lines
drivers/gpu/drm/i915/pxp/intel_pxp.c new file +10
-0+*/ + +#include "i915_drv.h" +#include "intel_pxp.h" + +int intel_pxp_init (struct drm_i915_private *i915) +{ +int ret; + +drm_info (&i915->drm,"i915_pxp_init\n" );
The messages should be human readable and bit informative.
include/uapi/drm/i915_drm.h struct drm_i915_gem_vm_control { · line 1904
Quoted 9 lines
include/uapi/drm/i915_drm.h +5
-0+++ b/include/uapi/drm/i915_drm.h@@ -1898,6 +1898,11 @@ struct drm_i915_gem_vm_control {__u32 vm_id; }; +struct drm_i915_pxp_ops { +__u64 pxp_info_ptr; +__u32 pxp_info_size; +};
This hunk is somewhat premature to add in uAPI header without any IOCTL. The uAPI bits should always be added by the last patches in the series so that bisecting will not break.
Based on the commit message, this aims to be a general purpose multiplexer IOCTL which is discouraged.
PS. "pxp_" is tautology in variable naming when the struct is pxp_ops.
Regards, Joonas
Quoted 11 lines
include/uapi/drm/i915_drm.h +1
-0+struct drm_i915_reg_read {/* * Register offset. Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx