git: 715f82e4f5c5 - main - bhyve nvme: Support minimal Controller list

From: Chuck Tuffli <chuck_at_FreeBSD.org>
Date: Tue, 16 Aug 2022 16:17:22 UTC
The branch main has been updated by chuck:

URL: https://cgit.FreeBSD.org/src/commit/?id=715f82e4f5c51c04314904dee8090c8abbbe2156

commit 715f82e4f5c51c04314904dee8090c8abbbe2156
Author:     Chuck Tuffli <chuck@FreeBSD.org>
AuthorDate: 2022-08-16 16:15:53 +0000
Commit:     Chuck Tuffli <chuck@FreeBSD.org>
CommitDate: 2022-08-16 16:15:53 +0000

    bhyve nvme: Support minimal Controller list
    
    Controllers must support the Identify Controller list if they support
    Namespace Management. But the UNH NVMe tests use this command regardless
    of whether the device under test supports Namespace Management.
    
    This implementation returns an empty Controller list (i.e., Number of
    Identifiers is zero).
    
    Fixes UNH Test 1.1.2
    
    Reviewed by:    jhb
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D36193
---
 usr.sbin/bhyve/pci_nvme.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index 7701d0b932ee..d6490fade178 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -1569,6 +1569,15 @@ nvme_opc_identify(struct pci_nvme_softc* sc, struct nvme_command* command,
 		((uint8_t *)dest)[1] = sizeof(uint64_t);
 		bcopy(sc->nsdata.eui64, ((uint8_t *)dest) + 4, sizeof(uint64_t));
 		break;
+	case 0x13:
+		/*
+		 * Controller list is optional but used by UNH tests. Return
+		 * a valid but empty list.
+		 */
+		dest = vm_map_gpa(sc->nsc_pi->pi_vmctx, command->prp1,
+		                  sizeof(uint16_t) * 2048);
+		memset(dest, 0, sizeof(uint16_t) * 2048);
+		break;
 	default:
 		DPRINTF("%s unsupported identify command requested 0x%x",
 		         __func__, command->cdw10 & 0xFF);