Commit 19431b02 authored by José Roberto de Souza's avatar José Roberto de Souza Committed by Rodrigo Vivi

drm/xe/uapi: Add XE_ENGINE_GET_PROPERTY uAPI

This is intended to get some properties that are of interest of UMDs
like the ban state.

Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Reviewed-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 3949d57f
...@@ -89,6 +89,8 @@ static const struct drm_ioctl_desc xe_ioctls[] = { ...@@ -89,6 +89,8 @@ static const struct drm_ioctl_desc xe_ioctls[] = {
DRM_IOCTL_DEF_DRV(XE_VM_BIND, xe_vm_bind_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(XE_VM_BIND, xe_vm_bind_ioctl, DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(XE_ENGINE_CREATE, xe_engine_create_ioctl, DRM_IOCTL_DEF_DRV(XE_ENGINE_CREATE, xe_engine_create_ioctl,
DRM_RENDER_ALLOW), DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(XE_ENGINE_GET_PROPERTY, xe_engine_get_property_ioctl,
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(XE_ENGINE_DESTROY, xe_engine_destroy_ioctl, DRM_IOCTL_DEF_DRV(XE_ENGINE_DESTROY, xe_engine_destroy_ioctl,
DRM_RENDER_ALLOW), DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(XE_EXEC, xe_exec_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(XE_EXEC, xe_exec_ioctl, DRM_RENDER_ALLOW),
......
...@@ -639,6 +639,32 @@ int xe_engine_create_ioctl(struct drm_device *dev, void *data, ...@@ -639,6 +639,32 @@ int xe_engine_create_ioctl(struct drm_device *dev, void *data,
return err; return err;
} }
int xe_engine_get_property_ioctl(struct drm_device *dev, void *data,
struct drm_file *file)
{
struct xe_device *xe = to_xe_device(dev);
struct xe_file *xef = to_xe_file(file);
struct drm_xe_engine_get_property *args = data;
struct xe_engine *e;
mutex_lock(&xef->engine.lock);
e = xa_load(&xef->engine.xa, args->engine_id);
mutex_unlock(&xef->engine.lock);
if (XE_IOCTL_ERR(xe, !e))
return -ENOENT;
switch (args->property) {
case XE_ENGINE_GET_PROPERTY_BAN:
args->value = !!(e->flags & ENGINE_FLAG_BANNED);
break;
default:
return -EINVAL;
}
return 0;
}
static void engine_kill_compute(struct xe_engine *e) static void engine_kill_compute(struct xe_engine *e)
{ {
if (!xe_vm_in_compute_mode(e->vm)) if (!xe_vm_in_compute_mode(e->vm))
......
...@@ -50,5 +50,7 @@ int xe_engine_destroy_ioctl(struct drm_device *dev, void *data, ...@@ -50,5 +50,7 @@ int xe_engine_destroy_ioctl(struct drm_device *dev, void *data,
struct drm_file *file); struct drm_file *file);
int xe_engine_set_property_ioctl(struct drm_device *dev, void *data, int xe_engine_set_property_ioctl(struct drm_device *dev, void *data,
struct drm_file *file); struct drm_file *file);
int xe_engine_get_property_ioctl(struct drm_device *dev, void *data,
struct drm_file *file);
#endif #endif
...@@ -118,6 +118,7 @@ struct xe_user_extension { ...@@ -118,6 +118,7 @@ struct xe_user_extension {
#define DRM_XE_ENGINE_SET_PROPERTY 0x0a #define DRM_XE_ENGINE_SET_PROPERTY 0x0a
#define DRM_XE_WAIT_USER_FENCE 0x0b #define DRM_XE_WAIT_USER_FENCE 0x0b
#define DRM_XE_VM_MADVISE 0x0c #define DRM_XE_VM_MADVISE 0x0c
#define DRM_XE_ENGINE_GET_PROPERTY 0x0d
/* Must be kept compact -- no holes */ /* 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) #define DRM_IOCTL_XE_DEVICE_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query)
...@@ -127,6 +128,7 @@ struct xe_user_extension { ...@@ -127,6 +128,7 @@ struct xe_user_extension {
#define DRM_IOCTL_XE_VM_DESTROY DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy) #define DRM_IOCTL_XE_VM_DESTROY DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)
#define DRM_IOCTL_XE_VM_BIND DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind) #define DRM_IOCTL_XE_VM_BIND DRM_IOW( DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)
#define DRM_IOCTL_XE_ENGINE_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_ENGINE_CREATE, struct drm_xe_engine_create) #define DRM_IOCTL_XE_ENGINE_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_ENGINE_CREATE, struct drm_xe_engine_create)
#define DRM_IOCTL_XE_ENGINE_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_ENGINE_GET_PROPERTY, struct drm_xe_engine_get_property)
#define DRM_IOCTL_XE_ENGINE_DESTROY DRM_IOW( DRM_COMMAND_BASE + DRM_XE_ENGINE_DESTROY, struct drm_xe_engine_destroy) #define DRM_IOCTL_XE_ENGINE_DESTROY DRM_IOW( DRM_COMMAND_BASE + DRM_XE_ENGINE_DESTROY, struct drm_xe_engine_destroy)
#define DRM_IOCTL_XE_EXEC DRM_IOW( DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec) #define DRM_IOCTL_XE_EXEC DRM_IOW( DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
#define DRM_IOCTL_XE_MMIO DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_MMIO, struct drm_xe_mmio) #define DRM_IOCTL_XE_MMIO DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_MMIO, struct drm_xe_mmio)
...@@ -568,8 +570,26 @@ struct drm_xe_engine_create { ...@@ -568,8 +570,26 @@ struct drm_xe_engine_create {
__u64 reserved[2]; __u64 reserved[2];
}; };
struct drm_xe_engine_get_property {
/** @extensions: Pointer to the first extension struct, if any */
__u64 extensions;
/** @engine_id: Engine ID */
__u32 engine_id;
/** @property: property to get */
#define XE_ENGINE_GET_PROPERTY_BAN 0
__u32 property;
/** @value: property value */
__u64 value;
/** @reserved: Reserved */
__u64 reserved[2];
};
struct drm_xe_engine_destroy { struct drm_xe_engine_destroy {
/** @vm_id: VM ID */ /** @engine_id: Engine ID */
__u32 engine_id; __u32 engine_id;
/** @pad: MBZ */ /** @pad: MBZ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment