Skip to content

Commit 94b2a2c

Browse files
akacprowjlawryno
authored andcommitted
accel/ivpu: Remove copy engine support
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. Signed-off-by: Andrzej Kacprowski <[email protected]> Reviewed-by: Jacek Lawrynowicz <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Signed-off-by: Jacek Lawrynowicz <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent a74f4d9 commit 94b2a2c

File tree

4 files changed

+21
-41
lines changed

4 files changed

+21
-41
lines changed

drivers/accel/ivpu/ivpu_drv.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,8 @@
4949
#define IVPU_JOB_ID_JOB_MASK GENMASK(7, 0)
5050
#define IVPU_JOB_ID_CONTEXT_MASK GENMASK(31, 8)
5151

52-
#define IVPU_NUM_ENGINES 2
5352
#define IVPU_NUM_PRIORITIES 4
54-
#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_ENGINES * IVPU_NUM_PRIORITIES)
55-
56-
#define IVPU_CMDQ_INDEX(engine, priority) ((engine) * IVPU_NUM_PRIORITIES + (priority))
53+
#define IVPU_NUM_CMDQS_PER_CTX (IVPU_NUM_PRIORITIES)
5754

5855
#define IVPU_PLATFORM_SILICON 0
5956
#define IVPU_PLATFORM_SIMICS 2

drivers/accel/ivpu/ivpu_job.c

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ static int ivpu_cmdq_fini(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cm
247247
static struct ivpu_cmdq *ivpu_cmdq_acquire(struct ivpu_file_priv *file_priv, u16 engine,
248248
u8 priority)
249249
{
250-
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);
251-
struct ivpu_cmdq *cmdq = file_priv->cmdq[cmdq_idx];
250+
struct ivpu_cmdq *cmdq = file_priv->cmdq[priority];
252251
int ret;
253252

254253
lockdep_assert_held(&file_priv->lock);
@@ -257,7 +256,7 @@ static struct ivpu_cmdq *ivpu_cmdq_acquire(struct ivpu_file_priv *file_priv, u16
257256
cmdq = ivpu_cmdq_alloc(file_priv);
258257
if (!cmdq)
259258
return NULL;
260-
file_priv->cmdq[cmdq_idx] = cmdq;
259+
file_priv->cmdq[priority] = cmdq;
261260
}
262261

263262
ret = ivpu_cmdq_init(file_priv, cmdq, engine, priority);
@@ -267,30 +266,27 @@ static struct ivpu_cmdq *ivpu_cmdq_acquire(struct ivpu_file_priv *file_priv, u16
267266
return cmdq;
268267
}
269268

270-
static void ivpu_cmdq_release_locked(struct ivpu_file_priv *file_priv, u16 engine, u8 priority)
269+
static void ivpu_cmdq_release_locked(struct ivpu_file_priv *file_priv, u8 priority)
271270
{
272-
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);
273-
struct ivpu_cmdq *cmdq = file_priv->cmdq[cmdq_idx];
271+
struct ivpu_cmdq *cmdq = file_priv->cmdq[priority];
274272

275273
lockdep_assert_held(&file_priv->lock);
276274

277275
if (cmdq) {
278-
file_priv->cmdq[cmdq_idx] = NULL;
276+
file_priv->cmdq[priority] = NULL;
279277
ivpu_cmdq_fini(file_priv, cmdq);
280278
ivpu_cmdq_free(file_priv, cmdq);
281279
}
282280
}
283281

284282
void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv)
285283
{
286-
u16 engine;
287284
u8 priority;
288285

289286
lockdep_assert_held(&file_priv->lock);
290287

291-
for (engine = 0; engine < IVPU_NUM_ENGINES; engine++)
292-
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++)
293-
ivpu_cmdq_release_locked(file_priv, engine, priority);
288+
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++)
289+
ivpu_cmdq_release_locked(file_priv, priority);
294290
}
295291

