Commit aa5fe428 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-xe-fixes-2024-02-29' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes



UAPI Changes:
- A couple of tracepoint updates from Priyanka and Lucas.
- Make sure BINDs are completed before accepting UNBINDs on LR vms.
- Don't arbitrarily restrict max number of batched binds.
- Add uapi for dumpable bos (agreed on IRC).
- Remove unused uapi flags and a leftover comment.

Driver Changes:
- A couple of fixes related to the execlist backend.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZeCBg4MA2hd1oggN@fedora
parents 45046af3 8188cae3
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -28,6 +28,14 @@
#include "xe_ttm_stolen_mgr.h"
#include "xe_vm.h"

const char *const xe_mem_type_to_name[TTM_NUM_MEM_TYPES]  = {
	[XE_PL_SYSTEM] = "system",
	[XE_PL_TT] = "gtt",
	[XE_PL_VRAM0] = "vram0",
	[XE_PL_VRAM1] = "vram1",
	[XE_PL_STOLEN] = "stolen"
};

static const struct ttm_place sys_placement_flags = {
	.fpfn = 0,
	.lpfn = 0,
@@ -713,8 +721,7 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
		migrate = xe->tiles[0].migrate;

	xe_assert(xe, migrate);

	trace_xe_bo_move(bo);
	trace_xe_bo_move(bo, new_mem->mem_type, old_mem_type, move_lacks_source);
	xe_device_mem_access_get(xe);

	if (xe_bo_is_pinned(bo) && !xe_bo_is_user(bo)) {
+1 −0
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ int xe_bo_evict_pinned(struct xe_bo *bo);
int xe_bo_restore_pinned(struct xe_bo *bo);

extern struct ttm_device_funcs xe_ttm_funcs;
extern const char *const xe_mem_type_to_name[];

int xe_gem_create_ioctl(struct drm_device *dev, void *data,
			struct drm_file *file);
+2 −10
Original line number Diff line number Diff line
@@ -131,14 +131,6 @@ static void bo_meminfo(struct xe_bo *bo,

static void show_meminfo(struct drm_printer *p, struct drm_file *file)
{
	static const char *const mem_type_to_name[TTM_NUM_MEM_TYPES]  = {
		[XE_PL_SYSTEM] = "system",
		[XE_PL_TT] = "gtt",
		[XE_PL_VRAM0] = "vram0",
		[XE_PL_VRAM1] = "vram1",
		[4 ... 6] = NULL,
		[XE_PL_STOLEN] = "stolen"
	};
	struct drm_memory_stats stats[TTM_NUM_MEM_TYPES] = {};
	struct xe_file *xef = file->driver_priv;
	struct ttm_device *bdev = &xef->xe->ttm;
@@ -171,7 +163,7 @@ static void show_meminfo(struct drm_printer *p, struct drm_file *file)
	spin_unlock(&client->bos_lock);

	for (mem_type = XE_PL_SYSTEM; mem_type < TTM_NUM_MEM_TYPES; ++mem_type) {
		if (!mem_type_to_name[mem_type])
		if (!xe_mem_type_to_name[mem_type])
			continue;

		man = ttm_manager_type(bdev, mem_type);
@@ -182,7 +174,7 @@ static void show_meminfo(struct drm_printer *p, struct drm_file *file)
					       DRM_GEM_OBJECT_RESIDENT |
					       (mem_type != XE_PL_SYSTEM ? 0 :
					       DRM_GEM_OBJECT_PURGEABLE),
					       mem_type_to_name[mem_type]);
					       xe_mem_type_to_name[mem_type]);
		}
	}
}
+3 −85
Original line number Diff line number Diff line
@@ -309,85 +309,6 @@ static int exec_queue_set_timeslice(struct xe_device *xe, struct xe_exec_queue *
	return q->ops->set_timeslice(q, value);
}

static int exec_queue_set_preemption_timeout(struct xe_device *xe,
					     struct xe_exec_queue *q, u64 value,
					     bool create)
{
	u32 min = 0, max = 0;

	xe_exec_queue_get_prop_minmax(q->hwe->eclass,
				      XE_EXEC_QUEUE_PREEMPT_TIMEOUT, &min, &max);

	if (xe_exec_queue_enforce_schedule_limit() &&
	    !xe_hw_engine_timeout_in_range(value, min, max))
		return -EINVAL;

	return q->ops->set_preempt_timeout(q, value);
}

