From: Nicholas Piggin <npiggin@gmail.com>
To: qemu-ppc@nongnu.org
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Laurent Vivier" <lvivier@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Coiby Xu" <Coiby.Xu@gmail.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Emanuele Giuseppe Esposito" <e.emanuelegiuseppe@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: [PATCH 2/4] tests/qtest: Fix virtio msix message endianness
Date: Thu, 17 Apr 2025 00:59:16 +1000 [thread overview]
Message-ID: <20250416145918.415674-3-npiggin@gmail.com> (raw)
In-Reply-To: <20250416145918.415674-1-npiggin@gmail.com>
msix messages are written to memory in little-endian order, so they
should not be byteswapped depending on target endianness, but read
as le and converted to host endian by the qtest.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
tests/qtest/libqos/virtio-pci-modern.c | 4 +++-
tests/qtest/libqos/virtio-pci.c | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/libqos/virtio-pci-modern.c b/tests/qtest/libqos/virtio-pci-modern.c
index f31b3be656d..5dae41e6d74 100644
--- a/tests/qtest/libqos/virtio-pci-modern.c
+++ b/tests/qtest/libqos/virtio-pci-modern.c
@@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/bswap.h"
#include "standard-headers/linux/pci_regs.h"
#include "standard-headers/linux/virtio_pci.h"
#include "standard-headers/linux/virtio_config.h"
@@ -136,7 +137,8 @@ static bool get_msix_status(QVirtioPCIDevice *dev, uint32_t msix_entry,
return qpci_msix_pending(dev->pdev, msix_entry);
}
- data = qtest_readl(dev->pdev->bus->qts, msix_addr);
+ qtest_memread(dev->pdev->bus->qts, msix_addr, &data, 4);
+ data = le32_to_cpu(data);
if (data == 0) {
return false;
}
diff --git a/tests/qtest/libqos/virtio-pci.c b/tests/qtest/libqos/virtio-pci.c
index 102e45b5248..76ea1f45ba9 100644
--- a/tests/qtest/libqos/virtio-pci.c
+++ b/tests/qtest/libqos/virtio-pci.c
@@ -131,7 +131,8 @@ static bool qvirtio_pci_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)
/* No ISR checking should be done if masked, but read anyway */
return qpci_msix_pending(dev->pdev, vqpci->msix_entry);
} else {
- data = qtest_readl(dev->pdev->bus->qts, vqpci->msix_addr);
+ qtest_memread(dev->pdev->bus->qts, vqpci->msix_addr, &data, 4);
+ data = le32_to_cpu(data);
if (data == 0) {
return false;
}
@@ -156,7 +157,8 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d)
/* No ISR checking should be done if masked, but read anyway */
return qpci_msix_pending(dev->pdev, dev->config_msix_entry);
} else {
- data = qtest_readl(dev->pdev->bus->qts, dev->config_msix_addr);
+ qtest_memread(dev->pdev->bus->qts, dev->config_msix_addr, &data, 4);
+ data = le32_to_cpu(data);
if (data == 0) {
return false;
}
--
2.47.1
next prev parent reply other threads:[~2025-04-16 15:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 14:59 [PATCH 0/4] tests/qtest: Enable spapr dma tests Nicholas Piggin
2025-04-16 14:59 ` [PATCH 1/4] tests/qtest: Enforce zero for the "un-fired" msix message value Nicholas Piggin
2025-04-16 14:59 ` Nicholas Piggin [this message]
2025-04-16 14:59 ` [PATCH 3/4] tests/qtest: Add libqos function for testing msix interrupt status Nicholas Piggin
2025-04-17 9:43 ` Philippe Mathieu-Daudé
2025-04-16 14:59 ` [PATCH 4/4] tests/qtest: Enable spapr dma with linear iommu map Nicholas Piggin
2025-04-17 16:18 ` Fabiano Rosas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250416145918.415674-3-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=Coiby.Xu@gmail.com \
--cc=danielhb413@gmail.com \
--cc=e.emanuelegiuseppe@gmail.com \
--cc=farosas@suse.de \
--cc=harshpb@linux.ibm.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).