diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c --- a/usr.sbin/bhyve/pci_nvme.c +++ b/usr.sbin/bhyve/pci_nvme.c @@ -324,7 +324,7 @@ uint32_t max_queues; /* max number of IO SQ's or CQ's */ uint32_t num_cqueues; uint32_t num_squeues; - bool num_q_is_set; /* Has host set Number of Queues */ + bool num_q_is_set; /* Number of Queues is set */ struct pci_nvme_ioreq *ioreqs; STAILQ_HEAD(, pci_nvme_ioreq) ioreqs_free; /* free list of ioreqs */ @@ -476,6 +476,7 @@ nsq = NVME_QUEUES; } + sc->num_q_is_set = true; sc->num_squeues = nsq; sc->submit_queues = calloc(sc->num_squeues + 1, @@ -1077,8 +1078,6 @@ sc->compl_queues[i].head = 0; } - sc->num_q_is_set = false; - pci_nvme_aer_destroy(sc); pci_nvme_aen_destroy(sc); @@ -1151,6 +1150,8 @@ DPRINTF("%s mapping Admin-CQ guest 0x%lx, host: %p", __func__, sc->regs.acq, sc->compl_queues[0].qbase); + sc->num_q_is_set = false; + return (0); } @@ -1802,7 +1803,7 @@ uint16_t nqr; /* Number of Queues Requested */ if (sc->num_q_is_set) { - WPRINTF("%s: Number of Queues already set", __func__); + WPRINTF("%s: Number of Queues has been initialized", __func__); pci_nvme_status_genc(&compl->status, NVME_SC_COMMAND_SEQUENCE_ERROR); return; @@ -1839,8 +1840,6 @@ /* Patch the command value which will be saved on callback's return */ command->cdw11 = NVME_FEATURE_NUM_QUEUES(sc); compl->cdw0 = NVME_FEATURE_NUM_QUEUES(sc); - - sc->num_q_is_set = true; } static int