]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bhyve: fix NVMe emulation update of SQHD
authorchuck <chuck@FreeBSD.org>
Fri, 27 Mar 2020 15:28:27 +0000 (15:28 +0000)
committerchuck <chuck@FreeBSD.org>
Fri, 27 Mar 2020 15:28:27 +0000 (15:28 +0000)
commit38b88d3d82c729fedf7f6d1c563f9ac3c34b552d
treefbb603cd59f0a9950877ed75c8c2e4fea907f432
parent83fb88ee4fc00b1347b523a5949f141a949a1810
bhyve: fix NVMe emulation update of SQHD

The SQHD field of a Completion Queue entry indicates the current
Submission Queue head pointer value. The head pointer represents the
next entry to be consumed and is updated after consuming the current
entry.

In the Admin queue processing, the current code updates the head pointer
after reporting the value to the host via the SQHD. This gives the
impression that the Controller is perpetually one command behind in its
processing of the Admin SQ. And while this doesn't appear to bother some
initiators, it is wrong.

Fix is to update the SQ head pointer prior to writing the SQHD value in
the completion.

While here, fix missed update of dword 0 (cdw0) in the completion
message.

Reported by: khng300
Reviewed by: jhb, imp
Approved by: jhb (maintainer)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24083
usr.sbin/bhyve/pci_nvme.c