diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index 406ff3e5e..6c106b009 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -1187,7 +1187,7 @@ _idxd_submit_compress_single(struct spdk_idxd_io_channel *chan, void *dst, const desc->src1_size = nbytes_src; desc->iaa.max_dst_size = nbytes_dst; desc->iaa.src2_size = sizeof(struct iaa_aecs); - desc->iaa.src2_addr = (uint64_t)chan->idxd->aecs; + desc->iaa.src2_addr = chan->idxd->aecs_addr; desc->flags |= IAA_FLAG_RD_SRC2_AECS; desc->compr_flags = IAA_COMP_FLAGS; op->output_size = output_size; diff --git a/lib/idxd/idxd_internal.h b/lib/idxd/idxd_internal.h index aa6bb18a6..127d1f165 100644 --- a/lib/idxd/idxd_internal.h +++ b/lib/idxd/idxd_internal.h @@ -143,6 +143,7 @@ struct spdk_idxd_device { bool pasid_enabled; enum idxd_dev type; struct iaa_aecs *aecs; + uint64_t aecs_addr; uint32_t version; }; diff --git a/lib/idxd/idxd_user.c b/lib/idxd/idxd_user.c index 18b076a6d..b96d12e48 100644 --- a/lib/idxd/idxd_user.c +++ b/lib/idxd/idxd_user.c @@ -505,6 +505,7 @@ idxd_attach(struct spdk_pci_device *device) struct spdk_idxd_device *idxd; uint16_t did = device->id.device_id; uint32_t cmd_reg; + uint64_t updated = sizeof(struct iaa_aecs); int rc; user_idxd = calloc(1, sizeof(struct spdk_user_idxd_device)); @@ -525,6 +526,14 @@ idxd_attach(struct spdk_pci_device *device) SPDK_ERRLOG("Failed to allocate iaa aecs\n"); goto err; } + + idxd->aecs_addr = spdk_vtophys((void *)idxd->aecs, &updated); + if (idxd->aecs_addr == SPDK_VTOPHYS_ERROR || updated < sizeof(struct iaa_aecs)) { + SPDK_ERRLOG("Failed to translate iaa aecs\n"); + spdk_free(idxd->aecs); + goto err; + } + /* Configure aecs table using fixed Huffman table */ idxd->aecs->output_accum[0] = DYNAMIC_HDR | 1; idxd->aecs->num_output_accum_bits = DYNAMIC_HDR_SIZE;