nvme/pcie: set doorbell base when allocating the bar

Change-Id: Id40f03f1bc4e90113dad6326dbeb9a7b5af5c1b1
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5960
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
This commit is contained in:
Changpeng Liu 2021-01-18 23:12:13 +08:00 committed by Jim Harris
parent 6b4b2d2913
commit 349895a25f
3 changed files with 5 additions and 4 deletions

View File

@ -498,6 +498,7 @@ nvme_pcie_ctrlr_allocate_bars(struct nvme_pcie_ctrlr *pctrlr)
pctrlr->regs = (volatile struct spdk_nvme_registers *)addr;
pctrlr->regs_size = size;
pctrlr->doorbell_base = (volatile uint32_t *)&pctrlr->regs->doorbell[0].sq_tdbl;
nvme_pcie_ctrlr_map_cmb(pctrlr);
return 0;

View File

@ -108,7 +108,6 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair,
struct nvme_pcie_qpair *pqpair = nvme_pcie_qpair(qpair);
struct nvme_tracker *tr;
uint16_t i;
volatile uint32_t *doorbell_base;
uint16_t num_trackers;
size_t page_align = sysconf(_SC_PAGESIZE);
size_t queue_align, queue_len;
@ -204,9 +203,8 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair,
}
}
doorbell_base = &pctrlr->regs->doorbell[0].sq_tdbl;
pqpair->sq_tdbl = doorbell_base + (2 * qpair->id + 0) * pctrlr->doorbell_stride_u32;
pqpair->cq_hdbl = doorbell_base + (2 * qpair->id + 1) * pctrlr->doorbell_stride_u32;
pqpair->sq_tdbl = pctrlr->doorbell_base + (2 * qpair->id + 0) * pctrlr->doorbell_stride_u32;
pqpair->cq_hdbl = pctrlr->doorbell_base + (2 * qpair->id + 1) * pctrlr->doorbell_stride_u32;
/*
* Reserve space for all of the trackers in a single allocation.

View File

@ -83,6 +83,8 @@ struct nvme_pcie_ctrlr {
/* Flag to indicate the MMIO register has been remapped */
bool is_remapped;
volatile uint32_t *doorbell_base;
};
struct nvme_tracker {