nvme/pcie: do not assume tracker array memory is physically contiguous

The spdk_dma_zmalloc guarantee about physical memory contiguity
is about to be removed soon. A single tracker is page size
aligned and is exactly one page big, so it is physically
contiguous, but we can't assume an array of those is physically
contiguous as well.

Change-Id: I3aa4d14dd677601c30aa2d8f15197886d6c46e58
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/416840
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2018-06-26 19:37:52 +02:00 committed by Jim Harris
parent ca1de9eb75
commit d36ce206ec

View File

@ -969,7 +969,6 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair)
struct nvme_tracker *tr;
uint16_t i;
volatile uint32_t *doorbell_base;
uint64_t phys_addr = 0;
uint64_t offset;
uint16_t num_trackers;
size_t page_size = sysconf(_SC_PAGESIZE);
@ -1028,7 +1027,7 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair)
* This ensures the PRP list embedded in the nvme_tracker object will not span a
* 4KB boundary, while allowing access to trackers in tr[] via normal array indexing.
*/
pqpair->tr = spdk_dma_zmalloc(num_trackers * sizeof(*tr), sizeof(*tr), &phys_addr);
pqpair->tr = spdk_dma_zmalloc(num_trackers * sizeof(*tr), sizeof(*tr), NULL);
if (pqpair->tr == NULL) {
SPDK_ERRLOG("nvme_tr failed\n");
return -ENOMEM;
@ -1039,9 +1038,8 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair)
for (i = 0; i < num_trackers; i++) {
tr = &pqpair->tr[i];
nvme_qpair_construct_tracker(tr, i, phys_addr);
nvme_qpair_construct_tracker(tr, i, spdk_vtophys(tr));
TAILQ_INSERT_HEAD(&pqpair->free_tr, tr, tq_list);
phys_addr += sizeof(struct nvme_tracker);
}
nvme_pcie_qpair_reset(qpair);