[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 36/71] tests/libqos: remove global_qtest from virtio
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 36/71] tests/libqos: remove global_qtest from virtio endianness checks |
Date: |
Mon, 3 Dec 2018 16:32:49 +0100 |
This is needed to support migration tests with qgraph.
Signed-off-by: Paolo Bonzini <address@hidden>
---
tests/libqos/virtio-pci.c | 11 ++++++++++-
tests/libqos/virtio.c | 5 +++++
tests/libqos/virtio.h | 8 ++------
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/tests/libqos/virtio-pci.c b/tests/libqos/virtio-pci.c
index 6bcdbbb..0b58b74 100644
--- a/tests/libqos/virtio-pci.c
+++ b/tests/libqos/virtio-pci.c
@@ -43,6 +43,14 @@ typedef struct QVirtioPCIForeachData {
void *user_data;
} QVirtioPCIForeachData;
+static inline bool qvirtio_pci_is_big_endian(QVirtioPCIDevice *dev)
+{
+ QPCIBus *bus = dev->pdev->bus;
+
+ /* FIXME: virtio 1.0 is always little-endian */
+ return qtest_big_endian(bus->qts);
+}
+
void qvirtio_pci_device_free(QVirtioPCIDevice *dev)
{
g_free(dev->pdev);
@@ -56,6 +64,7 @@ static void qvirtio_pci_init_from_pcidev(QVirtioPCIDevice
*dev, QPCIDevice *pci_
dev->config_msix_entry = -1;
dev->vdev.bus = &qvirtio_pci;
+ dev->vdev.big_endian = qvirtio_pci_is_big_endian(dev);
/* each virtio-xxx-pci device should override at least this function */
dev->obj.get_driver = NULL;
@@ -99,7 +108,7 @@ static uint8_t qvirtio_pci_config_readb(QVirtioDevice *d,
uint64_t off)
* 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()
+ * case will be managed inside qvirtio_pci_is_big_endian()
*/
static uint16_t qvirtio_pci_config_readw(QVirtioDevice *d, uint64_t off)
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index c1ff020..5a62950 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -372,3 +372,8 @@ void qvirtio_start_device(QVirtioDevice *vdev)
qvirtio_set_acknowledge(vdev);
qvirtio_set_driver(vdev);
}
+
+bool qvirtio_is_big_endian(QVirtioDevice *d)
+{
+ return d->big_endian;
+}
diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h
index 2c68668..7f0f9dd 100644
--- a/tests/libqos/virtio.h
+++ b/tests/libqos/virtio.h
@@ -21,6 +21,7 @@ typedef struct QVirtioDevice {
const QVirtioBus *bus;
/* Device type */
uint16_t device_type;
+ bool big_endian;
} QVirtioDevice;
typedef struct QVirtQueue {
@@ -90,12 +91,6 @@ struct QVirtioBus {
void (*virtqueue_kick)(QVirtioDevice *d, QVirtQueue *vq);
};
-static inline bool qvirtio_is_big_endian(QVirtioDevice *d)
-{
- /* FIXME: virtio 1.0 is always little-endian */
- return qtest_big_endian(global_qtest);
-}
-
static inline uint32_t qvring_size(uint32_t num, uint32_t align)
{
return ((sizeof(struct vring_desc) * num + sizeof(uint16_t) * (3 + num)
@@ -109,6 +104,7 @@ uint32_t qvirtio_config_readl(QVirtioDevice *d, uint64_t
addr);
uint64_t qvirtio_config_readq(QVirtioDevice *d, uint64_t addr);
uint32_t qvirtio_get_features(QVirtioDevice *d);
void qvirtio_set_features(QVirtioDevice *d, uint32_t features);
+bool qvirtio_is_big_endian(QVirtioDevice *d);
void qvirtio_reset(QVirtioDevice *d);
void qvirtio_set_acknowledge(QVirtioDevice *d);
--
1.8.3.1
- [Qemu-devel] [PATCH 25/71] tests/libqos: arm/sabrelite machine node, (continued)
- [Qemu-devel] [PATCH 25/71] tests/libqos: arm/sabrelite machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 27/71] tests/libqos: aarch64/xlnx-zcu102 machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 26/71] tests/libqos: arm/xilinx-zynq-a9 machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 29/71] tests/qgraph: add generic PCI testcases, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 31/71] tests/qgraph: ppc64/pseries machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 32/71] tests/libqos: has_buggy_msi flag, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 33/71] tests/libqos: e1000e driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 35/71] tests/libqos: virtio-pci driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 37/71] tests/libqos: virtio-mmio driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 38/71] tests/libqos: arm/virt machine node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 36/71] tests/libqos: remove global_qtest from virtio endianness checks,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 34/71] qos-test: e1000e test node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 39/71] tests/qgraph: add generic virtio testcases, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 41/71] qos-test: virtio-console and virtio-serial test node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 42/71] tests/libqos: virtio-9p driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 40/71] tests/libqos: virtio-serial driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 44/71] tests/libqos: virtio-balloon driver and interface nodes, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 43/71] qos-test: virtio-9p test node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 45/71] tests/qgraph: remove virtio-balloon-test, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 47/71] qos-test: virtio-rng test node, Paolo Bonzini, 2018/12/03
- [Qemu-devel] [PATCH 46/71] tests/libqos: virtio-rng driver and interface nodes, Paolo Bonzini, 2018/12/03