static int exec_queue_set_job_timeout(struct xe_device *xe, struct xe_exec_queue *q,
				      u64 value, bool create)
{
	u32 min = 0, max = 0;

	if (XE_IOCTL_DBG(xe, !create))
		return -EINVAL;

	xe_exec_queue_get_prop_minmax(q->hwe->eclass,
				      XE_EXEC_QUEUE_JOB_TIMEOUT, &min, &max);

	if (xe_exec_queue_enforce_schedule_limit() &&
	    !xe_hw_engine_timeout_in_range(value, min, max))
		return -EINVAL;

	return q->ops->set_job_timeout(q, value);
}

static int exec_queue_set_acc_trigger(struct xe_device *xe, struct xe_exec_queue *q,
				      u64 value, bool create)
{
	if (XE_IOCTL_DBG(xe, !create))
		return -EINVAL;

	if (XE_IOCTL_DBG(xe, !xe->info.has_usm))
		return -EINVAL;

	q->usm.acc_trigger = value;

	return 0;
}

static int exec_queue_set_acc_notify(struct xe_device *xe, struct xe_exec_queue *q,
				     u64 value, bool create)
{
	if (XE_IOCTL_DBG(xe, !create))
		return -EINVAL;

	if (XE_IOCTL_DBG(xe, !xe->info.has_usm))
		return -EINVAL;

	q->usm.acc_notify = value;

	return 0;
}

static int exec_queue_set_acc_granularity(struct xe_device *xe, struct xe_exec_queue *q,
					  u64 value, bool create)
{
	if (XE_IOCTL_DBG(xe, !create))
		return -EINVAL;

	if (XE_IOCTL_DBG(xe, !xe->info.has_usm))
		return -EINVAL;

	if (value > DRM_XE_ACC_GRANULARITY_64M)
		return -EINVAL;

	q->usm.acc_granularity = value;

	return 0;
}

typedef int (*xe_exec_queue_set_property_fn)(struct xe_device *xe,
					     struct xe_exec_queue *q,
					     u64 value, bool create);
@@ -395,11 +316,6 @@ typedef int (*xe_exec_queue_set_property_fn)(struct xe_device *xe,
static const xe_exec_queue_set_property_fn exec_queue_set_property_funcs[] = {
	[DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY] = exec_queue_set_priority,
	[DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE] = exec_queue_set_timeslice,
	[DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT] = exec_queue_set_preemption_timeout,
	[DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT] = exec_queue_set_job_timeout,
	[DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER] = exec_queue_set_acc_trigger,
	[DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY] = exec_queue_set_acc_notify,
	[DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY] = exec_queue_set_acc_granularity,
};

static int exec_queue_user_ext_set_property(struct xe_device *xe,
@@ -418,7 +334,9 @@ static int exec_queue_user_ext_set_property(struct xe_device *xe,

	if (XE_IOCTL_DBG(xe, ext.property >=
			 ARRAY_SIZE(exec_queue_set_property_funcs)) ||
	    XE_IOCTL_DBG(xe, ext.pad))
	    XE_IOCTL_DBG(xe, ext.pad) ||
	    XE_IOCTL_DBG(xe, ext.property != DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY &&
			 ext.property != DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE))
		return -EINVAL;

	idx = array_index_nospec(ext.property, ARRAY_SIZE(exec_queue_set_property_funcs));
+0 −10
Original line number Diff line number Diff line
@@ -150,16 +150,6 @@ struct xe_exec_queue {
		spinlock_t lock;
	} compute;

	/** @usm: unified shared memory state */
	struct {
		/** @acc_trigger: access counter trigger */
		u32 acc_trigger;
		/** @acc_notify: access counter notify */
		u32 acc_notify;
		/** @acc_granularity: access counter granularity */
		u32 acc_granularity;
	} usm;

	/** @ops: submission backend exec queue operations */
	const struct xe_exec_queue_ops *ops;

Loading