[PATCH v2] hw/nvme: fix copy cmd for pi enabled namespaces

2022-04-21 Thread Dmitry Tikhov
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 --- v2: * remove

Re: [PATCH 2/2] hw/nvme: fix copy cmd for pi enabled namespaces

2022-04-21 Thread Dmitry Tikhov
On Wed, Apr 20, 2022 at 21:16:15, Klaus Jensen wrote: > Discussed this with the TP authors and, no, reftag should not be > re-computed for PRACT 0, regardless of the PI type. Ok, should i resend patch with only adding nvme_dif_mangle_mdata in the read part?

Re: [PATCH] hw/nvme: add new command abort case

2022-04-20 Thread Dmitry Tikhov
On Wed, Apr 20, 2022 at 12:54:44, Klaus Jensen wrote: > > NVM Command Set Specification v1.0b, Section 5.2.3. It is exactly what > you quoted above. > > I think you are interpreting > > "If a command is aborted as a result of the Reference Tag Check bit of > the PRCHK field being set to '1',

Re: [PATCH] hw/nvme: add new command abort case

2022-04-20 Thread Dmitry Tikhov
On Wed, Apr 20, 2022 at 12:36:54, Klaus Jensen wrote: > On Apr 20 12:13, Klaus Jensen wrote: > > On Apr 20 11:20, Dmitry Tikhov wrote: > > > NVMe command set specification for end-to-end data protection formatted > > > namespace states: > > > > > >

[PATCH 0/2] Fix nvme copy command with pi metadata

2022-04-20 Thread Dmitry Tikhov
enabled namespaces. Dmitry Tikhov (2): hw/nvme: refactor check of disabled dif hw/nvme: fix copy cmd for pi enabled namespaces hw/nvme/ctrl.c | 5 ++ hw/nvme/dif.c| 186 +-- hw/nvme/dif.h| 3 + hw/nvme/trace-events | 4 +- 4 files

[PATCH 2/2] hw/nvme: fix copy cmd for pi enabled namespaces

2022-04-20 Thread Dmitry Tikhov
information section of the source metadata should not be copied as is to the destination. Source range start lba and destination range start lba could differ so recalculation of reftag is always needed. Signed-off-by: Dmitry Tikhov --- hw/nvme/ctrl.c | 5 hw/nvme/dif.c | 65

[PATCH 1/2] hw/nvme: refactor check of disabled dif

2022-04-20 Thread Dmitry Tikhov
Move to a separate function code determining whether protection checking in end-to-end data protection enabled namespace should be done. Currently this code is used only in nvme_dif_prchk_crc16 and nvme_dif_prchk_crc64 functions. Signed-off-by: Dmitry Tikhov --- hw/nvme/dif.c| 121

[PATCH] hw/nvme: add new command abort case

2022-04-20 Thread Dmitry Tikhov
handling case of set Reference Tag Check bit in the type 3 formatted namespace. Signed-off-by: Dmitry Tikhov --- hw/nvme/dif.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c index 62d885f83e..63c44c86ab 100644 --- a/hw/nvme/dif.c +++ b/hw/nvme/dif.c @@ -26,6

Re: [PATCH] hw/nvme: fix control flow statement

2022-04-15 Thread Dmitry Tikhov
On Fri, Apr 15, 2022 at 21:42:05, Klaus Jensen wrote: > On Apr 15 13:35, Keith Busch wrote: > > On Fri, Apr 15, 2022 at 10:27:21PM +0300, Dmitry Tikhov wrote: > > > Since there is no else after nvme_dsm_cb invocation, metadata associated > > > with non-zero block rang

[PATCH] hw/nvme: fix control flow statement

2022-04-15 Thread Dmitry Tikhov
inding by calling blk_aio_pwrite_zeroes and subsequent nvme_dsm_cb callback because of missing else statement. Signed-off-by: Dmitry Tikhov --- hw/nvme/ctrl.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 03760ddeae..7ebd2aa326 100644

[PATCH v2] hw/nvme: add missing return statement

2022-04-15 Thread Dmitry Tikhov
return on call stack unwinding by calling blk_aio_pwrite_zeroes and subsequent nvme_dsm_cb callback. Fixes: d7d1474fd85d ("hw/nvme: reimplement dsm to allow cancellation") Signed-off-by: Dmitry Tikhov --- v2: - Instead of adding else just insert return statement - Add: "Fixes: d7d1474

[PATCH] hw/nvme: fix narrowing conversion

2022-04-12 Thread Dmitry Tikhov
aks namespace Signed-off-by: Dmitry Tikhov --- hw/nvme/ns.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index 324f53ea0c..af6504fad2 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -29,7 +29,8 @@ void nvme_ns_init_format(NvmeNamespace