git: 2ef32d016b9f - stable/13 - bhyve nvme: Fix reported SANICAP value

From: Chuck Tuffli <chuck_at_FreeBSD.org>
Date: Sat, 19 Nov 2022 17:55:26 UTC
The branch stable/13 has been updated by chuck:

URL: https://cgit.FreeBSD.org/src/commit/?id=2ef32d016b9ff85f1ac747af3505ad7795af2e47

commit 2ef32d016b9ff85f1ac747af3505ad7795af2e47
Author:     Chuck Tuffli <chuck@FreeBSD.org>
AuthorDate: 2022-08-16 16:14:43 +0000
Commit:     Chuck Tuffli <chuck@FreeBSD.org>
CommitDate: 2022-11-20 01:54:34 +0000

    bhyve nvme: Fix reported SANICAP value
    
    The NVMe specification only allows Controllers compliant with the
    revision 1.3 and earlier specification to report a value of 0x0 in the
    No-Deallocate Modifies Media After Sanitize (NODMMAS) field.
    
    For our revision 1.4 Controller, report that media is not modified after
    Sanitize as the implementation does not implement Sanitize.
    
    Fixes UNH Test 1.1.2
    
    (cherry picked from commit ec0efe34dd486359d57bc1e792a0e4f9280f66d7)
---
 usr.sbin/bhyve/pci_nvme.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 9a465f3b1910..9ab23792d58d 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -559,6 +559,10 @@ pci_nvme_init_ctrldata(struct pci_nvme_softc *sc)
 	cd->wctemp = 0x0157;
 	cd->cctemp = 0x0157;
 
+	/* SANICAP must not be 0 for Revision 1.4 and later NVMe Controllers */
+	cd->sanicap = (NVME_CTRLR_DATA_SANICAP_NODMMAS_NO <<
+			NVME_CTRLR_DATA_SANICAP_NODMMAS_SHIFT);
+
 	cd->sqes = (6 << NVME_CTRLR_DATA_SQES_MAX_SHIFT) |
 	    (6 << NVME_CTRLR_DATA_SQES_MIN_SHIFT);
 	cd->cqes = (4 << NVME_CTRLR_DATA_CQES_MAX_SHIFT) |