[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/33] block/nvme: Correctly initialize Admin Queue Attributes
From: |
Stefan Hajnoczi |
Subject: |
[PULL 16/33] block/nvme: Correctly initialize Admin Queue Attributes |
Date: |
Wed, 4 Nov 2020 15:18:11 +0000 |
From: Philippe Mathieu-Daudé <philmd@redhat.com>
From the specification chapter 3.1.8 "AQA - Admin Queue Attributes"
the Admin Submission Queue Size field is a 0’s based value:
Admin Submission Queue Size (ASQS):
Defines the size of the Admin Submission Queue in entries.
Enabling a controller while this field is cleared to 00h
produces undefined results. The minimum size of the Admin
Submission Queue is two entries. The maximum size of the
Admin Submission Queue is 4096 entries.
This is a 0’s based value.
This bug has never been hit because the device initialization
uses a single command synchronously :)
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20201029093306.1063879-15-philmd@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
---
block/nvme.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/block/nvme.c b/block/nvme.c
index 7285bd2e27..0902aa5542 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -789,9 +789,9 @@ static int nvme_init(BlockDriverState *bs, const char
*device, int namespace,
goto out;
}
s->queue_count = 1;
- QEMU_BUILD_BUG_ON(NVME_QUEUE_SIZE & 0xF000);
- regs->aqa = cpu_to_le32((NVME_QUEUE_SIZE << AQA_ACQS_SHIFT) |
- (NVME_QUEUE_SIZE << AQA_ASQS_SHIFT));
+ QEMU_BUILD_BUG_ON((NVME_QUEUE_SIZE - 1) & 0xF000);
+ regs->aqa = cpu_to_le32(((NVME_QUEUE_SIZE - 1) << AQA_ACQS_SHIFT) |
+ ((NVME_QUEUE_SIZE - 1) << AQA_ASQS_SHIFT));
regs->asq = cpu_to_le64(s->queues[INDEX_ADMIN]->sq.iova);
regs->acq = cpu_to_le64(s->queues[INDEX_ADMIN]->cq.iova);
--
2.28.0
- [PULL 06/33] block/nvme: Trace controller capabilities, (continued)
- [PULL 06/33] block/nvme: Trace controller capabilities, Stefan Hajnoczi, 2020/11/04
- [PULL 07/33] block/nvme: Trace nvme_poll_queue() per queue, Stefan Hajnoczi, 2020/11/04
- [PULL 08/33] block/nvme: Improve nvme_free_req_queue_wait() trace information, Stefan Hajnoczi, 2020/11/04
- [PULL 09/33] block/nvme: Trace queue pair creation/deletion, Stefan Hajnoczi, 2020/11/04
- [PULL 10/33] block/nvme: Move definitions before structure declarations, Stefan Hajnoczi, 2020/11/04
- [PULL 11/33] block/nvme: Use unsigned integer for queue counter/size, Stefan Hajnoczi, 2020/11/04
- [PULL 12/33] block/nvme: Make nvme_identify() return boolean indicating error, Stefan Hajnoczi, 2020/11/04
- [PULL 13/33] block/nvme: Make nvme_init_queue() return boolean indicating error, Stefan Hajnoczi, 2020/11/04
- [PULL 14/33] block/nvme: Introduce Completion Queue definitions, Stefan Hajnoczi, 2020/11/04
- [PULL 15/33] block/nvme: Use definitions instead of magic values in add_io_queue(), Stefan Hajnoczi, 2020/11/04
- [PULL 16/33] block/nvme: Correctly initialize Admin Queue Attributes,
Stefan Hajnoczi <=
- [PULL 17/33] block/nvme: Simplify ADMIN queue access, Stefan Hajnoczi, 2020/11/04
- [PULL 19/33] block/nvme: Set request_alignment at initialization, Stefan Hajnoczi, 2020/11/04
- [PULL 18/33] block/nvme: Simplify nvme_cmd_sync(), Stefan Hajnoczi, 2020/11/04
- [PULL 20/33] block/nvme: Correct minimum device page size, Stefan Hajnoczi, 2020/11/04
- [PULL 21/33] block/nvme: Change size and alignment of IDENTIFY response buffer, Stefan Hajnoczi, 2020/11/04
- [PULL 22/33] block/nvme: Change size and alignment of queue, Stefan Hajnoczi, 2020/11/04
- [PULL 23/33] block/nvme: Change size and alignment of prp_list_pages, Stefan Hajnoczi, 2020/11/04
- [PULL 24/33] block/nvme: Align iov's va and size on host page size, Stefan Hajnoczi, 2020/11/04
- [PULL 25/33] block/nvme: Fix use of write-only doorbells page on Aarch64 arch, Stefan Hajnoczi, 2020/11/04
- [PULL 26/33] block/nvme: Fix nvme_submit_command() on big-endian host, Stefan Hajnoczi, 2020/11/04