From fbac7e0ba248aec4a9f03075cfb05141cc32fc06 Mon Sep 17 00:00:00 2001 From: Chuck Tuffli Date: Fri, 4 Jan 2019 15:03:35 +0000 Subject: [PATCH] Fix bhyve's NVMe Completion Queue entry values The function which processes Admin commands was not returning the Command Specific value in Completion Queue Entry, Dword 0 (CDW0). This effects commands such as Set Features, Number of Queues which returns the number of queues supported by the device in CDW0. In this case, the host will only create 1 queue pair (Number of Queues is zero based). This also masked a bug in the queue counting logic. Reviewed by: imp, araujo Approved by: imp (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D18703 --- usr.sbin/bhyve/pci_nvme.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c index 10697056d72..5a8ab086d1e 100644 --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -983,6 +983,7 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, uint64_t value) cq = &sc->compl_queues[0]; cp = &(cq->qbase)[cq->tail]; + cp->cdw0 = compl.cdw0; cp->sqid = 0; cp->sqhd = sqhead; cp->cid = cmd->cid;