Commit 189b203e authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Oded Gabbay
Browse files

habanalabs: replace 'pf' to 'prefetch'



pf was an abbreviation for prefetch but because pf already stands
for 'physical function', we decided to change it to 'prefetch'.

Signed-off-by: default avatarDafna Hirschfeld <dhirschfeld@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent dd600db4
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -783,8 +783,8 @@ static int device_early_init(struct hl_device *hdev)
		goto free_cs_cmplt_wq;
	}

	hdev->pf_wq = alloc_workqueue("hl-prefetch", WQ_UNBOUND, 0);
	if (!hdev->pf_wq) {
	hdev->prefetch_wq = alloc_workqueue("hl-prefetch", WQ_UNBOUND, 0);
	if (!hdev->prefetch_wq) {
		dev_err(hdev->dev, "Failed to allocate MMU prefetch workqueue\n");
		rc = -ENOMEM;
		goto free_ts_free_wq;
@@ -794,7 +794,7 @@ static int device_early_init(struct hl_device *hdev)
					GFP_KERNEL);
	if (!hdev->hl_chip_info) {
		rc = -ENOMEM;
		goto free_pf_wq;
		goto free_prefetch_wq;
	}

	rc = hl_mmu_if_set_funcs(hdev);
@@ -833,8 +833,8 @@ static int device_early_init(struct hl_device *hdev)
	hl_mem_mgr_fini(&hdev->kernel_mem_mgr);
free_chip_info:
	kfree(hdev->hl_chip_info);
free_pf_wq:
	destroy_workqueue(hdev->pf_wq);
free_prefetch_wq:
	destroy_workqueue(hdev->prefetch_wq);
free_ts_free_wq:
	destroy_workqueue(hdev->ts_free_obj_wq);
free_cs_cmplt_wq:
@@ -877,7 +877,7 @@ static void device_early_fini(struct hl_device *hdev)

	kfree(hdev->hl_chip_info);

	destroy_workqueue(hdev->pf_wq);
	destroy_workqueue(hdev->prefetch_wq);
	destroy_workqueue(hdev->ts_free_obj_wq);
	destroy_workqueue(hdev->cs_cmplt_wq);
	destroy_workqueue(hdev->eq_wq);
@@ -1076,7 +1076,7 @@ static void cleanup_resources(struct hl_device *hdev, bool hard_reset, bool fw_r
	hl_cs_rollback_all(hdev, skip_wq_flush);

	/* flush the MMU prefetch workqueue */
	flush_workqueue(hdev->pf_wq);
	flush_workqueue(hdev->prefetch_wq);

	/* Release all pending user interrupts, each pending user interrupt
	 * holds a reference to user context
+4 −4
Original line number Diff line number Diff line
@@ -2811,7 +2811,7 @@ struct hl_mmu_funcs {

/**
 * struct hl_prefetch_work - prefetch work structure handler
 * @pf_work: actual work struct.
 * @prefetch_work: actual work struct.
 * @ctx: compute context.
 * @va: virtual address to pre-fetch.
 * @size: pre-fetch size.
@@ -2819,7 +2819,7 @@ struct hl_mmu_funcs {
 * @asid: ASID for maintenance operation.
 */
struct hl_prefetch_work {
	struct work_struct	pf_work;
	struct work_struct	prefetch_work;
	struct hl_ctx		*ctx;
	u64			va;
	u64			size;
@@ -3060,7 +3060,7 @@ struct hl_reset_info {
 * @cs_cmplt_wq: work queue of CS completions for executing work in process
 *               context.
 * @ts_free_obj_wq: work queue for timestamp registration objects release.
 * @pf_wq: work queue for MMU pre-fetch operations.
 * @prefetch_wq: work queue for MMU pre-fetch operations.
 * @kernel_ctx: Kernel driver context structure.
 * @kernel_queues: array of hl_hw_queue.
 * @cs_mirror_list: CS mirror list for TDR.
@@ -3231,7 +3231,7 @@ struct hl_device {
	struct workqueue_struct		*eq_wq;
	struct workqueue_struct		*cs_cmplt_wq;
	struct workqueue_struct		*ts_free_obj_wq;
	struct workqueue_struct		*pf_wq;
	struct workqueue_struct		*prefetch_wq;
	struct hl_ctx			*kernel_ctx;
	struct hl_hw_queue		*kernel_queues;
	struct list_head		cs_mirror_list;
+11 −11
Original line number Diff line number Diff line
@@ -699,7 +699,7 @@ int hl_mmu_invalidate_cache_range(struct hl_device *hdev, bool is_hard,

static void hl_mmu_prefetch_work_function(struct work_struct *work)
{
	struct hl_prefetch_work *pfw = container_of(work, struct hl_prefetch_work, pf_work);
	struct hl_prefetch_work *pfw = container_of(work, struct hl_prefetch_work, prefetch_work);
	struct hl_ctx *ctx = pfw->ctx;
	struct hl_device *hdev = ctx->hdev;

@@ -723,25 +723,25 @@ static void hl_mmu_prefetch_work_function(struct work_struct *work)

int hl_mmu_prefetch_cache_range(struct hl_ctx *ctx, u32 flags, u32 asid, u64 va, u64 size)
{
	struct hl_prefetch_work *handle_pf_work;
	struct hl_prefetch_work *handle_prefetch_work;

	handle_pf_work = kmalloc(sizeof(*handle_pf_work), GFP_KERNEL);
	if (!handle_pf_work)
	handle_prefetch_work = kmalloc(sizeof(*handle_prefetch_work), GFP_KERNEL);
	if (!handle_prefetch_work)
		return -ENOMEM;

	INIT_WORK(&handle_pf_work->pf_work, hl_mmu_prefetch_work_function);
	handle_pf_work->ctx = ctx;
	handle_pf_work->va = va;
	handle_pf_work->size = size;
	handle_pf_work->flags = flags;
	handle_pf_work->asid = asid;
	INIT_WORK(&handle_prefetch_work->prefetch_work, hl_mmu_prefetch_work_function);
	handle_prefetch_work->ctx = ctx;
	handle_prefetch_work->va = va;
	handle_prefetch_work->size = size;
	handle_prefetch_work->flags = flags;
	handle_prefetch_work->asid = asid;

	/*
	 * as actual prefetch is done in a WQ we must get the context (and put it
	 * at the end of the work function)
	 */
	hl_ctx_get(ctx);
	queue_work(ctx->hdev->pf_wq, &handle_pf_work->pf_work);
	queue_work(ctx->hdev->prefetch_wq, &handle_prefetch_work->prefetch_work);

	return 0;
}