hw/nvme: 64-bit pi support

This adds support for one possible new protection information format
introduced in TP4068 (and integrated in NVMe 2.0): the 64-bit CRC guard
and 48-bit reference tag. This version does not support storage tags.

Like the CRC16 support already present, this uses a software
implementation of CRC64 (so it is naturally pretty slow). But its good
enough for verification purposes.

This may go nicely hand-in-hand with the support that Keith submitted
for the Linux kernel[1].

  [1]: https://lore.kernel.org/linux-nvme/20220126165214.GA1782352@dhcp-10-100-145-180.wdc.com/T/

Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Naveen Nagar <naveen.n1@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
Naveen Nagar 2021-11-16 18:56:52 +05:30 committed by Klaus Jensen
parent ac0b34c58d
commit 44219b6029
7 changed files with 608 additions and 98 deletions

View file

@ -102,6 +102,7 @@ typedef struct NvmeNamespaceParams {
uint8_t mset;
uint8_t pi;
uint8_t pil;
uint8_t pif;
uint16_t mssrl;
uint32_t mcl;
@ -127,6 +128,7 @@ typedef struct NvmeNamespace {
int64_t size;
int64_t moff;
NvmeIdNs id_ns;
NvmeIdNsNvm id_ns_nvm;
NvmeLBAF lbaf;
unsigned int nlbaf;
size_t lbasz;
@ -134,6 +136,7 @@ typedef struct NvmeNamespace {
uint8_t csi;
uint16_t status;
int attached;
uint8_t pif;
struct {
uint16_t zrwas;