[Intel-xe] [RFC PATCH v3 2/2] drm/xe/uapi: Add query engines uAPI

Matthew Auld matthew.william.auld at gmail.com
Thu Mar 23 09:43:24 UTC 2023


On Thu, 23 Mar 2023 at 02:58, Matthew Brost <matthew.brost at intel.com> wrote:
>
> Not all hardware engines are created equally, certain instance have
> unique capabilities or properties. Introduce a uAPI to query for both
> capabilities and properties. The capabilities are represented by a bit
> mask which is unique to each class. The properties are represented by a
> name and value return in an array to the user.
>
> v3: s/xe_engine/xe_hw_engine
>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> ---
>  include/uapi/drm/xe_drm.h | 41 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 89596d353d3e..2f936fe2e452 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -119,6 +119,7 @@ struct xe_user_extension {
>  #define DRM_XE_WAIT_USER_FENCE         0x0b
>  #define DRM_XE_VM_MADVISE              0x0c
>  #define DRM_XE_ENGINE_GET_PROPERTY     0x0d
> +#define DRM_XE_HW_ENGINE_QUERY         0x0f
>
>  /* Must be kept compact -- no holes */
>  #define DRM_IOCTL_XE_DEVICE_QUERY              DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query)
> @@ -135,6 +136,7 @@ struct xe_user_extension {
>  #define DRM_IOCTL_XE_ENGINE_SET_PROPERTY       DRM_IOW( DRM_COMMAND_BASE + DRM_XE_ENGINE_SET_PROPERTY, struct drm_xe_engine_set_property)
>  #define DRM_IOCTL_XE_WAIT_USER_FENCE           DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)
>  #define DRM_IOCTL_XE_VM_MADVISE                        DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise)
> +#define DRM_IOCTL_XE_ENGINE_QUERY              DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_HW_ENGINE_QUERY, struct drm_xe_hw_engine_query)
>
>  struct drm_xe_hw_engine_class_instance {
>         __u16 engine_class;
> @@ -253,6 +255,45 @@ struct drm_xe_device_query {
>         __u64 reserved[2];
>  };
>
> +struct drm_xe_hw_engine_query_property {
> +       /** @name: name of the property */
> +       __u64 name;
> +
> +       /** @value: value property */
> +       __u64 value;
> +
> +       /** @reserved: reserved */
> +       __u64 reserved[2];
> +};
> +
> +struct drm_xe_hw_engine_query {
> +       /** @extensions: pointer to the first extension struct, if any */
> +       __u64 extensions;
> +
> +       /** @eci: engine class instance to query */
> +       struct drm_xe_hw_engine_class_instance eci;
> +
> +       /** @capabilities: bit mask of capabilities, specific to each class */
> +       __u64 capabilities;
> +
> +       /**
> +        * @size: Size of the queried properties, if user passes in zero the KMD
> +        * returns the size of the properties array, if user passes in the size
> +        * of the properties array the KMD copies the properties to the user
> +        * pointer.
> +        */
> +       __u32 size;

Just a drive-by-comment, AFAICT we need some kind of __u32 pad here?

> +
> +       /**
> +        * @properties: user pointer to which an array of  struct
> +        * drm_xe_hw_engine_query_property are copied to if size is non-zero
> +        */
> +       __u64 properties;
> +
> +       /** @reserved: reserved */
> +       __u64 reserved[2];
> +};
> +
>  struct drm_xe_gem_create {
>         /** @extensions: Pointer to the first extension struct, if any */
>         __u64 extensions;
> --
> 2.34.1
>


More information about the Intel-xe mailing list