Skip to content

Commit

Permalink
accel/ivpu: Remove copy engine support
Browse files Browse the repository at this point in the history
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 <Andrzej.Kacprowski@intel.com>
Reviewed-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241017145817.121590-4-jacek.lawrynowicz@linux.intel.com
  • Loading branch information
Andrzej Kacprowski authored and Jacek Lawrynowicz committed Oct 30, 2024
1 parent a74f4d9 commit 94b2a2c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 41 deletions.
5 changes: 1 addition & 4 deletions drivers/accel/ivpu/ivpu_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 15 additions & 28 deletions drivers/accel/ivpu/ivpu_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ static int ivpu_cmdq_fini(struct ivpu_file_priv *file_priv, struct ivpu_cmdq *cm
static struct ivpu_cmdq *ivpu_cmdq_acquire(struct ivpu_file_priv *file_priv, u16 engine,
u8 priority)
{
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);
struct ivpu_cmdq *cmdq = file_priv->cmdq[cmdq_idx];
struct ivpu_cmdq *cmdq = file_priv->cmdq[priority];
int ret;

lockdep_assert_held(&file_priv->lock);
Expand All @@ -257,7 +256,7 @@ static struct ivpu_cmdq *ivpu_cmdq_acquire(struct ivpu_file_priv *file_priv, u16
cmdq = ivpu_cmdq_alloc(file_priv);
if (!cmdq)
return NULL;
file_priv->cmdq[cmdq_idx] = cmdq;
file_priv->cmdq[priority] = cmdq;
}

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

static void ivpu_cmdq_release_locked(struct ivpu_file_priv *file_priv, u16 engine, u8 priority)
static void ivpu_cmdq_release_locked(struct ivpu_file_priv *file_priv, u8 priority)
{
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);
struct ivpu_cmdq *cmdq = file_priv->cmdq[cmdq_idx];
struct ivpu_cmdq *cmdq = file_priv->cmdq[priority];

lockdep_assert_held(&file_priv->lock);

if (cmdq) {
file_priv->cmdq[cmdq_idx] = NULL;
file_priv->cmdq[priority] = NULL;
ivpu_cmdq_fini(file_priv, cmdq);
ivpu_cmdq_free(file_priv, cmdq);
}
}

void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv)
{
u16 engine;
u8 priority;

lockdep_assert_held(&file_priv->lock);

for (engine = 0; engine < IVPU_NUM_ENGINES; engine++)
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++)
ivpu_cmdq_release_locked(file_priv, engine, priority);
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++)
ivpu_cmdq_release_locked(file_priv, priority);
}

/*
Expand All @@ -301,19 +297,15 @@ void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv)
*/
static void ivpu_cmdq_reset(struct ivpu_file_priv *file_priv)
{
u16 engine;
u8 priority;

mutex_lock(&file_priv->lock);

for (engine = 0; engine < IVPU_NUM_ENGINES; engine++) {
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);
struct ivpu_cmdq *cmdq = file_priv->cmdq[cmdq_idx];
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
struct ivpu_cmdq *cmdq = file_priv->cmdq[priority];

if (cmdq)
cmdq->db_registered = false;
}
if (cmdq)
cmdq->db_registered = false;
}

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

static void ivpu_cmdq_fini_all(struct ivpu_file_priv *file_priv)
{
u16 engine;
u8 priority;

for (engine = 0; engine < IVPU_NUM_ENGINES; engine++) {
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
int cmdq_idx = IVPU_CMDQ_INDEX(engine, priority);

if (file_priv->cmdq[cmdq_idx])
ivpu_cmdq_fini(file_priv, file_priv->cmdq[cmdq_idx]);
}
for (priority = 0; priority < IVPU_NUM_PRIORITIES; priority++) {
if (file_priv->cmdq[priority])
ivpu_cmdq_fini(file_priv, file_priv->cmdq[priority]);
}
}

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

if (params->engine > DRM_IVPU_ENGINE_COPY)
if (params->engine != DRM_IVPU_ENGINE_COMPUTE)
return -EINVAL;

if (params->priority > DRM_IVPU_JOB_PRIORITY_REALTIME)
Expand Down
8 changes: 4 additions & 4 deletions drivers/accel/ivpu/ivpu_jsm_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions include/uapi/drm/ivpu_accel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 94b2a2c

Please sign in to comment.