diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2020-09-04 14:41:30 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2020-09-10 11:11:13 +0200 |
commit | e5ff22ba9fc276c2f8f56af7d82770da027671f1 (patch) | |
tree | 81af00be0febf3b22db1fad86320cde780ad9df5 /block/nvme.c | |
parent | c7100f0a0bec585b88b67138f6e33791ec2dbf3e (diff) | |
download | qemu-e5ff22ba9fc276c2f8f56af7d82770da027671f1.zip qemu-e5ff22ba9fc276c2f8f56af7d82770da027671f1.tar.gz qemu-e5ff22ba9fc276c2f8f56af7d82770da027671f1.tar.bz2 |
block/nvme: Pair doorbell registers
For each queue doorbell registers are paired as:
- Submission Queue Tail Doorbell
- Completion Queue Head Doorbell
Reflect that in the NVMeRegs structure, and adapt
nvme_create_queue_pair() accordingly.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200904124130.583838-4-philmd@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Fam Zheng <fam@euphon.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/nvme.c')
-rw-r--r-- | block/nvme.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/block/nvme.c b/block/nvme.c index a216cc4..f4f27b6 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -84,7 +84,10 @@ typedef struct { /* Memory mapped registers */ typedef volatile struct { NvmeBar ctrl; - uint32_t doorbells[]; + struct { + uint32_t sq_tail; + uint32_t cq_head; + } doorbells[]; } NVMeRegs; #define INDEX_ADMIN 0 @@ -244,14 +247,14 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s, error_propagate(errp, local_err); goto fail; } - q->sq.doorbell = &s->regs->doorbells[idx * 2 * s->doorbell_scale]; + q->sq.doorbell = &s->regs->doorbells[idx * s->doorbell_scale].sq_tail; nvme_init_queue(s, &q->cq, size, NVME_CQ_ENTRY_BYTES, &local_err); if (local_err) { error_propagate(errp, local_err); goto fail; } - q->cq.doorbell = &s->regs->doorbells[(idx * 2 + 1) * s->doorbell_scale]; + q->cq.doorbell = &s->regs->doorbells[idx * s->doorbell_scale].cq_head; return q; fail: |