3c4f941ac7
The patches were selected from the recent "Patch Round-up for stable 7.2.1" [0]. Those that should be relevant for our supported use-cases (and the upcoming nvme use-case) were picked. Most of the patches added now have not been submitted to qemu-stable before. The follow-up for the virtio-rng-pci migration fix will break migration between versions with the fix and without the fix when a virtio-pci-rng(-non)-transitional device is used. Luckily Proxmox VE only uses the virtio-pci-rng device, and this was fixed by 0006-virtio-rng-pci-fix-migration-compat-for-vectors.patch which was applied before any public version of Proxmox VE's QEMU 7.2 package was released. [0]: https://lists.nongnu.org/archive/html/qemu-stable/2023-03/msg00010.html [1]: https://bugzilla.redhat.com/show_bug.cgi?id=2162569 Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
68 lines
2.2 KiB
Diff
68 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Klaus Jensen <k.jensen@samsung.com>
|
|
Date: Wed, 8 Mar 2023 19:57:12 +0300
|
|
Subject: [PATCH] hw/nvme: fix missing endian conversions for doorbell buffers
|
|
|
|
The eventidx and doorbell value are not handling endianness correctly.
|
|
Fix this.
|
|
|
|
Fixes: 3f7fe8de3d49 ("hw/nvme: Implement shadow doorbell buffer support")
|
|
Cc: qemu-stable@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 2fda0726e5149e032acfa5fe442db56cd6433c4c)
|
|
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
|
Conflicts: hw/nvme/ctrl.c
|
|
(picked up from qemu-stable mailing list)
|
|
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
|
|
---
|
|
hw/nvme/ctrl.c | 22 ++++++++++++++++------
|
|
1 file changed, 16 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
|
|
index e54276dc1d..98d8e34109 100644
|
|
--- a/hw/nvme/ctrl.c
|
|
+++ b/hw/nvme/ctrl.c
|
|
@@ -1333,8 +1333,12 @@ static inline void nvme_blk_write(BlockBackend *blk, int64_t offset,
|
|
|
|
static void nvme_update_cq_head(NvmeCQueue *cq)
|
|
{
|
|
- pci_dma_read(&cq->ctrl->parent_obj, cq->db_addr, &cq->head,
|
|
- sizeof(cq->head));
|
|
+ uint32_t v;
|
|
+
|
|
+ pci_dma_read(&cq->ctrl->parent_obj, cq->db_addr, &v, sizeof(v));
|
|
+
|
|
+ cq->head = le32_to_cpu(v);
|
|
+
|
|
trace_pci_nvme_shadow_doorbell_cq(cq->cqid, cq->head);
|
|
}
|
|
|
|
@@ -6141,15 +6145,21 @@ static uint16_t nvme_admin_cmd(NvmeCtrl *n, NvmeRequest *req)
|
|
|
|
static void nvme_update_sq_eventidx(const NvmeSQueue *sq)
|
|
{
|
|
- pci_dma_write(&sq->ctrl->parent_obj, sq->ei_addr, &sq->tail,
|
|
- sizeof(sq->tail));
|
|
+ uint32_t v = cpu_to_le32(sq->tail);
|
|
+
|
|
+ pci_dma_write(&sq->ctrl->parent_obj, sq->ei_addr, &v, sizeof(v));
|
|
+
|
|
trace_pci_nvme_eventidx_sq(sq->sqid, sq->tail);
|
|
}
|
|
|
|
static void nvme_update_sq_tail(NvmeSQueue *sq)
|
|
{
|
|
- pci_dma_read(&sq->ctrl->parent_obj, sq->db_addr, &sq->tail,
|
|
- sizeof(sq->tail));
|
|
+ uint32_t v;
|
|
+
|
|
+ pci_dma_read(&sq->ctrl->parent_obj, sq->db_addr, &v, sizeof(v));
|
|
+
|
|
+ sq->tail = le32_to_cpu(v);
|
|
+
|
|
trace_pci_nvme_shadow_doorbell_sq(sq->sqid, sq->tail);
|
|
}
|
|
|