[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 06/21] nvme: add support for the abort command
From: |
Klaus Jensen |
Subject: |
[PATCH v3 06/21] nvme: add support for the abort command |
Date: |
Mon, 11 Nov 2019 13:25:30 +0100 |
Required for compliance with NVMe revision 1.2.1. See NVM Express 1.2.1,
Section 5.1 ("Abort command").
The Abort command is a best effort command; for now, the device always
fails to abort the given command.
Signed-off-by: Klaus Jensen <address@hidden>
---
hw/block/nvme.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index daa2367b0863..84e4f2ea7a15 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -741,6 +741,18 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeCmd *cmd)
}
}
+static uint16_t nvme_abort(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req)
+{
+ uint16_t sqid = le32_to_cpu(cmd->cdw10) & 0xffff;
+
+ req->cqe.result = 1;
+ if (nvme_check_sqid(n, sqid)) {
+ return NVME_INVALID_FIELD | NVME_DNR;
+ }
+
+ return NVME_SUCCESS;
+}
+
static inline void nvme_set_timestamp(NvmeCtrl *n, uint64_t ts)
{
trace_nvme_setfeat_timestamp(ts);
@@ -859,6 +871,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *cmd,
NvmeRequest *req)
trace_nvme_err_invalid_setfeat(dw10);
return NVME_INVALID_FIELD | NVME_DNR;
}
+
return NVME_SUCCESS;
}
@@ -875,6 +888,8 @@ static uint16_t nvme_admin_cmd(NvmeCtrl *n, NvmeCmd *cmd,
NvmeRequest *req)
return nvme_create_cq(n, cmd);
case NVME_ADM_CMD_IDENTIFY:
return nvme_identify(n, cmd);
+ case NVME_ADM_CMD_ABORT:
+ return nvme_abort(n, cmd, req);
case NVME_ADM_CMD_SET_FEATURES:
return nvme_set_feature(n, cmd, req);
case NVME_ADM_CMD_GET_FEATURES:
@@ -1388,6 +1403,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **errp)
id->ieee[2] = 0xb3;
id->ver = cpu_to_le32(0x00010201);
id->oacs = cpu_to_le16(0);
+ id->acl = 3;
id->frmw = 7 << 1;
id->lpa = 1 << 0;
id->sqes = (0x6 << 4) | 0x6;
--
2.24.0
- [PATCH v3 00/20] nvme: support NVMe v1.3d, SGLs and multiple namespaces, Klaus Jensen, 2019/11/11
- [PATCH v3 01/21] nvme: remove superfluous breaks, Klaus Jensen, 2019/11/11
- [PATCH v3 03/21] nvme: add missing fields in the identify controller data structure, Klaus Jensen, 2019/11/11
- [PATCH v3 06/21] nvme: add support for the abort command,
Klaus Jensen <=
- [PATCH v3 04/21] nvme: populate the mandatory subnqn and ver fields, Klaus Jensen, 2019/11/11
- [PATCH v3 02/21] nvme: move device parameters to separate struct, Klaus Jensen, 2019/11/11
- [PATCH v3 05/21] nvme: allow completion queues in the cmb, Klaus Jensen, 2019/11/11
- [PATCH v3 10/21] nvme: add logging to error information log page, Klaus Jensen, 2019/11/11
- [PATCH v3 09/21] nvme: add support for the asynchronous event request command, Klaus Jensen, 2019/11/11
- [PATCH v3 08/21] nvme: add support for the get log page command, Klaus Jensen, 2019/11/11
- [PATCH v3 07/21] nvme: refactor device realization, Klaus Jensen, 2019/11/11
- [PATCH v3 11/21] nvme: add missing mandatory features, Klaus Jensen, 2019/11/11
- [PATCH v3 19/21] nvme: make lba data size configurable, Klaus Jensen, 2019/11/11
- [PATCH v3 20/21] pci: pass along the return value of dma_memory_rw, Klaus Jensen, 2019/11/11