Skip to contentSkip to conversation

accel/ivpu: Changes for 6.13-rc5

PATCH Applied Jacek Lawrynowicz 2 participants 26 messages Oct 17, 2024 – Oct 30, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover accel/ivpu: Changes for 6.13-rc5

- Remove support for deprecated and unused copy engine
- Improved open() performance by lazy allocating MMU page tables
- Error handling fixes in MMU code
- Extend VPU address ranges to allow bigger workloads

Andrzej Kacprowski (1):
accel/ivpu: Remove copy engine support

Karol Wachowski (9):
accel/ivpu: Do not fail when more than 1 tile is fused accel/ivpu: Defer MMU root page table allocation accel/ivpu: Clear CDTAB entry in case of failure accel/ivpu: Unmap partially mapped BOs in case of errors accel/ivpu: Use xa_alloc_cyclic() instead of custom function accel/ivpu: Make command queue ID allocated on XArray accel/ivpu: Don't allocate preemption buffers when MIP is disabled accel/ivpu: Increase DMA address range
accel/ivpu: Move secondary preemption buffer allocation to DMA range

Maciej Falkowski (1):
accel/ivpu: Add debug Kconfig option

 drivers/accel/ivpu/Kconfig            |  10 ++
 drivers/accel/ivpu/Makefile           |   2 +
 drivers/accel/ivpu/ivpu_drv.c         |  31 +++--
 drivers/accel/ivpu/ivpu_drv.h         |  16 +--
 drivers/accel/ivpu/ivpu_fw.c          |   8 +-
 drivers/accel/ivpu/ivpu_hw.c          |  10 +-
 drivers/accel/ivpu/ivpu_hw_btrs.c     |  12 +-
 drivers/accel/ivpu/ivpu_job.c         | 148 ++++++++++--------------
 drivers/accel/ivpu/ivpu_job.h         |   2 +
 drivers/accel/ivpu/ivpu_jsm_msg.c     |   8 +-
 drivers/accel/ivpu/ivpu_mmu.c         | 101 ++++++----------
 drivers/accel/ivpu/ivpu_mmu.h         |   4 +-
 drivers/accel/ivpu/ivpu_mmu_context.c | 158 ++++++++++++++------------
 drivers/accel/ivpu/ivpu_mmu_context.h |   9 +-
 drivers/accel/ivpu/ivpu_pm.c          |   2 +
 include/uapi/drm/ivpu_accel.h         |   6 +-
 16 files changed, 243 insertions(+), 284 deletions(-)

--
2.45.1

#1 lore raw

PATCH 1/11 accel/ivpu: Do not fail when more than 1 tile is fused

From: Karol Wachowski <[email protected]>

Allow TILE_FUSE register to disable more than 1 tile.
The driver should not prevent such configurations from being functional.

---
 drivers/accel/ivpu/ivpu_hw_btrs.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/accel/ivpu/ivpu_hw_btrs.c +3 -9
index 6d5f1cc711435..3212c99f36823 100644
@@ -141,16 +141,10 @@ static int read_tile_config_fuse(struct ivpu_device *vdev, u32 *tile_fuse_config
 	}
 
 	config = REG_GET_FLD(VPU_HW_BTRS_LNL_TILE_FUSE, CONFIG, fuse);
-	if (!tile_disable_check(config)) {
-		ivpu_err(vdev, "Fuse: Invalid tile disable config (0x%x)\n", config);
-		return -EIO;
-	}
+	if (!tile_disable_check(config))
+		ivpu_warn(vdev, "More than 1 tile disabled, tile fuse config mask: 0x%x\n", config);
 
-	if (config)
-		ivpu_dbg(vdev, MISC, "Fuse: %d tiles enabled. Tile number %d disabled\n",
-			 BTRS_LNL_TILE_MAX_NUM - 1, ffs(config) - 1);
-	else
-		ivpu_dbg(vdev, MISC, "Fuse: All %d tiles enabled\n", BTRS_LNL_TILE_MAX_NUM);
+	ivpu_dbg(vdev, MISC, "Tile disable config mask: 0x%x\n", config);
 
 	*tile_fuse_config = config;
 	return 0;
Signature · 1 line
2.45.1
Reviewed-by on v1 1/11
#2 lore raw

Re: [PATCH 01/11] accel/ivpu: Do not fail when more than 1 tile is fused

Quoted 8 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Allow TILE_FUSE register to disable more than 1 tile.
The driver should not prevent such configurations from being functional.

#3 lore raw

PATCH 2/11 accel/ivpu: Defer MMU root page table allocation

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Defer root page table allocation and unify context init/fini functions. Move allocation of the root page table from the file_priv_open function to perform a lazy allocation approach during ivpu_bo_pin().

By doing so, we avoid the overhead of allocating page tables for simple operations like GET_PARAM that do not require them. Additionally, the MMU context descriptor table initialization has been moved to the ivpu_mmu_context_map_page function.

This change streamlines the process and ensures that the descriptor table is only initialized when it is actually needed.
Refactor init/fini functions to remove redundant code and make the context management more straightforward.

Overall, these changes lead to a reduction in the time taken by the file descriptor open operation, as the costly root page table allocation is now avoided for operations that do not require it.

---
 drivers/accel/ivpu/ivpu_drv.c         |  12 +--
 drivers/accel/ivpu/ivpu_mmu.c         |  94 ++++++-----------
 drivers/accel/ivpu/ivpu_mmu.h         |   4 +-
 drivers/accel/ivpu/ivpu_mmu_context.c | 145 +++++++++++++-------------
 drivers/accel/ivpu/ivpu_mmu_context.h |   9 +-
 5 files changed, 115 insertions(+), 149 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +3 -9
index e7d8967c02f29..34e3e9b1c3f23 100644
@@ -86,7 +86,7 @@ static void file_priv_unbind(struct ivpu_device *vdev, struct ivpu_file_priv *fi
 
 		ivpu_cmdq_release_all_locked(file_priv);
 		ivpu_bo_unbind_all_bos_from_context(vdev, &file_priv->ctx);
-		ivpu_mmu_user_context_fini(vdev, &file_priv->ctx);
+		ivpu_mmu_context_fini(vdev, &file_priv->ctx);
 		file_priv->bound = false;
 		drm_WARN_ON(&vdev->drm, !xa_erase_irq(&vdev->context_xa, file_priv->ctx.id));
 	}
@@ -254,9 +254,7 @@ static int ivpu_open(struct drm_device *dev, struct drm_file *file)
 		goto err_unlock;
 	}
 
