diff mbox series

[22/25] block/nvme: Change size and alignment of queue

Message ID 20201027135547.374946-23-philmd@redhat.com
State New
Headers show
Series block/nvme: Fix Aarch64 host | expand

Commit Message

Philippe Mathieu-Daudé Oct. 27, 2020, 1:55 p.m. UTC
From: Eric Auger <eric.auger@redhat.com>

In preparation of 64kB host page support, let's change the size
and alignment of the queue so that the VFIO DMA MAP succeeds.
We align on the host page size.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 block/nvme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Hajnoczi Oct. 28, 2020, 3:37 p.m. UTC | #1
On Tue, Oct 27, 2020 at 02:55:44PM +0100, Philippe Mathieu-Daudé wrote:
> From: Eric Auger <eric.auger@redhat.com>

> 

> In preparation of 64kB host page support, let's change the size

> and alignment of the queue so that the VFIO DMA MAP succeeds.

> We align on the host page size.

> 

> Signed-off-by: Eric Auger <eric.auger@redhat.com>

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---

>  block/nvme.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox series

Patch

diff --git a/block/nvme.c b/block/nvme.c
index ad70303c5c1..941f96b4c92 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -167,9 +167,9 @@  static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q,
     size_t bytes;
     int r;
 
-    bytes = ROUND_UP(nentries * entry_bytes, s->page_size);
+    bytes = ROUND_UP(nentries * entry_bytes, qemu_real_host_page_size);
     q->head = q->tail = 0;
-    q->queue = qemu_try_memalign(s->page_size, bytes);
+    q->queue = qemu_try_memalign(qemu_real_host_page_size, bytes);
     if (!q->queue) {
         error_setg(errp, "Cannot allocate queue");
         return false;