296292
/*
@@ -301,19 +297,15 @@ void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv)
301297
*/
302298
static void ivpu_cmdq_reset(struct ivpu_file_priv *file_priv)
303299
{
304-
u16 engine;
305300
u8 priority;
306301

307302
mutex_lock(&file_priv->lock);
308303

309-
for (engine = 0; engine < IVPU_NUM_ENGINES; engine++) {
310-
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
311-
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);
312-
struct ivpu_cmdq *cmdq = file_priv->cmdq[cmdq_idx];
304+
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
305+
struct ivpu_cmdq *cmdq = file_priv->cmdq[priority];
313306

314-
if (cmdq)
315-
cmdq->db_registered = false;
316-
}
307+
if (cmdq)
308+
cmdq->db_registered = false;
317309
}
318310

319311
mutex_unlock(&file_priv->lock);
@@ -334,16 +326,11 @@ void ivpu_cmdq_reset_all_contexts(struct ivpu_device *vdev)
334326

335327
static void ivpu_cmdq_fini_all(struct ivpu_file_priv *file_priv)
336328
{
337-
u16 engine;
338329
u8 priority;
339330

340-
for (engine = 0; engine < IVPU_NUM_ENGINES; engine++) {
341-
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
342-
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);
343-
344-
if (file_priv->cmdq[cmdq_idx])
345-
ivpu_cmdq_fini(file_priv, file_priv->cmdq[cmdq_idx]);
346-
}
331+
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
332+
if (file_priv->cmdq[priority])
333+
ivpu_cmdq_fini(file_priv, file_priv->cmdq[priority]);
347334
}
348335
}
349336

@@ -699,7 +686,7 @@ int ivpu_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
699686
int idx, ret;
700687
u8 priority;
701688

702-
if (params->engine > DRM_IVPU_ENGINE_COPY)
689+
if (params->engine != DRM_IVPU_ENGINE_COMPUTE)
703690
return -EINVAL;
704691

705692
if (params->priority > DRM_IVPU_JOB_PRIORITY_REALTIME)

drivers/accel/ivpu/ivpu_jsm_msg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ int ivpu_jsm_get_heartbeat(struct ivpu_device *vdev, u32 engine, u64 *heartbeat)
132132
struct vpu_jsm_msg resp;
133133
int ret;
134134

135-
if (engine > VPU_ENGINE_COPY)
135+
if (engine != VPU_ENGINE_COMPUTE)
136136
return -EINVAL;
137137

138138
req.payload.query_engine_hb.engine_idx = engine;
@@ -155,7 +155,7 @@ int ivpu_jsm_reset_engine(struct ivpu_device *vdev, u32 engine)
155155
struct vpu_jsm_msg resp;
156156
int ret;
157157

158-
if (engine > VPU_ENGINE_COPY)
158+
if (engine != VPU_ENGINE_COMPUTE)
159159
return -EINVAL;
160160

161161
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
174174
struct vpu_jsm_msg resp;
175175
int ret;
176176

177-
if (engine > VPU_ENGINE_COPY)
177+
if (engine != VPU_ENGINE_COMPUTE)
178178
return -EINVAL;
179179

180180
req.payload.engine_preempt.engine_idx = engine;
@@ -346,7 +346,7 @@ int ivpu_jsm_hws_resume_engine(struct ivpu_device *vdev, u32 engine)
346346
struct vpu_jsm_msg resp;
347347
int ret;
348348

349-
if (engine >= VPU_ENGINE_NB)
349+
if (engine != VPU_ENGINE_COMPUTE)
350350
return -EINVAL;
351351

352352
req.payload.hws_resume_engine.engine_idx = engine;

include/uapi/drm/ivpu_accel.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ struct drm_ivpu_bo_info {
258258

259259
/* drm_ivpu_submit engines */
260260
#define DRM_IVPU_ENGINE_COMPUTE 0
261-
#define DRM_IVPU_ENGINE_COPY 1
261+
#define DRM_IVPU_ENGINE_COPY 1 /* Deprecated */
262262

263263
/**
264264
* struct drm_ivpu_submit - Submit commands to the VPU
@@ -289,10 +289,6 @@ struct drm_ivpu_submit {
289289
* %DRM_IVPU_ENGINE_COMPUTE:
290290
*
291291
* Performs Deep Learning Neural Compute Inference Operations
292-
*
293-
* %DRM_IVPU_ENGINE_COPY:
294-
*
295-
* Performs memory copy operations to/from system memory allocated for VPU
296292
*/
297293
__u32 engine;
298294

0 commit comments

Comments
 (0)