Skip to content

Commit 5511696

Browse files
jraman567stefanhaRH
authored andcommitted
vfio-user: build library
add the libvfio-user library as a submodule. build it as a meson subproject. libvfio-user is distributed with BSD 3-Clause license and json-c with MIT (Expat) license Signed-off-by: Elena Ufimtseva <[email protected]> Signed-off-by: John G Johnson <[email protected]> Signed-off-by: Jagannathan Raman <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Message-id: c2adec87958b081d1dc8775d4aa05c897912f025.1655151679.git.jag.raman@oracle.com [Changed submodule URL to QEMU's libvfio-user mirror on GitLab. The QEMU project mirrors its dependencies so that it can provide full source code even in the event that its dependencies become unavailable. Note that the mirror repo is manually updated, so please contact me to make newer libvfio-user commits available. If I become a bottleneck we can set up a cronjob. Updated scripts/meson-buildoptions.sh to match the meson_options.txt change. Failure to do so can result in scripts/meson-buildoptions.sh being modified by the build system later on and you end up with a dirty working tree. --Stefan] Signed-off-by: Stefan Hajnoczi <[email protected]>
1 parent 9b5b473 commit 5511696

File tree

12 files changed

+63
-1
lines changed

12 files changed

+63
-1
lines changed

.gitlab-ci.d/buildtest.yml

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ build-system-centos:
168168
IMAGE: centos8
169169
CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-fdt=system
170170
--enable-modules --enable-trace-backends=dtrace --enable-docs
171+
--enable-vfio-user-server
171172
TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
172173
x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
173174
MAKE_CHECK_ARGS: check-build

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@
6464
[submodule "tests/lcitool/libvirt-ci"]
6565
path = tests/lcitool/libvirt-ci
6666
url = https://gitlab.com/libvirt/libvirt-ci.git
67+
[submodule "subprojects/libvfio-user"]
68+
path = subprojects/libvfio-user
69+
url = https://gitlab.com/qemu-project/libvfio-user.git

Kconfig.host

+4
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ config MULTIPROCESS_ALLOWED
4242
config FUZZ
4343
bool
4444
select SPARSE_MEM
45+
46+
config VFIO_USER_SERVER_ALLOWED
47+
bool
48+
imply VFIO_USER_SERVER

MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -3642,6 +3642,7 @@ F: hw/remote/proxy-memory-listener.c
36423642
F: include/hw/remote/proxy-memory-listener.h
36433643
F: hw/remote/iohub.c
36443644
F: include/hw/remote/iohub.h
3645+
F: subprojects/libvfio-user
36453646

36463647
EBPF:
36473648
M: Jason Wang <[email protected]>

configure

+17
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ meson_args=""
315315
ninja=""
316316
bindir="bin"
317317
skip_meson=no
318+
vfio_user_server="disabled"
318319

319320
# The following Meson options are handled manually (still they
320321
# are included in the automatically generated help message)
@@ -909,6 +910,10 @@ for opt do
909910
;;
910911
--disable-blobs) meson_option_parse --disable-install-blobs ""
911912
;;
913+
--enable-vfio-user-server) vfio_user_server="enabled"
914+
;;
915+
--disable-vfio-user-server) vfio_user_server="disabled"
916+
;;
912917
--enable-tcmalloc) meson_option_parse --enable-malloc=tcmalloc tcmalloc
913918
;;
914919
--enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
@@ -2132,6 +2137,17 @@ write_container_target_makefile() {
21322137

21332138

21342139

2140+
##########################################
2141+
# check for vfio_user_server
2142+
2143+
case "$vfio_user_server" in
2144+
enabled )
2145+
if test "$git_submodules_action" != "ignore"; then
2146+
git_submodules="${git_submodules} subprojects/libvfio-user"
2147+
fi
2148+
;;
2149+
esac
2150+
21352151
##########################################
21362152
# End of CC checks
21372153
# After here, no more $cc or $ld runs
@@ -2672,6 +2688,7 @@ if test "$skip_meson" = no; then
26722688
test "$slirp" != auto && meson_option_add "-Dslirp=$slirp"
26732689
test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
26742690
test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
2691+
test "$vfio_user_server" != auto && meson_option_add "-Dvfio_user_server=$vfio_user_server"
26752692
run_meson() {
26762693
NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path"
26772694
}

hw/remote/Kconfig

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ config MULTIPROCESS
22
bool
33
depends on PCI && PCI_EXPRESS && KVM
44
select REMOTE_PCIHOST
5+
6+
config VFIO_USER_SERVER
7+
bool
8+
depends on MULTIPROCESS

hw/remote/meson.build

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('remote-obj.c'))
77
remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy.c'))
88
remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iohub.c'))
99

