Commit 9b9529ce authored by Francois Dugast's avatar Francois Dugast Committed by Rodrigo Vivi
Browse files

drm/xe: Rename engine to exec_queue

Engine was inappropriately used to refer to execution queues and it
also created some confusion with hardware engines. Where it applies
the exec_queue variable name is changed to q and comments are also
updated.

Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/162


Signed-off-by: default avatarFrancois Dugast <francois.dugast@intel.com>
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent c22a4ed0
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ static int run_sanity_job(struct xe_migrate *m, struct xe_device *xe,
			  struct kunit *test)
{
	u64 batch_base = xe_migrate_batch_base(m, xe->info.supports_usm);
	struct xe_sched_job *job = xe_bb_create_migration_job(m->eng, bb,
	struct xe_sched_job *job = xe_bb_create_migration_job(m->q, bb,
							      batch_base,
							      second_idx);
	struct dma_fence *fence;
@@ -215,7 +215,7 @@ static void test_pt_update(struct xe_migrate *m, struct xe_bo *pt,
	xe_map_memset(xe, &pt->vmap, 0, (u8)expected, pt->size);

	then = ktime_get();
	fence = xe_migrate_update_pgtables(m, NULL, NULL, m->eng, &update, 1,
	fence = xe_migrate_update_pgtables(m, NULL, NULL, m->q, &update, 1,
					   NULL, 0, &pt_update);
	now = ktime_get();
	if (sanity_fence_failed(xe, fence, "Migration pagetable update", test))
@@ -257,7 +257,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
		return;
	}

	big = xe_bo_create_pin_map(xe, tile, m->eng->vm, SZ_4M,
	big = xe_bo_create_pin_map(xe, tile, m->q->vm, SZ_4M,
				   ttm_bo_type_kernel,
				   XE_BO_CREATE_VRAM_IF_DGFX(tile) |
				   XE_BO_CREATE_PINNED_BIT);
@@ -266,7 +266,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
		goto vunmap;
	}

	pt = xe_bo_create_pin_map(xe, tile, m->eng->vm, XE_PAGE_SIZE,
	pt = xe_bo_create_pin_map(xe, tile, m->q->vm, XE_PAGE_SIZE,
				  ttm_bo_type_kernel,
				  XE_BO_CREATE_VRAM_IF_DGFX(tile) |
				  XE_BO_CREATE_PINNED_BIT);
@@ -276,7 +276,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
		goto free_big;
	}

	tiny = xe_bo_create_pin_map(xe, tile, m->eng->vm,
	tiny = xe_bo_create_pin_map(xe, tile, m->q->vm,
				    2 * SZ_4K,
				    ttm_bo_type_kernel,
				    XE_BO_CREATE_VRAM_IF_DGFX(tile) |
@@ -295,14 +295,14 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
	}

	kunit_info(test, "Starting tests, top level PT addr: %lx, special pagetable base addr: %lx\n",
		   (unsigned long)xe_bo_main_addr(m->eng->vm->pt_root[id]->bo, XE_PAGE_SIZE),
		   (unsigned long)xe_bo_main_addr(m->q->vm->pt_root[id]->bo, XE_PAGE_SIZE),
		   (unsigned long)xe_bo_main_addr(m->pt_bo, XE_PAGE_SIZE));

	/* First part of the test, are we updating our pagetable bo with a new entry? */
	xe_map_wr(xe, &bo->vmap, XE_PAGE_SIZE * (NUM_KERNEL_PDE - 1), u64,
		  0xdeaddeadbeefbeef);
	expected = xe_pte_encode(pt, 0, XE_CACHE_WB, 0);
	if (m->eng->vm->flags & XE_VM_FLAG_64K)
	if (m->q->vm->flags & XE_VM_FLAG_64K)
		expected |= XE_PTE_PS64;
	if (xe_bo_is_vram(pt))
		xe_res_first(pt->ttm.resource, 0, pt->size, &src_it);
@@ -399,11 +399,11 @@ static int migrate_test_run_device(struct xe_device *xe)
		struct ww_acquire_ctx ww;

		kunit_info(test, "Testing tile id %d.\n", id);
		xe_vm_lock(m->eng->vm, &ww, 0, true);
		xe_vm_lock(m->q->vm, &ww, 0, true);
		xe_device_mem_access_get(xe);
		xe_migrate_sanity_test(m, test);
		xe_device_mem_access_put(xe);
		xe_vm_unlock(m->eng->vm, &ww);
		xe_vm_unlock(m->q->vm, &ww);
	}

	return 0;
+13 −13
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@

#include "regs/xe_gpu_commands.h"
#include "xe_device.h"
#include "xe_engine_types.h"
#include "xe_exec_queue_types.h"
#include "xe_gt.h"
#include "xe_hw_fence.h"
#include "xe_sa.h"
@@ -60,30 +60,30 @@ struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm)
}

static struct xe_sched_job *
__xe_bb_create_job(struct xe_engine *kernel_eng, struct xe_bb *bb, u64 *addr)
__xe_bb_create_job(struct xe_exec_queue *q, struct xe_bb *bb, u64 *addr)
{
	u32 size = drm_suballoc_size(bb->bo);

	bb->cs[bb->len++] = MI_BATCH_BUFFER_END;

	WARN_ON(bb->len * 4 + bb_prefetch(kernel_eng->gt) > size);
	WARN_ON(bb->len * 4 + bb_prefetch(q->gt) > size);

	xe_sa_bo_flush_write(bb->bo);

	return xe_sched_job_create(kernel_eng, addr);
	return xe_sched_job_create(q, addr);
}

struct xe_sched_job *xe_bb_create_wa_job(struct xe_engine *wa_eng,
struct xe_sched_job *xe_bb_create_wa_job(struct xe_exec_queue *q,
					 struct xe_bb *bb, u64 batch_base_ofs)
{
	u64 addr = batch_base_ofs + drm_suballoc_soffset(bb->bo);

	XE_WARN_ON(!(wa_eng->vm->flags & XE_VM_FLAG_MIGRATION));
	XE_WARN_ON(!(q->vm->flags & XE_VM_FLAG_MIGRATION));

	return __xe_bb_create_job(wa_eng, bb, &addr);
	return __xe_bb_create_job(q, bb, &addr);
}

struct xe_sched_job *xe_bb_create_migration_job(struct xe_engine *kernel_eng,
struct xe_sched_job *xe_bb_create_migration_job(struct xe_exec_queue *q,
						struct xe_bb *bb,
						u64 batch_base_ofs,
						u32 second_idx)
@@ -95,18 +95,18 @@ struct xe_sched_job *xe_bb_create_migration_job(struct xe_engine *kernel_eng,
	};

	XE_WARN_ON(second_idx > bb->len);
	XE_WARN_ON(!(kernel_eng->vm->flags & XE_VM_FLAG_MIGRATION));
	XE_WARN_ON(!(q->vm->flags & XE_VM_FLAG_MIGRATION));

	return __xe_bb_create_job(kernel_eng, bb, addr);
	return __xe_bb_create_job(q, bb, addr);
}

struct xe_sched_job *xe_bb_create_job(struct xe_engine *kernel_eng,
struct xe_sched_job *xe_bb_create_job(struct xe_exec_queue *q,
				      struct xe_bb *bb)
{
	u64 addr = xe_sa_bo_gpu_addr(bb->bo);

	XE_WARN_ON(kernel_eng->vm && kernel_eng->vm->flags & XE_VM_FLAG_MIGRATION);
	return __xe_bb_create_job(kernel_eng, bb, &addr);
	XE_WARN_ON(q->vm && q->vm->flags & XE_VM_FLAG_MIGRATION);
	return __xe_bb_create_job(q, bb, &addr);
}

void xe_bb_free(struct xe_bb *bb, struct dma_fence *fence)
+4 −4
Original line number Diff line number Diff line
@@ -11,16 +11,16 @@
struct dma_fence;

struct xe_gt;
struct xe_engine;
struct xe_exec_queue;
struct xe_sched_job;

struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 size, bool usm);
struct xe_sched_job *xe_bb_create_job(struct xe_engine *kernel_eng,
struct xe_sched_job *xe_bb_create_job(struct xe_exec_queue *q,
				      struct xe_bb *bb);
struct xe_sched_job *xe_bb_create_migration_job(struct xe_engine *kernel_eng,
struct xe_sched_job *xe_bb_create_migration_job(struct xe_exec_queue *q,
						struct xe_bb *bb, u64 batch_ofs,
						u32 second_idx);
struct xe_sched_job *xe_bb_create_wa_job(struct xe_engine *wa_eng,
struct xe_sched_job *xe_bb_create_wa_job(struct xe_exec_queue *q,
					 struct xe_bb *bb, u64 batch_ofs);
void xe_bb_free(struct xe_bb *bb, struct dma_fence *fence);

+19 −19
Original line number Diff line number Diff line
@@ -53,9 +53,9 @@ static struct xe_device *coredump_to_xe(const struct xe_devcoredump *coredump)
	return container_of(coredump, struct xe_device, devcoredump);
}

static struct xe_guc *engine_to_guc(struct xe_engine *e)
static struct xe_guc *exec_queue_to_guc(struct xe_exec_queue *q)
{
	return &e->gt->uc.guc;
	return &q->gt->uc.guc;
}

static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
@@ -91,7 +91,7 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,

	drm_printf(&p, "\n**** GuC CT ****\n");
	xe_guc_ct_snapshot_print(coredump->snapshot.ct, &p);
	xe_guc_engine_snapshot_print(coredump->snapshot.ge, &p);
	xe_guc_exec_queue_snapshot_print(coredump->snapshot.ge, &p);

	drm_printf(&p, "\n**** HW Engines ****\n");
	for (i = 0; i < XE_NUM_HW_ENGINES; i++)
@@ -112,7 +112,7 @@ static void xe_devcoredump_free(void *data)
		return;

	xe_guc_ct_snapshot_free(coredump->snapshot.ct);
	xe_guc_engine_snapshot_free(coredump->snapshot.ge);
	xe_guc_exec_queue_snapshot_free(coredump->snapshot.ge);
	for (i = 0; i < XE_NUM_HW_ENGINES; i++)
		if (coredump->snapshot.hwe[i])
			xe_hw_engine_snapshot_free(coredump->snapshot.hwe[i]);
@@ -123,14 +123,14 @@ static void xe_devcoredump_free(void *data)
}

static void devcoredump_snapshot(struct xe_devcoredump *coredump,
				 struct xe_engine *e)
				 struct xe_exec_queue *q)
{
	struct xe_devcoredump_snapshot *ss = &coredump->snapshot;
	struct xe_guc *guc = engine_to_guc(e);
	struct xe_guc *guc = exec_queue_to_guc(q);
	struct xe_hw_engine *hwe;
	enum xe_hw_engine_id id;
	u32 adj_logical_mask = e->logical_mask;
	u32 width_mask = (0x1 << e->width) - 1;
	u32 adj_logical_mask = q->logical_mask;
	u32 width_mask = (0x1 << q->width) - 1;
	int i;
	bool cookie;

@@ -138,22 +138,22 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
	ss->boot_time = ktime_get_boottime();

	cookie = dma_fence_begin_signalling();
	for (i = 0; e->width > 1 && i < XE_HW_ENGINE_MAX_INSTANCE;) {
	for (i = 0; q->width > 1 && i < XE_HW_ENGINE_MAX_INSTANCE;) {
		if (adj_logical_mask & BIT(i)) {
			adj_logical_mask |= width_mask << i;
			i += e->width;
			i += q->width;
		} else {
			++i;
		}
	}

	xe_force_wake_get(gt_to_fw(e->gt), XE_FORCEWAKE_ALL);
	xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);

	coredump->snapshot.ct = xe_guc_ct_snapshot_capture(&guc->ct, true);
	coredump->snapshot.ge = xe_guc_engine_snapshot_capture(e);
	coredump->snapshot.ge = xe_guc_exec_queue_snapshot_capture(q);

	for_each_hw_engine(hwe, e->gt, id) {
		if (hwe->class != e->hwe->class ||
	for_each_hw_engine(hwe, q->gt, id) {
		if (hwe->class != q->hwe->class ||
		    !(BIT(hwe->logical_instance) & adj_logical_mask)) {
			coredump->snapshot.hwe[id] = NULL;
			continue;
@@ -161,21 +161,21 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
		coredump->snapshot.hwe[id] = xe_hw_engine_snapshot_capture(hwe);
	}

	xe_force_wake_put(gt_to_fw(e->gt), XE_FORCEWAKE_ALL);
	xe_force_wake_put(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
	dma_fence_end_signalling(cookie);
}

/**
 * xe_devcoredump - Take the required snapshots and initialize coredump device.
 * @e: The faulty xe_engine, where the issue was detected.
 * @q: The faulty xe_exec_queue, where the issue was detected.
 *
 * This function should be called at the crash time within the serialized
 * gt_reset. It is skipped if we still have the core dump device available
 * with the information of the 'first' snapshot.
 */
void xe_devcoredump(struct xe_engine *e)
void xe_devcoredump(struct xe_exec_queue *q)
{
	struct xe_device *xe = gt_to_xe(e->gt);
	struct xe_device *xe = gt_to_xe(q->gt);
	struct xe_devcoredump *coredump = &xe->devcoredump;

	if (coredump->captured) {
@@ -184,7 +184,7 @@ void xe_devcoredump(struct xe_engine *e)
	}

	coredump->captured = true;
	devcoredump_snapshot(coredump, e);
	devcoredump_snapshot(coredump, q);

	drm_info(&xe->drm, "Xe device coredump has been created\n");
	drm_info(&xe->drm, "Check your /sys/class/drm/card%d/device/devcoredump/data\n",
+3 −3
Original line number Diff line number Diff line
@@ -7,12 +7,12 @@
#define _XE_DEVCOREDUMP_H_

struct xe_device;
struct xe_engine;
struct xe_exec_queue;

#ifdef CONFIG_DEV_COREDUMP
void xe_devcoredump(struct xe_engine *e);
void xe_devcoredump(struct xe_exec_queue *q);
#else
static inline void xe_devcoredump(struct xe_engine *e)
static inline void xe_devcoredump(struct xe_exec_queue *q)
{
}
#endif
Loading