From 63a7f853063133fd1aa34ab0744b009fa3d7e183 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 8 Jul 2021 13:50:06 +0200 Subject: meson: fix missing preprocessor symbols While most libraries do not need a CONFIG_* symbol because the "when:" clauses are enough, some do. Add them back or stop using them if possible. In the case of libpmem, the statement to add the CONFIG_* symbol was still in configure, but could not be triggered because it checked for "no" instead of "disabled" (and it would be wrong anyway since the test for the library has not been done yet). Reported-by: Li Zhijian Fixes: 587d59d6cc ("configure, meson: convert virgl detection to meson", 2021-07-06) Fixes: 83ef16821a ("configure, meson: convert libdaxctl detection to meson", 2021-07-06) Fixes: e36e8c70f6 ("configure, meson: convert libpmem detection to meson", 2021-07-06) Fixes: 53c22b68e3 ("configure, meson: convert liburing detection to meson", 2021-07-06) Signed-off-by: Paolo Bonzini --- meson.build | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 7e12de0..9cd966a 100644 --- a/meson.build +++ b/meson.build @@ -1223,8 +1223,11 @@ config_host_data.set('CONFIG_VTE', vte.found()) config_host_data.set('CONFIG_LIBATTR', have_old_libattr) config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found()) config_host_data.set('CONFIG_EBPF', libbpf.found()) +config_host_data.set('CONFIG_LIBDAXCTL', libdaxctl.found()) config_host_data.set('CONFIG_LIBISCSI', libiscsi.found()) config_host_data.set('CONFIG_LIBNFS', libnfs.found()) +config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found()) +config_host_data.set('CONFIG_LIBPMEM', libpmem.found()) config_host_data.set('CONFIG_RBD', rbd.found()) config_host_data.set('CONFIG_SDL', sdl.found()) config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) @@ -1237,6 +1240,7 @@ config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) config_host_data.set('CONFIG_VNC_PNG', png.found()) config_host_data.set('CONFIG_VNC_SASL', sasl.found()) config_host_data.set('CONFIG_VIRTFS', have_virtfs) +config_host_data.set('CONFIG_VTE', vte.found()) config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found()) config_host_data.set('CONFIG_KEYUTILS', keyutils.found()) config_host_data.set('CONFIG_GETTID', has_gettid) -- cgit v1.1 From f5723ab66560a10f8461ac223e3d8369c10dc964 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 24 Jun 2021 12:38:04 +0200 Subject: modules: collect module meta-data Add script to collect the module meta-data from the source code, store the results in *.modinfo files. Signed-off-by: Gerd Hoffmann Reviewed-by: Jose R. Ziviani Message-Id: <20210624103836.2382472-3-kraxel@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 9cd966a..ff580f1 100644 --- a/meson.build +++ b/meson.build @@ -2241,6 +2241,9 @@ subdir('tests/qtest/fuzz') # Library dependencies # ######################## +modinfo_collect = find_program('scripts/modinfo-collect.py') +modinfo_files = [] + block_mods = [] softmmu_mods = [] foreach d, list : modules @@ -2254,6 +2257,19 @@ foreach d, list : modules else softmmu_mods += sl endif + if module_ss.sources() != [] + # FIXME: Should use sl.extract_all_objects(recursive: true) as + # input. Sources can be used multiple times but objects are + # unique when it comes to lookup in compile_commands.json. + # Depnds on a mesion version with + # https://github.com/mesonbuild/meson/pull/8900 + modinfo_files += custom_target(d + '-' + m + '.modinfo', + output: d + '-' + m + '.modinfo', + input: module_ss.sources(), + capture: true, + build_by_default: true, # to be removed when added to a target + command: [modinfo_collect, '@INPUT@']) + endif else if d == 'block' block_ss.add_all(module_ss) -- cgit v1.1 From 5ebbfecc3e6fa443a506ec5fe65f0ca98973d404 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 24 Jun 2021 12:38:05 +0200 Subject: modules: generate modinfo.c Add script to generate C source with a small database containing the module meta-data. Signed-off-by: Gerd Hoffmann Reviewed-by: Jose R. Ziviani Message-Id: <20210624103836.2382472-4-kraxel@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index ff580f1..7b827f7 100644 --- a/meson.build +++ b/meson.build @@ -2242,6 +2242,7 @@ subdir('tests/qtest/fuzz') ######################## modinfo_collect = find_program('scripts/modinfo-collect.py') +modinfo_generate = find_program('scripts/modinfo-generate.py') modinfo_files = [] block_mods = [] @@ -2267,7 +2268,6 @@ foreach d, list : modules output: d + '-' + m + '.modinfo', input: module_ss.sources(), capture: true, - build_by_default: true, # to be removed when added to a target command: [modinfo_collect, '@INPUT@']) endif else @@ -2280,6 +2280,17 @@ foreach d, list : modules endforeach endforeach +if enable_modules + modinfo_src = custom_target('modinfo.c', + output: 'modinfo.c', + input: modinfo_files, + command: [modinfo_generate, '@INPUT@'], + capture: true) + modinfo_lib = static_library('modinfo', modinfo_src) + modinfo_dep = declare_dependency(link_whole: modinfo_lib) + softmmu_ss.add(modinfo_dep) +endif + nm = find_program('nm') undefsym = find_program('scripts/undefsym.py') block_syms = custom_target('block.syms', output: 'block.syms', -- cgit v1.1 From db2e89df998abbcf11b68f29558c45c8379d8916 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 24 Jun 2021 12:38:22 +0200 Subject: modules: target-specific module build infrastructure Signed-off-by: Gerd Hoffmann Reviewed-by: Jose R. Ziviani Message-Id: <20210624103836.2382472-21-kraxel@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 7b827f7..7babef4 100644 --- a/meson.build +++ b/meson.build @@ -2001,6 +2001,7 @@ user_ss = ss.source_set() util_ss = ss.source_set() modules = {} +target_modules = {} hw_arch = {} target_arch = {} target_softmmu_arch = {} @@ -2280,6 +2281,42 @@ foreach d, list : modules endforeach endforeach +foreach d, list : target_modules + foreach m, module_ss : list + if enable_modules and targetos != 'windows' + foreach target : target_dirs + if target.endswith('-softmmu') + config_target = config_target_mak[target] + config_target += config_host + target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])] + c_args = ['-DNEED_CPU_H', + '-DCONFIG_TARGET="@0@-config-target.h"'.format(target), + '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)] + target_module_ss = module_ss.apply(config_target, strict: false) + if target_module_ss.sources() != [] + module_name = d + '-' + m + '-' + config_target['TARGET_NAME'] + sl = static_library(module_name, + [genh, target_module_ss.sources()], + dependencies: [modulecommon, target_module_ss.dependencies()], + include_directories: target_inc, + c_args: c_args, + pic: true) + softmmu_mods += sl + # FIXME: Should use sl.extract_all_objects(recursive: true) too. + modinfo_files += custom_target(module_name + '.modinfo', + output: module_name + '.modinfo', + input: target_module_ss.sources(), + capture: true, + command: [modinfo_collect, '--target', target, '@INPUT@']) + endif + endif + endforeach + else + specific_ss.add_all(module_ss) + endif + endforeach +endforeach + if enable_modules modinfo_src = custom_target('modinfo.c', output: 'modinfo.c', -- cgit v1.1 From c94a7b8892dbb6b688994e5b9a717bda23de4e9a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 24 Jun 2021 12:38:29 +0200 Subject: accel: build qtest modular Allow building accelerators as module. Start with qtest as first user. Signed-off-by: Gerd Hoffmann Reviewed-by: Jose R. Ziviani Message-Id: <20210624103836.2382472-28-kraxel@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 7babef4..c943e44 100644 --- a/meson.build +++ b/meson.build @@ -2000,6 +2000,9 @@ trace_ss = ss.source_set() user_ss = ss.source_set() util_ss = ss.source_set() +# accel modules +qtest_module_ss = ss.source_set() + modules = {} target_modules = {} hw_arch = {} @@ -2238,6 +2241,9 @@ specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) subdir('tests/qtest/libqos') subdir('tests/qtest/fuzz') +# accel modules +target_modules += { 'accel' : { 'qtest': qtest_module_ss }} + ######################## # Library dependencies # ######################## -- cgit v1.1 From dae0ec159f92050026961656e9b7ded1e72758a4 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 24 Jun 2021 12:38:31 +0200 Subject: accel: build tcg modular Build tcg accel ops as module. Which is only a small fraction of tcg. Also only x86 for now. Signed-off-by: Gerd Hoffmann Reviewed-by: Jose R. Ziviani Message-Id: <20210624103836.2382472-30-kraxel@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index c943e44..d9aa2d7 100644 --- a/meson.build +++ b/meson.build @@ -92,6 +92,8 @@ if cpu in ['x86', 'x86_64'] } endif +modular_tcg = ['i386-softmmu', 'x86_64-softmmu'] + edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ] install_edk2_blobs = false if get_option('install_blobs') @@ -1531,6 +1533,11 @@ foreach target : target_dirs elif sym == 'CONFIG_XEN' and have_xen_pci_passthrough config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } endif + if target in modular_tcg + config_target += { 'CONFIG_TCG_MODULAR': 'y' } + else + config_target += { 'CONFIG_TCG_BUILTIN': 'y' } + endif accel_kconfig += [ sym + '=y' ] endif endforeach @@ -2002,6 +2009,7 @@ util_ss = ss.source_set() # accel modules qtest_module_ss = ss.source_set() +tcg_module_ss = ss.source_set() modules = {} target_modules = {} @@ -2242,7 +2250,11 @@ subdir('tests/qtest/libqos') subdir('tests/qtest/fuzz') # accel modules -target_modules += { 'accel' : { 'qtest': qtest_module_ss }} +tcg_real_module_ss = ss.source_set() +tcg_real_module_ss.add_all(when: 'CONFIG_TCG_MODULAR', if_true: tcg_module_ss) +specific_ss.add_all(when: 'CONFIG_TCG_BUILTIN', if_true: tcg_module_ss) +target_modules += { 'accel' : { 'qtest': qtest_module_ss, + 'tcg': tcg_real_module_ss }} ######################## # Library dependencies # -- cgit v1.1 From 904ad5ec1583145ef411acb2dec63beeb12ea721 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 7 Jul 2021 16:35:26 +0200 Subject: meson: switch function tests from compilation to linking Some tests for glibc functions cause compilation to emit warnings but still succeed even if the function is not there. Therefore, change from cc.compiles to cc.links. Reported-by: Richard Zak Signed-off-by: Paolo Bonzini --- meson.build | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index d9aa2d7..5a56e3f 100644 --- a/meson.build +++ b/meson.build @@ -1340,10 +1340,10 @@ config_host_data.set('HAVE_STRUCT_STAT_ST_ATIM', cc.has_member('struct stat', 'st_atim', prefix: '#include ')) -config_host_data.set('CONFIG_EVENTFD', cc.compiles(''' +config_host_data.set('CONFIG_EVENTFD', cc.links(''' #include int main(void) { return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); }''')) -config_host_data.set('CONFIG_FDATASYNC', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_FDATASYNC', cc.links(gnu_source_prefix + ''' #include int main(void) { #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 @@ -1352,22 +1352,22 @@ config_host_data.set('CONFIG_FDATASYNC', cc.compiles(gnu_source_prefix + ''' #error Not supported #endif }''')) -config_host_data.set('CONFIG_MADVISE', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_MADVISE', cc.links(gnu_source_prefix + ''' #include #include #include int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }''')) -config_host_data.set('CONFIG_MEMFD', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_MEMFD', cc.links(gnu_source_prefix + ''' #include int main(void) { return memfd_create("foo", MFD_ALLOW_SEALING); }''')) -config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.links(gnu_source_prefix + ''' #include #if !defined(AT_EMPTY_PATH) # error missing definition #else int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } #endif''')) -config_host_data.set('CONFIG_PIPE2', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_PIPE2', cc.links(gnu_source_prefix + ''' #include #include @@ -1376,16 +1376,16 @@ config_host_data.set('CONFIG_PIPE2', cc.compiles(gnu_source_prefix + ''' int pipefd[2]; return pipe2(pipefd, O_CLOEXEC); }''')) -config_host_data.set('CONFIG_POSIX_MADVISE', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_POSIX_MADVISE', cc.links(gnu_source_prefix + ''' #include #include int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }''')) -config_host_data.set('CONFIG_SIGNALFD', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_SIGNALFD', cc.links(gnu_source_prefix + ''' #include #include #include int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }''')) -config_host_data.set('CONFIG_SPLICE', cc.compiles(gnu_source_prefix + ''' +config_host_data.set('CONFIG_SPLICE', cc.links(gnu_source_prefix + ''' #include #include #include -- cgit v1.1 From f4063f9c319e3924b0c6d09dfe43e94d01253ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Wed, 7 Jul 2021 14:17:40 +0100 Subject: meson: Introduce target-specific Kconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a target-specific Kconfig. We need the definitions in Kconfig so the minikconf tool can verify they exits. However CONFIG_FOO is only enabled for target foo via the meson.build rules. Two architecture have a particularity, ARM and MIPS. As their translators have been split you can potentially build a plain 32 bit build along with a 64-bit version including the 32-bit subset. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210131111316.232778-6-f4bug@amsat.org> Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20210707131744.26027-2-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 5a56e3f..d82f7a7 100644 --- a/meson.build +++ b/meson.build @@ -1604,7 +1604,8 @@ foreach target : target_dirs command: [minikconf, get_option('default_devices') ? '--defconfig' : '--allnoconfig', config_devices_mak, '@DEPFILE@', '@INPUT@', - host_kconfig, accel_kconfig]) + host_kconfig, accel_kconfig, + 'CONFIG_' + config_target['TARGET_ARCH'].to_upper() + '=y']) config_devices_data = configuration_data() config_devices = keyval.load(config_devices_mak) -- cgit v1.1 From 812b31d3f91507160c367440c17715b62d5e0869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 7 Jul 2021 14:17:43 +0100 Subject: configs: rename default-configs to configs and reorganise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for offering variation to our build configurations lets move everything and rename it to default. Common included base configs are also renamed. During the cleanup the stale usb.mak and pci.mak references were removed from MAINTAINERS. Signed-off-by: Alex Bennée Cc: Paolo Bonzini Reviewed-by: Richard Henderson Message-Id: <20210707131744.26027-5-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index d82f7a7..71c7462 100644 --- a/meson.build +++ b/meson.build @@ -1549,7 +1549,7 @@ foreach target : target_dirs endif actual_target_dirs += target - config_target += keyval.load('default-configs/targets' / target + '.mak') + config_target += keyval.load('configs/targets' / target + '.mak') config_target += { 'TARGET_' + config_target['TARGET_ARCH'].to_upper(): 'y' } if 'TARGET_NEED_FDT' in config_target @@ -1597,7 +1597,7 @@ foreach target : target_dirs if target.endswith('-softmmu') config_devices_mak = target + '-config-devices.mak' config_devices_mak = configure_file( - input: ['default-configs/devices' / target + '.mak', 'Kconfig'], + input: ['configs/devices' / target / 'default.mak', 'Kconfig'], output: config_devices_mak, depfile: config_devices_mak + '.d', capture: true, -- cgit v1.1 From d1d5e9eefd7f0165884998f3054836580a69e1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 7 Jul 2021 14:17:44 +0100 Subject: configure: allow the selection of alternate config in the build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While the default config works well enough it does end up enabling a lot of stuff. For more minimal builds we can select a different list of devices and let Kconfig work out what we want. For example: ../../configure --without-default-features \ --target-list=arm-softmmu,aarch64-softmmu \ --with-devices-aarch64=minimal will override the aarch64-softmmu default set of devices with a more minimal set of devices that just enables the virt and sbsa-ref models. Signed-off-by: Alex Bennée Cc: Philippe Mathieu-Daudé Cc: Paolo Bonzini Reviewed-by: Richard Henderson Message-Id: <20210707131744.26027-6-alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 71c7462..651c3b1 100644 --- a/meson.build +++ b/meson.build @@ -1595,9 +1595,10 @@ foreach target : target_dirs configuration: config_target_data)} if target.endswith('-softmmu') + config_input = meson.get_external_property(target, 'default') config_devices_mak = target + '-config-devices.mak' config_devices_mak = configure_file( - input: ['configs/devices' / target / 'default.mak', 'Kconfig'], + input: ['configs/devices' / target / config_input + '.mak', 'Kconfig'], output: config_devices_mak, depfile: config_devices_mak + '.d', capture: true, -- cgit v1.1 From 411ad8dd80077e98ed465775b044caf1a9482f6c Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Fri, 9 Jul 2021 10:25:33 +0900 Subject: meson: Use input/output for entitlements target input/output parameters respect dependencies. Signed-off-by: Akihiko Odaki Message-Id: <20210709012533.58262-1-akihiko.odaki@gmail.com> Signed-off-by: Paolo Bonzini --- meson.build | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 651c3b1..b2e8731 100644 --- a/meson.build +++ b/meson.build @@ -2609,28 +2609,32 @@ foreach target : target_dirs link_args: link_args, gui_app: exe['gui']) - if 'CONFIG_HVF' in config_target - entitlements = meson.current_source_dir() / 'accel/hvf/entitlements.plist' - else - entitlements = '/dev/null' - endif if targetos == 'darwin' - icon = meson.current_source_dir() / 'pc-bios/qemu.rsrc' + icon = 'pc-bios/qemu.rsrc' + build_input = [emulator, files(icon)] + install_input = [ + get_option('bindir') / exe_name, + meson.current_source_dir() / icon + ] + if 'CONFIG_HVF' in config_target + entitlements = 'accel/hvf/entitlements.plist' + build_input += files(entitlements) + install_input += meson.current_source_dir() / entitlements + endif + emulators += {exe['name'] : custom_target(exe['name'], - depends: emulator, + input: build_input, output: exe['name'], command: [ - meson.current_source_dir() / 'scripts/entitlement.sh', - meson.current_build_dir() / exe_name, - meson.current_build_dir() / exe['name'], - entitlements, icon + files('scripts/entitlement.sh'), + '@OUTPUT@', + '@INPUT@' ]) } meson.add_install_script('scripts/entitlement.sh', '--install', - get_option('bindir') / exe_name, get_option('bindir') / exe['name'], - entitlements, icon) + install_input) else emulators += {exe['name']: emulator} endif -- cgit v1.1