aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-10-17 12:30:24 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-10-28 09:36:58 +1100
commit30ca440eec9fe1d7eec5a48addac656438778278 (patch)
tree68e20f4d2ffa59169c9597ee0e1fac8b6d4a210e /tests/libqos
parenta980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4 (diff)
tests: enable virtio tests on SPAPR
but disable MSI-X tests on SPAPR as we can't check the result (the memory region used on PC is not readable on SPAPR). Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/libqos')
-rw-r--r--tests/libqos/virtio-pci.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c
index 7aa29b1a9c..7e60b3a427 100644
--- a/tests/libqos/virtio-pci.c
+++ b/tests/libqos/virtio-pci.c
@@ -68,16 +68,36 @@ static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d, uint64_t addr)
return qpci_io_readb(dev->pdev, (void *)(uintptr_t)addr);
}
+/* PCI is always read in little-endian order
+ * but virtio ( < 1.0) is in guest order
+ * so with a big-endian guest the order has been reversed,
+ * reverse it again
+ * virtio-1.0 is always little-endian, like PCI, but this
+ * case will be managed inside qvirtio_is_big_endian()
+ */
+
static uint16_t qvirtio_pci_config_readw(QVirtioDevice *d, uint64_t addr)
{
QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;
- return qpci_io_readw(dev->pdev, (void *)(uintptr_t)addr);
+ uint16_t value;
+
+ value = qpci_io_readw(dev->pdev, (void *)(uintptr_t)addr);
+ if (qvirtio_is_big_endian(d)) {
+ value = bswap16(value);
+ }
+ return value;
}
static uint32_t qvirtio_pci_config_readl(QVirtioDevice *d, uint64_t addr)
{
QVirtioPCIDevice *dev = (QVirtioPCIDevice *)d;
- return qpci_io_readl(dev->pdev, (void *)(uintptr_t)addr);
+ uint32_t value;
+
+ value = qpci_io_readl(dev->pdev, (void *)(uintptr_t)addr);
+ if (qvirtio_is_big_endian(d)) {
+ value = bswap32(value);
+ }
+ return value;
}
static uint64_t qvirtio_pci_config_readq(QVirtioDevice *d, uint64_t addr)