From 30ca440eec9fe1d7eec5a48addac656438778278 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Mon, 17 Oct 2016 12:30:24 +0200 Subject: 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 Signed-off-by: David Gibson --- tests/libqos/virtio-pci.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'tests/libqos') 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) -- cgit v1.2.3