From: Dmitry Tikhov <d.tihov@yadro.com>
To: <qemu-devel@nongnu.org>
Cc: kbusch@kernel.org, its@irrelevant.dk, ddtikhov@gmail.com,
qemu-block@nongnu.org, linux@yadro.com
Subject: [PATCH v2] hw/nvme: fix copy cmd for pi enabled namespaces
Date: Thu, 21 Apr 2022 13:51:58 +0300 [thread overview]
Message-ID: <20220421105158.ufd3wzivaougxokx@localhost.localdomain> (raw)
Current implementation have problem in the read part of copy command.
Because there is no metadata mangling before nvme_dif_check invocation,
reftag error could be thrown for blocks of namespace that have not been
previously written to.
Signed-off-by: Dmitry Tikhov <d.tihov@yadro.com>
---
v2:
* remove refactoring
* remove write part fix
---
hw/nvme/ctrl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 74540a03d5..08574c4dcb 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -2787,6 +2787,10 @@ static void nvme_copy_in_completed_cb(void *opaque, int ret)
size_t mlen = nvme_m2b(ns, nlb);
uint8_t *mbounce = iocb->bounce + nvme_l2b(ns, nlb);
+ status = nvme_dif_mangle_mdata(ns, mbounce, mlen, slba);
+ if (status) {
+ goto invalid;
+ }
status = nvme_dif_check(ns, iocb->bounce, len, mbounce, mlen, prinfor,
slba, apptag, appmask, &reftag);
if (status) {
--
2.35.1
next reply other threads:[~2022-04-21 10:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 10:51 Dmitry Tikhov [this message]
2022-04-28 20:16 ` [PATCH v2] hw/nvme: fix copy cmd for pi enabled namespaces Klaus Jensen
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=20220421105158.ufd3wzivaougxokx@localhost.localdomain \
--to=d.tihov@yadro.com \
--cc=ddtikhov@gmail.com \
--cc=its@irrelevant.dk \
--cc=kbusch@kernel.org \
--cc=linux@yadro.com \
--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).