thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-meson-use-have_vhost_-variables-to-pick-sources.patch

586cba
From a7d57a09e33275d5e6649273b5c9da1bc3c92491 Mon Sep 17 00:00:00 2001
586cba
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
586cba
Date: Thu, 21 Jul 2022 15:51:53 +0200
586cba
Subject: [PATCH 06/32] meson: use have_vhost_* variables to pick sources
586cba
MIME-Version: 1.0
586cba
Content-Type: text/plain; charset=UTF-8
586cba
Content-Transfer-Encoding: 8bit
586cba
586cba
RH-Author: Eugenio Pérez <eperezma@redhat.com>
586cba
RH-MergeRequest: 108: Net Control Virtqueue shadow Support
586cba
RH-Commit: [6/27] bc3db1efb759c0bc97fde2f4fbb3d6dc404c8d3d (eperezmartin/qemu-kvm)
586cba
RH-Bugzilla: 1939363
586cba
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
586cba
RH-Acked-by: Cindy Lu <lulu@redhat.com>
586cba
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
586cba
586cba
Bugzilla: https://bugzilla.redhat.com/1939363
586cba
586cba
Upstream Status: git://git.qemu.org/qemu.git
586cba
586cba
commit 43b6d7ee1fbc5b5fb7c85d8131fdac1863214ad6
586cba
Author: Paolo Bonzini <pbonzini@redhat.com>
586cba
Date:   Wed Apr 20 17:34:06 2022 +0200
586cba
586cba
    meson: use have_vhost_* variables to pick sources
586cba
586cba
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
586cba
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
586cba
586cba
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
586cba
---
586cba
 Kconfig.host            |  3 ---
586cba
 backends/meson.build    |  8 ++++++--
586cba
 hw/net/meson.build      |  8 ++++++--
586cba
 hw/virtio/Kconfig       |  3 ---
586cba
 hw/virtio/meson.build   | 25 ++++++++++++++++---------
586cba
 meson.build             |  1 +
586cba
 net/meson.build         | 12 +++++++-----
586cba
 tests/qtest/meson.build |  4 +++-
586cba
 8 files changed, 39 insertions(+), 25 deletions(-)
586cba
586cba
diff --git a/Kconfig.host b/Kconfig.host
586cba
index 60b9c07b5e..1165c4eacd 100644
586cba
--- a/Kconfig.host
586cba
+++ b/Kconfig.host
586cba
@@ -22,15 +22,12 @@ config TPM
586cba
 
586cba
 config VHOST_USER
586cba
     bool
586cba
-    select VHOST
586cba
 
586cba
 config VHOST_VDPA
586cba
     bool
586cba
-    select VHOST
586cba
 
586cba
 config VHOST_KERNEL
586cba
     bool
586cba
-    select VHOST
586cba
 
586cba
 config VIRTFS
586cba
     bool
