aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2022-04-29 10:33:35 +0200
committerKlaus Jensen <k.jensen@samsung.com>2022-06-03 21:48:24 +0200
commit9f2e1acf83c332752f52c39dad390c94ec2ba9f5 (patch)
tree5e6d11c13cc5617800b4bd05fcfa60ecc6d6139b
parentbd9f371c6f6eeb8e907dfc770876ad8ef4ff85fc (diff)
downloadqemu-9f2e1acf83c332752f52c39dad390c94ec2ba9f5.zip
qemu-9f2e1acf83c332752f52c39dad390c94ec2ba9f5.tar.gz
qemu-9f2e1acf83c332752f52c39dad390c94ec2ba9f5.tar.bz2
hw/nvme: do not report null uuid
Do not report the "null uuid" (all zeros) in the namespace identification descriptors. Reported-by: Luis Chamberlain <mcgrof@kernel.org> Reported-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
-rw-r--r--hw/nvme/ctrl.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index a2f6069..909e357 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4955,16 +4955,13 @@ static uint16_t nvme_identify_ns_descr_list(NvmeCtrl *n, NvmeRequest *req)
return NVME_INVALID_FIELD | NVME_DNR;
}
- /*
- * If the EUI-64 field is 0 and the NGUID field is 0, the namespace must
- * provide a valid Namespace UUID in the Namespace Identification Descriptor
- * data structure. QEMU does not yet support setting NGUID.
- */
- uuid.hdr.nidt = NVME_NIDT_UUID;
- uuid.hdr.nidl = NVME_NIDL_UUID;
- memcpy(uuid.v, ns->params.uuid.data, NVME_NIDL_UUID);
- memcpy(pos, &uuid, sizeof(uuid));
- pos += sizeof(uuid);
+ if (!qemu_uuid_is_null(&ns->params.uuid)) {
+ uuid.hdr.nidt = NVME_NIDT_UUID;
+ uuid.hdr.nidl = NVME_NIDL_UUID;
+ memcpy(uuid.v, ns->params.uuid.data, NVME_NIDL_UUID);
+ memcpy(pos, &uuid, sizeof(uuid));
+ pos += sizeof(uuid);
+ }
if (ns->params.eui64) {
eui64.hdr.nidt = NVME_NIDT_EUI64;