[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 36/37] vhost-net: disable when cross-endian
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 36/37] vhost-net: disable when cross-endian |
Date: |
Sun, 29 Jun 2014 20:00:13 +0300 |
From: Greg Kurz <address@hidden>
As of today, vhost assumes guest and host have the same endianness.
This is definitely not compatible with modern PPC64 and ARM that
can change endianness at runtime. Let's disable vhost-net and print
an error message when we detect such a case:
qemu-system-ppc64: vhost-net does not support cross-endian
qemu-system-ppc64: unable to start vhost net: 38: falling back on userspace
virtio
This way users can continue to run VMs without changing their setup and
have a chance to know that performance will be impacted.
Suggested-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Greg Kurz <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/net/vhost_net.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 7ac7c21..f87c798 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -275,6 +275,19 @@ static void vhost_net_stop_one(struct vhost_net *net,
vhost_dev_disable_notifiers(&net->dev, dev);
}
+static bool vhost_net_device_endian_ok(VirtIODevice *vdev)
+{
+#ifdef TARGET_IS_BIENDIAN
+#ifdef HOST_WORDS_BIGENDIAN
+ return virtio_is_big_endian(vdev);
+#else
+ return !virtio_is_big_endian(vdev);
+#endif
+#else
+ return true;
+#endif
+}
+
int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
int total_queues)
{
@@ -283,6 +296,12 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
int r, i = 0;
+ if (!vhost_net_device_endian_ok(dev)) {
+ error_report("vhost-net does not support cross-endian");
+ r = -ENOSYS;
+ goto err;
+ }
+
if (!k->set_guest_notifiers) {
error_report("binding does not support guest notifiers");
r = -ENOSYS;
--
MST
- [Qemu-devel] [PULL 26/37] virtio: add endian-ambivalent support to VirtIODevice, (continued)
- [Qemu-devel] [PULL 26/37] virtio: add endian-ambivalent support to VirtIODevice, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 27/37] virtio: memory accessors for endian-ambivalent targets, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 28/37] virtio: allow byte swapping for vring, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 29/37] virtio-net: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 30/37] virtio-balloon: use virtio wrappers to access page frame numbers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 31/37] virtio-blk: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 32/37] virtio-scsi: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 33/37] virtio-serial-bus: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 34/37] virtio-9p: use virtio wrappers to access headers, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 35/37] target-ppc: enable virtio endian ambivalent support, Michael S. Tsirkin, 2014/06/29
- [Qemu-devel] [PULL 36/37] vhost-net: disable when cross-endian,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 37/37] tests: add human format test for string output visitor, Michael S. Tsirkin, 2014/06/29
- Re: [Qemu-devel] [PULL 00/37] pc,vhost,virtio fixes, enhancements, Peter Maydell, 2014/06/29