From 715f82e4f5c51c04314904dee8090c8abbbe2156 Mon Sep 17 00:00:00 2001 From: Chuck Tuffli Date: Tue, 16 Aug 2022 09:15:53 -0700 Subject: [PATCH] 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);