qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/2] hw/nvme late fix
@ 2023-08-08  6:27 Klaus Jensen
  2023-08-08  6:27 ` [PULL 1/2] hw/nvme: fix CRC64 for guard tag Klaus Jensen
  2023-08-08  6:27 ` [PULL 2/2] docs: update hw/nvme documentation for protection information Klaus Jensen
  0 siblings, 2 replies; 3+ messages in thread
From: Klaus Jensen @ 2023-08-08  6:27 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: qemu-block, Keith Busch, Kevin Wolf, Hanna Reitz, Klaus Jensen,
	Philippe Mathieu-Daudé, Stefan Hajnoczi, Fam Zheng,
	Klaus Jensen

From: Klaus Jensen <k.jensen@samsung.com>

Hi,

This is a fix for hw/nvme protection information discovered by Ankit
late in the cycle. This is not a regression, but a long standing bug and
not critical (obviously no users of this until now, no potential for
crash or similar, just plain wrong).

If this can make it for -rc3 that is great, but it can easily be deferred
to a stable release or -rc4 if other fixes require it.

Thanks,


The following changes since commit 0450cf08976f9036feaded438031b4cba94f6452:

  Merge tag 'fixes-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2023-08-07 13:55:00 -0700)

are available in the Git repository at:

  https://gitlab.com/birkelund/qemu.git tags/nvme-next-pull-request

for you to fetch changes up to bb223df9403beada5b2ab408d2d9a82471432a21:

  docs: update hw/nvme documentation for protection information (2023-08-08 08:10:15 +0200)

----------------------------------------------------------------
hw/nvme late fix

- late fix for nvme pi
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmTR3uMACgkQTeGvMW1P
DenZzgf/T5pb1dQhYthpJ/OOLcvtttpRChQSvZJ8uxyzWoNS/9hKn5gd8buvdGwt
fO1QU3Ogh6ArwZ9GT5OqLV05d9vMuvJlPxpbqOs8XZACobH+nb3CqXBcX1F7TxqV
j9OmFH4UGPDo42hkT+jqa+kHc9hxmpwg+f6Wlpad+ZJ2UAel0/19JsQItln8JQ/I
Jxd07Q5qcj06RtwcPf/0WUOs4I6sTkifu7uZIrx1YjYN4/jQmaF2L0MQjUw1ktLF
hFXSW3iarDKh2fFlfR2fMkkoLLnoS6NoZnTj3fBDabcuMfpJlf7WZ5fuYpOlCKtB
kpN9/WaGpZtXmWAg82R7wlgR4D9vkw==
=EuEc
-----END PGP SIGNATURE-----

----------------------------------------------------------------

Ankit Kumar (2):
  hw/nvme: fix CRC64 for guard tag
  docs: update hw/nvme documentation for protection information

 docs/system/devices/nvme.rst | 12 +++++++++---
 hw/nvme/dif.c                |  4 ++--
 2 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.41.0



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

* [PULL 1/2] hw/nvme: fix CRC64 for guard tag
  2023-08-08  6:27 [PULL 0/2] hw/nvme late fix Klaus Jensen
@ 2023-08-08  6:27 ` Klaus Jensen
  2023-08-08  6:27 ` [PULL 2/2] docs: update hw/nvme documentation for protection information Klaus Jensen
  1 sibling, 0 replies; 3+ messages in thread
From: Klaus Jensen @ 2023-08-08  6:27 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: qemu-block, Keith Busch, Kevin Wolf, Hanna Reitz, Klaus Jensen,
	Philippe Mathieu-Daudé, Stefan Hajnoczi, Fam Zheng,
	Ankit Kumar, qemu-stable, Klaus Jensen

From: Ankit Kumar <ankit.kumar@samsung.com>

The nvme CRC64 generator expects the caller to pass inverted seed value.
Pass inverted crc value for metadata buffer.

Cc: qemu-stable@nongnu.org
Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support")
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 hw/nvme/dif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
index 63c44c86ab55..01b19c33734e 100644
--- a/hw/nvme/dif.c
+++ b/hw/nvme/dif.c
@@ -115,7 +115,7 @@ static void nvme_dif_pract_generate_dif_crc64(NvmeNamespace *ns, uint8_t *buf,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         dif->g64.guard = cpu_to_be64(crc);
@@ -246,7 +246,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         trace_pci_nvme_dif_prchk_guard_crc64(be64_to_cpu(dif->g64.guard), crc);
-- 
2.41.0



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

* [PULL 2/2] docs: update hw/nvme documentation for protection information
  2023-08-08  6:27 [PULL 0/2] hw/nvme late fix Klaus Jensen
  2023-08-08  6:27 ` [PULL 1/2] hw/nvme: fix CRC64 for guard tag Klaus Jensen
@ 2023-08-08  6:27 ` Klaus Jensen
  1 sibling, 0 replies; 3+ messages in thread
From: Klaus Jensen @ 2023-08-08  6:27 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel
  Cc: qemu-block, Keith Busch, Kevin Wolf, Hanna Reitz, Klaus Jensen,
	Philippe Mathieu-Daudé, Stefan Hajnoczi, Fam Zheng,
	Ankit Kumar, Klaus Jensen

From: Ankit Kumar <ankit.kumar@samsung.com>

Add missing entry for pif ("protection information format").
Protection information size can be 8 or 16 bytes, Update the pil entry
as per the NVM command set specification.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 docs/system/devices/nvme.rst | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/docs/system/devices/nvme.rst b/docs/system/devices/nvme.rst
index 2a3af268f7a5..32ff287cd78e 100644
--- a/docs/system/devices/nvme.rst
+++ b/docs/system/devices/nvme.rst
@@ -271,9 +271,15 @@ The virtual namespace device supports DIF- and DIX-based protection information
 
 ``pil=UINT8`` (default: ``0``)
   Controls the location of the protection information within the metadata. Set
-  to ``1`` to transfer protection information as the first eight bytes of
-  metadata. Otherwise, the protection information is transferred as the last
-  eight bytes.
+  to ``1`` to transfer protection information as the first bytes of metadata.
+  Otherwise, the protection information is transferred as the last bytes of
+  metadata.
+
+``pif=UINT8`` (default: ``0``)
+  By default, the namespace device uses 16 bit guard protection information
+  format (``pif=0``). Set to ``2`` to enable 64 bit guard protection
+  information format. This requires at least 16 bytes of metadata. Note that
+  ``pif=2`` (32 bit guards) are currently not supported.
 
 Virtualization Enhancements and SR-IOV (Experimental Support)
 -------------------------------------------------------------
-- 
2.41.0



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

end of thread, other threads:[~2023-08-08  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08  6:27 [PULL 0/2] hw/nvme late fix Klaus Jensen
2023-08-08  6:27 ` [PULL 1/2] hw/nvme: fix CRC64 for guard tag Klaus Jensen
2023-08-08  6:27 ` [PULL 2/2] docs: update hw/nvme documentation for protection information Klaus Jensen

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).