586cba
diff --git a/backends/meson.build b/backends/meson.build
586cba
index 6e68945528..cb92f639ca 100644
586cba
--- a/backends/meson.build
586cba
+++ b/backends/meson.build
586cba
@@ -12,9 +12,13 @@ softmmu_ss.add([files(
586cba
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
586cba
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
586cba
 softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
586cba
-softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true: files('vhost-user.c'))
586cba
+if have_vhost_user
586cba
+  softmmu_ss.add(when: 'CONFIG_VIRTIO', if_true: files('vhost-user.c'))
586cba
+endif
586cba
 softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c'))
586cba
-softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'], if_true: files('cryptodev-vhost-user.c'))
586cba
+if have_vhost_user_crypto
586cba
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost-user.c'))
586cba
+endif
586cba
 softmmu_ss.add(when: 'CONFIG_GIO', if_true: [files('dbus-vmstate.c'), gio])
586cba
 softmmu_ss.add(when: 'CONFIG_SGX', if_true: files('hostmem-epc.c'))
586cba
 
586cba
diff --git a/hw/net/meson.build b/hw/net/meson.build
586cba
index 685b75badb..ebac261542 100644
586cba
--- a/hw/net/meson.build
586cba
+++ b/hw/net/meson.build
586cba
@@ -46,8 +46,12 @@ specific_ss.add(when: 'CONFIG_XILINX_ETHLITE', if_true: files('xilinx_ethlite.c'
586cba
 softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('net_rx_pkt.c'))
586cba
 specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c'))
586cba
 
586cba
-softmmu_ss.add(when: ['CONFIG_VIRTIO_NET', 'CONFIG_VHOST_NET'], if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
586cba
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
586cba
+if have_vhost_net
586cba
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
586cba
+  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
586cba
+else
586cba
+  softmmu_ss.add(files('vhost_net-stub.c'))
586cba
+endif
586cba
 
586cba
 softmmu_ss.add(when: 'CONFIG_ETSEC', if_true: files(
586cba
   'fsl_etsec/etsec.c',
586cba
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
586cba
index c144d42f9b..8ca7b3d9d6 100644
586cba
--- a/hw/virtio/Kconfig
586cba
+++ b/hw/virtio/Kconfig
586cba
@@ -1,6 +1,3 @@
586cba
-config VHOST
586cba
-    bool
586cba
-
586cba
 config VIRTIO
586cba
     bool
586cba
 
586cba
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
586cba
index 67dc77e00f..30a832eb4a 100644
586cba
--- a/hw/virtio/meson.build
586cba
+++ b/hw/virtio/meson.build
586cba
@@ -2,18 +2,22 @@ softmmu_virtio_ss = ss.source_set()
586cba
 softmmu_virtio_ss.add(files('virtio-bus.c'))
586cba
 softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.c'))
586cba
 softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c'))
586cba
-softmmu_virtio_ss.add(when: 'CONFIG_VHOST', if_false: files('vhost-stub.c'))
586cba
-
586cba
-softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
586cba
-softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
586cba
-
586cba
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
586cba
 
586cba
 virtio_ss = ss.source_set()
586cba
 virtio_ss.add(files('virtio.c'))
586cba
-virtio_ss.add(when: 'CONFIG_VHOST', if_true: files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
586cba
-virtio_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user.c'))
586cba
-virtio_ss.add(when: 'CONFIG_VHOST_VDPA', if_true: files('vhost-shadow-virtqueue.c', 'vhost-vdpa.c'))
586cba
+
586cba
+if have_vhost
586cba
+  virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
586cba
+  if have_vhost_user
586cba
+    virtio_ss.add(files('vhost-user.c'))
586cba
+  endif
586cba
+  if have_vhost_vdpa
586cba
+    virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c'))
586cba
+  endif
586cba
+else
586cba
+  softmmu_virtio_ss.add(files('vhost-stub.c'))
586cba
+endif
586cba
+
586cba
 virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c'))
586cba
 virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c'))
586cba
 virtio_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-crypto-pci.c'))
586cba
@@ -53,3 +57,6 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pci.c'))
586cba
 virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
586cba
 
586cba
 specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: virtio_ss)
586cba
+softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
586cba
+softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
586cba
+softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
586cba
diff --git a/meson.build b/meson.build
586cba
index 735f538497..9ba675f098 100644
586cba
--- a/meson.build
586cba
+++ b/meson.build
586cba
@@ -305,6 +305,7 @@ have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host
586cba
 have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
586cba
 have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
586cba
 have_vhost_net = 'CONFIG_VHOST_NET' in config_host
586cba
+have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel
586cba
 have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
586cba
 
586cba
 # Target-specific libraries and flags
586cba
diff --git a/net/meson.build b/net/meson.build
586cba
index 847bc2ac85..c965e83b26 100644
586cba
--- a/net/meson.build
586cba
+++ b/net/meson.build
586cba
@@ -26,10 +26,10 @@ softmmu_ss.add(when: vde, if_true: files('vde.c'))
586cba
 if have_netmap
586cba
   softmmu_ss.add(files('netmap.c'))
586cba
 endif
586cba
-vhost_user_ss = ss.source_set()
586cba
-vhost_user_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
586cba
-softmmu_ss.add_all(when: 'CONFIG_VHOST_NET_USER', if_true: vhost_user_ss)
586cba
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
586cba
+if have_vhost_net_user
586cba
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
586cba
+  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
586cba
+endif
586cba
 
586cba
 softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('tap-linux.c'))
586cba
 softmmu_ss.add(when: 'CONFIG_BSD', if_true: files('tap-bsd.c'))
586cba
@@ -40,6 +40,8 @@ if not config_host.has_key('CONFIG_LINUX') and not config_host.has_key('CONFIG_B
586cba
 endif
586cba
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_posix))
586cba
 softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c'))
586cba
-softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: files('vhost-vdpa.c'))
586cba
+if have_vhost_net_vdpa
586cba
+  softmmu_ss.add(files('vhost-vdpa.c'))
586cba
+endif
586cba
 
586cba
 subdir('can')
586cba
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
586cba
index 67cd32def1..9f550df900 100644
586cba
--- a/tests/qtest/meson.build
586cba
+++ b/tests/qtest/meson.build
586cba
@@ -269,7 +269,9 @@ qos_test_ss.add(
586cba
 if have_virtfs
586cba
   qos_test_ss.add(files('virtio-9p-test.c'))
586cba
 endif
586cba
-qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c'))
586cba
+if have_vhost_user
586cba
+  qos_test_ss.add(files('vhost-user-test.c'))
586cba
+endif
586cba
 if have_tools and have_vhost_user_blk_server
586cba
   qos_test_ss.add(files('vhost-user-blk-test.c'))
586cba
 endif
586cba
-- 
586cba
2.31.1
586cba