blob: 12e4262104b4bb721660f4b352117ede99ada7b2 [file] [log] [blame]
From fbd14bd460cb1114ce7f7823747a391fbf0db55b Mon Sep 17 00:00:00 2001
From: Sachin Kumar <sachin.kumar@intel.com>
Date: Wed, 30 Aug 2023 05:53:49 +0000
Subject: [PATCH] CHROMIUM: drm/i915/pxp: import downstream pxp definitions
To avoid ioctl define collision and upstream conflicts, definitions for
PXP multi-session downstream implementation will live in
include/uapi/drm/i915_drm_downstream.h.
These definitions must be synchornized with other kernels that support
PXP.
BUG=b:257876317
TEST=emerge-rex sys-kernel/chromeos-kernel-6_1
Change-Id: I4d51a5386de29cadca1ef5334cccd3538d02c257
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4825548
Reviewed-by: Paz Zcharya <pazz@google.com>
Reviewed-by: Juston Li <justonli@google.com>
Commit-Queue: Sachin Kumar <sachin.kumar@intel.com>
Tested-by: Hasan Abuzaina <hasan.m.abuzaina@intel.corp-partner.google.com>
---
include/uapi/drm/i915_drm.h | 1 +
include/uapi/drm/i915_drm_prelim.h | 76 ++++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
create mode 100644 include/uapi/drm/i915_drm_prelim.h
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 063ffb43890fa857a8bdc149a4fff546991eebd2..129ee568f94e2d934d2ee767a7878a6a87f36c05 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -3839,6 +3839,7 @@ struct drm_i915_gem_create_ext_set_pat {
};
#include "i915_drm_downstream.h"
+#include "i915_drm_prelim.h"
/* ID of the protected content session managed by i915 when PXP is active */
#define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf
diff --git a/include/uapi/drm/i915_drm_prelim.h b/include/uapi/drm/i915_drm_prelim.h
new file mode 100644
index 0000000000000000000000000000000000000000..951d0a1fb5cdfc3cc9d42c87cd97176dbfbadb7c
--- /dev/null
+++ b/include/uapi/drm/i915_drm_prelim.h
@@ -0,0 +1,76 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2021 Intel Corporation
+ */
+
+#ifndef __I915_DRM_PRELIM_H__
+#define __I915_DRM_PRELIM_H__
+
+#include "drm.h"
+
+/*
+ * Modifications to structs/values defined here are subject to
+ * backwards-compatibility constraints.
+ *
+ * Internal/downstream declarations must be added here, not to
+ * i915_drm.h. The values in i915_drm_prelim.h must also be kept
+ * synchronized with values in i915_drm.h.
+ */
+
+/* PRELIM ioctl numbers go down from 0x5f */
+#define PRELIM_DRM_I915_PXP_OPS 0x52
+/* NOTE: PXP_OPS PRELIM ioctl code 0x52 maintains compatibility with DII-server products */
+
+#define PRELIM_DRM_IOCTL_I915_PXP_OPS DRM_IOWR(DRM_COMMAND_BASE + PRELIM_DRM_I915_PXP_OPS, \
+ struct prelim_drm_i915_pxp_ops)
+
+/* End PRELIM ioctl's */
+
+/*
+ * struct pxp_set_session_status_params - Params to reserved, set or destroy
+ * the session from the PXP state machine.
+ */
+struct prelim_drm_i915_pxp_set_session_status_params {
+ __u32 pxp_tag; /* in/out, session identifier tag */
+ __u32 session_type; /* in, session type */
+ __u32 session_mode; /* in, session mode */
+#define PRELIM_DRM_I915_PXP_MODE_LM 0
+#define PRELIM_DRM_I915_PXP_MODE_HM 1
+#define PRELIM_DRM_I915_PXP_MODE_SM 2
+
+ __u32 req_session_state; /* in, new session state */
+ /* Request KMD to allocate session id and move it to INIT */
+#define PRELIM_DRM_I915_PXP_REQ_SESSION_ID_INIT 0
+ /* Inform KMD that UMD has completed the initialization */
+#define PRELIM_DRM_I915_PXP_REQ_SESSION_IN_PLAY 1
+ /* Request KMD to terminate the session */
+#define PRELIM_DRM_I915_PXP_REQ_SESSION_TERMINATE 2
+} __attribute__((packed));
+
+/*
+ * DRM_I915_PXP_OPS -
+ *
+ * PXP is an i915 componment, that helps user space to establish the hardware
+ * protected session and manage the status of each alive software session,
+ * as well as the life cycle of each session.
+ *
+ * This ioctl is to allow user space driver to create, set, and destroy each
+ * session. It also provides the communication chanel to TEE (Trusted
+ * Execution Environment) for the protected hardware session creation.
+ */
+
+struct prelim_drm_i915_pxp_ops {
+ __u32 action; /* in - specified action of this operation */
+#define PRELIM_DRM_I915_PXP_ACTION_SET_SESSION_STATUS 0
+
+ __u32 status; /* out - status output for this operation */
+#define PRELIM_DRM_I915_PXP_OP_STATUS_SUCCESS 0
+#define PRELIM_DRM_I915_PXP_OP_STATUS_RETRY_REQUIRED 1
+#define PRELIM_DRM_I915_PXP_OP_STATUS_SESSION_NOT_AVAILABLE 2
+#define PRELIM_DRM_I915_PXP_OP_STATUS_ERROR_UNKNOWN 3
+
+ __u64 params; /* in/out - pointer to data matching the action */
+} __attribute__((packed));
+
+#endif /* __I915_DRM_PRELIM_H__ */
+
--
2.34.1