<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
My bad... yes I meant signed-off.<span id="ms-outlook-android-cursor"></span><br>
</div>
<div dir="auto" style="direction: ltr; margin: 0; padding: 0; font-family: sans-serif; font-size: 11pt; color: black; ">
...alan</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Latvala, Petri <petri.latvala@intel.com><br>
<b>Sent:</b> Tuesday, October 5, 2021 12:05:17 AM<br>
<b>To:</b> Teres Alexis, Alan Previn <alan.previn.teres.alexis@intel.com><br>
<b>Cc:</b> igt-dev@lists.freedesktop.org <igt-dev@lists.freedesktop.org><br>
<b>Subject:</b> Re: [igt-dev] [PATCH i-g-t v12 01/15] i915_drm.h sync</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Mon, Oct 04, 2021 at 03:39:35PM -0700, Alan Previn wrote:<br>
> Sync UAPI for to get GEM_CREATE_EXT's I915_OBJECT_PARAM_PROTECTED_CONTENT<br>
> and GEM_CONTEXT_CREATE's I915_CONTEXT_PARAM_PROTECTED_CONTENT<br>
> <br>
> Taken from kernel commit:<br>
> commit d3ac8d42168a9be7380be8035df8b6d3780ec2a1<br>
> ("drm/i915/pxp: interfaces for using protected objects.")<br>
> <br>
> Reviewed-by: Alan Previn <alan.previn.teres.alexis@intel.com><br>
<br>
You probably meant Signed-off-by.<br>
<br>
<br>
-- <br>
Petri Latvala<br>
<br>
<br>
> ---<br>
> include/drm-uapi/i915_drm.h | 94 +++++++++++++++++++++++++++++++++++++<br>
> 1 file changed, 94 insertions(+)<br>
> <br>
> diff --git a/include/drm-uapi/i915_drm.h b/include/drm-uapi/i915_drm.h<br>
> index f4691fcc..6e81f6ea 100644<br>
> --- a/include/drm-uapi/i915_drm.h<br>
> +++ b/include/drm-uapi/i915_drm.h<br>
> @@ -1815,6 +1815,55 @@ struct drm_i915_gem_context_param {<br>
> * attempted to use it, never re-use this context param number.<br>
> */<br>
> #define I915_CONTEXT_PARAM_RINGSIZE 0xc<br>
> +<br>
> +/*<br>
> + * I915_CONTEXT_PARAM_PROTECTED_CONTENT:<br>
> + *<br>
> + * Mark that the context makes use of protected content, which will result<br>
> + * in the context being invalidated when the protected content session is.<br>
> + * Given that the protected content session is killed on suspend, the device<br>
> + * is kept awake for the lifetime of a protected context, so the user should<br>
> + * make sure to dispose of them once done.<br>
> + * This flag can only be set at context creation time and, when set to true,<br>
> + * must be preceded by an explicit setting of I915_CONTEXT_PARAM_RECOVERABLE<br>
> + * to false. This flag can't be set to true in conjunction with setting the<br>
> + * I915_CONTEXT_PARAM_BANNABLE flag to false. Creation example:<br>
> + *<br>
> + * .. code-block:: C<br>
> + *<br>
> + * struct drm_i915_gem_context_create_ext_setparam p_protected = {<br>
> + * .base = {<br>
> + * .name = I915_CONTEXT_CREATE_EXT_SETPARAM,<br>
> + * },<br>
> + * .param = {<br>
> + * .param = I915_CONTEXT_PARAM_PROTECTED_CONTENT,<br>
> + * .value = 1,<br>
> + * }<br>
> + * };<br>
> + * struct drm_i915_gem_context_create_ext_setparam p_norecover = {<br>
> + * .base = {<br>
> + * .name = I915_CONTEXT_CREATE_EXT_SETPARAM,<br>
> + * .next_extension = to_user_pointer(&p_protected),<br>
> + * },<br>
> + * .param = {<br>
> + * .param = I915_CONTEXT_PARAM_RECOVERABLE,<br>
> + * .value = 0,<br>
> + * }<br>
> + * };<br>
> + * struct drm_i915_gem_context_create_ext create = {<br>
> + * .flags = I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS,<br>
> + * .extensions = to_user_pointer(&p_norecover);<br>
> + * };<br>
> + *<br>
> + * ctx_id = gem_context_create_ext(drm_fd, &create);<br>
> + *<br>
> + * In addition to the normal failure cases, setting this flag during context<br>
> + * creation can result in the following errors:<br>
> + *<br>
> + * -ENODEV: feature not available<br>
> + * -EPERM: trying to mark a recoverable or not bannable context as protected<br>
> + */<br>
> +#define I915_CONTEXT_PARAM_PROTECTED_CONTENT 0xd<br>
> /* Must be kept compact -- no holes and well documented */<br>
> <br>
> __u64 value;<br>
> @@ -2931,8 +2980,12 @@ struct drm_i915_gem_create_ext {<br>
> *<br>
> * For I915_GEM_CREATE_EXT_MEMORY_REGIONS usage see<br>
> * struct drm_i915_gem_create_ext_memory_regions.<br>
> + *<br>
> + * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see<br>
> + * struct drm_i915_gem_create_ext_protected_content.<br>
> */<br>
> #define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0<br>
> +#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1<br>
> __u64 extensions;<br>
> };<br>
> <br>
> @@ -2990,6 +3043,47 @@ struct drm_i915_gem_create_ext_memory_regions {<br>
> __u64 regions;<br>
> };<br>
> <br>
> +/**<br>
> + * struct drm_i915_gem_create_ext_protected_content - The<br>
> + * I915_OBJECT_PARAM_PROTECTED_CONTENT extension.<br>
> + *<br>
> + * If this extension is provided, buffer contents are expected to be protected<br>
> + * by PXP encryption and require decryption for scan out and processing. This<br>
> + * is only possible on platforms that have PXP enabled, on all other scenarios<br>
> + * using this extension will cause the ioctl to fail and return -ENODEV. The<br>
> + * flags parameter is reserved for future expansion and must currently be set<br>
> + * to zero.<br>
> + *<br>
> + * The buffer contents are considered invalid after a PXP session teardown.<br>
> + *<br>
> + * The encryption is guaranteed to be processed correctly only if the object<br>
> + * is submitted with a context created using the<br>
> + * I915_CONTEXT_PARAM_PROTECTED_CONTENT flag. This will also enable extra checks<br>
> + * at submission time on the validity of the objects involved.<br>
> + *<br>
> + * Below is an example on how to create a protected object:<br>
> + *<br>
> + * .. code-block:: C<br>
> + *<br>
> + * struct drm_i915_gem_create_ext_protected_content protected_ext = {<br>
> + * .base = { .name = I915_GEM_CREATE_EXT_PROTECTED_CONTENT },<br>
> + * .flags = 0,<br>
> + * };<br>
> + * struct drm_i915_gem_create_ext create_ext = {<br>
> + * .size = PAGE_SIZE,<br>
> + * .extensions = (uintptr_t)&protected_ext,<br>
> + * };<br>
> + *<br>
> + * int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);<br>
> + * if (err) ...<br>
> + */<br>
> +struct drm_i915_gem_create_ext_protected_content {<br>
> + /** @base: Extension link. See struct i915_user_extension. */<br>
> + struct i915_user_extension base;<br>
> + /** @flags: reserved for future usage, currently MBZ */<br>
> + __u32 flags;<br>
> +};<br>
> +<br>
> /* ID of the protected content session managed by i915 when PXP is active */<br>
> #define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf<br>
> <br>
> -- <br>
> 2.25.1<br>
> <br>
</div>
</span></font></div>
</body>
</html>