-	ret = ivpu_mmu_user_context_init(vdev, &file_priv->ctx, ctx_id);
-	if (ret)
-		goto err_xa_erase;
+	ivpu_mmu_context_init(vdev, &file_priv->ctx, ctx_id);
 
 	file_priv->default_job_limit.min = FIELD_PREP(IVPU_JOB_ID_CONTEXT_MASK,
 						      (file_priv->ctx.id - 1));
@@ -273,8 +271,6 @@ static int ivpu_open(struct drm_device *dev, struct drm_file *file)
 
 	return 0;
 
-err_xa_erase:
-	xa_erase_irq(&vdev->context_xa, ctx_id);
 err_unlock:
 	mutex_unlock(&vdev->context_list_lock);
 	mutex_destroy(&file_priv->ms_lock);
@@ -652,9 +648,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
 	if (ret)
 		goto err_shutdown;
 
-	ret = ivpu_mmu_global_context_init(vdev);
-	if (ret)
-		goto err_shutdown;
+	ivpu_mmu_global_context_init(vdev);
 
 	ret = ivpu_mmu_init(vdev);
 	if (ret)
drivers/accel/ivpu/ivpu_mmu.c +30 -64

132 lines not on this page · raw message

drivers/accel/ivpu/ivpu_mmu.h +2 -2
index 6fa35c2407106..7afea9cd8731d 100644
@@ -40,8 +40,8 @@ struct ivpu_mmu_info {
 int ivpu_mmu_init(struct ivpu_device *vdev);
 void ivpu_mmu_disable(struct ivpu_device *vdev);
 int ivpu_mmu_enable(struct ivpu_device *vdev);
-int ivpu_mmu_set_pgtable(struct ivpu_device *vdev, int ssid, struct ivpu_mmu_pgtable *pgtable);
-void ivpu_mmu_clear_pgtable(struct ivpu_device *vdev, int ssid);
+int ivpu_mmu_cd_set(struct ivpu_device *vdev, int ssid, struct ivpu_mmu_pgtable *pgtable);
+void ivpu_mmu_cd_clear(struct ivpu_device *vdev, int ssid);
 int ivpu_mmu_invalidate_tlb(struct ivpu_device *vdev, u16 ssid);
 
 void ivpu_mmu_irq_evtq_handler(struct ivpu_device *vdev);
drivers/accel/ivpu/ivpu_mmu_context.c +75 -70

221 lines not on this page · raw message

drivers/accel/ivpu/ivpu_mmu_context.h +5 -4
index 7f9aaf3d10c2f..8042fc0670622 100644
@@ -23,19 +23,20 @@ struct ivpu_mmu_pgtable {
 };
 
 struct ivpu_mmu_context {
-	struct mutex lock; /* Protects: mm, pgtable */
+	struct mutex lock; /* Protects: mm, pgtable, is_cd_valid */
 	struct drm_mm mm;
 	struct ivpu_mmu_pgtable pgtable;
+	bool is_cd_valid;
 	u32 id;
 };
 
-int ivpu_mmu_global_context_init(struct ivpu_device *vdev);
+void ivpu_mmu_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx, u32 context_id);
+void ivpu_mmu_context_fini(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx);
+void ivpu_mmu_global_context_init(struct ivpu_device *vdev);
 void ivpu_mmu_global_context_fini(struct ivpu_device *vdev);
 int ivpu_mmu_reserved_context_init(struct ivpu_device *vdev);
 void ivpu_mmu_reserved_context_fini(struct ivpu_device *vdev);
 
