diff options
author | Klaus Jensen | 2020-09-30 01:19:07 +0200 |
---|---|---|
committer | Klaus Jensen | 2020-10-27 11:29:25 +0100 |
commit | 1b48e4611a7a3ee3065d3bb8428f5f6acb5232fe (patch) | |
tree | 5ec1a14c661eb2103adf6bdcfac19246eaf17836 /hw/block | |
parent | hw/block/nvme: support for admin-only command set (diff) | |
download | qemu-1b48e4611a7a3ee3065d3bb8428f5f6acb5232fe.tar.gz qemu-1b48e4611a7a3ee3065d3bb8428f5f6acb5232fe.tar.xz qemu-1b48e4611a7a3ee3065d3bb8428f5f6acb5232fe.zip |
hw/block/nvme: reject io commands if only admin command set selected
If the host sets CC.CSS to 111b, all commands submitted to I/O queues
should be completed with status Invalid Command Opcode.
Note that this is technically a v1.4 feature, but it does not hurt to
implement before we finally bump the reported version implemented.
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw/block')
-rw-r--r-- | hw/block/nvme.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c index c1323ca869..32c35fe587 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1026,6 +1026,10 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req) trace_pci_nvme_io_cmd(nvme_cid(req), nsid, nvme_sqid(req), req->cmd.opcode, nvme_io_opc_str(req->cmd.opcode)); + if (NVME_CC_CSS(n->bar.cc) == NVME_CC_CSS_ADMIN_ONLY) { + return NVME_INVALID_OPCODE | NVME_DNR; + } + if (!nvme_nsid_valid(n, nsid)) { return NVME_INVALID_NSID | NVME_DNR; } |