return e;
}
+enum xe_engine_priority
+xe_engine_device_get_max_priority(struct xe_device *xe)
+{
+ return capable(CAP_SYS_NICE) ? XE_ENGINE_PRIORITY_HIGH :
+ XE_ENGINE_PRIORITY_NORMAL;
+}
+
static int engine_set_priority(struct xe_device *xe, struct xe_engine *e,
u64 value, bool create)
{
if (XE_IOCTL_ERR(xe, value > XE_ENGINE_PRIORITY_HIGH))
return -EINVAL;
- if (XE_IOCTL_ERR(xe, value == XE_ENGINE_PRIORITY_HIGH &&
- !capable(CAP_SYS_NICE)))
+ if (XE_IOCTL_ERR(xe, value > xe_engine_device_get_max_priority(xe)))
return -EPERM;
return e->ops->set_priority(e, value);
struct drm_file *file);
int xe_engine_get_property_ioctl(struct drm_device *dev, void *data,
struct drm_file *file);
+enum xe_engine_priority xe_engine_device_get_max_priority(struct xe_device *xe);
#endif
#include "xe_bo.h"
#include "xe_device.h"
+#include "xe_engine.h"
#include "xe_ggtt.h"
#include "xe_gt.h"
#include "xe_guc_hwconfig.h"
config->info[XE_QUERY_CONFIG_GT_COUNT] = xe->info.tile_count;
config->info[XE_QUERY_CONFIG_MEM_REGION_COUNT] =
hweight_long(xe->info.mem_region_mask);
+ config->info[XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY] =
+ xe_engine_device_get_max_priority(xe);
if (copy_to_user(query_ptr, config, size)) {
kfree(config);
#define XE_QUERY_CONFIG_VA_BITS 3
#define XE_QUERY_CONFIG_GT_COUNT 4
#define XE_QUERY_CONFIG_MEM_REGION_COUNT 5
-#define XE_QUERY_CONFIG_NUM_PARAM XE_QUERY_CONFIG_MEM_REGION_COUNT + 1
+#define XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY 6
+#define XE_QUERY_CONFIG_NUM_PARAM XE_QUERY_CONFIG_MAX_ENGINE_PRIORITY + 1
__u64 info[];
};