-int ivpu_mmu_user_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx, u32 ctx_id);
-void ivpu_mmu_user_context_fini(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx);
 void ivpu_mmu_user_context_mark_invalid(struct ivpu_device *vdev, u32 ssid);
 
 int ivpu_mmu_context_insert_node(struct ivpu_mmu_context *ctx, const struct ivpu_addr_range *range,
Signature · 1 line
2.45.1
Reviewed-by on v1 2/11
#4 lore raw

Re: [PATCH 02/11] accel/ivpu: Defer MMU root page table allocation

Quoted 16 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Defer root page table allocation and unify context init/fini functions. Move allocation of the root page table from the file_priv_open function to perform a lazy allocation approach during ivpu_bo_pin().

By doing so, we avoid the overhead of allocating page tables for simple operations like GET_PARAM that do not require them. Additionally, the MMU context descriptor table initialization has been moved to the ivpu_mmu_context_map_page function.

This change streamlines the process and ensures that the descriptor table is only initialized when it is actually needed.
Refactor init/fini functions to remove redundant code and make the context management more straightforward.

Quoted 7 lines

Overall, these changes lead to a reduction in the time taken by the file descriptor open operation, as the costly root page table allocation is now avoided for operations that do not require it.

#5 lore raw

PATCH 3/11 accel/ivpu: Remove copy engine support

In reply to Jacek Lawrynowicz

From: Andrzej Kacprowski <[email protected]>

Copy engine was deprecated by the FW and is no longer supported. Compute engine includes all copy engine functionality and should be used instead.

This change does not affect user space as the copy engine was never used outside of a couple of tests.

---
 drivers/accel/ivpu/ivpu_drv.h     |  5 +---
 drivers/accel/ivpu/ivpu_job.c     | 43 +++++++++++--------------------
 drivers/accel/ivpu/ivpu_jsm_msg.c |  8 +++---
 include/uapi/drm/ivpu_accel.h     |  6 +----
 4 files changed, 21 insertions(+), 41 deletions(-)
drivers/accel/ivpu/ivpu_drv.h +1 -4
index f905021ac1748..5b4f5104b4708 100644
@@ -49,11 +49,8 @@
 #define IVPU_JOB_ID_JOB_MASK		GENMASK(7, 0)
 #define IVPU_JOB_ID_CONTEXT_MASK	GENMASK(31, 8)
 
-#define IVPU_NUM_ENGINES       2
 #define IVPU_NUM_PRIORITIES    4
-#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_ENGINES * IVPU_NUM_PRIORITIES)
-
-#define IVPU_CMDQ_INDEX(engine, priority) ((engine) * IVPU_NUM_PRIORITIES + (priority))
+#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_PRIORITIES)
 
 #define IVPU_PLATFORM_SILICON 0
 #define IVPU_PLATFORM_SIMICS  2
drivers/accel/ivpu/ivpu_job.c +15 -28

101 lines not on this page · raw message

drivers/accel/ivpu/ivpu_jsm_msg.c +4 -4
index 8f5d904ca1ed4..30a40be769301 100644
@@ -132,7 +132,7 @@ int ivpu_jsm_get_heartbeat(struct ivpu_device *vdev, u32 engine, u64 *heartbeat)
 	struct vpu_jsm_msg resp;
 	int ret;
 
-	if (engine > VPU_ENGINE_COPY)
+	if (engine != VPU_ENGINE_COMPUTE)
 		return -EINVAL;
 
 	req.payload.query_engine_hb.engine_idx = engine;
@@ -155,7 +155,7 @@ int ivpu_jsm_reset_engine(struct ivpu_device *vdev, u32 engine)
 	struct vpu_jsm_msg resp;
 	int ret;
 
-	if (engine > VPU_ENGINE_COPY)
+	if (engine != VPU_ENGINE_COMPUTE)
 		return -EINVAL;
 
 	req.payload.engine_reset.engine_idx = engine;
@@ -174,7 +174,7 @@ int ivpu_jsm_preempt_engine(struct ivpu_device *vdev, u32 engine, u32 preempt_id
 	struct vpu_jsm_msg resp;
 	int ret;
 
-	if (engine > VPU_ENGINE_COPY)
+	if (engine != VPU_ENGINE_COMPUTE)
 		return -EINVAL;
 
 	req.payload.engine_preempt.engine_idx = engine;
@@ -346,7 +346,7 @@ int ivpu_jsm_hws_resume_engine(struct ivpu_device *vdev, u32 engine)
 	struct vpu_jsm_msg resp;
 	int ret;
 
-	if (engine >= VPU_ENGINE_NB)
+	if (engine != VPU_ENGINE_COMPUTE)
 		return -EINVAL;
 
 	req.payload.hws_resume_engine.engine_idx = engine;
include/uapi/drm/ivpu_accel.h +1 -5
index 234664d352507..a35b97b097bf6 100644
@@ -258,7 +258,7 @@ struct drm_ivpu_bo_info {
 
 /* drm_ivpu_submit engines */
 #define DRM_IVPU_ENGINE_COMPUTE 0
-#define DRM_IVPU_ENGINE_COPY    1
+#define DRM_IVPU_ENGINE_COPY    1 /* Deprecated */
 
 /**
  * struct drm_ivpu_submit - Submit commands to the VPU
@@ -289,10 +289,6 @@ struct drm_ivpu_submit {
 	 * %DRM_IVPU_ENGINE_COMPUTE:
 	 *
 	 * Performs Deep Learning Neural Compute Inference Operations
-	 *
-	 * %DRM_IVPU_ENGINE_COPY:
-	 *
-	 * Performs memory copy operations to/from system memory allocated for VPU
 	 */
 	__u32 engine;
 
Signature · 1 line
2.45.1
Reviewed-by on v1 3/11
#6 lore raw

Re: [PATCH 03/11] accel/ivpu: Remove copy engine support

Quoted 6 lines · Jacek Lawrynowicz

From: Andrzej Kacprowski <[email protected]>

Copy engine was deprecated by the FW and is no longer supported. Compute engine includes all copy engine functionality and should be used instead.

Quoted 6 lines

This change does not affect user space as the copy engine was never used outside of a couple of tests.

#7 lore raw

PATCH 4/11 accel/ivpu: Clear CDTAB entry in case of failure

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Don't leave a context descriptor in case CFGI_ALL flush fails. Mark it as invalid (by clearing valid bit) so nothing is left in partially-initialized state.

---
 drivers/accel/ivpu/ivpu_mmu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_mmu.c +8 -1
index 4ff0d7a519859..26ef52fbb93e5 100644
@@ -749,10 +749,17 @@ static int ivpu_mmu_cdtab_entry_set(struct ivpu_device *vdev, u32 ssid, u64 cd_d
 
 	ret = ivpu_mmu_cmdq_write_cfgi_all(vdev);
 	if (ret)
-		goto unlock;
+		goto err_invalidate;
 
 	ret = ivpu_mmu_cmdq_sync(vdev);
+	if (ret)
+		goto err_invalidate;
 unlock:
+	mutex_unlock(&mmu->lock);
+	return 0;
+
+err_invalidate:
+	WRITE_ONCE(entry[0], 0);
 	mutex_unlock(&mmu->lock);
 	return ret;
 }
Signature · 1 line
2.45.1
Reviewed-by on v1 4/11
#8 lore raw

Re: [PATCH 04/11] accel/ivpu: Clear CDTAB entry in case of failure

Quoted 9 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Don't leave a context descriptor in case CFGI_ALL flush fails. Mark it as invalid (by clearing valid bit) so nothing is left in partially-initialized state.

#9 lore raw

PATCH 5/11 accel/ivpu: Unmap partially mapped BOs in case of errors

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Ensure that all buffers that were created only partially through allocated scatter-gather table are unmapped from MMU600 in case of errors.

---
 drivers/accel/ivpu/ivpu_mmu_context.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/accel/ivpu/ivpu_mmu_context.c +11 -8
index 8992fe93b679a..697b57071d546 100644
@@ -432,6 +432,7 @@ int
 ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
 			 u64 vpu_addr, struct sg_table *sgt,  bool llc_coherent)
 {
+	size_t start_vpu_addr = vpu_addr;
 	struct scatterlist *sg;
 	int ret;
 	u64 prot;
@@ -462,7 +463,7 @@ ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
 		ret = ivpu_mmu_context_map_pages(vdev, ctx, vpu_addr, dma_addr, size, prot);
 		if (ret) {
 			ivpu_err(vdev, "Failed to map context pages\n");
-			goto err_unlock;
+			goto err_unmap_pages;
 		}
 		vpu_addr += size;
 	}
@@ -472,7 +473,7 @@ ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
 		if (ret) {
 			ivpu_err(vdev, "Failed to set context descriptor for context %u: %d\n",
 				 ctx->id, ret);
-			goto err_unlock;
+			goto err_unmap_pages;
 		}
 		ctx->is_cd_valid = true;
 	}
@@ -480,17 +481,19 @@ ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx,
 	/* Ensure page table modifications are flushed from wc buffers to memory */
 	wmb();
 
-	mutex_unlock(&ctx->lock);
-
 	ret = ivpu_mmu_invalidate_tlb(vdev, ctx->id);
-	if (ret)
+	if (ret) {
 		ivpu_err(vdev, "Failed to invalidate TLB for ctx %u: %d\n", ctx->id, ret);
-	return ret;
+		goto err_unmap_pages;
+	}
 
-err_unlock:
 	mutex_unlock(&ctx->lock);
-	return ret;
+	return 0;
 
+err_unmap_pages:
+	ivpu_mmu_context_unmap_pages(ctx, start_vpu_addr, vpu_addr - start_vpu_addr);
+	mutex_unlock(&ctx->lock);
+	return ret;
 }
 
 void
Signature · 1 line
2.45.1
Reviewed-by on v1 5/11
#10 lore raw

Re: [PATCH 05/11] accel/ivpu: Unmap partially mapped BOs in case of errors

Quoted 8 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Ensure that all buffers that were created only partially through allocated scatter-gather table are unmapped from MMU600 in case of errors.

