Skip to contentSkip to conversation

hw/block/nvme: Correct error status for unaligned ZA

PATCH In review Dmitry Fomichev 2 participants 2 messages Jan 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/block/nvme: Correct error status for unaligned ZA

TP 4053 says (in section 2.3.1.1) -
... if a Zone Append command specifies a ZSLBA that is not the lowest logical block address in that zone, then the controller shall abort that command with a status code of Invalid Field In Command.

In the code, Zone Invalid Write is returned instead, fix this.

---
 hw/block/nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/nvme.c +1 -1
index a8dc13553d..f64676a930 100644
@@ -1150,7 +1150,7 @@ static uint16_t nvme_check_zone_write(NvmeCtrl *n, NvmeNamespace *ns,
         if (append) {
             if (unlikely(slba != zone->d.zslba)) {
                 trace_pci_nvme_err_append_not_at_start(slba, zone->d.zslba);
-                status = NVME_ZONE_INVALID_WRITE;
+                status = NVME_INVALID_FIELD;
             }
             if (nvme_l2b(ns, nlb) > (n->page_size << n->zasl)) {
                 trace_pci_nvme_err_append_too_large(slba, nlb, n->zasl);
Signature · 1 line
2.28.0
#1 lore raw
Quoted 28 lines · Dmitry Fomichev

TP 4053 says (in section 2.3.1.1) -
... if a Zone Append command specifies a ZSLBA that is not the lowest logical block address in that zone, then the controller shall abort that command with a status code of Invalid Field In Command.

In the code, Zone Invalid Write is returned instead, fix this.

---
 hw/block/nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/block/nvme.c +1 -1
index a8dc13553d..f64676a930 100644
@@ -1150,7 +1150,7 @@ static uint16_t nvme_check_zone_write(NvmeCtrl *n, NvmeNamespace *ns,
         if (append) {
             if (unlikely(slba != zone->d.zslba)) {
                 trace_pci_nvme_err_append_not_at_start(slba, zone->d.zslba);
-                status = NVME_ZONE_INVALID_WRITE;
+                status = NVME_INVALID_FIELD;
             }
             if (nvme_l2b(ns, nlb) > (n->page_size << n->zasl)) {
                 trace_pci_nvme_err_append_too_large(slba, nlb, n->zasl);
Signature · 1 line
2.28.0

Thanks, applying!