From nobody Wed Dec 17 05:38:24 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1655308711; cv=none; d=zohomail.com; s=zohoarc; b=FaqLVSvYQBWO6+D2SPB2h77Wqk1UlX4gmJWJNRUIv+lTk70AI1gAQzK+NCuOokrw3Y+A1lGPC2o/Af2LN1icH6YZdTy3tJYXGEvBn6HYda7o+7F0nJ+pV8efRezdp67ZkUILB6JtVnQiPL7L3uTC7+7afwgaQtuls1xNjXnbYDM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655308711; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MkRklNSy2yniK/CNmaX0qG2VchhSg1earBDHS0IXhOg=; b=JoCjNIOtGOII6rdp9qRnyxDpG8vGm7SVVKipy8ghDVNCQ7gMcU3dg/LOCGkl/sMMAUE+vyS+BD+rN9k7Ifpmll0tB4PZ6BA4Yj8FTt6ZfL0zWTfWuZJ4Fo4BTdCAoGgn0dfXsEPhshYYb76pjjKOOT65wwDspY5eRdezriJSF08= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1655308711278309.37388671118435; Wed, 15 Jun 2022 08:58:31 -0700 (PDT) Received: from localhost ([::1]:48444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1VPY-0002Tv-Va for importer@patchew.org; Wed, 15 Jun 2022 11:58:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1VLi-0003x0-W0 for qemu-devel@nongnu.org; Wed, 15 Jun 2022 11:54:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1VLf-0007J0-OL for qemu-devel@nongnu.org; Wed, 15 Jun 2022 11:54:30 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-257-bC2RbRQePk-jTlphPWz32A-1; Wed, 15 Jun 2022 11:54:23 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C0BA38005C8; Wed, 15 Jun 2022 15:54:22 +0000 (UTC) Received: from localhost (unknown [10.39.192.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AB97C2811A; Wed, 15 Jun 2022 15:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655308466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MkRklNSy2yniK/CNmaX0qG2VchhSg1earBDHS0IXhOg=; b=aTQzt/ljR7ibCx84+03OLHATw9sPxh5k6fXfAhMu04iL5ogx4YEz+Hq1d48LDVjjLCXZjn wbqiSQkE+ojbnayjHfs8Cja1uTYcHzBEoUYGPmsSPkN009+UgaTJiB+C9Q+YTMRiLJyHq4 loGAg3gnovPAA1wChE7iexi8CPHcQZw= X-MC-Unique: bC2RbRQePk-jTlphPWz32A-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Thomas Huth , Jagannathan Raman , Aarushi Mehta , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Elena Ufimtseva , Marcel Apfelbaum , Stefan Hajnoczi , Laurent Vivier , , "Dr. David Alan Gilbert" , Richard Henderson , virtio-fs@redhat.com, Hanna Reitz , David Hildenbrand , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Eric Blake , Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Beraldo Leal , Peter Xu , Eduardo Habkost , Qiuhao Li , Paolo Bonzini , Markus Armbruster , Bandan Das , "Michael S. Tsirkin" , Stefano Garzarella , Alexander Bulekov , Julia Suvorova , Darren Kenny , Wainer dos Santos Moschetta , John G Johnson Subject: [PULL 06/18] vfio-user: build library Date: Wed, 15 Jun 2022 16:51:17 +0100 Message-Id: <20220615155129.1025811-7-stefanha@redhat.com> In-Reply-To: <20220615155129.1025811-1-stefanha@redhat.com> References: <20220615155129.1025811-1-stefanha@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655308713421100001 Content-Type: text/plain; charset="utf-8" From: Jagannathan Raman 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 Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman Reviewed-by: Stefan Hajnoczi Message-id: c2adec87958b081d1dc8775d4aa05c897912f025.1655151679.git.jag.ram= an@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 Reviewed-by: Stefan Hajnoczi > --- MAINTAINERS | 1 + meson_options.txt | 2 ++ configure | 17 +++++++++++++++++ meson.build | 23 ++++++++++++++++++++++- .gitlab-ci.d/buildtest.yml | 1 + .gitmodules | 3 +++ Kconfig.host | 4 ++++ hw/remote/Kconfig | 4 ++++ hw/remote/meson.build | 2 ++ scripts/meson-buildoptions.sh | 4 ++++ subprojects/libvfio-user | 1 + tests/docker/dockerfiles/centos8.docker | 2 ++ 12 files changed, 63 insertions(+), 1 deletion(-) create mode 160000 subprojects/libvfio-user diff --git a/MAINTAINERS b/MAINTAINERS index 5ba93348aa..d0fcaf0edb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3642,6 +3642,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 =20 EBPF: M: Jason Wang diff --git a/meson_options.txt b/meson_options.txt index 0e8197386b..f3e2f22c1e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -88,6 +88,8 @@ option('cfi_debug', type: 'boolean', value: 'false', description: 'Verbose errors in case of CFI violation') option('multiprocess', type: 'feature', value: 'auto', description: 'Out of process device emulation support') +option('vfio_user_server', type: 'feature', value: 'disabled', + description: 'vfio-user server support') option('dbus_display', type: 'feature', value: 'auto', description: '-display dbus support') option('tpm', type : 'feature', value : 'auto', diff --git a/configure b/configure index 4b12a8094c..c14e7f590a 100755 --- a/configure +++ b/configure @@ -315,6 +315,7 @@ meson_args=3D"" ninja=3D"" bindir=3D"bin" skip_meson=3Dno +vfio_user_server=3D"disabled" =20 # The following Meson options are handled manually (still they # are included in the automatically generated help message) @@ -909,6 +910,10 @@ for opt do ;; --disable-blobs) meson_option_parse --disable-install-blobs "" ;; + --enable-vfio-user-server) vfio_user_server=3D"enabled" + ;; + --disable-vfio-user-server) vfio_user_server=3D"disabled" + ;; --enable-tcmalloc) meson_option_parse --enable-malloc=3Dtcmalloc tcmalloc ;; --enable-jemalloc) meson_option_parse --enable-malloc=3Djemalloc jemalloc @@ -2132,6 +2137,17 @@ write_container_target_makefile() { =20 =20 =20 +########################################## +# check for vfio_user_server + +case "$vfio_user_server" in + enabled ) + if test "$git_submodules_action" !=3D "ignore"; then + git_submodules=3D"${git_submodules} subprojects/libvfio-user" + fi + ;; +esac + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -2672,6 +2688,7 @@ if test "$skip_meson" =3D no; then test "$slirp" !=3D auto && meson_option_add "-Dslirp=3D$slirp" test "$smbd" !=3D '' && meson_option_add "-Dsmbd=3D$smbd" test "$tcg" !=3D enabled && meson_option_add "-Dtcg=3D$tcg" + test "$vfio_user_server" !=3D auto && meson_option_add "-Dvfio_user_serv= er=3D$vfio_user_server" run_meson() { NINJA=3D$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" = "$source_path" } diff --git a/meson.build b/meson.build index 9e65cc5367..ca19ddc30c 100644 --- a/meson.build +++ b/meson.build @@ -308,6 +308,10 @@ multiprocess_allowed =3D get_option('multiprocess') \ .require(targetos =3D=3D 'linux', error_message: 'Multiprocess QEMU is s= upported only on Linux') \ .allowed() =20 +vfio_user_server_allowed =3D get_option('vfio_user_server') \ + .require(targetos =3D=3D 'linux', error_message: 'vfio-user server is su= pported only on Linux') \ + .allowed() + have_tpm =3D get_option('tpm') \ .require(targetos !=3D 'windows', error_message: 'TPM emulation only ava= ilable on POSIX systems') \ .allowed() @@ -2380,7 +2384,8 @@ host_kconfig =3D \ (have_virtfs ? ['CONFIG_VIRTFS=3Dy'] : []) + \ ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=3Dy'] : []) + \ (have_pvrdma ? ['CONFIG_PVRDMA=3Dy'] : []) + \ - (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=3Dy'] : []) + (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=3Dy'] : []) + \ + (vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=3Dy'] : []) =20 ignored =3D [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] =20 @@ -2672,6 +2677,21 @@ if have_system endif endif =20 +libvfio_user_dep =3D not_found +if have_system and vfio_user_server_allowed + have_internal =3D fs.exists(meson.current_source_dir() / 'subprojects/li= bvfio-user/meson.build') + + if not have_internal + error('libvfio-user source not found - please pull git submodule') + endif + + libvfio_user_proj =3D subproject('libvfio-user') + + libvfio_user_lib =3D libvfio_user_proj.get_variable('libvfio_user_dep') + + libvfio_user_dep =3D declare_dependency(dependencies: [libvfio_user_lib]) +endif + fdt =3D not_found if have_system fdt_opt =3D get_option('fdt') @@ -3790,6 +3810,7 @@ summary_info +=3D {'target list': ' '.join(targ= et_dirs)} if have_system summary_info +=3D {'default devices': get_option('default_devices')} summary_info +=3D {'out of process emulation': multiprocess_allowed} + summary_info +=3D {'vfio-user server': vfio_user_server_allowed} endif summary(summary_info, bool_yn: true, section: 'Targets and accelerators') =20 diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index cb7cad44b5..8a4353ef93 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -168,6 +168,7 @@ build-system-centos: IMAGE: centos8 CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-fdt=3Dsystem --enable-modules --enable-trace-backends=3Ddtrace --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 b8bff47df8..aedd9a03d4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -64,3 +64,6 @@ [submodule "tests/lcitool/libvirt-ci"] path =3D tests/lcitool/libvirt-ci url =3D https://gitlab.com/libvirt/libvirt-ci.git +[submodule "subprojects/libvfio-user"] + path =3D subprojects/libvfio-user + url =3D https://gitlab.com/qemu-project/libvfio-user.git diff --git a/Kconfig.host b/Kconfig.host index 1165c4eacd..d763d89269 100644 --- a/Kconfig.host +++ b/Kconfig.host @@ -42,3 +42,7 @@ config MULTIPROCESS_ALLOWED config FUZZ bool select SPARSE_MEM + +config VFIO_USER_SERVER_ALLOWED + bool + imply VFIO_USER_SERVER 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..7da83350c8 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')) =20 +remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: libvfio_user_dep) + specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c')) specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-= listener.c')) =20 diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 1fc1d2e2c3..24eb5f35ea 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -153,6 +153,8 @@ meson_options_help() { printf "%s\n" ' usb-redir libusbredir support' printf "%s\n" ' vde vde network backend support' printf "%s\n" ' vdi vdi image format support' + printf "%s\n" ' vfio-user-server' + printf "%s\n" ' vfio-user server support' printf "%s\n" ' vhost-crypto vhost-user crypto backend support' printf "%s\n" ' vhost-kernel vhost kernel backend support' printf "%s\n" ' vhost-net vhost-net kernel acceleration support' @@ -415,6 +417,8 @@ _meson_option_parse() { --disable-vde) printf "%s" -Dvde=3Ddisabled ;; --enable-vdi) printf "%s" -Dvdi=3Denabled ;; --disable-vdi) printf "%s" -Dvdi=3Ddisabled ;; + --enable-vfio-user-server) printf "%s" -Dvfio_user_server=3Denabled ;; + --disable-vfio-user-server) printf "%s" -Dvfio_user_server=3Ddisabled = ;; --enable-vhost-crypto) printf "%s" -Dvhost_crypto=3Denabled ;; --disable-vhost-crypto) printf "%s" -Dvhost_crypto=3Ddisabled ;; --enable-vhost-kernel) printf "%s" -Dvhost_kernel=3Denabled ;; diff --git a/subprojects/libvfio-user b/subprojects/libvfio-user new file mode 160000 index 0000000000..0b28d20557 --- /dev/null +++ b/subprojects/libvfio-user @@ -0,0 +1 @@ +Subproject commit 0b28d205572c80b568a1003db2c8f37ca333e4d7 diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerf= iles/centos8.docker index 4b20925bbf..10618bfa83 100644 --- a/tests/docker/dockerfiles/centos8.docker +++ b/tests/docker/dockerfiles/centos8.docker @@ -51,6 +51,7 @@ RUN dnf update -y && \ libbpf-devel \ libcacard-devel \ libcap-ng-devel \ + libcmocka-devel \ libcurl-devel \ libdrm-devel \ libepoxy-devel \ @@ -59,6 +60,7 @@ RUN dnf update -y && \ libgcrypt-devel \ libiscsi-devel \ libjpeg-devel \ + json-c-devel \ libnfs-devel \ libpmem-devel \ libpng-devel \ --=20 2.36.1