#11 lore raw

PATCH 6/11 accel/ivpu: Use xa_alloc_cyclic() instead of custom function

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Remove custom ivpu_id_alloc() wrapper used for ID allocations and replace it with standard xa_alloc_cyclic() API.

The idea behind ivpu_id_alloc() was to have monotonic IDs, so the driver is easier to debug because same IDs are not reused all over. The same can be achieved just by using appropriate Linux API.

---
 drivers/accel/ivpu/ivpu_drv.c | 11 ++++-------
 drivers/accel/ivpu/ivpu_drv.h |  4 ++--
 drivers/accel/ivpu/ivpu_job.c | 34 ++++++----------------------------
 3 files changed, 12 insertions(+), 37 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +4 -7
index 34e3e9b1c3f23..383e3eb988983 100644
@@ -256,10 +256,8 @@ static int ivpu_open(struct drm_device *dev, struct drm_file *file)
 
 	ivpu_mmu_context_init(vdev, &file_priv->ctx, ctx_id);
 
-	file_priv->default_job_limit.min = FIELD_PREP(IVPU_JOB_ID_CONTEXT_MASK,
-						      (file_priv->ctx.id - 1));
-	file_priv->default_job_limit.max = file_priv->default_job_limit.min | IVPU_JOB_ID_JOB_MASK;
-	file_priv->job_limit = file_priv->default_job_limit;
+	file_priv->job_limit.min = FIELD_PREP(IVPU_JOB_ID_CONTEXT_MASK, (file_priv->ctx.id - 1));
+	file_priv->job_limit.max = file_priv->job_limit.min | IVPU_JOB_ID_JOB_MASK;
 
 	mutex_unlock(&vdev->context_list_lock);
 	drm_dev_exit(idx);
@@ -618,9 +616,8 @@ static int ivpu_dev_init(struct ivpu_device *vdev)
 	lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key);
 	INIT_LIST_HEAD(&vdev->bo_list);
 
-	vdev->default_db_limit.min = IVPU_MIN_DB;
-	vdev->default_db_limit.max = IVPU_MAX_DB;
-	vdev->db_limit = vdev->default_db_limit;
+	vdev->db_limit.min = IVPU_MIN_DB;
+	vdev->db_limit.max = IVPU_MAX_DB;
 
 	ret = drmm_mutex_init(&vdev->drm, &vdev->context_list_lock);
 	if (ret)
