From 41d283bdab08868a244b9c19dce507fdf15a8990 Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Wed, 17 Jun 2015 15:23:34 +0200 Subject: virtio: introduce virtio_legacy_is_cross_endian() This helper will be used by vhost and tap to detect cross-endianness in the legacy virtio case. Signed-off-by: Greg Kurz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-access.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/hw/virtio') diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h index ee28c21fef..cee5dd70c9 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -32,6 +32,19 @@ static inline bool virtio_access_is_big_endian(VirtIODevice *vdev) #endif } +static inline bool virtio_legacy_is_cross_endian(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 false; +#endif +} + static inline uint16_t virtio_lduw_phys(VirtIODevice *vdev, hwaddr pa) { if (virtio_access_is_big_endian(vdev)) { -- cgit v1.2.1 From 1e7398a140f7a6bd9f5a438e7ad0f1ef50990e25 Mon Sep 17 00:00:00 2001 From: Pankaj Gupta Date: Tue, 16 Jun 2015 13:48:59 +0530 Subject: vhost: enable vhost without without MSI-X We use vhostforce to enable vhost even if Guests don't have MSI-X support and we fall back to QEMU virtio-net. This gives a very small performance gain, but the disadvantage is that guest now controls which virtio code is running (qemu or vhost) so our attack surface is doubled. This patch will enable vhost unconditionally whenever it's requested. For compatibility, enable vhost when vhostforce is set, as well. Signed-off-by: Pankaj Gupta Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Jason Wang --- include/hw/virtio/vhost.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/hw/virtio') diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 84f170e789..dd510509eb 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -51,7 +51,6 @@ struct vhost_dev { bool log_enabled; unsigned long long log_size; Error *migration_blocker; - bool force; bool memory_changed; hwaddr mem_changed_start_addr; hwaddr mem_changed_end_addr; @@ -61,7 +60,7 @@ struct vhost_dev { }; int vhost_dev_init(struct vhost_dev *hdev, void *opaque, - VhostBackendType backend_type, bool force); + VhostBackendType backend_type); void vhost_dev_cleanup(struct vhost_dev *hdev); bool vhost_dev_query(struct vhost_dev *hdev, VirtIODevice *vdev); int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev); -- cgit v1.2.1