[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/47] hw/nvme: fix missing cq eventidx update
From: |
Michael Tokarev |
Subject: |
[PATCH 10/47] hw/nvme: fix missing cq eventidx update |
Date: |
Wed, 8 Mar 2023 19:57:13 +0300 |
From: Klaus Jensen <k.jensen@samsung.com>
Prior to reading the shadow doorbell cq head, we have to update the
eventidx. Otherwise, we risk that the driver will skip an mmio doorbell
write. This happens on riscv64, as reported by Guenter.
Adding the missing update to the cq eventidx fixes the issue.
Fixes: 3f7fe8de3d49 ("hw/nvme: Implement shadow doorbell buffer support")
Cc: qemu-stable@nongnu.org
Cc: qemu-riscv@nongnu.org
Reported-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
(cherry picked from commit fa5db2aa168bdc0f15c269b6212ef47632fab8ba)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
hw/nvme/ctrl.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 83f5e58e8d..366b973a9e 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1331,6 +1331,15 @@ static inline void nvme_blk_write(BlockBackend *blk,
int64_t offset,
}
}
+static void nvme_update_cq_eventidx(const NvmeCQueue *cq)
+{
+ uint32_t v = cpu_to_le32(cq->head);
+
+ //not in 7.2: trace_pci_nvme_update_cq_eventidx(cq->cqid, cq->head);
+
+ pci_dma_write(PCI_DEVICE(cq->ctrl), cq->ei_addr, &v, sizeof(v));
+}
+
static void nvme_update_cq_head(NvmeCQueue *cq)
{
uint32_t v;
@@ -1355,6 +1364,7 @@ static void nvme_post_cqes(void *opaque)
hwaddr addr;
if (n->dbbuf_enabled) {
+ nvme_update_cq_eventidx(cq);
nvme_update_cq_head(cq);
}
--
2.30.2
- [RFC PATCH 00/47] Patch Round-up for stable 7.2.1, Michael Tokarev, 2023/03/08
- [PATCH 07/47] target/riscv: Set pc_succ_insn for !rvc illegal insn, Michael Tokarev, 2023/03/08
- [PATCH 10/47] hw/nvme: fix missing cq eventidx update,
Michael Tokarev <=
- [PATCH 06/47] meson: accept relative symlinks in "meson introspect --installed" data, Michael Tokarev, 2023/03/08
- [PATCH 02/47] vhost: fix vq dirty bitmap syncing when vIOMMU is enabled, Michael Tokarev, 2023/03/08
- [PATCH 05/47] target/arm: fix handling of HLT semihosting in system mode, Michael Tokarev, 2023/03/08
- [PATCH 13/47] target/arm: allow writes to SCR_EL3.HXEn bit when FEAT_HCX is enabled, Michael Tokarev, 2023/03/08
- [PATCH 14/47] target/arm: Fix in_debug path in S1_ptw_translate, Michael Tokarev, 2023/03/08
- [PATCH 12/47] target/arm: Fix sve_probe_page, Michael Tokarev, 2023/03/08
- [PATCH 11/47] configure: fix GLIB_VERSION for cross-compilation, Michael Tokarev, 2023/03/08
- [PATCH 18/47] qcow2: Fix theoretical corruption in store_bitmap() error path, Michael Tokarev, 2023/03/08
- [PATCH 16/47] migration/ram: Fix error handling in ram_write_tracking_start(), Michael Tokarev, 2023/03/08
- [PATCH 22/47] target/i386: Fix C flag for BLSI, BLSMSK, BLSR, Michael Tokarev, 2023/03/08