[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH for-9.1 v2 06/11] vhost-user: enable frontends on any POSIX syste
From: |
Stefano Garzarella |
Subject: |
[PATCH for-9.1 v2 06/11] vhost-user: enable frontends on any POSIX system |
Date: |
Tue, 26 Mar 2024 14:39:31 +0100 |
The vhost-user protocol is not really Linux-specific so let's enable
vhost-user frontends for any POSIX system.
In vhost_net.c we use VHOST_FILE_UNBIND which is defined in a Linux
specific header, let's define it for other systems as well.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---
meson.build | 1 -
hw/net/vhost_net.c | 5 +++++
hw/block/Kconfig | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index c9c3217ba4..c19d51501a 100644
--- a/meson.build
+++ b/meson.build
@@ -151,7 +151,6 @@ have_tpm = get_option('tpm') \
# vhost
have_vhost_user = get_option('vhost_user') \
- .disable_auto_if(host_os != 'linux') \
.require(host_os != 'windows',
error_message: 'vhost-user is not available on Windows').allowed()
have_vhost_vdpa = get_option('vhost_vdpa') \
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index e8e1661646..b8a59b9e90 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -34,8 +34,13 @@
#include "standard-headers/linux/virtio_ring.h"
#include "hw/virtio/vhost.h"
#include "hw/virtio/virtio-bus.h"
+#if defined(__linux__)
#include "linux-headers/linux/vhost.h"
+#endif
+#ifndef VHOST_FILE_UNBIND
+#define VHOST_FILE_UNBIND -1
+#endif
/* Features supported by host kernel. */
static const int kernel_feature_bits[] = {
diff --git a/hw/block/Kconfig b/hw/block/Kconfig
index 9e8f28f982..29ee09e434 100644
--- a/hw/block/Kconfig
+++ b/hw/block/Kconfig
@@ -40,7 +40,7 @@ config VHOST_USER_BLK
bool
# Only PCI devices are provided for now
default y if VIRTIO_PCI
- depends on VIRTIO && VHOST_USER && LINUX
+ depends on VIRTIO && VHOST_USER
config SWIM
bool
--
2.44.0
- Re: [PATCH for-9.1 v2 02/11] libvhost-user: fail vu_message_write() if sendmsg() is failing, (continued)
[PATCH for-9.1 v2 03/11] libvhost-user: mask F_INFLIGHT_SHMFD if memfd is not supported, Stefano Garzarella, 2024/03/26
[PATCH for-9.1 v2 05/11] contrib/vhost-user-blk: fix bind() using the right size of the address, Stefano Garzarella, 2024/03/26
[PATCH for-9.1 v2 04/11] vhost-user-server: don't abort if we can't set fd non-blocking, Stefano Garzarella, 2024/03/26
[PATCH for-9.1 v2 06/11] vhost-user: enable frontends on any POSIX system,
Stefano Garzarella <=
[PATCH for-9.1 v2 07/11] libvhost-user: enable it on any POSIX system, Stefano Garzarella, 2024/03/26
[PATCH for-9.1 v2 08/11] contrib/vhost-user-blk: enable it on any POSIX system, Stefano Garzarella, 2024/03/26
[PATCH for-9.1 v2 09/11] hostmem: add a new memory backend based on POSIX shm_open(), Stefano Garzarella, 2024/03/26
[PATCH for-9.1 v2 10/11] tests/qtest/vhost-user-blk-test: use memory-backend-shm, Stefano Garzarella, 2024/03/26
[PATCH for-9.1 v2 11/11] tests/qtest/vhost-user-test: add a test case for memory-backend-shm, Stefano Garzarella, 2024/03/26