idxd: Do vtophys on batch descriptor array up front instead of

dynamically

This can be done once on allocation rather than every time the batch is
submitted.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I8092f65f1b864cc3cc78db9fdee085d8bb0471df
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10293
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Ben Walker 2021-11-18 12:30:29 -07:00 committed by Tomasz Zawadzki
parent f4b7b44a8a
commit a0d7a99914
2 changed files with 10 additions and 9 deletions

View File

@ -255,6 +255,14 @@ spdk_idxd_configure_chan(struct spdk_idxd_io_channel *chan)
goto err_user_desc_or_op;
}
rc = _vtophys(batch->user_desc, &batch->user_desc_addr,
DESC_PER_BATCH * sizeof(struct idxd_hw_desc));
if (rc) {
SPDK_ERRLOG("Failed to translate batch descriptor memory\n");
rc = -ENOMEM;
goto err_user_desc_or_op;
}
batch->user_ops = op = spdk_zmalloc(DESC_PER_BATCH * sizeof(struct idxd_ops),
0x40, NULL,
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
@ -1109,7 +1117,6 @@ spdk_idxd_batch_submit(struct spdk_idxd_io_channel *chan, struct idxd_batch *bat
{
struct idxd_hw_desc *desc;
struct idxd_ops *op;
uint64_t desc_addr;
int i, rc;
assert(chan != NULL);
@ -1133,16 +1140,9 @@ spdk_idxd_batch_submit(struct spdk_idxd_io_channel *chan, struct idxd_batch *bat
return rc;
}
/* TODO: pre-translate these when allocated for max batch size. */
rc = _vtophys(batch->user_desc, &desc_addr, batch->index * sizeof(struct idxd_hw_desc));
if (rc) {
TAILQ_INSERT_TAIL(&chan->ops_pool, op, link);
return rc;
}
/* Command specific. */
desc->opcode = IDXD_OPCODE_BATCH;
desc->desc_list_addr = desc_addr;
desc->desc_list_addr = batch->user_desc_addr;
desc->desc_count = batch->index;
op->batch = batch;
assert(batch->index <= DESC_PER_BATCH);

View File

@ -77,6 +77,7 @@ static inline void movdir64b(void *dst, const void *src)
struct idxd_batch {
struct idxd_hw_desc *user_desc;
struct idxd_ops *user_ops;
uint64_t user_desc_addr;
uint8_t index;
struct spdk_idxd_io_channel *chan;
TAILQ_ENTRY(idxd_batch) link;