qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] hw/block/nvme: fix csi field for cns 0x00 and 0x11


From: Gollu Appalanaidu
Subject: [PATCH] hw/block/nvme: fix csi field for cns 0x00 and 0x11
Date: Mon, 26 Apr 2021 13:16:50 +0530

As per the TP 4056d Namespace types CNS 0x00 and CNS 0x11
CSI field shouldn't use but it is being used for these two
Identify command CNS values, fix that.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
---
 hw/nvme/ctrl.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 2e7498a73e..1657b1d04a 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4244,11 +4244,16 @@ static uint16_t nvme_identify_ns(NvmeCtrl *n, 
NvmeRequest *req, bool active)
         }
     }
 
-    if (c->csi == NVME_CSI_NVM && nvme_csi_has_nvm_support(ns)) {
-        return nvme_c2h(n, (uint8_t *)&ns->id_ns, sizeof(NvmeIdNs), req);
+    if (active && nvme_csi_has_nvm_support(ns)) {
+        goto out;
+    } else if (!active && ns->csi == NVME_CSI_NVM) {
+        goto out;
+    } else {
+        return NVME_INVALID_CMD_SET | NVME_DNR;
     }
 
-    return NVME_INVALID_CMD_SET | NVME_DNR;
+out:
+    return nvme_c2h(n, (uint8_t *)&ns->id_ns, sizeof(NvmeIdNs), req);
 }
 
 static uint16_t nvme_identify_ns_attached_list(NvmeCtrl *n, NvmeRequest *req)
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]