10+
remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: libvfio_user_dep)
11+
1012
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c'))
1113
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-listener.c'))
1214

meson.build

+22-1
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ multiprocess_allowed = get_option('multiprocess') \
308308
.require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \
309309
.allowed()
310310

311+
vfio_user_server_allowed = get_option('vfio_user_server') \
312+
.require(targetos == 'linux', error_message: 'vfio-user server is supported only on Linux') \
313+
.allowed()
314+
311315
have_tpm = get_option('tpm') \
312316
.require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
313317
.allowed()
@@ -2380,7 +2384,8 @@ host_kconfig = \
23802384
(have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
23812385
('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
23822386
(have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
2383-
(multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : [])
2387+
(multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) + \
2388+
(vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y'] : [])
23842389

23852390
ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
23862391

@@ -2672,6 +2677,21 @@ if have_system
26722677
endif
26732678
endif
26742679

2680+
libvfio_user_dep = not_found
2681+
if have_system and vfio_user_server_allowed
2682+
have_internal = fs.exists(meson.current_source_dir() / 'subprojects/libvfio-user/meson.build')
2683+
2684+
if not have_internal
2685+
error('libvfio-user source not found - please pull git submodule')
2686+
endif
2687+
2688+
libvfio_user_proj = subproject('libvfio-user')
2689+
2690+
libvfio_user_lib = libvfio_user_proj.get_variable('libvfio_user_dep')
2691+
2692+
libvfio_user_dep = declare_dependency(dependencies: [libvfio_user_lib])
2693+
endif
2694+
26752695
fdt = not_found
26762696
if have_system
26772697
fdt_opt = get_option('fdt')
@@ -3790,6 +3810,7 @@ summary_info += {'target list': ' '.join(target_dirs)}
37903810
if have_system
37913811
summary_info += {'default devices': get_option('default_devices')}
37923812
summary_info += {'out of process emulation': multiprocess_allowed}
3813+
summary_info += {'vfio-user server': vfio_user_server_allowed}
37933814
endif
37943815
summary(summary_info, bool_yn: true, section: 'Targets and accelerators')
37953816

meson_options.txt

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ option('cfi_debug', type: 'boolean', value: 'false',
8888
description: 'Verbose errors in case of CFI violation')
8989
option('multiprocess', type: 'feature', value: 'auto',
9090
description: 'Out of process device emulation support')
91+
option('vfio_user_server', type: 'feature', value: 'disabled',
92+
description: 'vfio-user server support')
9193
option('dbus_display', type: 'feature', value: 'auto',
9294
description: '-display dbus support')
9395
option('tpm', type : 'feature', value : 'auto',

scripts/meson-buildoptions.sh

+4
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ meson_options_help() {
153153
printf "%s\n" ' usb-redir libusbredir support'
154154
printf "%s\n" ' vde vde network backend support'
155155
printf "%s\n" ' vdi vdi image format support'
156+
printf "%s\n" ' vfio-user-server'
157+
printf "%s\n" ' vfio-user server support'
156158
printf "%s\n" ' vhost-crypto vhost-user crypto backend support'
157159
printf "%s\n" ' vhost-kernel vhost kernel backend support'
158160
printf "%s\n" ' vhost-net vhost-net kernel acceleration support'
@@ -415,6 +417,8 @@ _meson_option_parse() {
415417
--disable-vde) printf "%s" -Dvde=disabled ;;
416418
--enable-vdi) printf "%s" -Dvdi=enabled ;;
417419
--disable-vdi) printf "%s" -Dvdi=disabled ;;
420+
--enable-vfio-user-server) printf "%s" -Dvfio_user_server=enabled ;;
421+
--disable-vfio-user-server) printf "%s" -Dvfio_user_server=disabled ;;
418422
--enable-vhost-crypto) printf "%s" -Dvhost_crypto=enabled ;;
419423
--disable-vhost-crypto) printf "%s" -Dvhost_crypto=disabled ;;
420424
--enable-vhost-kernel) printf "%s" -Dvhost_kernel=enabled ;;

subprojects/libvfio-user

Submodule libvfio-user added at 0b28d20

tests/docker/dockerfiles/centos8.docker

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ RUN dnf update -y && \
5151
libbpf-devel \
5252
libcacard-devel \
5353
libcap-ng-devel \
54+
libcmocka-devel \
5455
libcurl-devel \
5556
libdrm-devel \
5657
libepoxy-devel \
@@ -59,6 +60,7 @@ RUN dnf update -y && \
5960
libgcrypt-devel \
6061
libiscsi-devel \
6162
libjpeg-devel \
63+
json-c-devel \
6264
libnfs-devel \
6365
libpmem-devel \
6466
libpng-devel \

0 commit comments

Comments
 (0)