All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] hw/nvme: fix copy cmd for pi enabled namespaces
@ 2022-04-21 10:51 Dmitry Tikhov
  2022-04-28 20:16 ` Klaus Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Tikhov @ 2022-04-21 10:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: kbusch, its, ddtikhov, qemu-block, linux

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] hw/nvme: fix copy cmd for pi enabled namespaces
  2022-04-21 10:51 [PATCH v2] hw/nvme: fix copy cmd for pi enabled namespaces Dmitry Tikhov
@ 2022-04-28 20:16 ` Klaus Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Klaus Jensen @ 2022-04-28 20:16 UTC (permalink / raw)
  To: Dmitry Tikhov; +Cc: kbusch, ddtikhov, qemu-devel, qemu-block, linux

[-- Attachment #1: Type: text/plain, Size: 1210 bytes --]

On Apr 21 13:51, Dmitry Tikhov wrote:
> 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
> 

Thanks Dmitry,

Applied to nvme-next.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-28 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 10:51 [PATCH v2] hw/nvme: fix copy cmd for pi enabled namespaces Dmitry Tikhov
2022-04-28 20:16 ` Klaus Jensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.