aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-04-20 17:33:41 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2022-04-28 08:52:20 +0200
commit3730a7341f19cbadde4d12e214b7a82b9de01f75 (patch)
tree73a1c076bdbbb7efa8a3231d83a2312009996520 /meson.build
parent88b6e618fda51cd2cfe7931e480e86ff8005a7d7 (diff)
meson, configure: move RDMA options to meson
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build56
1 files changed, 50 insertions, 6 deletions
diff --git a/meson.build b/meson.build
index 83b7347c5f..9c03436756 100644
--- a/meson.build
+++ b/meson.build
@@ -1219,9 +1219,22 @@ if numa.found() and not cc.links('''
endif
rdma = not_found
-if 'CONFIG_RDMA' in config_host
- rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
+if not get_option('rdma').auto() or have_system
+ libumad = cc.find_library('ibumad', required: get_option('rdma'))
+ rdma_libs = [cc.find_library('rdmacm', has_headers: ['rdma/rdma_cma.h'],
+ required: get_option('rdma'),
+ kwargs: static_kwargs),
+ cc.find_library('ibverbs', required: get_option('rdma'),
+ kwargs: static_kwargs),
+ libumad]
+ rdma = declare_dependency(dependencies: rdma_libs)
+ foreach lib: rdma_libs
+ if not lib.found()
+ rdma = not_found
+ endif
+ endforeach
endif
+
xen = not_found
if 'CONFIG_XEN_BACKEND' in config_host
xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
@@ -1554,6 +1567,7 @@ config_host_data.set('CONFIG_NUMA', numa.found())
config_host_data.set('CONFIG_OPENGL', opengl.found())
config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
config_host_data.set('CONFIG_RBD', rbd.found())
+config_host_data.set('CONFIG_RDMA', rdma.found())
config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
config_host_data.set('CONFIG_SECCOMP', seccomp.found())
@@ -1652,7 +1666,7 @@ config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '
if rdma.found()
config_host_data.set('HAVE_IBV_ADVISE_MR',
cc.has_function('ibv_advise_mr',
- args: config_host['RDMA_LIBS'].split(),
+ dependencies: rdma,
prefix: '#include <infiniband/verbs.h>'))
endif
@@ -1972,6 +1986,36 @@ config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
int main(int argc, char *argv[]) { return bar(argv[0]); }
'''), error_message: 'AVX512F not available').allowed())
+have_pvrdma = get_option('pvrdma') \
+ .require(rdma.found(), error_message: 'PVRDMA requires OpenFabrics libraries') \
+ .require(cc.compiles('''
+ int main(void)
+ {
+ char buf = 0;
+ void *addr = &buf;
+ addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
+
+ return 0;
+ }'''), error_message: 'PVRDMA requires mremap').allowed()
+
+if have_pvrdma
+ config_host_data.set('LEGACY_RDMA_REG_MR', not cc.compiles('''
+ #include <infiniband/verbs.h>
+ int main(void)
+ {
+ struct ibv_mr *mr;
+ struct ibv_pd *pd = NULL;
+ size_t length = 10;
+ uint64_t iova = 0;
+ int access = 0;
+ void *addr = NULL;
+
+ mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
+ ibv_dereg_mr(mr);
+ return 0;
+ }'''))
+endif
+
if get_option('membarrier').disabled()
have_membarrier = false
elif targetos == 'windows'
@@ -2106,7 +2150,7 @@ host_kconfig = \
('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
(have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
- ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : []) + \
+ (have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
(multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : [])
ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
@@ -3700,8 +3744,8 @@ summary_info += {'l2tpv3 support': have_l2tpv3}
summary_info += {'Linux AIO support': libaio}
summary_info += {'Linux io_uring support': linux_io_uring}
summary_info += {'ATTR/XATTR support': libattr}
-summary_info += {'RDMA support': config_host.has_key('CONFIG_RDMA')}
-summary_info += {'PVRDMA support': config_host.has_key('CONFIG_PVRDMA')}
+summary_info += {'RDMA support': rdma}
+summary_info += {'PVRDMA support': have_pvrdma}
summary_info += {'fdt support': fdt_opt == 'disabled' ? false : fdt_opt}
summary_info += {'libcap-ng support': libcap_ng}
summary_info += {'bpf support': libbpf}