@@ -8248,7 +8248,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
id->nn = cpu_to_le32(NVME_MAX_NAMESPACES);
id->oncs = cpu_to_le16(NVME_ONCS_WRITE_ZEROES | NVME_ONCS_TIMESTAMP |
NVME_ONCS_FEATURES | NVME_ONCS_DSM |
- NVME_ONCS_COMPARE | NVME_ONCS_COPY);
+ NVME_ONCS_COMPARE | NVME_ONCS_COPY |
+ NVME_ONCS_RESERVATIONS);
/*
* NOTE: If this device ever supports a command set that does NOT use 0x0
@@ -20,6 +20,7 @@
#include "qemu/bitops.h"
#include "sysemu/sysemu.h"
#include "sysemu/block-backend.h"
+#include "block/block_int.h"
#include "nvme.h"
#include "trace.h"
@@ -33,6 +34,7 @@ void nvme_ns_init_format(NvmeNamespace *ns)
BlockDriverInfo bdi;
int npdg, ret;
int64_t nlbas;
+ uint8_t blk_pr_cap;
ns->lbaf = id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(id_ns->flbas)];
ns->lbasz = 1 << ns->lbaf.ds;
@@ -55,6 +57,9 @@ void nvme_ns_init_format(NvmeNamespace *ns)
}
id_ns->npda = id_ns->npdg = npdg - 1;
+
+ blk_pr_cap = blk_bs(ns->blkconf.blk)->bl.pr_cap;
+ id_ns->rescap = block_pr_cap_to_nvme(blk_pr_cap);
}
static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
@@ -1251,7 +1251,7 @@ enum NvmeIdCtrlOncs {
NVME_ONCS_DSM = 1 << 2,
NVME_ONCS_WRITE_ZEROES = 1 << 3,
NVME_ONCS_FEATURES = 1 << 4,
- NVME_ONCS_RESRVATIONS = 1 << 5,
+ NVME_ONCS_RESERVATIONS = 1 << 5,
NVME_ONCS_TIMESTAMP = 1 << 6,
NVME_ONCS_VERIFY = 1 << 7,
NVME_ONCS_COPY = 1 << 8,