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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to