43 lines
1.4 KiB
Diff
43 lines
1.4 KiB
Diff
|
|
From 6de964bac51139ef24f43bde56933cd8eafaf317 Mon Sep 17 00:00:00 2001
|
||
|
|
From: gubin <gubin_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Sat, 22 Mar 2025 15:25:39 +0800
|
||
|
|
Subject: [PATCH] hw/nvme: fix invalid endian conversion
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
cherry-pick from d2b5bb860e6c17442ad95cc275feb07c1665be5c
|
||
|
|
|
||
|
|
numcntl is one byte and so is max_vfs. Using cpu_to_le16 on big endian
|
||
|
|
hosts results in numcntl being set to 0.
|
||
|
|
|
||
|
|
Fix by dropping the endian conversion.
|
||
|
|
|
||
|
|
Fixes: 99f48ae7ae ("hw/nvme: Add support for Secondary Controller List")
|
||
|
|
Reported-by: Kevin Wolf <kwolf@redhat.com>
|
||
|
|
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
|
||
|
|
Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
|
||
|
|
Message-ID: <20240222-fix-sriov-numcntl-v1-1-d60bea5e72d0@samsung.com>
|
||
|
|
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
||
|
|
Signed-off-by: gubin <gubin_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
hw/nvme/ctrl.c | 2 +-
|
||
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
|
||
|
|
index 29445938d5..9410344844 100644
|
||
|
|
--- a/hw/nvme/ctrl.c
|
||
|
|
+++ b/hw/nvme/ctrl.c
|
||
|
|
@@ -7928,7 +7928,7 @@ static void nvme_init_state(NvmeCtrl *n)
|
||
|
|
n->aer_reqs = g_new0(NvmeRequest *, n->params.aerl + 1);
|
||
|
|
QTAILQ_INIT(&n->aer_queue);
|
||
|
|
|
||
|
|
- list->numcntl = cpu_to_le16(max_vfs);
|
||
|
|
+ list->numcntl = max_vfs;
|
||
|
|
for (i = 0; i < max_vfs; i++) {
|
||
|
|
sctrl = &list->sec[i];
|
||
|
|
sctrl->pcid = cpu_to_le16(n->cntlid);
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|