All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: "Huang, Sean Z" <sean.z.huang@intel.com>,
	Intel-gfx@lists.freedesktop.org
Cc: Bommu Krishnaiah <krishnaiah.bommu@intel.com>,
	Joonas@freedesktop.org, Matthew@freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 25/27] drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL
Date: Tue, 17 Nov 2020 10:42:04 +0200	[thread overview]
Message-ID: <60405b7d-cb61-48c7-f4b4-d13a6adba7a3@intel.com> (raw)
In-Reply-To: <20201115210815.5272-25-sean.z.huang@intel.com>

On 15/11/2020 23:08, Huang, Sean Z wrote:
> From: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
>
> 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.
>
> Signed-off-by: Bommu Krishnaiah <krishnaiah.bommu@intel.com>
> Cc: Joonas Lahtinen joonas.lahtinen@linux.intel.com
> Cc: Matthew Auld matthew.auld@intel.com
> Cc: Telukuntla Sreedhar <sreedhar.telukuntla@intel.com>
> ---
>   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(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 73c77a4e8216..a2b5b6f2723f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -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),
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 58276694c848..41698a823737 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -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),
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index 180f97fd91dc..97d4fefa7ad8 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -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;
> +};
> +
> +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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2020-11-17  8:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-15 21:07 [Intel-gfx] [PATCH 01/27] drm/i915/pxp: Introduce Intel PXP component Huang, Sean Z
2020-11-15 21:07 ` [Intel-gfx] [PATCH 02/27] drm/i915/pxp: Enable PXP irq worker and callback stub Huang, Sean Z
2020-11-15 21:07 ` [Intel-gfx] [PATCH 03/27] drm/i915/pxp: Add PXP context for logical hardware states Huang, Sean Z
2020-11-15 21:07 ` [Intel-gfx] [PATCH 04/27] drm/i915/pxp: set KCR reg init during the boot time Huang, Sean Z
2020-11-15 21:07 ` [Intel-gfx] [PATCH 05/27] drm/i915/pxp: Enable ioctl action to set the ring3 context Huang, Sean Z
2020-11-16 10:22   ` Joonas Lahtinen
2020-11-16 10:53     ` Chris Wilson
2020-11-15 21:07 ` [Intel-gfx] [PATCH 06/27] drm/i915: Rename the whitelist to allowlist Huang, Sean Z
2020-11-16 10:26   ` Joonas Lahtinen
2020-11-16 11:33     ` Chris Wilson
2020-11-15 21:07 ` [Intel-gfx] [PATCH 07/27] drm/i915/pxp: Add PXP-related registers into allowlist Huang, Sean Z
2020-11-16 10:33   ` Joonas Lahtinen
2020-11-16 11:10     ` Chris Wilson
2020-11-15 21:07 ` [Intel-gfx] [PATCH 08/27] drm/i915/pxp: Read register to check hardware session state Huang, Sean Z
2020-11-15 21:07 ` [Intel-gfx] [PATCH 09/27] drm/i915/pxp: Implement funcs to get/set PXP tag Huang, Sean Z
2020-11-15 21:07 ` [Intel-gfx] [PATCH 10/27] drm/i915/pxp: Enable ioctl action to reserve session slot Huang, Sean Z
2020-11-16 11:01   ` Joonas Lahtinen
2020-11-15 21:07 ` [Intel-gfx] [PATCH 11/27] drm/i915/pxp: Enable ioctl action to set session in play Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 12/27] drm/i915/pxp: Func to send hardware session termination Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 13/27] drm/i915/pxp: Enable ioctl action to terminate the session Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 14/27] drm/i915/pxp: Enable ioctl action to query PXP tag Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 15/27] drm/i915/pxp: Destroy all type0 sessions upon teardown Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 16/27] drm/i915/pxp: Termiante the session upon app crash Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 17/27] drm/i915/pxp: Enable PXP power management Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 18/27] drm/i915/pxp: Implement funcs to create the TEE channel Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 19/27] drm/i915/pxp: Enable ioctl action to send TEE commands Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 20/27] drm/i915/pxp: Create the arbitrary session after boot Huang, Sean Z
2020-11-16 10:54   ` Joonas Lahtinen
2020-11-15 21:08 ` [Intel-gfx] [PATCH 21/27] drm/i915/pxp: Add i915 trace logs for PXP operations Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 22/27] drm/i915/pxp: Expose session state for display protection flip Huang, Sean Z
2020-11-16 10:49   ` Joonas Lahtinen
2020-11-16 23:37     ` Huang, Sean Z
2020-11-17  8:39   ` Anshuman Gupta
2020-11-17 19:09     ` Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 23/27] mei: bus: enable pavp device Huang, Sean Z
2020-11-16 10:46   ` Joonas Lahtinen
2020-11-16 10:49     ` Winkler, Tomas
2020-11-16 11:08       ` Joonas Lahtinen
2020-11-15 21:08 ` [Intel-gfx] [PATCH 24/27] mei: pxp: export pavp client to me client bus Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 25/27] drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL Huang, Sean Z
2020-11-16 10:38   ` Joonas Lahtinen
2020-11-16 10:39     ` Joonas Lahtinen
2020-11-17  8:42   ` Lionel Landwerlin [this message]
2020-11-15 21:08 ` [Intel-gfx] [PATCH 26/27] drm/i915/pavp: User interface for Protected buffer Huang, Sean Z
2020-11-15 21:08 ` [Intel-gfx] [PATCH 27/27] drm/i915/pxp: Add plane decryption support Huang, Sean Z
2020-11-15 21:30 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/27] drm/i915/pxp: Introduce Intel PXP component Patchwork
2020-11-15 22:00 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-11-16 10:09 ` [Intel-gfx] [PATCH 01/27] " Joonas Lahtinen
  -- strict thread matches above, loose matches on Subject: below --
2020-11-15 20:23 Huang, Sean Z
2020-11-15 20:23 ` [Intel-gfx] [PATCH 25/27] drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL Huang, Sean Z
2020-11-14  1:45 [Intel-gfx] [PATCH 01/27] drm/i915/pxp: Introduce Intel PXP component Sean Z Huang
2020-11-14  1:45 ` [Intel-gfx] [PATCH 25/27] drm/i915/uapi: introduce drm_i915_gem_create_ext for TGL Sean Z Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60405b7d-cb61-48c7-f4b4-d13a6adba7a3@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=Joonas@freedesktop.org \
    --cc=Matthew@freedesktop.org \
    --cc=krishnaiah.bommu@intel.com \
    --cc=sean.z.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.