nvme: return the physical address in nvme_pcie_ctrlr_alloc_cmb()
Commit 9ad044c4
remove the offset parameter in nvme_pcie_ctrlr_alloc_cmb()
and uses spdk_vtophys() to get the physical address of the submission
queue, however, the memory isn't registered to SPDK yet, so use the
offset to get the physical address again.
Change-Id: Ida0f4a8bf1e72d6446fba442a1b71f0ddaab4bb8
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1933
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
bdc5746287
commit
163eba9565
@ -991,7 +991,8 @@ nvme_pcie_qpair_reset(struct spdk_nvme_qpair *qpair)
|
||||
}
|
||||
|
||||
static void *
|
||||
nvme_pcie_ctrlr_alloc_cmb(struct spdk_nvme_ctrlr *ctrlr, uint64_t size, uint64_t alignment)
|
||||
nvme_pcie_ctrlr_alloc_cmb(struct spdk_nvme_ctrlr *ctrlr, uint64_t size, uint64_t alignment,
|
||||
uint64_t *phys_addr)
|
||||
{
|
||||
struct nvme_pcie_ctrlr *pctrlr = nvme_pcie_ctrlr(ctrlr);
|
||||
uintptr_t addr;
|
||||
@ -1009,6 +1010,7 @@ nvme_pcie_ctrlr_alloc_cmb(struct spdk_nvme_ctrlr *ctrlr, uint64_t size, uint64_t
|
||||
SPDK_ERRLOG("Tried to allocate past valid CMB range!\n");
|
||||
return NULL;
|
||||
}
|
||||
*phys_addr = pctrlr->cmb.bar_pa + addr - (uintptr_t)pctrlr->cmb.bar_va;
|
||||
|
||||
pctrlr->cmb.current_offset = (addr + size) - (uintptr_t)pctrlr->cmb.bar_va;
|
||||
|
||||
@ -1064,8 +1066,7 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair,
|
||||
/* cmd and cpl rings must be aligned on page size boundaries. */
|
||||
if (ctrlr->opts.use_cmb_sqs) {
|
||||
pqpair->cmd = nvme_pcie_ctrlr_alloc_cmb(ctrlr, pqpair->num_entries * sizeof(struct spdk_nvme_cmd),
|
||||
sysconf(_SC_PAGESIZE));
|
||||
pqpair->cmd_bus_addr = spdk_vtophys(pqpair->cmd, NULL);
|
||||
sysconf(_SC_PAGESIZE), &pqpair->cmd_bus_addr);
|
||||
if (pqpair->cmd != NULL) {
|
||||
pqpair->sq_in_cmb = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user