Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Apr 2020 19:25:28 +0000 (UTC)
From:      Chuck Tuffli <chuck@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r359834 - stable/12/usr.sbin/bhyve
Message-ID:  <202004121925.03CJPS5x099079@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: chuck
Date: Sun Apr 12 19:25:28 2020
New Revision: 359834
URL: https://svnweb.freebsd.org/changeset/base/359834

Log:
  MFC r359367
  
  bhyve: fix NVMe emulation update of SQHD

Modified:
  stable/12/usr.sbin/bhyve/pci_nvme.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/pci_nvme.c
==============================================================================
--- stable/12/usr.sbin/bhyve/pci_nvme.c	Sun Apr 12 19:21:44 2020	(r359833)
+++ stable/12/usr.sbin/bhyve/pci_nvme.c	Sun Apr 12 19:25:28 2020	(r359834)
@@ -1152,7 +1152,8 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u
 			    cmd->opc));
 			pci_nvme_status_genc(&compl.status, NVME_SC_INVALID_OPCODE);
 		}
-	
+		sqhead = (sqhead + 1) % sq->size;
+
 		if (NVME_COMPLETION_VALID(compl)) {
 			struct nvme_completion *cp;
 			int phase;
@@ -1169,7 +1170,6 @@ pci_nvme_handle_admin_cmd(struct pci_nvme_softc* sc, u
 
 			cq->tail = (cq->tail + 1) % cq->size;
 		}
-		sqhead = (sqhead + 1) % sq->size;
 	}
 
 	DPRINTF(("setting sqhead %u", sqhead));
@@ -1284,8 +1284,9 @@ pci_nvme_set_completion(struct pci_nvme_softc *sc,
 
 	compl = &cq->qbase[cq->tail];
 
-	compl->sqhd = atomic_load_acq_short(&sq->head);
+	compl->cdw0 = cdw0;
 	compl->sqid = sqid;
+	compl->sqhd = atomic_load_acq_short(&sq->head);
 	compl->cid = cid;
 
 	// toggle phase



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004121925.03CJPS5x099079>