From: Jagannathan Raman <jag.raman@oracle.com>
To: qemu-devel@nongnu.org
Cc: eduardo@habkost.net, elena.ufimtseva@oracle.com,
john.g.johnson@oracle.com, berrange@redhat.com, bleal@redhat.com,
john.levon@nutanix.com, mst@redhat.com, armbru@redhat.com,
quintela@redhat.com, f4bug@amsat.org, alex.williamson@redhat.com,
kanth.ghatraju@oracle.com, stefanha@redhat.com,
thanos.makatos@nutanix.com, pbonzini@redhat.com,
jag.raman@oracle.com, eblake@redhat.com, dgilbert@redhat.com
Subject: [PATCH v6 06/19] vfio-user: build library
Date: Thu, 17 Feb 2022 02:48:53 -0500 [thread overview]
Message-ID: <a38e60c8d79b2d2aa90f34dd5af6bcffd63a5cfc.1645079934.git.jag.raman@oracle.com> (raw)
In-Reply-To: <cover.1645079934.git.jag.raman@oracle.com>
add the libvfio-user library as a submodule. build it as a cmake
subproject.
Signed-off-by: Elena Ufimtseva <elena.ufimtseva@oracle.com>
Signed-off-by: John G Johnson <john.g.johnson@oracle.com>
Signed-off-by: Jagannathan Raman <jag.raman@oracle.com>
---
configure | 19 +++++++++-
meson.build | 44 +++++++++++++++++++++-
.gitlab-ci.d/buildtest.yml | 2 +
.gitmodules | 3 ++
Kconfig.host | 4 ++
MAINTAINERS | 1 +
hw/remote/Kconfig | 4 ++
hw/remote/meson.build | 2 +
meson_options.txt | 2 +
subprojects/libvfio-user | 1 +
tests/docker/dockerfiles/centos8.docker | 2 +
tests/docker/dockerfiles/ubuntu2004.docker | 2 +
12 files changed, 84 insertions(+), 2 deletions(-)
create mode 160000 subprojects/libvfio-user
diff --git a/configure b/configure
index 9a326eda1e..2acb2604c2 100755
--- a/configure
+++ b/configure
@@ -356,6 +356,7 @@ ninja=""
gio="$default_feature"
skip_meson=no
slirp_smbd="$default_feature"
+vfio_user_server="disabled"
# The following Meson options are handled manually (still they
# are included in the automatically generated help message)
@@ -1172,6 +1173,10 @@ for opt do
;;
--disable-blobs) meson_option_parse --disable-install-blobs ""
;;
+ --enable-vfio-user-server) vfio_user_server="enabled"
+ ;;
+ --disable-vfio-user-server) vfio_user_server="disabled"
+ ;;
--enable-tcmalloc) meson_option_parse --enable-malloc=tcmalloc tcmalloc
;;
--enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
@@ -1425,6 +1430,7 @@ cat << EOF
rng-none dummy RNG, avoid using /dev/(u)random and getrandom()
gio libgio support
slirp-smbd use smbd (at path --smbd=*) in slirp networking
+ vfio-user-server vfio-user server support
NOTE: The object files are built at the place where configure is launched
EOF
@@ -3100,6 +3106,17 @@ but not implemented on your system"
fi
fi
+##########################################
+# check for vfio_user_server
+
+case "$vfio_user_server" in
+ auto | enabled )
+ if test "$git_submodules_action" != "ignore"; then
+ git_submodules="${git_submodules} subprojects/libvfio-user"
+ fi
+ ;;
+esac
+
##########################################
# End of CC checks
# After here, no more $cc or $ld runs
@@ -3790,7 +3807,7 @@ if test "$skip_meson" = no; then
-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \
- -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
+ -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp -Dvfio_user_server=$vfio_user_server \
$(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
$(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
"$@" $cross_arg "$PWD" "$source_path"
diff --git a/meson.build b/meson.build
index ae5f7eec6e..5111b6fed8 100644
--- a/meson.build
+++ b/meson.build
@@ -278,6 +278,11 @@ if targetos != 'linux' and get_option('multiprocess').enabled()
endif
multiprocess_allowed = targetos == 'linux' and not get_option('multiprocess').disabled()
+if targetos != 'linux' and get_option('vfio_user_server').enabled()
+ error('vfio-user server is supported only on Linux')
+endif
+vfio_user_server_allowed = targetos == 'linux' and not get_option('vfio_user_server').disabled()
+
# Target-specific libraries and flags
libm = cc.find_library('m', required: false)
threads = dependency('threads')
@@ -1876,7 +1881,8 @@ host_kconfig = \
(have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : []) + \
- (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : [])
+ (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) + \
+ (vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y'] : [])
ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
@@ -2265,6 +2271,41 @@ if get_option('cfi') and slirp_opt == 'system'
+ ' Please configure with --enable-slirp=git')
endif
+vfiouser = not_found
+if have_system and vfio_user_server_allowed
+ have_internal = fs.exists(meson.current_source_dir() / 'subprojects/libvfio-user/Makefile')
+
+ if not have_internal
+ error('libvfio-user source not found - please pull git submodule')
+ endif
+
+ json_c = dependency('json-c', required: false)
+ if not json_c.found()
+ json_c = dependency('libjson-c', required: false)
+ endif
+ if not json_c.found()
+ json_c = dependency('libjson-c-dev', required: false)
+ endif
+
+ if not json_c.found()
+ error('Unable to find json-c package')
+ endif
+
+ cmake = import('cmake')
+
+ vfiouser_subproj = cmake.subproject('libvfio-user')
+
+ vfiouser_sl = vfiouser_subproj.dependency('vfio-user-static')
+
+ # Although cmake links the json-c library with vfio-user-static
+ # target, that info is not available to meson via cmake.subproject.
+ # As such, we have to separately declare the json-c dependency here.
+ # This appears to be a current limitation of using cmake inside meson.
+ # libvfio-user is planning a switch to meson in the future, which
+ # would address this item automatically.
+ vfiouser = declare_dependency(dependencies: [vfiouser_sl, json_c])
+endif
+
fdt = not_found
fdt_opt = get_option('fdt')
if have_system
@@ -3366,6 +3407,7 @@ summary_info += {'target list': ' '.join(target_dirs)}
if have_system
summary_info += {'default devices': get_option('default_devices')}
summary_info += {'out of process emulation': multiprocess_allowed}
+ summary_info += {'vfio-user server': vfio_user_server_allowed}
endif
summary(summary_info, bool_yn: true, section: 'Targets and accelerators')
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index 0aa70213fb..e52391ec5c 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -42,6 +42,7 @@ build-system-ubuntu:
variables:
IMAGE: ubuntu2004
CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-slirp=system
+ --enable-vfio-user-server
TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
microblazeel-softmmu mips64el-softmmu
MAKE_CHECK_ARGS: check-build
@@ -165,6 +166,7 @@ build-system-centos:
IMAGE: centos8
CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-fdt=system
--enable-modules --enable-trace-backends=dtrace --enable-docs
+ --enable-vfio-user-server
TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
MAKE_CHECK_ARGS: check-build
diff --git a/.gitmodules b/.gitmodules
index f4b6a9b401..d66af96dc9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -67,3 +67,6 @@
[submodule "tests/lcitool/libvirt-ci"]
path = tests/lcitool/libvirt-ci
url = https://gitlab.com/libvirt/libvirt-ci.git
+[submodule "subprojects/libvfio-user"]
+ path = subprojects/libvfio-user
+ url = https://github.com/nutanix/libvfio-user.git
diff --git a/Kconfig.host b/Kconfig.host
index 60b9c07b5e..f2da8bcf8a 100644
--- a/Kconfig.host
+++ b/Kconfig.host
@@ -45,3 +45,7 @@ config MULTIPROCESS_ALLOWED
config FUZZ
bool
select SPARSE_MEM
+
+config VFIO_USER_SERVER_ALLOWED
+ bool
+ imply VFIO_USER_SERVER
diff --git a/MAINTAINERS b/MAINTAINERS
index 81aa31b5e1..9af3e96d63 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3567,6 +3567,7 @@ F: hw/remote/proxy-memory-listener.c
F: include/hw/remote/proxy-memory-listener.h
F: hw/remote/iohub.c
F: include/hw/remote/iohub.h
+F: subprojects/libvfio-user
EBPF:
M: Jason Wang <jasowang@redhat.com>
diff --git a/hw/remote/Kconfig b/hw/remote/Kconfig
index 08c16e235f..2d6b4f4cf4 100644
--- a/hw/remote/Kconfig
+++ b/hw/remote/Kconfig
@@ -2,3 +2,7 @@ config MULTIPROCESS
bool
depends on PCI && PCI_EXPRESS && KVM
select REMOTE_PCIHOST
+
+config VFIO_USER_SERVER
+ bool
+ depends on MULTIPROCESS
diff --git a/hw/remote/meson.build b/hw/remote/meson.build
index e6a5574242..dfea6b533b 100644
--- a/hw/remote/meson.build
+++ b/hw/remote/meson.build
@@ -7,6 +7,8 @@ remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('remote-obj.c'))
remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy.c'))
remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iohub.c'))
+remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: vfiouser)
+
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c'))
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-listener.c'))
diff --git a/meson_options.txt b/meson_options.txt
index 95d527f773..0713ef508c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -68,6 +68,8 @@ option('multiprocess', type: 'feature', value: 'auto',
description: 'Out of process device emulation support')
option('dbus_display', type: 'feature', value: 'auto',
description: '-display dbus support')
+option('vfio_user_server', type: 'feature', value: 'auto',
+ description: 'vfio-user server support')
option('attr', type : 'feature', value : 'auto',
description: 'attr/xattr support')
diff --git a/subprojects/libvfio-user b/subprojects/libvfio-user
new file mode 160000
index 0000000000..7056525da5
--- /dev/null
+++ b/subprojects/libvfio-user
@@ -0,0 +1 @@
+Subproject commit 7056525da5399d00831e90bed4aedb4b8442c9b2
diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker
index 3ede55d09b..b6b4aa9626 100644
--- a/tests/docker/dockerfiles/centos8.docker
+++ b/tests/docker/dockerfiles/centos8.docker
@@ -23,6 +23,7 @@ RUN dnf update -y && \
capstone-devel \
ccache \
clang \
+ cmake \
ctags \
cyrus-sasl-devel \
daxctl-devel \
@@ -45,6 +46,7 @@ RUN dnf update -y && \
gtk3-devel \
hostname \
jemalloc-devel \
+ json-c-devel \
libaio-devel \
libasan \
libattr-devel \
diff --git a/tests/docker/dockerfiles/ubuntu2004.docker b/tests/docker/dockerfiles/ubuntu2004.docker
index 87513125b8..22468d01e7 100644
--- a/tests/docker/dockerfiles/ubuntu2004.docker
+++ b/tests/docker/dockerfiles/ubuntu2004.docker
@@ -18,6 +18,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
ca-certificates \
ccache \
clang \
+ cmake \
dbus \
debianutils \
diffutils \
@@ -58,6 +59,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
libiscsi-dev \
libjemalloc-dev \
libjpeg-turbo8-dev \
+ libjson-c-dev \
liblttng-ust-dev \
liblzo2-dev \
libncursesw5-dev \
--
2.20.1
next prev parent reply other threads:[~2022-02-17 8:19 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 7:48 [PATCH v6 00/19] vfio-user server in QEMU Jagannathan Raman
2022-02-17 7:48 ` [PATCH v6 01/19] configure, meson: override C compiler for cmake Jagannathan Raman
2022-02-17 12:09 ` Peter Maydell
2022-02-17 15:49 ` Jag Raman
2022-02-18 3:40 ` Jag Raman
2022-02-18 12:13 ` Paolo Bonzini
2022-02-18 14:49 ` Jag Raman
2022-02-18 15:16 ` Jag Raman
2022-02-20 8:27 ` Paolo Bonzini
2022-02-20 13:27 ` Paolo Bonzini
2022-02-22 19:05 ` Jag Raman
2022-02-24 17:52 ` Paolo Bonzini
2022-02-25 4:03 ` Jag Raman
2022-02-28 18:12 ` Paolo Bonzini
2022-02-28 19:55 ` Jag Raman
2022-02-17 7:48 ` [PATCH v6 02/19] tests/avocado: Specify target VM argument to helper routines Jagannathan Raman
2022-02-17 7:48 ` [PATCH v6 03/19] qdev: unplug blocker for devices Jagannathan Raman
2022-02-21 15:27 ` Stefan Hajnoczi
2022-02-28 16:23 ` Jag Raman
2022-02-21 15:30 ` Stefan Hajnoczi
2022-02-28 19:11 ` Jag Raman
2022-02-17 7:48 ` [PATCH v6 04/19] remote/machine: add HotplugHandler for remote machine Jagannathan Raman
2022-02-21 15:30 ` Stefan Hajnoczi
2022-02-17 7:48 ` [PATCH v6 05/19] remote/machine: add vfio-user property Jagannathan Raman
2022-02-21 15:32 ` Stefan Hajnoczi
2022-02-17 7:48 ` Jagannathan Raman [this message]
2022-02-17 7:48 ` [PATCH v6 07/19] vfio-user: define vfio-user-server object Jagannathan Raman
2022-02-21 15:37 ` Stefan Hajnoczi
2022-02-28 19:14 ` Jag Raman
2022-03-02 16:45 ` Stefan Hajnoczi
2022-02-25 15:42 ` Eric Blake
2022-02-17 7:48 ` [PATCH v6 08/19] vfio-user: instantiate vfio-user context Jagannathan Raman
2022-02-21 15:42 ` Stefan Hajnoczi
2022-02-28 19:16 ` Jag Raman
2022-02-17 7:48 ` [PATCH v6 09/19] vfio-user: find and init PCI device Jagannathan Raman
2022-02-21 15:57 ` Stefan Hajnoczi
2022-02-28 19:17 ` Jag Raman
2022-02-17 7:48 ` [PATCH v6 10/19] vfio-user: run vfio-user context Jagannathan Raman
2022-02-22 10:13 ` Stefan Hajnoczi
2022-02-25 16:06 ` Eric Blake
2022-02-28 19:22 ` Jag Raman
2022-02-17 7:48 ` [PATCH v6 11/19] vfio-user: handle PCI config space accesses Jagannathan Raman
2022-02-22 11:09 ` Stefan Hajnoczi
2022-02-28 19:23 ` Jag Raman
2022-02-17 7:48 ` [PATCH v6 12/19] vfio-user: IOMMU support for remote device Jagannathan Raman
2022-02-22 10:40 ` Stefan Hajnoczi
2022-02-28 19:54 ` Jag Raman
2022-03-02 16:49 ` Stefan Hajnoczi
2022-03-03 14:49 ` Jag Raman
2022-03-07 9:45 ` Stefan Hajnoczi
2022-03-07 14:42 ` Jag Raman
2022-03-08 10:04 ` Stefan Hajnoczi
2022-02-17 7:49 ` [PATCH v6 13/19] vfio-user: handle DMA mappings Jagannathan Raman
2022-02-17 7:49 ` [PATCH v6 14/19] vfio-user: handle PCI BAR accesses Jagannathan Raman
2022-02-22 11:04 ` Stefan Hajnoczi
2022-02-17 7:49 ` [PATCH v6 15/19] vfio-user: handle device interrupts Jagannathan Raman
2022-03-07 10:24 ` Stefan Hajnoczi
2022-03-07 15:10 ` Jag Raman
2022-03-08 10:15 ` Stefan Hajnoczi
2022-03-26 23:47 ` Jag Raman
2022-03-29 14:24 ` Stefan Hajnoczi
2022-03-29 19:06 ` Jag Raman
2022-03-30 9:40 ` Thanos Makatos
2022-04-04 9:44 ` Stefan Hajnoczi
2022-02-17 7:49 ` [PATCH v6 16/19] softmmu/vl: defer backend init Jagannathan Raman
2022-03-07 10:48 ` Stefan Hajnoczi
2022-03-07 15:31 ` Jag Raman
2022-02-17 7:49 ` [PATCH v6 17/19] vfio-user: register handlers to facilitate migration Jagannathan Raman
2022-02-18 12:20 ` Paolo Bonzini
2022-02-18 14:55 ` Jag Raman
2022-03-07 11:26 ` Stefan Hajnoczi
2022-02-17 7:49 ` [PATCH v6 18/19] vfio-user: handle reset of remote device Jagannathan Raman
2022-03-07 11:36 ` Stefan Hajnoczi
2022-03-07 15:37 ` Jag Raman
2022-03-08 10:21 ` Stefan Hajnoczi
2022-02-17 7:49 ` [PATCH v6 19/19] vfio-user: avocado tests for vfio-user Jagannathan Raman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a38e60c8d79b2d2aa90f34dd5af6bcffd63a5cfc.1645079934.git.jag.raman@oracle.com \
--to=jag.raman@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=bleal@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eduardo@habkost.net \
--cc=elena.ufimtseva@oracle.com \
--cc=f4bug@amsat.org \
--cc=john.g.johnson@oracle.com \
--cc=john.levon@nutanix.com \
--cc=kanth.ghatraju@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=thanos.makatos@nutanix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.