aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Tuffli <chuck@FreeBSD.org>2020-08-24 01:51:21 +0000
committerChuck Tuffli <chuck@FreeBSD.org>2020-08-24 01:51:21 +0000
commit71a51f69a4fa0730fb403cd75e25327a4ae644d4 (patch)
tree0f0b702815d9824c9e754b4f9c0f1d2c7fac8c69
parentc4a86c1fc0d934d46d79f0124a7e8f84b8bddc58 (diff)
downloadsrc-71a51f69a4fa0730fb403cd75e25327a4ae644d4.tar.gz
src-71a51f69a4fa0730fb403cd75e25327a4ae644d4.zip
bhyve: NVMe queue create must init head/tail
The NVMe emulation code did not explicitly initialize queue head and tail pointers on queue creation. As these pointers are part of calloc()'ed memory, this only becomes a problem if the queues are deleted and then recreated. This error can manifest with messages about completions not matching a command.
Notes
Notes: svn path=/head/; revision=364603
-rw-r--r--usr.sbin/bhyve/pci_nvme.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/pci_nvme.c b/usr.sbin/bhyve/pci_nvme.c
index d972ac5ea87d..24f401630d6d 100644
--- a/usr.sbin/bhyve/pci_nvme.c
+++ b/usr.sbin/bhyve/pci_nvme.c
@@ -932,6 +932,7 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struct nvme_command* command,
NVME_SC_MAXIMUM_QUEUE_SIZE_EXCEEDED);
return (1);
}
+ nsq->head = nsq->tail = 0;
nsq->cqid = (command->cdw11 >> 16) & 0xffff;
if ((nsq->cqid == 0) || (nsq->cqid > sc->num_cqueues)) {
@@ -1053,6 +1054,7 @@ nvme_opc_create_io_cq(struct pci_nvme_softc* sc, struct nvme_command* command,
NVME_SC_MAXIMUM_QUEUE_SIZE_EXCEEDED);
return (1);
}
+ ncq->head = ncq->tail = 0;
ncq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx,
command->prp1,
sizeof(struct nvme_command) * (size_t)ncq->size);