nvme queue

-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmctyJoACgkQTeGvMW1P
 DelYBgf+OofWBMas7WJykSpPkhmAUPhUZ50XmeuJqPntb7JLTv7Ne7eoe5/ddG/G
 ul3M3B4oaErx6j6gbAVwRO7EwnLXhI3YL8Ar5ykqXQD9ZqIhXdhKqO7JxSKgBMuN
 0Jtaarviqrn9BO+ZTiMmtJIwh1/tztmmzv97m7r3SwEaoVCK6xK1iIE/dPNIO/ad
 UxWkuSCBWIy9iKuN61q9tBYUMhfhvUggobtU7a9zjrtfSWV1rzboDIgKi8T1DToS
 ahKLsztFg3X4PhBD8O//u0WZSdr/Fh+/3Ya1Dfxsh/wWinuO1kRCEbCCsW+TqDC2
 0vLHlVCtGEmibz8Fhk06c+0QdbHMPQ==
 =dsX0
 -----END PGP SIGNATURE-----

Merge tag 'pull-nvme-20241108' of https://gitlab.com/birkelund/qemu into staging

nvme queue

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmctyJoACgkQTeGvMW1P
# DelYBgf+OofWBMas7WJykSpPkhmAUPhUZ50XmeuJqPntb7JLTv7Ne7eoe5/ddG/G
# ul3M3B4oaErx6j6gbAVwRO7EwnLXhI3YL8Ar5ykqXQD9ZqIhXdhKqO7JxSKgBMuN
# 0Jtaarviqrn9BO+ZTiMmtJIwh1/tztmmzv97m7r3SwEaoVCK6xK1iIE/dPNIO/ad
# UxWkuSCBWIy9iKuN61q9tBYUMhfhvUggobtU7a9zjrtfSWV1rzboDIgKi8T1DToS
# ahKLsztFg3X4PhBD8O//u0WZSdr/Fh+/3Ya1Dfxsh/wWinuO1kRCEbCCsW+TqDC2
# 0vLHlVCtGEmibz8Fhk06c+0QdbHMPQ==
# =dsX0
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 08 Nov 2024 08:15:22 GMT
# gpg:                using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [full]
# gpg:                 aka "Klaus Jensen <k.jensen@samsung.com>" [full]
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#      Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'pull-nvme-20241108' of https://gitlab.com/birkelund/qemu:
  hw/nvme: fix handling of over-committed queues

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2024-11-08 10:26:11 +00:00
commit ff30ed9c44

View File

@ -1520,9 +1520,16 @@ static void nvme_post_cqes(void *opaque)
stl_le_p(&n->bar.csts, NVME_CSTS_FAILED); stl_le_p(&n->bar.csts, NVME_CSTS_FAILED);
break; break;
} }
QTAILQ_REMOVE(&cq->req_list, req, entry); QTAILQ_REMOVE(&cq->req_list, req, entry);
nvme_inc_cq_tail(cq); nvme_inc_cq_tail(cq);
nvme_sg_unmap(&req->sg); nvme_sg_unmap(&req->sg);
if (QTAILQ_EMPTY(&sq->req_list) && !nvme_sq_empty(sq)) {
qemu_bh_schedule(sq->bh);
}
QTAILQ_INSERT_TAIL(&sq->req_list, req, entry); QTAILQ_INSERT_TAIL(&sq->req_list, req, entry);
} }
if (cq->tail != cq->head) { if (cq->tail != cq->head) {
@ -7981,7 +7988,6 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr, int val)
/* Completion queue doorbell write */ /* Completion queue doorbell write */
uint16_t new_head = val & 0xffff; uint16_t new_head = val & 0xffff;
int start_sqs;
NvmeCQueue *cq; NvmeCQueue *cq;
qid = (addr - (0x1000 + (1 << 2))) >> 3; qid = (addr - (0x1000 + (1 << 2))) >> 3;
@ -8032,18 +8038,15 @@ static void nvme_process_db(NvmeCtrl *n, hwaddr addr, int val)
trace_pci_nvme_mmio_doorbell_cq(cq->cqid, new_head); trace_pci_nvme_mmio_doorbell_cq(cq->cqid, new_head);
start_sqs = nvme_cq_full(cq) ? 1 : 0; /* scheduled deferred cqe posting if queue was previously full */
if (nvme_cq_full(cq)) {
qemu_bh_schedule(cq->bh);
}
cq->head = new_head; cq->head = new_head;
if (!qid && n->dbbuf_enabled) { if (!qid && n->dbbuf_enabled) {
stl_le_pci_dma(pci, cq->db_addr, cq->head, MEMTXATTRS_UNSPECIFIED); stl_le_pci_dma(pci, cq->db_addr, cq->head, MEMTXATTRS_UNSPECIFIED);
} }
if (start_sqs) {
NvmeSQueue *sq;
QTAILQ_FOREACH(sq, &cq->sq_list, entry) {
qemu_bh_schedule(sq->bh);
}
qemu_bh_schedule(cq->bh);
}
if (cq->tail == cq->head) { if (cq->tail == cq->head) {
if (cq->irq_enabled) { if (cq->irq_enabled) {