lib/idxd: pre translate the completion address for batch entries
Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I9df51acc2bbd3deffcb172c0fd3e7012ec3d4b3b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9100 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
d09b5674a4
commit
7abf75c2b5
@ -247,23 +247,34 @@ spdk_idxd_configure_chan(struct spdk_idxd_io_channel *chan)
|
|||||||
|
|
||||||
/* Populate the batches */
|
/* Populate the batches */
|
||||||
TAILQ_FOREACH(batch, &chan->batch_pool, link) {
|
TAILQ_FOREACH(batch, &chan->batch_pool, link) {
|
||||||
batch->user_desc = spdk_zmalloc(DESC_PER_BATCH * sizeof(struct idxd_hw_desc),
|
batch->user_desc = desc = spdk_zmalloc(DESC_PER_BATCH * sizeof(struct idxd_hw_desc),
|
||||||
0x40, NULL,
|
0x40, NULL,
|
||||||
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
||||||
if (batch->user_desc == NULL) {
|
if (batch->user_desc == NULL) {
|
||||||
SPDK_ERRLOG("Failed to allocate batch descriptor memory\n");
|
SPDK_ERRLOG("Failed to allocate batch descriptor memory\n");
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_user_desc_or_op;
|
goto err_user_desc_or_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
batch->user_ops = spdk_zmalloc(DESC_PER_BATCH * sizeof(struct idxd_ops),
|
batch->user_ops = op = spdk_zmalloc(DESC_PER_BATCH * sizeof(struct idxd_ops),
|
||||||
0x40, NULL,
|
0x40, NULL,
|
||||||
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
SPDK_ENV_LCORE_ID_ANY, SPDK_MALLOC_DMA);
|
||||||
if (batch->user_ops == NULL) {
|
if (batch->user_ops == NULL) {
|
||||||
SPDK_ERRLOG("Failed to allocate user completion memory\n");
|
SPDK_ERRLOG("Failed to allocate user completion memory\n");
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto err_user_desc_or_op;
|
goto err_user_desc_or_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < DESC_PER_BATCH; i++) {
|
||||||
|
rc = _vtophys(&op->hw, &desc->completion_addr, sizeof(struct idxd_hw_comp_record));
|
||||||
|
if (rc) {
|
||||||
|
SPDK_ERRLOG("Failed to translate batch entry completion memory\n");
|
||||||
|
rc = -ENOMEM;
|
||||||
|
goto err_user_desc_or_op;
|
||||||
|
}
|
||||||
|
op++;
|
||||||
|
desc++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chan->portal = chan->idxd->impl->portal_get_addr(chan->idxd);
|
chan->portal = chan->idxd->impl->portal_get_addr(chan->idxd);
|
||||||
@ -794,8 +805,6 @@ _idxd_prep_batch_cmd(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn,
|
|||||||
{
|
{
|
||||||
struct idxd_hw_desc *desc;
|
struct idxd_hw_desc *desc;
|
||||||
struct idxd_ops *op;
|
struct idxd_ops *op;
|
||||||
uint64_t op_hw_addr;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
if (_is_batch_valid(batch, chan) == false) {
|
if (_is_batch_valid(batch, chan) == false) {
|
||||||
SPDK_ERRLOG("Attempt to add to an invalid batch.\n");
|
SPDK_ERRLOG("Attempt to add to an invalid batch.\n");
|
||||||
@ -811,18 +820,12 @@ _idxd_prep_batch_cmd(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn,
|
|||||||
desc = *_desc = &batch->user_desc[batch->index];
|
desc = *_desc = &batch->user_desc[batch->index];
|
||||||
op = *_op = &batch->user_ops[batch->index];
|
op = *_op = &batch->user_ops[batch->index];
|
||||||
|
|
||||||
rc = _vtophys(&op->hw, &op_hw_addr, sizeof(struct idxd_hw_comp_record));
|
|
||||||
if (rc) {
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
op->desc = desc;
|
op->desc = desc;
|
||||||
SPDK_DEBUGLOG(idxd, "Prep batch %p index %u\n", batch, batch->index);
|
SPDK_DEBUGLOG(idxd, "Prep batch %p index %u\n", batch, batch->index);
|
||||||
|
|
||||||
batch->index++;
|
batch->index++;
|
||||||
|
|
||||||
desc->flags = IDXD_FLAG_COMPLETION_ADDR_VALID | IDXD_FLAG_REQUEST_COMPLETION;
|
desc->flags = IDXD_FLAG_COMPLETION_ADDR_VALID | IDXD_FLAG_REQUEST_COMPLETION;
|
||||||
desc->completion_addr = op_hw_addr;
|
|
||||||
op->cb_arg = cb_arg;
|
op->cb_arg = cb_arg;
|
||||||
op->cb_fn = cb_fn;
|
op->cb_fn = cb_fn;
|
||||||
op->batch = batch;
|
op->batch = batch;
|
||||||
|
Loading…
Reference in New Issue
Block a user