git: f70653fc82ba - stable/13 - bhyve nvme: Support minimal Controller list

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

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

commit f70653fc82bafdf0818666b4d803eaf4e4e579a9
Author:     Chuck Tuffli <chuck@FreeBSD.org>
AuthorDate: 2022-08-16 16:15:53 +0000
Commit:     Chuck Tuffli <chuck@FreeBSD.org>
CommitDate: 2022-11-20 01:55:02 +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
    
    (cherry picked from commit 715f82e4f5c51c04314904dee8090c8abbbe2156)
---
 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 9ab23792d58d..141ec2248aeb 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -1541,6 +1541,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);