drivers/accel/ivpu/ivpu_drv.h +2 -2
index 5b4f5104b4708..6774402821706 100644
@@ -137,7 +137,7 @@ struct ivpu_device {
 
 	struct xarray db_xa;
 	struct xa_limit db_limit;
-	struct xa_limit default_db_limit;
+	u32 db_next;
 
 	struct mutex bo_list_lock; /* Protects bo_list */
 	struct list_head bo_list;
@@ -174,7 +174,7 @@ struct ivpu_file_priv {
 	struct list_head ms_instance_list;
 	struct ivpu_bo *ms_info_bo;
 	struct xa_limit job_limit;
-	struct xa_limit default_job_limit;
+	u32 job_id_next;
 	bool has_mmu_faults;
 	bool bound;
 	bool aborted;
drivers/accel/ivpu/ivpu_job.c +6 -28
index f580959e87787..9154c2e14245f 100644
@@ -72,26 +72,6 @@ static void ivpu_preemption_buffers_free(struct ivpu_device *vdev,
 		ivpu_bo_free(cmdq->secondary_preempt_buf);
 }
 
-static int ivpu_id_alloc(struct xarray *xa, u32 *id, void *entry, struct xa_limit *limit,
-			 const struct xa_limit default_limit)
-{
-	int ret;
-
-	ret = __xa_alloc(xa, id, entry, *limit, GFP_KERNEL);
-	if (ret) {
-		limit->min = default_limit.min;
-		ret = __xa_alloc(xa, id, entry, *limit, GFP_KERNEL);
-		if (ret)
-			return ret;
-	}
-
-	limit->min = *id + 1;
-	if (limit->min > limit->max)
-		limit->min = default_limit.min;
-
-	return ret;
-}
-
 static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv)
 {
 	struct ivpu_device *vdev = file_priv->vdev;
@@ -102,11 +82,9 @@ static struct ivpu_cmdq *ivpu_cmdq_alloc(struct ivpu_file_priv *file_priv)
 	if (!cmdq)
 		return NULL;
 
-	xa_lock(&vdev->db_xa); /* lock here to protect db_limit */
-	ret = ivpu_id_alloc(&vdev->db_xa, &cmdq->db_id, NULL, &vdev->db_limit,
-			    vdev->default_db_limit);
-	xa_unlock(&vdev->db_xa);
-	if (ret) {
+	ret = xa_alloc_cyclic(&vdev->db_xa, &cmdq->db_id, NULL, vdev->db_limit, &vdev->db_next,
+			      GFP_KERNEL);
+	if (ret < 0) {
 		ivpu_err(vdev, "Failed to allocate doorbell id: %d\n", ret);
 		goto err_free_cmdq;
 	}
@@ -554,9 +532,9 @@ static int ivpu_job_submit(struct ivpu_job *job, u8 priority)
 
 	xa_lock(&vdev->submitted_jobs_xa);
 	is_first_job = xa_empty(&vdev->submitted_jobs_xa);
-	ret = ivpu_id_alloc(&vdev->submitted_jobs_xa, &job->job_id, job, &file_priv->job_limit,
-			    file_priv->default_job_limit);
-	if (ret) {
+	ret = __xa_alloc_cyclic(&vdev->submitted_jobs_xa, &job->job_id, job, file_priv->job_limit,
+				&file_priv->job_id_next, GFP_KERNEL);
+	if (ret < 0) {
 		ivpu_dbg(vdev, JOB, "Too many active jobs in ctx %d\n",
 			 file_priv->ctx.id);
 		ret = -EBUSY;
Signature · 1 line
2.45.1
Reviewed-by on v1 6/11
#12 lore raw

Re: [PATCH 06/11] accel/ivpu: Use xa_alloc_cyclic() instead of custom function

Quoted 5 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Remove custom ivpu_id_alloc() wrapper used for ID allocations and replace it with standard xa_alloc_cyclic() API.

Quoted 7 lines

The idea behind ivpu_id_alloc() was to have monotonic IDs, so the driver is easier to debug because same IDs are not reused all over. The same can be achieved just by using appropriate Linux API.

#13 lore raw

PATCH 7/11 accel/ivpu: Make command queue ID allocated on XArray

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Use XArray for dynamic command queue ID allocations instead of fixed ones. This is required by upcoming changes to UAPI that will allow to manage command queues by user space instead of having predefined number of queues in a context.

---
 drivers/accel/ivpu/ivpu_drv.c |  6 +++
 drivers/accel/ivpu/ivpu_drv.h |  7 ++-
 drivers/accel/ivpu/ivpu_job.c | 91 ++++++++++++++++++-----------------
 drivers/accel/ivpu/ivpu_job.h |  2 +
 4 files changed, 60 insertions(+), 46 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +6 -0
index 383e3eb988983..f5a8d93fe2a57 100644
@@ -104,6 +104,8 @@ static void file_priv_release(struct kref *ref)
 	pm_runtime_get_sync(vdev->drm.dev);
 	mutex_lock(&vdev->context_list_lock);
 	file_priv_unbind(vdev, file_priv);
+	drm_WARN_ON(&vdev->drm, !xa_empty(&file_priv->cmdq_xa));
+	xa_destroy(&file_priv->cmdq_xa);
 	mutex_unlock(&vdev->context_list_lock);
 	pm_runtime_put_autosuspend(vdev->drm.dev);
 
@@ -259,6 +261,10 @@ static int ivpu_open(struct drm_device *dev, struct drm_file *file)
 	file_priv->job_limit.min = FIELD_PREP(IVPU_JOB_ID_CONTEXT_MASK, (file_priv->ctx.id - 1));
 	file_priv->job_limit.max = file_priv->job_limit.min | IVPU_JOB_ID_JOB_MASK;
 
+	xa_init_flags(&file_priv->cmdq_xa, XA_FLAGS_ALLOC1);
+	file_priv->cmdq_limit.min = IVPU_CMDQ_MIN_ID;
+	file_priv->cmdq_limit.max = IVPU_CMDQ_MAX_ID;
+
 	mutex_unlock(&vdev->context_list_lock);
 	drm_dev_exit(idx);
 
drivers/accel/ivpu/ivpu_drv.h +6 -1
index 6774402821706..8e79d78906bfe 100644
@@ -52,6 +52,9 @@
 #define IVPU_NUM_PRIORITIES    4
 #define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_PRIORITIES)
 
+#define IVPU_CMDQ_MIN_ID 1
+#define IVPU_CMDQ_MAX_ID 255
+
 #define IVPU_PLATFORM_SILICON 0
 #define IVPU_PLATFORM_SIMICS  2
 #define IVPU_PLATFORM_FPGA    3
@@ -168,13 +171,15 @@ struct ivpu_file_priv {
 	struct kref ref;
 	struct ivpu_device *vdev;
 	struct mutex lock; /* Protects cmdq */
-	struct ivpu_cmdq *cmdq[IVPU_NUM_CMDQS_PER_CTX];
+	struct xarray cmdq_xa;
 	struct ivpu_mmu_context ctx;
 	struct mutex ms_lock; /* Protects ms_instance_list, ms_info_bo */
 	struct list_head ms_instance_list;
 	struct ivpu_bo *ms_info_bo;
 	struct xa_limit job_limit;
 	u32 job_id_next;
+	struct xa_limit cmdq_limit;
+	u32 cmdq_id_next;
 	bool has_mmu_faults;
 	bool bound;
 	bool aborted;
drivers/accel/ivpu/ivpu_job.c +46 -45

212 lines not on this page · raw message

drivers/accel/ivpu/ivpu_job.h +2 -0
index 6accb94028c7a..8b19e3f8b4cfb 100644
@@ -28,8 +28,10 @@ struct ivpu_cmdq {
 	struct ivpu_bo *secondary_preempt_buf;
 	struct ivpu_bo *mem;
 	u32 entry_count;
+	u32 id;
 	u32 db_id;
 	bool db_registered;
+	u8 priority;
 };
 
 /**
Signature · 1 line
2.45.1
Reviewed-by on v1 7/11
#14 lore raw

Re: [PATCH 07/11] accel/ivpu: Make command queue ID allocated on XArray

Quoted 10 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Use XArray for dynamic command queue ID allocations instead of fixed ones. This is required by upcoming changes to UAPI that will allow to manage command queues by user space instead of having predefined number of queues in a context.

#15 lore raw

PATCH 8/11 accel/ivpu: Don't allocate preemption buffers when MIP is disabled

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Do not allocate preemption buffers when Mid Inference Preemption (MIP) is disabled through test mode.

Rename IVPU_TEST_MODE_PREEMPTION_DISABLE to IVPU_TEST_MODE_MIP_DISABLE to better describe that this test mode only disables MIP - job level preemption will still occur.

---
 drivers/accel/ivpu/ivpu_drv.h | 2 +-
 drivers/accel/ivpu/ivpu_job.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/accel/ivpu/ivpu_drv.h +1 -1
index 8e79d78906bfe..3fdff3f6cffd8 100644
@@ -197,7 +197,7 @@ extern bool ivpu_force_snoop;
 #define IVPU_TEST_MODE_NULL_SUBMISSION    BIT(2)
 #define IVPU_TEST_MODE_D0I3_MSG_DISABLE   BIT(4)
 #define IVPU_TEST_MODE_D0I3_MSG_ENABLE    BIT(5)
-#define IVPU_TEST_MODE_PREEMPTION_DISABLE BIT(6)
+#define IVPU_TEST_MODE_MIP_DISABLE        BIT(6)
 #define IVPU_TEST_MODE_DISABLE_TIMEOUTS   BIT(8)
 #define IVPU_TEST_MODE_TURBO		  BIT(9)
 extern int ivpu_test_mode;
drivers/accel/ivpu/ivpu_job.c +3 -3
index 82a57a30244d3..39ba6d3d8b0de 100644
@@ -35,7 +35,8 @@ static int ivpu_preemption_buffers_create(struct ivpu_device *vdev,
 	u64 primary_size = ALIGN(vdev->fw->primary_preempt_buf_size, PAGE_SIZE);
 	u64 secondary_size = ALIGN(vdev->fw->secondary_preempt_buf_size, PAGE_SIZE);
 
-	if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW)
+	if (vdev->fw->sched_mode != VPU_SCHEDULING_MODE_HW ||
+	    ivpu_test_mode & IVPU_TEST_MODE_MIP_DISABLE)
 		return 0;
 
 	cmdq->primary_preempt_buf = ivpu_bo_create(vdev, &file_priv->ctx, &vdev->hw->ranges.user,
@@ -347,8 +348,7 @@ static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job)
 	if (unlikely(ivpu_test_mode & IVPU_TEST_MODE_NULL_SUBMISSION))
 		entry->flags = VPU_JOB_FLAGS_NULL_SUBMISSION_MASK;
 
-	if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW &&
-	    (unlikely(!(ivpu_test_mode & IVPU_TEST_MODE_PREEMPTION_DISABLE)))) {
+	if (vdev->fw->sched_mode == VPU_SCHEDULING_MODE_HW) {
 		if (cmdq->primary_preempt_buf) {
 			entry->primary_preempt_buf_addr = cmdq->primary_preempt_buf->vpu_addr;
 			entry->primary_preempt_buf_size = ivpu_bo_size(cmdq->primary_preempt_buf);
Signature · 1 line
2.45.1
Reviewed-by on v1 8/11
#16 lore raw

Re: [PATCH 08/11] accel/ivpu: Don't allocate preemption buffers when MIP is disabled

Quoted 5 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Do not allocate preemption buffers when Mid Inference Preemption (MIP) is disabled through test mode.

Quoted 7 lines

Rename IVPU_TEST_MODE_PREEMPTION_DISABLE to IVPU_TEST_MODE_MIP_DISABLE to better describe that this test mode only disables MIP - job level preemption will still occur.

#17 lore raw

PATCH 9/11 accel/ivpu: Add debug Kconfig option

In reply to Jacek Lawrynowicz

From: Maciej Falkowski <[email protected]>

Add CONFIG_DRM_ACCEL_IVPU_DEBUG option that:
- Adds -DDEBUG that enables printk regardless of the kernel config
- Enables unsafe module params (that are now disabled by default)

---
 drivers/accel/ivpu/Kconfig    | 10 ++++++++++
 drivers/accel/ivpu/Makefile   |  2 ++
 drivers/accel/ivpu/ivpu_drv.c |  2 ++
 drivers/accel/ivpu/ivpu_fw.c  |  2 ++
 drivers/accel/ivpu/ivpu_pm.c  |  2 ++
 5 files changed, 18 insertions(+)
drivers/accel/ivpu/Kconfig +10 -0
index e4d418b44626e..8858b32e05640 100644
@@ -16,3 +16,13 @@ config DRM_ACCEL_IVPU
 	  and Deep Learning applications.
 
 	  If "M" is selected, the module will be called intel_vpu.
+
+config DRM_ACCEL_IVPU_DEBUG
+	bool "Intel NPU debug mode"
+	depends on DRM_ACCEL_IVPU
+	default n
+	help
+	  Choose this option to enable additional
+	  debug features for the Intel NPU driver:
+	  - Always print debug messages regardless of dyndbg config,
+	  - Enable unsafe module params.
drivers/accel/ivpu/Makefile +2 -0
index e73937c86d9ad..1029e0bab0615 100644
@@ -24,4 +24,6 @@ intel_vpu-$(CONFIG_DEV_COREDUMP) += ivpu_coredump.o
 
 obj-$(CONFIG_DRM_ACCEL_IVPU) += intel_vpu.o
 
+subdir-ccflags-$(CONFIG_DRM_ACCEL_IVPU_DEBUG) += -DDEBUG
+
 CFLAGS_ivpu_trace_points.o = -I$(src)
drivers/accel/ivpu/ivpu_drv.c +2 -0
index f5a8d93fe2a57..ca2bf47ce2484 100644
@@ -43,8 +43,10 @@ module_param_named(dbg_mask, ivpu_dbg_mask, int, 0644);
 MODULE_PARM_DESC(dbg_mask, "Driver debug mask. See IVPU_DBG_* macros.");
 
 int ivpu_test_mode;
+#if IS_ENABLED(CONFIG_DRM_ACCEL_IVPU_DEBUG)
 module_param_named_unsafe(test_mode, ivpu_test_mode, int, 0644);
 MODULE_PARM_DESC(test_mode, "Test mode mask. See IVPU_TEST_MODE_* macros.");
+#endif
 
 u8 ivpu_pll_min_ratio;
 module_param_named(pll_min_ratio, ivpu_pll_min_ratio, byte, 0644);
drivers/accel/ivpu/ivpu_fw.c +2 -0
index be367465e7df4..d358cf0b0f972 100644
@@ -46,8 +46,10 @@
 #define IVPU_FOCUS_PRESENT_TIMER_MS 1000
 
 static char *ivpu_firmware;
+#if IS_ENABLED(CONFIG_DRM_ACCEL_IVPU_DEBUG)
 module_param_named_unsafe(firmware, ivpu_firmware, charp, 0644);
 MODULE_PARM_DESC(firmware, "NPU firmware binary in /lib/firmware/..");
+#endif
 
 static struct {
 	int gen;
drivers/accel/ivpu/ivpu_pm.c +2 -0
index e567df79a6129..dbc0711e28d13 100644
@@ -24,8 +24,10 @@
 #include "vpu_boot_api.h"
 
 static bool ivpu_disable_recovery;
+#if IS_ENABLED(CONFIG_DRM_ACCEL_IVPU_DEBUG)
 module_param_named_unsafe(disable_recovery, ivpu_disable_recovery, bool, 0644);
 MODULE_PARM_DESC(disable_recovery, "Disables recovery when NPU hang is detected");
+#endif
 
 static unsigned long ivpu_tdr_timeout_ms;
 module_param_named(tdr_timeout_ms, ivpu_tdr_timeout_ms, ulong, 0644);
Signature · 1 line
2.45.1
#18 lore raw

Re: [PATCH 09/11] accel/ivpu: Add debug Kconfig option

Quoted 22 lines · Jacek Lawrynowicz

From: Maciej Falkowski <[email protected]>

Add CONFIG_DRM_ACCEL_IVPU_DEBUG option that:
- Adds -DDEBUG that enables printk regardless of the kernel config
- Enables unsafe module params (that are now disabled by default)

---
  drivers/accel/ivpu/Kconfig    | 10 ++++++++++
  drivers/accel/ivpu/Makefile   |  2 ++
  drivers/accel/ivpu/ivpu_drv.c |  2 ++
  drivers/accel/ivpu/ivpu_fw.c  |  2 ++
  drivers/accel/ivpu/ivpu_pm.c  |  2 ++
  5 files changed, 18 insertions(+)
drivers/accel/ivpu/Kconfig +0 -0
index e4d418b44626e..8858b32e05640 100644

drivers/accel/ivpu/Kconfig config DRM_ACCEL_IVPU · line 23

Quoted 8 lines
drivers/accel/ivpu/Kconfig +5 -0
@@ -16,3 +16,13 @@ config DRM_ACCEL_IVPU
  	  and Deep Learning applications.
 
  	  If "M" is selected, the module will be called intel_vpu.
+
+config DRM_ACCEL_IVPU_DEBUG
+	bool "Intel NPU debug mode"
+	depends on DRM_ACCEL_IVPU
+	default n

The default is N, so this is redundant, no?

Quoted 7 lines
drivers/accel/ivpu/Kconfig +5 -0
+	help
+	  Choose this option to enable additional
+	  debug features for the Intel NPU driver:
+	  - Always print debug messages regardless of dyndbg config,
+	  - Enable unsafe module params.
drivers/accel/ivpu/Makefile +0 -0
index e73937c86d9ad..1029e0bab0615 100644
#19 lore raw

Re: [PATCH 09/11] accel/ivpu: Add debug Kconfig option

Hi,

Quoted 18 lines · Jeffrey Hugo
Quoted 17 lines · Jacek Lawrynowicz

From: Maciej Falkowski <[email protected]>

Add CONFIG_DRM_ACCEL_IVPU_DEBUG option that:
  - Adds -DDEBUG that enables printk regardless of the kernel config
  - Enables unsafe module params (that are now disabled by default)

---
  drivers/accel/ivpu/Kconfig    | 10 ++++++++++
  drivers/accel/ivpu/Makefile   |  2 ++
  drivers/accel/ivpu/ivpu_drv.c |  2 ++
  drivers/accel/ivpu/ivpu_fw.c  |  2 ++
  drivers/accel/ivpu/ivpu_pm.c  |  2 ++

  5 files changed, 18 insertions(+)
Quoted 15 lines

drivers/accel/ivpu/Kconfig config DRM_ACCEL_IVPU · line 23

Quoted 12 lines
drivers/accel/ivpu/Kconfig +0 -0
index e4d418b44626e..8858b32e05640 100644
@@ -16,3 +16,13 @@ config DRM_ACCEL_IVPU

        and Deep Learning applications.
          If "M" is selected, the module will be called intel_vpu.

drivers/accel/ivpu/Kconfig +5 -0
+
+config DRM_ACCEL_IVPU_DEBUG
+    bool "Intel NPU debug mode"
+    depends on DRM_ACCEL_IVPU
+    default n

The default is N, so this is redundant, no?

Yes, I will remove it.

#20 lore raw

PATCH 10/11 accel/ivpu: Increase DMA address range

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Increase DMA address range to:
* 128 GB on 37xx (due to MMU limitations)
* 256 GB on other generations
Merge User and DMA ranges on 40xx and above as it is possible to access whole 256 GBs from both FW and DMA.

Increase User range on 37xx from 255MB to 511MB
to allow loading very large models.

Do not set global_alias_pio_base/size on other generations than 37xx as it's only used on 37xx anyway.

---
 drivers/accel/ivpu/ivpu_fw.c          |  6 ++++--
 drivers/accel/ivpu/ivpu_hw.c          | 10 +++++-----
 drivers/accel/ivpu/ivpu_mmu_context.c |  4 ++--
 3 files changed, 11 insertions(+), 9 deletions(-)
drivers/accel/ivpu/ivpu_fw.c +4 -2
index d358cf0b0f972..6037ec0b30968 100644
@@ -584,8 +584,10 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params
 	boot_params->ipc_payload_area_start = ipc_mem_rx->vpu_addr + ivpu_bo_size(ipc_mem_rx) / 2;
 	boot_params->ipc_payload_area_size = ivpu_bo_size(ipc_mem_rx) / 2;
 
-	boot_params->global_aliased_pio_base = vdev->hw->ranges.user.start;
-	boot_params->global_aliased_pio_size = ivpu_hw_range_size(&vdev->hw->ranges.user);
+	if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
+		boot_params->global_aliased_pio_base = vdev->hw->ranges.user.start;
+		boot_params->global_aliased_pio_size = ivpu_hw_range_size(&vdev->hw->ranges.user);
+	}
 
 	/* Allow configuration for L2C_PAGE_TABLE with boot param value */
 	boot_params->autoconfig = 1;
drivers/accel/ivpu/ivpu_hw.c +5 -5
index 1c259d7178151..09ada8b500b99 100644
@@ -114,14 +114,14 @@ static void memory_ranges_init(struct ivpu_device *vdev)
 {
 	if (ivpu_hw_ip_gen(vdev) == IVPU_HW_IP_37XX) {
 		ivpu_hw_range_init(&vdev->hw->ranges.global, 0x80000000, SZ_512M);
-		ivpu_hw_range_init(&vdev->hw->ranges.user,   0xc0000000, 255 * SZ_1M);
+		ivpu_hw_range_init(&vdev->hw->ranges.user,   0x88000000, 511 * SZ_1M);
 		ivpu_hw_range_init(&vdev->hw->ranges.shave, 0x180000000, SZ_2G);
-		ivpu_hw_range_init(&vdev->hw->ranges.dma,   0x200000000, SZ_8G);
+		ivpu_hw_range_init(&vdev->hw->ranges.dma,   0x200000000, SZ_128G);
 	} else {
 		ivpu_hw_range_init(&vdev->hw->ranges.global, 0x80000000, SZ_512M);
-		ivpu_hw_range_init(&vdev->hw->ranges.user,   0x80000000, SZ_256M);
-		ivpu_hw_range_init(&vdev->hw->ranges.shave,  0x80000000 + SZ_256M, SZ_2G - SZ_256M);
-		ivpu_hw_range_init(&vdev->hw->ranges.dma,   0x200000000, SZ_8G);
+		ivpu_hw_range_init(&vdev->hw->ranges.shave,  0x80000000, SZ_2G);
+		ivpu_hw_range_init(&vdev->hw->ranges.user,  0x100000000, SZ_256G);
+		vdev->hw->ranges.dma = vdev->hw->ranges.user;
 	}
 }
 
drivers/accel/ivpu/ivpu_mmu_context.c +2 -2
index 697b57071d546..891967a95bc3c 100644
@@ -571,8 +571,8 @@ void ivpu_mmu_context_init(struct ivpu_device *vdev, struct ivpu_mmu_context *ct
 		start = vdev->hw->ranges.global.start;
 		end = vdev->hw->ranges.shave.end;
 	} else {
-		start = vdev->hw->ranges.user.start;
-		end = vdev->hw->ranges.dma.end;
+		start = min_t(u64, vdev->hw->ranges.user.start, vdev->hw->ranges.shave.start);
+		end = max_t(u64, vdev->hw->ranges.user.end, vdev->hw->ranges.dma.end);
 	}
 
 	drm_mm_init(&ctx->mm, start, end - start);
Signature · 1 line
2.45.1
Reviewed-by on v1 10/11
#21 lore raw

Re: [PATCH 10/11] accel/ivpu: Increase DMA address range

Quoted 11 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Increase DMA address range to:
* 128 GB on 37xx (due to MMU limitations)
* 256 GB on other generations
Merge User and DMA ranges on 40xx and above as it is possible to access whole 256 GBs from both FW and DMA.

Increase User range on 37xx from 255MB to 511MB
to allow loading very large models.

Quoted 7 lines

Do not set global_alias_pio_base/size on other generations than 37xx as it's only used on 37xx anyway.

#22 lore raw

PATCH 11/11 accel/ivpu: Move secondary preemption buffer allocation to DMA range

In reply to Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Secondary preemption buffer is accessible by NPU's DMA and can be allocated with addresses above 4 GB. Move secondary preemption buffer allocation from SHAVE range which is much smaller (2GB) to DMA range. This allows to allocate more command queues with corresponding preemption buffers without running out of address range.

---
 drivers/accel/ivpu/ivpu_job.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_job.c +1 -1
index 39ba6d3d8b0de..7149312f16e19 100644
@@ -46,7 +46,7 @@ static int ivpu_preemption_buffers_create(struct ivpu_device *vdev,
 		return -ENOMEM;
 	}
 
-	cmdq->secondary_preempt_buf = ivpu_bo_create(vdev, &file_priv->ctx, &vdev->hw->ranges.shave,
+	cmdq->secondary_preempt_buf = ivpu_bo_create(vdev, &file_priv->ctx, &vdev->hw->ranges.dma,
 						     secondary_size, DRM_IVPU_BO_WC);
 	if (!cmdq->secondary_preempt_buf) {
 		ivpu_err(vdev, "Failed to create secondary preemption buffer\n");
Signature · 1 line
2.45.1
Reviewed-by on v1 11/11
#23 lore raw

Re: [PATCH 11/11] accel/ivpu: Move secondary preemption buffer allocation to DMA range

Quoted 11 lines · Jacek Lawrynowicz

From: Karol Wachowski <[email protected]>

Secondary preemption buffer is accessible by NPU's DMA and can be allocated with addresses above 4 GB. Move secondary preemption buffer allocation from SHAVE range which is much smaller (2GB) to DMA range. This allows to allocate more command queues with corresponding preemption buffers without running out of address range.

#24 lore raw
In reply to Jacek Lawrynowicz

Oops, I meant 6.13-rc1

Quoted 42 lines · Jacek Lawrynowicz

- Remove support for deprecated and unused copy engine
- Improved open() performance by lazy allocating MMU page tables
- Error handling fixes in MMU code
- Extend VPU address ranges to allow bigger workloads

Andrzej Kacprowski (1):
accel/ivpu: Remove copy engine support

Karol Wachowski (9):
accel/ivpu: Do not fail when more than 1 tile is fused accel/ivpu: Defer MMU root page table allocation accel/ivpu: Clear CDTAB entry in case of failure accel/ivpu: Unmap partially mapped BOs in case of errors accel/ivpu: Use xa_alloc_cyclic() instead of custom function accel/ivpu: Make command queue ID allocated on XArray accel/ivpu: Don't allocate preemption buffers when MIP is disabled accel/ivpu: Increase DMA address range
accel/ivpu: Move secondary preemption buffer allocation to DMA range

Maciej Falkowski (1):
accel/ivpu: Add debug Kconfig option

 drivers/accel/ivpu/Kconfig            |  10 ++
 drivers/accel/ivpu/Makefile           |   2 +
 drivers/accel/ivpu/ivpu_drv.c         |  31 +++--
 drivers/accel/ivpu/ivpu_drv.h         |  16 +--
 drivers/accel/ivpu/ivpu_fw.c          |   8 +-
 drivers/accel/ivpu/ivpu_hw.c          |  10 +-
 drivers/accel/ivpu/ivpu_hw_btrs.c     |  12 +-
 drivers/accel/ivpu/ivpu_job.c         | 148 ++++++++++--------------
 drivers/accel/ivpu/ivpu_job.h         |   2 +
 drivers/accel/ivpu/ivpu_jsm_msg.c     |   8 +-
 drivers/accel/ivpu/ivpu_mmu.c         | 101 ++++++----------
 drivers/accel/ivpu/ivpu_mmu.h         |   4 +-
 drivers/accel/ivpu/ivpu_mmu_context.c | 158 ++++++++++++++------------
 drivers/accel/ivpu/ivpu_mmu_context.h |   9 +-
 drivers/accel/ivpu/ivpu_pm.c          |   2 +
 include/uapi/drm/ivpu_accel.h         |   6 +-
 16 files changed, 243 insertions(+), 284 deletions(-)

--
2.45.1

author Applied
#25 lore raw
In reply to Jacek Lawrynowicz

Applied to drm-mic-next

Quoted 42 lines · Jacek Lawrynowicz

- Remove support for deprecated and unused copy engine
- Improved open() performance by lazy allocating MMU page tables
- Error handling fixes in MMU code
- Extend VPU address ranges to allow bigger workloads

Andrzej Kacprowski (1):
accel/ivpu: Remove copy engine support

Karol Wachowski (9):
accel/ivpu: Do not fail when more than 1 tile is fused accel/ivpu: Defer MMU root page table allocation accel/ivpu: Clear CDTAB entry in case of failure accel/ivpu: Unmap partially mapped BOs in case of errors accel/ivpu: Use xa_alloc_cyclic() instead of custom function accel/ivpu: Make command queue ID allocated on XArray accel/ivpu: Don't allocate preemption buffers when MIP is disabled accel/ivpu: Increase DMA address range
accel/ivpu: Move secondary preemption buffer allocation to DMA range

Maciej Falkowski (1):
accel/ivpu: Add debug Kconfig option

 drivers/accel/ivpu/Kconfig            |  10 ++
 drivers/accel/ivpu/Makefile           |   2 +
 drivers/accel/ivpu/ivpu_drv.c         |  31 +++--
 drivers/accel/ivpu/ivpu_drv.h         |  16 +--
 drivers/accel/ivpu/ivpu_fw.c          |   8 +-
 drivers/accel/ivpu/ivpu_hw.c          |  10 +-
 drivers/accel/ivpu/ivpu_hw_btrs.c     |  12 +-
 drivers/accel/ivpu/ivpu_job.c         | 148 ++++++++++--------------
 drivers/accel/ivpu/ivpu_job.h         |   2 +
 drivers/accel/ivpu/ivpu_jsm_msg.c     |   8 +-
 drivers/accel/ivpu/ivpu_mmu.c         | 101 ++++++----------
 drivers/accel/ivpu/ivpu_mmu.h         |   4 +-
 drivers/accel/ivpu/ivpu_mmu_context.c | 158 ++++++++++++++------------
 drivers/accel/ivpu/ivpu_mmu_context.h |   9 +-
 drivers/accel/ivpu/ivpu_pm.c          |   2 +
 include/uapi/drm/ivpu_accel.h         |   6 +-
 16 files changed, 243 insertions(+), 284 deletions(-)

--
2.45.1