* [PULL 0/3] hw/nvme updates
@ 2021-09-24 6:46 Klaus Jensen
2021-09-24 6:46 ` [PULL 1/3] hw/nvme: fix validation of ASQ and ACQ Klaus Jensen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Klaus Jensen @ 2021-09-24 6:46 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Kevin Wolf, Fam Zheng, qemu-block, Klaus Jensen, Klaus Jensen,
Hanna Reitz, Stefan Hajnoczi, Keith Busch,
Philippe Mathieu-Daudé
From: Klaus Jensen <k.jensen@samsung.com>
Hi Peter,
The following changes since commit 2c3e83f92d93fbab071b8a96b8ab769b01902475:
Merge remote-tracking branch 'remotes/alistair23/tags/pull-riscv-to-apply-20210921' into staging (2021-09-21 10:57:48 -0700)
are available in the Git repository at:
git://git.infradead.org/qemu-nvme.git tags/nvme-next-pull-request
for you to fetch changes up to c53a9a91021c2f57de9ab18393d0048bd0fe90c2:
hw/nvme: Return error for fused operations (2021-09-24 08:43:58 +0200)
----------------------------------------------------------------
hw/nvme updates
----------------------------------------------------------------
Klaus Jensen (1):
hw/nvme: fix validation of ASQ and ACQ
Naveen Nagar (1):
hw/nvme: fix verification of select field in namespace attachment
Pankaj Raghav (1):
hw/nvme: Return error for fused operations
hw/nvme/ctrl.c | 31 ++++++++++++++++++++-----------
hw/nvme/trace-events | 2 --
include/block/nvme.h | 5 +++++
3 files changed, 25 insertions(+), 13 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL 1/3] hw/nvme: fix validation of ASQ and ACQ
2021-09-24 6:46 [PULL 0/3] hw/nvme updates Klaus Jensen
@ 2021-09-24 6:46 ` Klaus Jensen
2021-09-24 6:47 ` [PULL 2/3] hw/nvme: fix verification of select field in namespace attachment Klaus Jensen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Klaus Jensen @ 2021-09-24 6:46 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Kevin Wolf, Fam Zheng, qemu-block, Klaus Jensen, Klaus Jensen,
Hanna Reitz, Stefan Hajnoczi, Keith Busch,
Philippe Mathieu-Daudé
From: Klaus Jensen <k.jensen@samsung.com>
Address 0x0 is a valid address. Fix the admin submission and completion
queue address validation to not error out on this.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
---
hw/nvme/ctrl.c | 8 --------
hw/nvme/trace-events | 2 --
2 files changed, 10 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 6baf9e0420d5..ff784851137e 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5623,14 +5623,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
trace_pci_nvme_err_startfail_sq();
return -1;
}
- if (unlikely(!asq)) {
- trace_pci_nvme_err_startfail_nbarasq();
- return -1;
- }
- if (unlikely(!acq)) {
- trace_pci_nvme_err_startfail_nbaracq();
- return -1;
- }
if (unlikely(asq & (page_size - 1))) {
trace_pci_nvme_err_startfail_asq_misaligned(asq);
return -1;
diff --git a/hw/nvme/trace-events b/hw/nvme/trace-events
index 430eeb395b24..ff6cafd520df 100644
--- a/hw/nvme/trace-events
+++ b/hw/nvme/trace-events
@@ -159,8 +159,6 @@ pci_nvme_err_invalid_setfeat(uint32_t dw10) "invalid set features, dw10=0x%"PRIx
pci_nvme_err_invalid_log_page(uint16_t cid, uint16_t lid) "cid %"PRIu16" lid 0x%"PRIx16""
pci_nvme_err_startfail_cq(void) "nvme_start_ctrl failed because there are non-admin completion queues"
pci_nvme_err_startfail_sq(void) "nvme_start_ctrl failed because there are non-admin submission queues"
-pci_nvme_err_startfail_nbarasq(void) "nvme_start_ctrl failed because the admin submission queue address is null"
-pci_nvme_err_startfail_nbaracq(void) "nvme_start_ctrl failed because the admin completion queue address is null"
pci_nvme_err_startfail_asq_misaligned(uint64_t addr) "nvme_start_ctrl failed because the admin submission queue address is misaligned: 0x%"PRIx64""
pci_nvme_err_startfail_acq_misaligned(uint64_t addr) "nvme_start_ctrl failed because the admin completion queue address is misaligned: 0x%"PRIx64""
pci_nvme_err_startfail_page_too_small(uint8_t log2ps, uint8_t maxlog2ps) "nvme_start_ctrl failed because the page size is too small: log2size=%u, min=%u"
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 2/3] hw/nvme: fix verification of select field in namespace attachment
2021-09-24 6:46 [PULL 0/3] hw/nvme updates Klaus Jensen
2021-09-24 6:46 ` [PULL 1/3] hw/nvme: fix validation of ASQ and ACQ Klaus Jensen
@ 2021-09-24 6:47 ` Klaus Jensen
2021-09-24 6:47 ` [PULL 3/3] hw/nvme: Return error for fused operations Klaus Jensen
2021-09-24 14:04 ` [PULL 0/3] hw/nvme updates Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Klaus Jensen @ 2021-09-24 6:47 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Kevin Wolf, Fam Zheng, qemu-block, Klaus Jensen, Naveen Nagar,
Klaus Jensen, Hanna Reitz, Minwoo Im, Stefan Hajnoczi,
Keith Busch, Philippe Mathieu-Daudé
From: Naveen Nagar <naveen.n1@samsung.com>
Fix is added to check for reserved value in select field for
namespace attachment
CC: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Naveen Nagar <naveen.n1@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 15 ++++++++++++---
include/block/nvme.h | 5 +++++
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index ff784851137e..dc0e7b00308e 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5191,7 +5191,7 @@ static uint16_t nvme_ns_attachment(NvmeCtrl *n, NvmeRequest *req)
uint16_t list[NVME_CONTROLLER_LIST_SIZE] = {};
uint32_t nsid = le32_to_cpu(req->cmd.nsid);
uint32_t dw10 = le32_to_cpu(req->cmd.cdw10);
- bool attach = !(dw10 & 0xf);
+ uint8_t sel = dw10 & 0xf;
uint16_t *nr_ids = &list[0];
uint16_t *ids = &list[1];
uint16_t ret;
@@ -5224,7 +5224,8 @@ static uint16_t nvme_ns_attachment(NvmeCtrl *n, NvmeRequest *req)
return NVME_NS_CTRL_LIST_INVALID | NVME_DNR;
}
- if (attach) {
+ switch (sel) {
+ case NVME_NS_ATTACHMENT_ATTACH:
if (nvme_ns(ctrl, nsid)) {
return NVME_NS_ALREADY_ATTACHED | NVME_DNR;
}
@@ -5235,7 +5236,10 @@ static uint16_t nvme_ns_attachment(NvmeCtrl *n, NvmeRequest *req)
nvme_attach_ns(ctrl, ns);
nvme_select_iocs_ns(ctrl, ns);
- } else {
+
+ break;
+
+ case NVME_NS_ATTACHMENT_DETACH:
if (!nvme_ns(ctrl, nsid)) {
return NVME_NS_NOT_ATTACHED | NVME_DNR;
}
@@ -5244,6 +5248,11 @@ static uint16_t nvme_ns_attachment(NvmeCtrl *n, NvmeRequest *req)
ns->attached--;
nvme_update_dmrsl(ctrl);
+
+ break;
+
+ default:
+ return NVME_INVALID_FIELD | NVME_DNR;
}
/*
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 77aae0117494..e3bd47bf76ab 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -1154,6 +1154,11 @@ enum NvmeIdCtrlCmic {
NVME_CMIC_MULTI_CTRL = 1 << 1,
};
+enum NvmeNsAttachmentOperation {
+ NVME_NS_ATTACHMENT_ATTACH = 0x0,
+ NVME_NS_ATTACHMENT_DETACH = 0x1,
+};
+
#define NVME_CTRL_SQES_MIN(sqes) ((sqes) & 0xf)
#define NVME_CTRL_SQES_MAX(sqes) (((sqes) >> 4) & 0xf)
#define NVME_CTRL_CQES_MIN(cqes) ((cqes) & 0xf)
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PULL 3/3] hw/nvme: Return error for fused operations
2021-09-24 6:46 [PULL 0/3] hw/nvme updates Klaus Jensen
2021-09-24 6:46 ` [PULL 1/3] hw/nvme: fix validation of ASQ and ACQ Klaus Jensen
2021-09-24 6:47 ` [PULL 2/3] hw/nvme: fix verification of select field in namespace attachment Klaus Jensen
@ 2021-09-24 6:47 ` Klaus Jensen
2021-09-24 14:04 ` [PULL 0/3] hw/nvme updates Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Klaus Jensen @ 2021-09-24 6:47 UTC (permalink / raw)
To: Peter Maydell, qemu-devel
Cc: Kevin Wolf, Fam Zheng, qemu-block, Klaus Jensen, Pankaj Raghav,
Klaus Jensen, Hanna Reitz, Stefan Hajnoczi, Keith Busch,
Philippe Mathieu-Daudé
From: Pankaj Raghav <p.raghav@samsung.com>
Currently, FUSED operations are not supported by QEMU. As per the 1.4 SPEC,
controller should abort the command that requested a fused operation with
an INVALID FIELD error code if they are not supported.
Changes from v1:
Added FUSE flag check also to the admin cmd processing as the FUSED
operations are mentioned in the general SQE section in the SPEC.
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index dc0e7b00308e..2f247a9275ca 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -3893,6 +3893,10 @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req)
return ns->status;
}
+ if (NVME_CMD_FLAGS_FUSE(req->cmd.flags)) {
+ return NVME_INVALID_FIELD;
+ }
+
req->ns = ns;
switch (req->cmd.opcode) {
@@ -5475,6 +5479,10 @@ static uint16_t nvme_admin_cmd(NvmeCtrl *n, NvmeRequest *req)
return NVME_INVALID_FIELD | NVME_DNR;
}
+ if (NVME_CMD_FLAGS_FUSE(req->cmd.flags)) {
+ return NVME_INVALID_FIELD;
+ }
+
switch (req->cmd.opcode) {
case NVME_ADM_CMD_DELETE_SQ:
return nvme_del_sq(n, req);
--
2.33.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL 0/3] hw/nvme updates
2021-09-24 6:46 [PULL 0/3] hw/nvme updates Klaus Jensen
` (2 preceding siblings ...)
2021-09-24 6:47 ` [PULL 3/3] hw/nvme: Return error for fused operations Klaus Jensen
@ 2021-09-24 14:04 ` Peter Maydell
3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2021-09-24 14:04 UTC (permalink / raw)
To: Klaus Jensen
Cc: Kevin Wolf, Fam Zheng, Qemu-block, Klaus Jensen, QEMU Developers,
Hanna Reitz, Stefan Hajnoczi, Keith Busch,
Philippe Mathieu-Daudé
On Fri, 24 Sept 2021 at 07:47, Klaus Jensen <its@irrelevant.dk> wrote:
>
> From: Klaus Jensen <k.jensen@samsung.com>
>
> Hi Peter,
>
> The following changes since commit 2c3e83f92d93fbab071b8a96b8ab769b01902475:
>
> Merge remote-tracking branch 'remotes/alistair23/tags/pull-riscv-to-apply-20210921' into staging (2021-09-21 10:57:48 -0700)
>
> are available in the Git repository at:
>
> git://git.infradead.org/qemu-nvme.git tags/nvme-next-pull-request
>
> for you to fetch changes up to c53a9a91021c2f57de9ab18393d0048bd0fe90c2:
>
> hw/nvme: Return error for fused operations (2021-09-24 08:43:58 +0200)
>
> ----------------------------------------------------------------
> hw/nvme updates
>
> ----------------------------------------------------------------
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/6.2
for any user-visible changes.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-09-24 14:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24 6:46 [PULL 0/3] hw/nvme updates Klaus Jensen
2021-09-24 6:46 ` [PULL 1/3] hw/nvme: fix validation of ASQ and ACQ Klaus Jensen
2021-09-24 6:47 ` [PULL 2/3] hw/nvme: fix verification of select field in namespace attachment Klaus Jensen
2021-09-24 6:47 ` [PULL 3/3] hw/nvme: Return error for fused operations Klaus Jensen
2021-09-24 14:04 ` [PULL 0/3] hw/nvme updates Peter Maydell
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).