From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Klaus Jensen <its@irrelevant.dk>,
Keith Busch <kbusch@kernel.org>,
Francis Pravin Antony Michael Raj <francis.michael@solidigm.com>,
Jonathan Derrick <jonathan.derrick@solidigm.com>,
Klaus Jensen <k.jensen@samsung.com>
Subject: [PULL 2/2] hw/nvme: Abort copy command when format is one while pif
Date: Wed, 2 Nov 2022 09:25:55 +0100 [thread overview]
Message-ID: <20221102082555.65165-3-its@irrelevant.dk> (raw)
In-Reply-To: <20221102082555.65165-1-its@irrelevant.dk>
From: Francis Pravin Antony Michael Raj <francis.michael@solidigm.com>
As per the NVMe Command Set specification Section 3.2.2, if
i) The namespace is formatted to use 16b Guard Protection
Information (i.e., pif = 0) and
ii) The Descriptor Format is not cleared to 0h
Then the copy command should be aborted with the status code of Invalid
Namespace or Format
Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support")
Signed-off-by: Francis Pravin Antony Michael Raj <francis.michael@solidigm.com>
Signed-off-by: Jonathan Derrick <jonathan.derrick@solidigm.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/nvme/ctrl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 73c870a42996..9a9857ccf85f 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -3034,7 +3034,8 @@ static uint16_t nvme_copy(NvmeCtrl *n, NvmeRequest *req)
goto invalid;
}
- if (ns->pif && format != 0x1) {
+ if ((ns->pif == 0x0 && format != 0x0) ||
+ (ns->pif != 0x0 && format != 0x1)) {
status = NVME_INVALID_FORMAT | NVME_DNR;
goto invalid;
}
--
2.38.1
next prev parent reply other threads:[~2022-11-02 8:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-02 8:25 [PULL 0/2] hw/nvme fixes Klaus Jensen
2022-11-02 8:25 ` [PULL 1/2] hw/nvme: reenable cqe batching Klaus Jensen
2022-11-02 8:25 ` Klaus Jensen [this message]
2022-11-03 21:26 ` [PULL 0/2] hw/nvme fixes Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221102082555.65165-3-its@irrelevant.dk \
--to=its@irrelevant.dk \
--cc=francis.michael@solidigm.com \
--cc=jonathan.derrick@solidigm.com \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).