This is needed to support migration tests with qgraph.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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);
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;
* 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)
qvirtio_set_acknowledge(vdev);
qvirtio_set_driver(vdev);
}
+
+bool qvirtio_is_big_endian(QVirtioDevice *d)
+{
+ return d->big_endian;
+}
const QVirtioBus *bus;
/* Device type */
uint16_t device_type;
+ bool big_endian;
} QVirtioDevice;
typedef struct QVirtQueue {
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)
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);