aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-08-08 16:39:20 -0700
committerRichard Henderson <richard.henderson@linaro.org>2023-08-08 16:39:20 -0700
commita8fc5165aab02f328ccd148aafec1e59fd1426eb (patch)
tree1c76987a200efa2e727a30fed6c895b814e139c4
parent32e07fddc6d989dc5fdff4f9c9e47cb1f3911904 (diff)
parentec5a138ce63ce460575a44cf9ec3172c33eb0fd6 (diff)
downloadqemu-a8fc5165aab02f328ccd148aafec1e59fd1426eb.zip
qemu-a8fc5165aab02f328ccd148aafec1e59fd1426eb.tar.gz
qemu-a8fc5165aab02f328ccd148aafec1e59fd1426eb.tar.bz2
Merge tag 'nvme-next-pull-request' of https://gitlab.com/birkelund/qemu 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>
-rw-r--r--docs/system/devices/nvme.rst12
-rw-r--r--hw/nvme/dif.c4
2 files changed, 11 insertions, 5 deletions
diff --git a/docs/system/devices/nvme.rst b/docs/system/devices/nvme.rst
index 2a3af26..4ea957b 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=1`` (32 bit guards) is currently not supported.
Virtualization Enhancements and SR-IOV (Experimental Support)
-------------------------------------------------------------
diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
index 63c44c8..01b19c3 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);