summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2020-10-29 10:32:59 +0100
committerStefan Hajnoczi2020-11-03 20:06:22 +0100
commita652a3ec697d5b4cfce44599d3540aae535b9545 (patch)
treed00194844343177a3ebdb64514de28a6b59b1392 /block
parentblock/nvme: Set request_alignment at initialization (diff)
downloadqemu-a652a3ec697d5b4cfce44599d3540aae535b9545.tar.gz
qemu-a652a3ec697d5b4cfce44599d3540aae535b9545.tar.xz
qemu-a652a3ec697d5b4cfce44599d3540aae535b9545.zip
block/nvme: Correct minimum device page size
While trying to simplify the code using a macro, we forgot the 12-bit shift... Correct that. Fixes: fad1eb68862 ("block/nvme: Use register definitions from 'block/nvme.h'") Reported-by: Eric Auger <eric.auger@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20201029093306.1063879-19-philmd@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Tested-by: Eric Auger <eric.auger@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/nvme.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/nvme.c b/block/nvme.c
index bb75448a09..bd3860ac4e 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -755,7 +755,7 @@ static int nvme_init(BlockDriverState *bs, const char *device, int namespace,
goto out;
}
- s->page_size = MAX(4096, 1 << NVME_CAP_MPSMIN(cap));
+ s->page_size = 1u << (12 + NVME_CAP_MPSMIN(cap));
s->doorbell_scale = (4 << NVME_CAP_DSTRD(cap)) / sizeof(uint32_t);
bs->bl.opt_mem_alignment = s->page_size;
bs->bl.request_alignment = s->page_size;