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é <phi...@linaro.org> Reviewed-by: Fabiano Rosas <faro...@suse.de> Signed-off-by: Nicholas Piggin <npig...@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