mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-04 04:04:19 +00:00
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: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
3949d57f1e
commit
19431b029b
@ -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_ENGINE_CREATE, xe_engine_create_ioctl,
|
||||
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_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,
|
||||
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)
|
||||
{
|
||||
if (!xe_vm_in_compute_mode(e->vm))
|
||||
|
@ -50,5 +50,7 @@ int xe_engine_destroy_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file);
|
||||
int xe_engine_set_property_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file);
|
||||
int xe_engine_get_property_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file);
|
||||
|
||||
#endif
|
||||
|
@ -118,6 +118,7 @@ struct xe_user_extension {
|
||||
#define DRM_XE_ENGINE_SET_PROPERTY 0x0a
|
||||
#define DRM_XE_WAIT_USER_FENCE 0x0b
|
||||
#define DRM_XE_VM_MADVISE 0x0c
|
||||
#define DRM_XE_ENGINE_GET_PROPERTY 0x0d
|
||||
|
||||
/* 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)
|
||||
@ -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_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_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_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)
|
||||
@ -568,8 +570,26 @@ struct drm_xe_engine_create {
|
||||
__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 {
|
||||
/** @vm_id: VM ID */
|
||||
/** @engine_id: Engine ID */
|
||||
__u32 engine_id;
|
||||
|
||||
/** @pad: MBZ */
|
||||
|
Loading…
Reference in New Issue
Block a user