Skip to content

Commit

Permalink
Merge tag 'nvme-next-pull-request' of https://gitlab.com/birkelund/qemu
Browse files Browse the repository at this point in the history
… into staging

hw/nvme fixes

- fix for invalid protection information calculation

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmTSREoACgkQTeGvMW1P
# DekH6Qf/e3gi0KloAUpbTQvGmBA6XmkJFAtOdZn7IJXVCowjYTIKU84DrdPyT1c1
# rofL4w0klKG5c4Or/Cs4dH/ASxTWaQZRlFAYxsTW3nUX74MnaFDRZcN2geb30ws7
# ryejVEKeHNWH/YYY4Ny55wO3tmy2ILAKnbiadiXhj4dQfCK1GzZnrx10PWxLNlkZ
# KRhiXLNBHpPnDlrLq7/nLs+/0cMrrqEz6ISm/Ju4iUczAH/wmqEbR/yD3pAwmH07
# PCaSeegOpwscovI5TWRelOJlzIXb6D8Xk9d3dGL5x/eeN7GlkgERX4MAcNYKwe8T
# JNR8y2ErTEj2nLU/juES1EpiR2gYKw==
# =vJlA
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 08 Aug 2023 06:34:02 AM PDT
# gpg:                using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [unknown]
# gpg:                 aka "Klaus Jensen <k.jensen@samsung.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#      Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'nvme-next-pull-request' of https://gitlab.com/birkelund/qemu:
  docs: update hw/nvme documentation for protection information
  hw/nvme: fix CRC64 for guard tag

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Aug 8, 2023
2 parents 32e07fd + ec5a138 commit a8fc516
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions docs/system/devices/nvme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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=1`` (32 bit guards) is currently not supported.

Virtualization Enhancements and SR-IOV (Experimental Support)
-------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions hw/nvme/dif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a8fc516

Please sign in to comment.