]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
hw/nvme: fix number of PIDs for FDP RUH update
authorVincent Fu <vincentfu@gmail.com>
Fri, 3 May 2024 17:50:04 +0000 (13:50 -0400)
committerKlaus Jensen <k.jensen@samsung.com>
Thu, 11 Jul 2024 15:05:37 +0000 (17:05 +0200)
The number of PIDs is in the upper 16 bits of cdw10. So we need to
right-shift by 16 bits instead of only a single bit.

Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
Cc: qemu-stable@nongnu.org
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/nvme/ctrl.c

index fa7ec0e794907e6cadf298ef2e4fa3dacaf44d00..231e1127cec841176a19989287825c5b26aebb47 100644 (file)
@@ -4352,7 +4352,7 @@ static uint16_t nvme_io_mgmt_send_ruh_update(NvmeCtrl *n, NvmeRequest *req)
     NvmeNamespace *ns = req->ns;
     uint32_t cdw10 = le32_to_cpu(cmd->cdw10);
     uint16_t ret = NVME_SUCCESS;
-    uint32_t npid = (cdw10 >> 1) + 1;
+    uint32_t npid = (cdw10 >> 16) + 1;
     unsigned int i = 0;
     g_autofree uint16_t *pids = NULL;
     uint32_t maxnpid;