summaryrefslogtreecommitdiff
path: root/hw/block
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2020-07-06 08:13:02 +0200
committerKlaus Jensen <k.jensen@samsung.com>2020-09-02 08:48:50 +0200
commitccbefdb51d55b6649cf30541a2d2542dc6f89fab (patch)
treeef6407ef182b236bb2300872c456720eb584a52a /hw/block
parent9e7ecdca26c34ffc5bda3d1d49e90bbb6b4f4422 (diff)
downloadqemu-ccbefdb51d55b6649cf30541a2d2542dc6f89fab.zip
hw/block/nvme: provide the mandatory subnqn field
The SUBNQN field is mandatory in NVM Express 1.3. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200706061303.246057-18-its@irrelevant.dk>
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/nvme.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 41d4e3795d..a021572de6 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -2168,6 +2168,7 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
{
NvmeIdCtrl *id = &n->id_ctrl;
uint8_t *pci_conf = pci_dev->config;
+ char *subnqn;
id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID));
id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID));
@@ -2206,6 +2207,10 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
id->oncs = cpu_to_le16(NVME_ONCS_WRITE_ZEROS | NVME_ONCS_TIMESTAMP |
NVME_ONCS_FEATURES);
+ subnqn = g_strdup_printf("nqn.2019-08.org.qemu:%s", n->params.serial);
+ strpadcpy((char *)id->subnqn, sizeof(id->subnqn), subnqn, '\0');
+ g_free(subnqn);
+
id->psd[0].mp = cpu_to_le16(0x9c4);
id->psd[0].enlat = cpu_to_le32(0x10);
id->psd[0].exlat = cpu_to_le32(0x4);