From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1766964878848640668==" MIME-Version: 1.0 From: Tony Zhu Subject: [Accel-config] [PATCH v2 1/1] accel-config:dsa_test Add no opcode operation support Date: Thu, 26 Aug 2021 23:14:44 -0400 Message-ID: <20210827031444.3075467-1-tony.zhu@intel.com> To: accel-config@lists.01.org List-ID: --===============1766964878848640668== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The No-op operation performs no DMA operation. Add the test support. Signed-off-by: Tony Zhu --- test/dsa.c | 28 ++++++++++++++++++++++++++++ test/dsa.h | 5 +++++ test/dsa_test.c | 30 ++++++++++++++++++++++++++++++ test/prep.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+) diff --git a/test/dsa.c b/test/dsa.c index 5396b1b..ce6f6a1 100644 --- a/test/dsa.c +++ b/test/dsa.c @@ -554,6 +554,34 @@ void free_batch_task(struct batch_task *btsk) free(btsk); } = +int dsa_wait_noop(struct dsa_context *ctx) +{ + struct dsa_completion_record *comp =3D ctx->single_task->comp; + int rc; + + rc =3D dsa_wait_on_desc_timeout(comp, ms_timeout); + if (rc < 0) { + err("noop desc timeout\n"); + return DSA_STATUS_TIMEOUT; + } + + return DSA_STATUS_OK; +} + +int dsa_noop(struct dsa_context *ctx) +{ + struct task *tsk =3D ctx->single_task; + int ret =3D DSA_STATUS_OK; + + tsk->dflags =3D IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR; + + dsa_prep_noop(tsk); + dsa_desc_submit(ctx, tsk->desc); + ret =3D dsa_wait_noop(ctx); + + return ret; +} + int dsa_wait_batch(struct dsa_context *ctx) { int rc; diff --git a/test/dsa.h b/test/dsa.h index 4e3cddc..5db0c02 100644 --- a/test/dsa.h +++ b/test/dsa.h @@ -217,6 +217,9 @@ struct task *__alloc_task(void); int init_task(struct task *tsk, int tflags, int opcode, unsigned long xfer_size); = +int dsa_noop(struct dsa_context *ctx); +int dsa_wait_noop(struct dsa_context *ctx); + int dsa_memcpy(struct dsa_context *ctx); int dsa_wait_memcpy(struct dsa_context *ctx); = @@ -232,6 +235,7 @@ int dsa_wait_compval(struct dsa_context *ctx); int dsa_dualcast(struct dsa_context *ctx); int dsa_wait_dualcast(struct dsa_context *ctx); = +void dsa_prep_noop(struct task *tsk); void dsa_prep_memcpy(struct task *tsk); void dsa_reprep_memcpy(struct dsa_context *ctx); void dsa_prep_memfill(struct task *tsk); @@ -256,6 +260,7 @@ int init_batch_task(struct batch_task *btsk, int task_n= um, int tflags, int opcode, unsigned long xfer_size, unsigned long dflags); = void dsa_prep_batch(struct batch_task *btsk, unsigned long desc_flags); +void dsa_prep_batch_noop(struct batch_task *btsk); void dsa_prep_batch_memcpy(struct batch_task *btsk); void dsa_prep_batch_memfill(struct batch_task *btsk); void dsa_prep_batch_compare(struct batch_task *btsk); diff --git a/test/dsa_test.c b/test/dsa_test.c index 90be118..5f7a7f1 100644 --- a/test/dsa_test.c +++ b/test/dsa_test.c @@ -58,6 +58,9 @@ static int test_batch(struct dsa_context *ctx, size_t buf= _size, return rc; = switch (bopcode) { + case DSA_OPCODE_NOOP: + dsa_prep_batch_noop(ctx->batch_task); + break; case DSA_OPCODE_MEMMOVE: dsa_prep_batch_memcpy(ctx->batch_task); break; @@ -157,6 +160,33 @@ int main(int argc, char *argv[]) } = switch (opcode) { + case DSA_OPCODE_NOOP: { + struct task *tsk; + + info("noop: len %#lx tflags %#x\n", buf_size, tflags); + + rc =3D alloc_task(dsa); + if (rc !=3D DSA_STATUS_OK) { + err("noop: alloc task failed, rc=3D%d\n", rc); + goto error; + } + + tsk =3D dsa->single_task; + + rc =3D dsa_noop(dsa); + if (rc !=3D DSA_STATUS_OK) { + err("noop failed stat %d\n", rc); + rc =3D -ENXIO; + break; + } + + rc =3D task_result_verify(tsk, 0); + if (rc !=3D DSA_STATUS_OK) + goto error; + + break; + } + case DSA_OPCODE_BATCH: if (bsize > dsa->max_batch_size || bsize < 2) { err("invalid num descs: %d\n", bsize); diff --git a/test/prep.c b/test/prep.c index bb06626..f22f190 100644 --- a/test/prep.c +++ b/test/prep.c @@ -30,6 +30,17 @@ void dsa_desc_submit(struct dsa_context *ctx, struct dsa= _hw_desc *hw) usleep(10000); } = +void dsa_prep_noop(struct task *tsk) +{ + info("preparing descriptor for noop\n"); + + tsk->dflags =3D IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR; + dsa_prep_desc_common(tsk->desc, tsk->opcode, (uint64_t)(tsk->dst1), + (uint64_t)(tsk->src1), 0, tsk->dflags); + tsk->desc->completion_addr =3D (uint64_t)(tsk->comp); + tsk->comp->status =3D 0; +} + void dsa_prep_memcpy(struct task *tsk) { info("preparing descriptor for memcpy\n"); @@ -63,6 +74,23 @@ void dsa_reprep_memcpy(struct dsa_context *ctx) dsa_desc_submit(ctx, hw); } = +void dsa_prep_batch_noop(struct batch_task *btsk) +{ + int i; + struct task *sub_task; + + uint32_t dflags =3D IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR; + for (i =3D 0; i < btsk->task_num; i++) { + sub_task =3D &(btsk->sub_tasks[i]); + dsa_prep_desc_common(sub_task->desc, sub_task->opcode, + (uint64_t)(sub_task->dst1), + (uint64_t)(sub_task->src1), + 0, dflags); + sub_task->desc->completion_addr =3D (uint64_t)(sub_task->comp); + sub_task->comp->status =3D 0; + } +} + /* Performs no error or bound checking */ void dsa_prep_batch_memcpy(struct batch_task *btsk) { -- = 2.27.0 --===============1766964878848640668==--