qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <eduardo@habkost.net>,
	qemu-block@nongnu.org, "Klaus Jensen" <k.jensen@samsung.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Yanan Wang" <wangyanan55@huawei.com>,
	"Keith Busch" <kbusch@kernel.org>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Klaus Jensen" <its@irrelevant.dk>,
	"Christoph Hellwig" <hch@lst.de>
Subject: [PATCH v2 4/5] hw/nvme: do not report null uuid
Date: Fri, 29 Apr 2022 10:33:35 +0200	[thread overview]
Message-ID: <20220429083336.2201286-5-its@irrelevant.dk> (raw)
In-Reply-To: <20220429083336.2201286-1-its@irrelevant.dk>

From: Klaus Jensen <k.jensen@samsung.com>

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>
---
 hw/nvme/ctrl.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 08574c4dcbc8..5a727b6ec344 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;
-- 
2.35.1



  parent reply	other threads:[~2022-04-29  8:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29  8:33 [PATCH v2 0/5] hw/nvme: fix namespace identifiers Klaus Jensen
2022-04-29  8:33 ` [PATCH v2 1/5] hw/nvme: enforce common serial per subsystem Klaus Jensen
2022-04-29  8:33 ` [PATCH v2 2/5] hw/nvme: do not auto-generate eui64 Klaus Jensen
2022-04-29 15:17   ` Christoph Hellwig
2022-04-29  8:33 ` [PATCH v2 3/5] hw/nvme: do not auto-generate uuid Klaus Jensen
2022-04-29 15:17   ` Christoph Hellwig
2022-04-29  8:33 ` Klaus Jensen [this message]
2022-04-29  8:33 ` [PATCH v2 5/5] hw/nvme: bump firmware revision Klaus Jensen
2022-05-12  9:27 ` [PATCH v2 0/5] hw/nvme: fix namespace identifiers Klaus Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220429083336.2201286-5-its@irrelevant.dk \
    --to=its@irrelevant.dk \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=hch@lst.de \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wangyanan55@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).