Commit f7d61b4064 for qemu.org
commit f7d61b4064458372dca0c3b1c2053eac6d311e5c
Author: Klaus Jensen <k.jensen@samsung.com>
Date: Fri Nov 13 10:58:39 2026 +0100
hw/nvme: fix fdp reclaim unit accounting
nvme_do_write_fdp falls back to placement handle zero for a write that
has no Data Placement directive or where the placement identifier is
invalid. However, it then passes the invalid placement identifier to
nvme_update_ruh which results in no update to RUAMW for placement handle
zero.
Reset the placement identifier along with the handle in the fallback.
Cc: qemu-stable@nongnu.org
Link: https://gitlab.com/qemu-project/qemu/-/work_items/4520
Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 685cbc2f34..a0d22daced 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -3754,6 +3754,7 @@ static void nvme_do_write_fdp(NvmeCtrl *n, NvmeRequest *req, uint64_t slba,
!nvme_parse_pid(ns, pid, &ph, &rg)) {
ph = 0;
rg = 0;
+ pid = 0;
}
ruhid = ns->fdp.phs[ph];