From 637f1ee377eab718cb23808299ea2770e722da5c Mon Sep 17 00:00:00 2001 From: Gareth Webb Date: Sun, 6 Feb 2022 22:36:09 +0000 Subject: [PATCH 01/29] target/i386: add TCG support for UMIP Signed-off-by: Gareth Webb Message-Id: <164425598317.21902.4257759159329756142-1@git.sr.ht> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 2 +- target/i386/cpu.h | 4 +++- target/i386/helper.c | 8 +++++++- target/i386/tcg/translate.c | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index aa9e636800..20639c375a 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -645,7 +645,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1, CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2, CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM, CPUID_7_0_EBX_RDSEED */ -#define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_PKU | \ +#define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU | \ /* CPUID_7_0_ECX_OSPKE is dynamic */ \ CPUID_7_0_ECX_LA57 | CPUID_7_0_ECX_PKS) #define TCG_7_0_EDX_FEATURES 0 diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 9911d7c871..e69ab5dd78 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -167,6 +167,7 @@ typedef enum X86Seg { #define HF_IOBPT_SHIFT 24 /* an io breakpoint enabled */ #define HF_MPX_EN_SHIFT 25 /* MPX Enabled (CR4+XCR0+BNDCFGx) */ #define HF_MPX_IU_SHIFT 26 /* BND registers in-use */ +#define HF_UMIP_SHIFT 27 /* CR4.UMIP */ #define HF_CPL_MASK (3 << HF_CPL_SHIFT) #define HF_INHIBIT_IRQ_MASK (1 << HF_INHIBIT_IRQ_SHIFT) @@ -192,6 +193,7 @@ typedef enum X86Seg { #define HF_IOBPT_MASK (1 << HF_IOBPT_SHIFT) #define HF_MPX_EN_MASK (1 << HF_MPX_EN_SHIFT) #define HF_MPX_IU_MASK (1 << HF_MPX_IU_SHIFT) +#define HF_UMIP_MASK (1 << HF_UMIP_SHIFT) /* hflags2 */ @@ -258,7 +260,7 @@ typedef enum X86Seg { (~(target_ulong)(CR4_VME_MASK | CR4_PVI_MASK | CR4_TSD_MASK \ | CR4_DE_MASK | CR4_PSE_MASK | CR4_PAE_MASK \ | CR4_MCE_MASK | CR4_PGE_MASK | CR4_PCE_MASK \ - | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK |CR4_UMIP_MASK \ + | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK | CR4_UMIP_MASK \ | CR4_LA57_MASK \ | CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \ | CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK | CR4_PKS_MASK)) diff --git a/target/i386/helper.c b/target/i386/helper.c index 533b29cb91..a4315048c0 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -174,7 +174,7 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4) } /* Clear bits we're going to recompute. */ - hflags = env->hflags & ~(HF_OSFXSR_MASK | HF_SMAP_MASK); + hflags = env->hflags & ~(HF_OSFXSR_MASK | HF_SMAP_MASK | HF_UMIP_MASK); /* SSE handling */ if (!(env->features[FEAT_1_EDX] & CPUID_SSE)) { @@ -190,6 +190,12 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4) if (new_cr4 & CR4_SMAP_MASK) { hflags |= HF_SMAP_MASK; } + if (!(env->features[FEAT_7_0_ECX] & CPUID_7_0_ECX_UMIP)) { + new_cr4 &= ~CR4_UMIP_MASK; + } + if (new_cr4 & CR4_UMIP_MASK) { + hflags |= HF_UMIP_MASK; + } if (!(env->features[FEAT_7_0_ECX] & CPUID_7_0_ECX_PKU)) { new_cr4 &= ~CR4_PKE_MASK; diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c index 77878cd832..2a94d33742 100644 --- a/target/i386/tcg/translate.c +++ b/target/i386/tcg/translate.c @@ -7382,6 +7382,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) case 0: /* sldt */ if (!PE(s) || VM86(s)) goto illegal_op; + if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) { + break; + } gen_svm_check_intercept(s, SVM_EXIT_LDTR_READ); tcg_gen_ld32u_tl(s->T0, cpu_env, offsetof(CPUX86State, ldt.selector)); @@ -7401,6 +7404,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) case 1: /* str */ if (!PE(s) || VM86(s)) goto illegal_op; + if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) { + break; + } gen_svm_check_intercept(s, SVM_EXIT_TR_READ); tcg_gen_ld32u_tl(s->T0, cpu_env, offsetof(CPUX86State, tr.selector)); @@ -7439,6 +7445,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) modrm = x86_ldub_code(env, s); switch (modrm) { CASE_MODRM_MEM_OP(0): /* sgdt */ + if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) { + break; + } gen_svm_check_intercept(s, SVM_EXIT_GDTR_READ); gen_lea_modrm(env, s, modrm); tcg_gen_ld32u_tl(s->T0, @@ -7495,6 +7504,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) break; CASE_MODRM_MEM_OP(1): /* sidt */ + if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) { + break; + } gen_svm_check_intercept(s, SVM_EXIT_IDTR_READ); gen_lea_modrm(env, s, modrm); tcg_gen_ld32u_tl(s->T0, cpu_env, offsetof(CPUX86State, idt.limit)); @@ -7670,6 +7682,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) break; CASE_MODRM_OP(4): /* smsw */ + if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) { + break; + } gen_svm_check_intercept(s, SVM_EXIT_READ_CR0); tcg_gen_ld_tl(s->T0, cpu_env, offsetof(CPUX86State, cr[0])); /* From a5c90c61a118027b86155cffdf4fe4e2e9de1020 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Mon, 7 Feb 2022 20:30:19 +0800 Subject: [PATCH 02/29] memory: Fix qemu crash on starting dirty log twice with stopped VM QEMU can now easily crash with two continuous migration carried out: (qemu) migrate -d exec:cat>out (qemu) migrate_cancel (qemu) migrate -d exec:cat>out [crash] ../softmmu/memory.c:2782: memory_global_dirty_log_start: Assertion `!(global_dirty_tracking & flags)' failed. It's because memory API provides a way to postpone dirty log stop if the VM is stopped, and that'll be re-done until the next VM start. It was added in 2017 with commit 1931076077 ("migration: optimize the downtime", 2017-08-01). However the recent work on allowing dirty tracking to be bitmask broke it, which is commit 63b41db4bc ("memory: make global_dirty_tracking a bitmask", 2021-11-01). The fix proposed in this patch contains two things: (1) Instead of passing over the flags to postpone stop dirty track, we add a global variable (along with current vmstate_change variable) to record what flags to stop dirty tracking. (2) When start dirty tracking, instead if remove the vmstate hook directly, we also execute the postponed stop process so that we make sure all the starts and stops will be paired. This procedure is overlooked in the bitmask-ify work in 2021. Cc: Hyman Huang Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2044818 Fixes: 63b41db4bc ("memory: make global_dirty_tracking a bitmask") Signed-off-by: Peter Xu Message-Id: <20220207123019.27223-1-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- softmmu/memory.c | 65 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/softmmu/memory.c b/softmmu/memory.c index 678dc62f06..8060c6de78 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -2790,19 +2790,32 @@ void memory_global_after_dirty_log_sync(void) MEMORY_LISTENER_CALL_GLOBAL(log_global_after_sync, Forward); } +/* + * Dirty track stop flags that are postponed due to VM being stopped. Should + * only be used within vmstate_change hook. + */ +static unsigned int postponed_stop_flags; static VMChangeStateEntry *vmstate_change; +static void memory_global_dirty_log_stop_postponed_run(void); void memory_global_dirty_log_start(unsigned int flags) { - unsigned int old_flags = global_dirty_tracking; - - if (vmstate_change) { - qemu_del_vm_change_state_handler(vmstate_change); - vmstate_change = NULL; - } + unsigned int old_flags; assert(flags && !(flags & (~GLOBAL_DIRTY_MASK))); - assert(!(global_dirty_tracking & flags)); + + if (vmstate_change) { + /* If there is postponed stop(), operate on it first */ + postponed_stop_flags &= ~flags; + memory_global_dirty_log_stop_postponed_run(); + } + + flags &= ~global_dirty_tracking; + if (!flags) { + return; + } + + old_flags = global_dirty_tracking; global_dirty_tracking |= flags; trace_global_dirty_changed(global_dirty_tracking); @@ -2830,29 +2843,45 @@ static void memory_global_dirty_log_do_stop(unsigned int flags) } } +/* + * Execute the postponed dirty log stop operations if there is, then reset + * everything (including the flags and the vmstate change hook). + */ +static void memory_global_dirty_log_stop_postponed_run(void) +{ + /* This must be called with the vmstate handler registered */ + assert(vmstate_change); + + /* Note: postponed_stop_flags can be cleared in log start routine */ + if (postponed_stop_flags) { + memory_global_dirty_log_do_stop(postponed_stop_flags); + postponed_stop_flags = 0; + } + + qemu_del_vm_change_state_handler(vmstate_change); + vmstate_change = NULL; +} + static void memory_vm_change_state_handler(void *opaque, bool running, RunState state) { - unsigned int flags = (unsigned int)(uintptr_t)opaque; if (running) { - memory_global_dirty_log_do_stop(flags); - - if (vmstate_change) { - qemu_del_vm_change_state_handler(vmstate_change); - vmstate_change = NULL; - } + memory_global_dirty_log_stop_postponed_run(); } } void memory_global_dirty_log_stop(unsigned int flags) { if (!runstate_is_running()) { + /* Postpone the dirty log stop, e.g., to when VM starts again */ if (vmstate_change) { - return; + /* Batch with previous postponed flags */ + postponed_stop_flags |= flags; + } else { + postponed_stop_flags = flags; + vmstate_change = qemu_add_vm_change_state_handler( + memory_vm_change_state_handler, NULL); } - vmstate_change = qemu_add_vm_change_state_handler( - memory_vm_change_state_handler, - (void *)(uintptr_t)flags); return; } From 308c8475bc9d7e352125dea42950afbaf9daadfe Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 9 Feb 2022 11:15:29 +0100 Subject: [PATCH 03/29] tests/qemu-iotests/testrunner: Print diff to stderr in TAP mode When running in TAP mode, stdout is reserved for the TAP protocol. To see the "diff" of the failed test, we have to print it to stderr instead. Signed-off-by: Thomas Huth Message-Id: <20220209101530.3442837-8-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/qemu-iotests/testrunner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py index 0eace147b8..9a94273975 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -404,7 +404,10 @@ class TestRunner(ContextManager['TestRunner']): if res.status == 'fail': failed.append(name) if res.diff: - print('\n'.join(res.diff)) + if self.tap: + print('\n'.join(res.diff), file=sys.stderr) + else: + print('\n'.join(res.diff)) elif res.status == 'not run': notrun.append(name) elif res.status == 'pass': From 43a363ae35f4a04bfb86e0ad033d33ef83514597 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 18 Dec 2021 16:39:43 +0100 Subject: [PATCH 04/29] meson: use .allowed() method for features The method is now in 0.59, using it simplifies some boolean conditions. The other new methods .require() and .disable_auto_if() can be used too, but introducing them is not just a matter of search-and-replace. Signed-off-by: Paolo Bonzini --- meson.build | 42 +++++++++++++++++++++--------------------- tests/meson.build | 2 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/meson.build b/meson.build index ae5f7eec6e..af136b780d 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('qemu', ['c'], meson_version: '>=0.58.2', +project('qemu', ['c'], meson_version: '>=0.59.3', default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto', 'b_staticpic=false', 'stdsplit=false'], version: files('VERSION')) @@ -99,7 +99,7 @@ else endif kvm_targets_c = '""' -if not get_option('kvm').disabled() and targetos == 'linux' +if get_option('kvm').allowed() and targetos == 'linux' kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"' endif config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) @@ -276,7 +276,7 @@ endif if targetos != 'linux' and get_option('multiprocess').enabled() error('Multiprocess QEMU is supported only on Linux') endif -multiprocess_allowed = targetos == 'linux' and not get_option('multiprocess').disabled() +multiprocess_allowed = targetos == 'linux' and get_option('multiprocess').allowed() # Target-specific libraries and flags libm = cc.find_library('m', required: false) @@ -313,7 +313,7 @@ elif targetos == 'haiku' cc.find_library('network'), cc.find_library('bsd')] elif targetos == 'openbsd' - if not get_option('tcg').disabled() and target_dirs.length() > 0 + if get_option('tcg').allowed() and target_dirs.length() > 0 # Disable OpenBSD W^X if available emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded') endif @@ -321,16 +321,16 @@ endif # Target-specific configuration of accelerators accelerators = [] -if not get_option('kvm').disabled() and targetos == 'linux' +if get_option('kvm').allowed() and targetos == 'linux' accelerators += 'CONFIG_KVM' endif -if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host +if get_option('xen').allowed() and 'CONFIG_XEN_BACKEND' in config_host accelerators += 'CONFIG_XEN' - have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux' + have_xen_pci_passthrough = get_option('xen_pci_passthrough').allowed() and targetos == 'linux' else have_xen_pci_passthrough = false endif -if not get_option('whpx').disabled() and targetos == 'windows' +if get_option('whpx').allowed() and targetos == 'windows' if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64' error('WHPX requires 64-bit host') elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \ @@ -338,14 +338,14 @@ if not get_option('whpx').disabled() and targetos == 'windows' accelerators += 'CONFIG_WHPX' endif endif -if not get_option('hvf').disabled() +if get_option('hvf').allowed() hvf = dependency('appleframeworks', modules: 'Hypervisor', required: get_option('hvf')) if hvf.found() accelerators += 'CONFIG_HVF' endif endif -if not get_option('hax').disabled() +if get_option('hax').allowed() if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd'] accelerators += 'CONFIG_HAX' endif @@ -358,7 +358,7 @@ if targetos == 'netbsd' endif tcg_arch = host_arch -if not get_option('tcg').disabled() +if get_option('tcg').allowed() if host_arch == 'unknown' if get_option('tcg_interpreter') warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu)) @@ -472,7 +472,7 @@ libattr_test = ''' libattr = not_found have_old_libattr = false -if not get_option('attr').disabled() +if get_option('attr').allowed() if cc.links(libattr_test) libattr = declare_dependency() else @@ -628,7 +628,7 @@ endif mpathlibs = [libudev] mpathpersist = not_found mpathpersist_new_api = false -if targetos == 'linux' and have_tools and not get_option('mpath').disabled() +if targetos == 'linux' and have_tools and get_option('mpath').allowed() mpath_test_source_new = ''' #include #include @@ -697,7 +697,7 @@ endif iconv = not_found curses = not_found -if have_system and not get_option('curses').disabled() +if have_system and get_option('curses').allowed() curses_test = ''' #if defined(__APPLE__) || defined(__OpenBSD__) #define _XOPEN_SOURCE_EXTENDED 1 @@ -759,7 +759,7 @@ if have_system and not get_option('curses').disabled() endforeach endif endif - if not get_option('iconv').disabled() + if get_option('iconv').allowed() foreach link_args : [ ['-liconv'], [] ] # Programs will be linked with glib and this will bring in libiconv on FreeBSD. # We need to use libiconv if available because mixing libiconv's headers with @@ -938,7 +938,7 @@ if liblzfse.found() and not cc.links(''' endif oss = not_found -if have_system and not get_option('oss').disabled() +if get_option('oss').allowed() and have_system if not cc.has_header('sys/soundcard.h') # not found elif targetos == 'netbsd' @@ -1092,7 +1092,7 @@ vnc = not_found png = not_found jpeg = not_found sasl = not_found -if have_system and not get_option('vnc').disabled() +if get_option('vnc').allowed() and have_system vnc = declare_dependency() # dummy dependency png = dependency('libpng', required: get_option('vnc_png'), method: 'pkg-config', kwargs: static_kwargs) @@ -1236,7 +1236,7 @@ selinux = dependency('libselinux', malloc = [] if get_option('malloc') == 'system' has_malloc_trim = \ - not get_option('malloc_trim').disabled() and \ + get_option('malloc_trim').allowed() and \ cc.links('''#include int main(void) { malloc_trim(0); return 0; }''') else @@ -1291,7 +1291,7 @@ fuse = dependency('fuse3', required: get_option('fuse'), kwargs: static_kwargs) fuse_lseek = not_found -if not get_option('fuse_lseek').disabled() +if get_option('fuse_lseek').allowed() if fuse.version().version_compare('>=3.8') # Dummy dependency fuse_lseek = declare_dependency() @@ -1714,7 +1714,7 @@ config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + ''' }''')) have_l2tpv3 = false -if not get_option('l2tpv3').disabled() and have_system +if get_option('l2tpv3').allowed() and have_system have_l2tpv3 = cc.has_type('struct mmsghdr', prefix: gnu_source_prefix + ''' #include @@ -1723,7 +1723,7 @@ endif config_host_data.set('CONFIG_L2TPV3', have_l2tpv3) have_netmap = false -if not get_option('netmap').disabled() and have_system +if get_option('netmap').allowed() and have_system have_netmap = cc.compiles(''' #include #include diff --git a/tests/meson.build b/tests/meson.build index 079c8f3727..1d05109eb4 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -85,7 +85,7 @@ if 'CONFIG_TCG' in config_all subdir('fp') endif -if not get_option('tcg').disabled() +if get_option('tcg').allowed() if 'CONFIG_PLUGIN' in config_host subdir('plugin') endif From a436d6d4126d59e7373e6887c7bd02701ce1156c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Sat, 18 Dec 2021 16:39:43 +0100 Subject: [PATCH 05/29] meson: use .require() and .disable_auto_if() method for features The method is now in 0.59, using it simplifies some conditionals. There is a small change, which is to build virtfs-proxy-helper in a tools-only build. This is done for consistency with other tools, which are not culled by the absence of system emulator binaries. .disable_auto_if() would also be useful to check for packages, for example -linux_io_uring = not_found -if not get_option('linux_io_uring').auto() or have_block - linux_io_uring = dependency('liburing', required: get_option('linux_io_uring'), - method: 'pkg-config', kwargs: static_kwargs) -endif +linux_io_uring = dependency('liburing', + required: get_option('linux_io_uring').disable_auto_if(not have_block), + method: 'pkg-config', kwargs: static_kwargs) This change however is much larger and I am not sure about the improved readability, so I am not performing it right now. Signed-off-by: Paolo Bonzini --- meson.build | 74 ++++++++++++++++++----------------------------- tools/meson.build | 31 ++++++-------------- 2 files changed, 37 insertions(+), 68 deletions(-) diff --git a/meson.build b/meson.build index af136b780d..15dfd66a3e 100644 --- a/meson.build +++ b/meson.build @@ -269,14 +269,12 @@ if 'syslog' in get_option('trace_backends') and not cc.compiles(''' endif # Miscellaneous Linux-only features -if targetos != 'linux' and get_option('mpath').enabled() - error('Multipath is supported only on Linux') -endif +get_option('mpath') \ + .require(targetos == 'linux', error_message: 'Multipath is supported only on Linux') -if targetos != 'linux' and get_option('multiprocess').enabled() - error('Multiprocess QEMU is supported only on Linux') -endif -multiprocess_allowed = targetos == 'linux' and get_option('multiprocess').allowed() +multiprocess_allowed = get_option('multiprocess') \ + .require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \ + .allowed() # Target-specific libraries and flags libm = cc.find_library('m', required: false) @@ -1268,19 +1266,13 @@ statx_test = gnu_source_prefix + ''' has_statx = cc.links(statx_test) -have_vhost_user_blk_server = (targetos == 'linux' and - 'CONFIG_VHOST_USER' in config_host) - -if get_option('vhost_user_blk_server').enabled() - if targetos != 'linux' - error('vhost_user_blk_server requires linux') - elif 'CONFIG_VHOST_USER' not in config_host - error('vhost_user_blk_server requires vhost-user support') - endif -elif get_option('vhost_user_blk_server').disabled() or not have_system - have_vhost_user_blk_server = false -endif - +have_vhost_user_blk_server = get_option('vhost_user_blk_server') \ + .require(targetos == 'linux', + error_message: 'vhost_user_blk_server requires linux') \ + .require('CONFIG_VHOST_USER' in config_host, + error_message: 'vhost_user_blk_server requires vhost-user support') \ + .disable_auto_if(not have_system) \ + .allowed() if get_option('fuse').disabled() and get_option('fuse_lseek').enabled() error('Cannot enable fuse-lseek while fuse is disabled') @@ -1407,36 +1399,26 @@ endif have_host_block_device = (targetos != 'darwin' or cc.has_header('IOKit/storage/IOMedia.h')) -dbus_display = false -if not get_option('dbus_display').disabled() - # FIXME enable_modules shouldn't be necessary, but: https://github.com/mesonbuild/meson/issues/8333 - dbus_display = gio.version().version_compare('>=2.64') and config_host.has_key('GDBUS_CODEGEN') and enable_modules - if get_option('dbus_display').enabled() and not dbus_display - error('Requirements missing to enable -display dbus (glib>=2.64 && --enable-modules)') - endif -endif +# FIXME enable_modules shouldn't be necessary, but: https://github.com/mesonbuild/meson/issues/8333 +dbus_display = get_option('dbus_display') \ + .require(gio.version().version_compare('>=2.64'), + error_message: '-display dbus requires glib>=2.64') \ + .require(enable_modules, + error_message: '-display dbus requires --enable-modules') \ + .require(config_host.has_key('GDBUS_CODEGEN'), + error_message: '-display dbus requires gdbus-codegen') \ + .allowed() -have_virtfs = (targetos == 'linux' and - have_system and - libattr.found() and - libcap_ng.found()) +have_virtfs = get_option('virtfs') \ + .require(targetos == 'linux', + error_message: 'virtio-9p (virtfs) requires Linux') \ + .require(libattr.found() and libcap_ng.found(), + error_message: 'virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel') \ + .disable_auto_if(not have_tools and not have_system) \ + .allowed() have_virtfs_proxy_helper = have_virtfs and have_tools -if get_option('virtfs').enabled() - if not have_virtfs - if targetos != 'linux' - error('virtio-9p (virtfs) requires Linux') - elif not libcap_ng.found() or not libattr.found() - error('virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel') - elif not have_system - error('virtio-9p (virtfs) needs system emulation support') - endif - endif -elif get_option('virtfs').disabled() - have_virtfs = false -endif - foreach k : get_option('trace_backends') config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true) endforeach diff --git a/tools/meson.build b/tools/meson.build index 3e5a0abfa2..46977af84f 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -1,25 +1,12 @@ -have_virtiofsd = (targetos == 'linux' and - have_tools and - seccomp.found() and - libcap_ng.found() and - 'CONFIG_VHOST_USER' in config_host) - -if get_option('virtiofsd').enabled() - if not have_virtiofsd - if targetos != 'linux' - error('virtiofsd requires Linux') - elif not seccomp.found() or not libcap_ng.found() - error('virtiofsd requires libcap-ng-devel and seccomp-devel') - elif 'CONFIG_VHOST_USER' not in config_host - error('virtiofsd needs vhost-user support') - else - # Disabled all the tools but virtiofsd. - have_virtiofsd = true - endif - endif -elif get_option('virtiofsd').disabled() or not have_system - have_virtiofsd = false -endif +have_virtiofsd = get_option('virtiofsd') \ + .require(targetos == 'linux', + error_message: 'virtiofsd requires Linux') \ + .require(seccomp.found() and libcap_ng.found(), + error_message: 'virtiofsd requires libcap-ng-devel and seccomp-devel') \ + .require('CONFIG_VHOST_USER' in config_host, + error_message: 'virtiofsd needs vhost-user-support') \ + .disable_auto_if(not have_tools and not have_system) \ + .allowed() if have_virtiofsd subdir('virtiofsd') From 622753d2fb501509ab03c241d476815f378d4ba5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 8 Nov 2021 13:38:58 +0100 Subject: [PATCH 06/29] configure, meson: move AVX tests to meson For consistency with other tests, --enable-avx2 and --enable-avx512f fail to compile on x86 systems if cpuid.h is not available. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- configure | 103 ---------------------------------- meson.build | 50 ++++++++++++++++- meson_options.txt | 4 ++ scripts/meson-buildoptions.sh | 6 ++ 4 files changed, 58 insertions(+), 105 deletions(-) diff --git a/configure b/configure index 3a29eff5cc..a6a577277f 100755 --- a/configure +++ b/configure @@ -323,8 +323,6 @@ qom_cast_debug="yes" trace_backends="log" trace_file="trace" opengl="$default_feature" -cpuid_h="no" -avx2_opt="$default_feature" guest_agent="$default_feature" vss_win32_sdk="$default_feature" win_sdk="no" @@ -1033,14 +1031,6 @@ for opt do ;; --disable-tools) want_tools="no" ;; - --disable-avx2) avx2_opt="no" - ;; - --enable-avx2) avx2_opt="yes" - ;; - --disable-avx512f) avx512f_opt="no" - ;; - --enable-avx512f) avx512f_opt="yes" - ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 ;; @@ -1406,8 +1396,6 @@ cat << EOF coroutine-pool coroutine freelist (better performance) tpm TPM support numa libnuma support - avx2 AVX2 optimization support - avx512f AVX512F optimization support replication replication support opengl opengl support qom-cast-debug cast debugging support @@ -2740,85 +2728,6 @@ else # "$safe_stack" = "" fi fi -######################################## -# check if cpuid.h is usable. - -cat > $TMPC << EOF -#include -int main(void) { - unsigned a, b, c, d; - unsigned max = __get_cpuid_max(0, 0); - - if (max >= 1) { - __cpuid(1, a, b, c, d); - } - - if (max >= 7) { - __cpuid_count(7, 0, a, b, c, d); - } - - return 0; -} -EOF -if compile_prog "" "" ; then - cpuid_h=yes -fi - -########################################## -# avx2 optimization requirement check -# -# There is no point enabling this if cpuid.h is not usable, -# since we won't be able to select the new routines. - -if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then - cat > $TMPC << EOF -#pragma GCC push_options -#pragma GCC target("avx2") -#include -#include -static int bar(void *a) { - __m256i x = *(__m256i *)a; - return _mm256_testz_si256(x, x); -} -int main(int argc, char *argv[]) { return bar(argv[0]); } -EOF - if compile_object "-Werror" ; then - avx2_opt="yes" - else - avx2_opt="no" - fi -fi - -########################################## -# avx512f optimization requirement check -# -# There is no point enabling this if cpuid.h is not usable, -# since we won't be able to select the new routines. -# by default, it is turned off. -# if user explicitly want to enable it, check environment - -if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then - cat > $TMPC << EOF -#pragma GCC push_options -#pragma GCC target("avx512f") -#include -#include -static int bar(void *a) { - __m512i x = *(__m512i *)a; - return _mm512_test_epi64_mask(x, x); -} -int main(int argc, char *argv[]) -{ - return bar(argv[0]); -} -EOF - if ! compile_object "-Werror" ; then - avx512f_opt="no" - fi -else - avx512f_opt="no" -fi - ######################################## # check if __[u]int128_t is usable. @@ -3419,14 +3328,6 @@ if test "$opengl" = "yes" ; then echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak fi -if test "$avx2_opt" = "yes" ; then - echo "CONFIG_AVX2_OPT=y" >> $config_host_mak -fi - -if test "$avx512f_opt" = "yes" ; then - echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak -fi - # XXX: suppress that if [ "$bsd" = "yes" ] ; then echo "CONFIG_BSD=y" >> $config_host_mak @@ -3459,10 +3360,6 @@ if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then echo "CONFIG_TSAN=y" >> $config_host_mak fi -if test "$cpuid_h" = "yes" ; then - echo "CONFIG_CPUID_H=y" >> $config_host_mak -fi - if test "$int128" = "yes" ; then echo "CONFIG_INT128=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 15dfd66a3e..7a262051b7 100644 --- a/meson.build +++ b/meson.build @@ -1762,6 +1762,52 @@ config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + ''' return getauxval(AT_HWCAP) == 0; }''')) +have_cpuid_h = cc.links(''' + #include + int main(void) { + unsigned a, b, c, d; + unsigned max = __get_cpuid_max(0, 0); + + if (max >= 1) { + __cpuid(1, a, b, c, d); + } + + if (max >= 7) { + __cpuid_count(7, 0, a, b, c, d); + } + + return 0; + }''') +config_host_data.set('CONFIG_CPUID_H', have_cpuid_h) + +config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \ + .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX2') \ + .require(cc.links(''' + #pragma GCC push_options + #pragma GCC target("avx2") + #include + #include + static int bar(void *a) { + __m256i x = *(__m256i *)a; + return _mm256_testz_si256(x, x); + } + int main(int argc, char *argv[]) { return bar(argv[0]); } + '''), error_message: 'AVX2 not available').allowed()) + +config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \ + .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512F') \ + .require(cc.links(''' + #pragma GCC push_options + #pragma GCC target("avx512f") + #include + #include + static int bar(void *a) { + __m512i x = *(__m512i *)a; + return _mm512_test_epi64_mask(x, x); + } + int main(int argc, char *argv[]) { return bar(argv[0]); } + '''), error_message: 'AVX512F not available').allowed()) + config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + ''' #include #include @@ -3289,8 +3335,8 @@ summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')} summary_info += {'memory allocator': get_option('malloc')} -summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')} -summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')} +summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')} +summary_info += {'avx512f optimization': config_host_data.get('CONFIG_AVX512F_OPT')} summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')} summary_info += {'gcov': get_option('b_coverage')} summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')} diff --git a/meson_options.txt b/meson_options.txt index 95d527f773..6ff349023c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -68,6 +68,10 @@ 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('avx2', type: 'feature', value: 'auto', + description: 'AVX2 optimizations') +option('avx512f', type: 'feature', value: 'disabled', + description: 'AVX512F optimizations') option('attr', type : 'feature', value : 'auto', description: 'attr/xattr support') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 48a454cece..dcfc39ec6b 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -26,6 +26,8 @@ meson_options_help() { printf "%s\n" ' alsa ALSA sound support' printf "%s\n" ' attr attr/xattr support' printf "%s\n" ' auth-pam PAM access control' + printf "%s\n" ' avx2 AVX2 optimizations' + printf "%s\n" ' avx512f AVX512F optimizations' printf "%s\n" ' bpf eBPF support' printf "%s\n" ' brlapi brlapi character device driver' printf "%s\n" ' bzip2 bzip2 support for DMG images' @@ -109,6 +111,10 @@ _meson_option_parse() { --disable-attr) printf "%s" -Dattr=disabled ;; --enable-auth-pam) printf "%s" -Dauth_pam=enabled ;; --disable-auth-pam) printf "%s" -Dauth_pam=disabled ;; + --enable-avx2) printf "%s" -Davx2=enabled ;; + --disable-avx2) printf "%s" -Davx2=disabled ;; + --enable-avx512f) printf "%s" -Davx512f=enabled ;; + --disable-avx512f) printf "%s" -Davx512f=disabled ;; --enable-bpf) printf "%s" -Dbpf=enabled ;; --disable-bpf) printf "%s" -Dbpf=disabled ;; --enable-brlapi) printf "%s" -Dbrlapi=enabled ;; From b87df9043ce44dd2de36a09846be2e398a827aad Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 8 Nov 2021 13:52:11 +0100 Subject: [PATCH 07/29] configure, meson: move membarrier test to meson The test is a bit different from the others, in that it does not run if $membarrier is empty. For meson, the default can simply be disabled; if one day we will toggle the default, no change is needed in meson.build. Signed-off-by: Paolo Bonzini --- configure | 40 ----------------------------------- meson.build | 22 ++++++++++++++++++- meson_options.txt | 6 ++++++ scripts/meson-buildoptions.sh | 3 +++ util/meson.build | 4 +++- 5 files changed, 33 insertions(+), 42 deletions(-) diff --git a/configure b/configure index a6a577277f..c49797012d 100755 --- a/configure +++ b/configure @@ -290,7 +290,6 @@ EXTRA_CXXFLAGS="" EXTRA_LDFLAGS="" xen_ctrl_version="$default_feature" -membarrier="$default_feature" vhost_kernel="$default_feature" vhost_net="$default_feature" vhost_crypto="$default_feature" @@ -967,10 +966,6 @@ for opt do ;; --enable-fdt=*) fdt="$optarg" ;; - --disable-membarrier) membarrier="no" - ;; - --enable-membarrier) membarrier="yes" - ;; --with-pkgversion=*) pkgversion="$optarg" ;; --with-coroutine=*) coroutine="$optarg" @@ -1382,7 +1377,6 @@ cat << EOF lto Enable Link-Time Optimization. safe-stack SafeStack Stack Smash Protection. Depends on clang/llvm >= 3.7 and requires coroutine backend ucontext. - membarrier membarrier system call (for Linux 4.14+ or Windows) rdma Enable RDMA-based migration pvrdma Enable PVRDMA support vhost-net vhost-net kernel acceleration support @@ -2823,37 +2817,6 @@ if test "$fortify_source" != "no"; then fi fi -########################################## -# check for usable membarrier system call -if test "$membarrier" = "yes"; then - have_membarrier=no - if test "$mingw32" = "yes" ; then - have_membarrier=yes - elif test "$linux" = "yes" ; then - cat > $TMPC << EOF - #include - #include - #include - #include - int main(void) { - syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); - syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); - exit(0); - } -EOF - if compile_prog "" "" ; then - have_membarrier=yes - fi - fi - if test "$have_membarrier" = "no"; then - feature_not_found "membarrier" "membarrier system call not available" - fi -else - # Do not enable it by default even for Mingw32, because it doesn't - # work on Wine. - membarrier=no -fi - ########################################## # check for usable AF_ALG environment have_afalg=no @@ -3315,9 +3278,6 @@ fi if test "$vhost_user_fs" = "yes" ; then echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak fi -if test "$membarrier" = "yes" ; then - echo "CONFIG_MEMBARRIER=y" >> $config_host_mak -fi if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 7a262051b7..6dc38a7916 100644 --- a/meson.build +++ b/meson.build @@ -1808,6 +1808,26 @@ 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()) +if get_option('membarrier').disabled() + have_membarrier = false +elif targetos == 'windows' + have_membarrier = true +elif targetos == 'linux' + have_membarrier = cc.compiles(''' + #include + #include + #include + #include + int main(void) { + syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); + syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); + exit(0); + }''') +endif +config_host_data.set('CONFIG_MEMBARRIER', get_option('membarrier') \ + .require(have_membarrier, error_message: 'membarrier system call not available') \ + .allowed()) + config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + ''' #include #include @@ -3331,7 +3351,7 @@ summary_info += {'link-time optimization (LTO)': get_option('b_lto')} summary_info += {'PIE': get_option('b_pie')} summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} summary_info += {'malloc trim support': has_malloc_trim} -summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')} +summary_info += {'membarrier': have_membarrier} summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')} summary_info += {'memory allocator': get_option('malloc')} diff --git a/meson_options.txt b/meson_options.txt index 6ff349023c..49f14f960e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -68,6 +68,12 @@ option('multiprocess', type: 'feature', value: 'auto', description: 'Out of process device emulation support') option('dbus_display', type: 'feature', value: 'auto', description: '-display dbus support') + +# Do not enable it by default even for Mingw32, because it doesn't +# work on Wine. +option('membarrier', type: 'feature', value: 'disabled', + description: 'membarrier system call (for Linux 4.14+ or Windows') + option('avx2', type: 'feature', value: 'auto', description: 'AVX2 optimizations') option('avx512f', type: 'feature', value: 'disabled', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index dcfc39ec6b..c204ede02b 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -65,6 +65,7 @@ meson_options_help() { printf "%s\n" ' lzfse lzfse support for DMG images' printf "%s\n" ' lzo lzo compression support' printf "%s\n" ' malloc-trim enable libc malloc_trim() for memory optimization' + printf "%s\n" ' membarrier membarrier system call (for Linux 4.14+ or Windows' printf "%s\n" ' mpath Multipath persistent reservation passthrough' printf "%s\n" ' multiprocess Out of process device emulation support' printf "%s\n" ' netmap netmap network backend support' @@ -204,6 +205,8 @@ _meson_option_parse() { --enable-malloc=*) quote_sh "-Dmalloc=$2" ;; --enable-malloc-trim) printf "%s" -Dmalloc_trim=enabled ;; --disable-malloc-trim) printf "%s" -Dmalloc_trim=disabled ;; + --enable-membarrier) printf "%s" -Dmembarrier=enabled ;; + --disable-membarrier) printf "%s" -Dmembarrier=disabled ;; --enable-mpath) printf "%s" -Dmpath=enabled ;; --disable-mpath) printf "%s" -Dmpath=disabled ;; --enable-multiprocess) printf "%s" -Dmultiprocess=enabled ;; diff --git a/util/meson.build b/util/meson.build index c9a9cc1cf5..3736988b9f 100644 --- a/util/meson.build +++ b/util/meson.build @@ -35,7 +35,9 @@ util_ss.add(files('crc32c.c')) util_ss.add(files('uuid.c')) util_ss.add(files('getauxval.c')) util_ss.add(files('rcu.c')) -util_ss.add(when: 'CONFIG_MEMBARRIER', if_true: files('sys_membarrier.c')) +if have_membarrier + util_ss.add(files('sys_membarrier.c')) +endif util_ss.add(files('log.c')) util_ss.add(files('pagesize.c')) util_ss.add(files('qdist.c')) From 34b52615a09a061bc03bbc5aa35a998ba79d9f22 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 8 Nov 2021 14:02:42 +0100 Subject: [PATCH 08/29] configure, meson: move AF_ALG test to meson Signed-off-by: Paolo Bonzini --- configure | 36 ----------------------------------- crypto/meson.build | 4 +++- meson.build | 16 +++++++++++++++- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 5 files changed, 23 insertions(+), 38 deletions(-) diff --git a/configure b/configure index c49797012d..07ea08cd08 100755 --- a/configure +++ b/configure @@ -329,7 +329,6 @@ want_tools="$default_feature" coroutine="" coroutine_pool="$default_feature" debug_stack_usage="no" -crypto_afalg="no" tls_priority="NORMAL" tpm="$default_feature" live_block_migration=${default_feature:-yes} @@ -976,10 +975,6 @@ for opt do ;; --enable-debug-stack-usage) debug_stack_usage="yes" ;; - --enable-crypto-afalg) crypto_afalg="yes" - ;; - --disable-crypto-afalg) crypto_afalg="no" - ;; --disable-vhost-net) vhost_net="no" ;; --enable-vhost-net) vhost_net="yes" @@ -1402,7 +1397,6 @@ cat << EOF vvfat vvfat image format support qed qed image format support parallels parallels image format support - crypto-afalg Linux AF_ALG crypto backend driver debug-mutex mutex debugging support rng-none dummy RNG, avoid using /dev/(u)random and getrandom() gio libgio support @@ -2817,32 +2811,6 @@ if test "$fortify_source" != "no"; then fi fi -########################################## -# check for usable AF_ALG environment -have_afalg=no -cat > $TMPC << EOF -#include -#include -#include -#include -int main(void) { - int sock; - sock = socket(AF_ALG, SOCK_SEQPACKET, 0); - return sock; -} -EOF -if compile_prog "" "" ; then - have_afalg=yes -fi -if test "$crypto_afalg" = "yes" -then - if test "$have_afalg" != "yes" - then - error_exit "AF_ALG requested but could not be detected" - fi -fi - - ########################################## # checks for sanitizers @@ -3308,10 +3276,6 @@ if test "$debug_stack_usage" = "yes" ; then echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak fi -if test "$crypto_afalg" = "yes" ; then - echo "CONFIG_AF_ALG=y" >> $config_host_mak -fi - if test "$have_asan_iface_fiber" = "yes" ; then echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak fi diff --git a/crypto/meson.build b/crypto/meson.build index 95a6a83504..9bf3a431fe 100644 --- a/crypto/meson.build +++ b/crypto/meson.build @@ -35,7 +35,9 @@ else endif crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c')) -crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c')) +if have_afalg + crypto_ss.add(if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c')) +endif crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c')) util_ss.add(files('aes.c')) diff --git a/meson.build b/meson.build index 6dc38a7916..9e1acb98aa 100644 --- a/meson.build +++ b/meson.build @@ -1828,6 +1828,20 @@ config_host_data.set('CONFIG_MEMBARRIER', get_option('membarrier') \ .require(have_membarrier, error_message: 'membarrier system call not available') \ .allowed()) +have_afalg = get_option('crypto_afalg') \ + .require(cc.compiles(gnu_source_prefix + ''' + #include + #include + #include + #include + int main(void) { + int sock; + sock = socket(AF_ALG, SOCK_SEQPACKET, 0); + return sock; + } + '''), error_message: 'AF_ALG requested but could not be detected').allowed() +config_host_data.set('CONFIG_AF_ALG', have_afalg) + config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + ''' #include #include @@ -3453,7 +3467,7 @@ summary_info += {'nettle': nettle} if nettle.found() summary_info += {' XTS': xts != 'private'} endif -summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')} +summary_info += {'AF_ALG support': have_afalg} summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')} summary(summary_info, bool_yn: true, section: 'Crypto') diff --git a/meson_options.txt b/meson_options.txt index 49f14f960e..67592d47b3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -113,6 +113,8 @@ option('nettle', type : 'feature', value : 'auto', description: 'nettle cryptography support') option('gcrypt', type : 'feature', value : 'auto', description: 'libgcrypt cryptography support') +option('crypto_afalg', type : 'feature', value : 'disabled', + description: 'Linux AF_ALG crypto backend driver') option('libdaxctl', type : 'feature', value : 'auto', description: 'libdaxctl support') option('libpmem', type : 'feature', value : 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index c204ede02b..a20d40e685 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -34,6 +34,7 @@ meson_options_help() { printf "%s\n" ' cap-ng cap_ng support' printf "%s\n" ' cocoa Cocoa user interface (macOS only)' printf "%s\n" ' coreaudio CoreAudio sound support' + printf "%s\n" ' crypto-afalg Linux AF_ALG crypto backend driver' printf "%s\n" ' curl CURL block device driver' printf "%s\n" ' curses curses UI' printf "%s\n" ' dbus-display -display dbus support' @@ -135,6 +136,8 @@ _meson_option_parse() { --disable-cocoa) printf "%s" -Dcocoa=disabled ;; --enable-coreaudio) printf "%s" -Dcoreaudio=enabled ;; --disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;; + --enable-crypto-afalg) printf "%s" -Dcrypto_afalg=enabled ;; + --disable-crypto-afalg) printf "%s" -Dcrypto_afalg=disabled ;; --enable-curl) printf "%s" -Dcurl=enabled ;; --disable-curl) printf "%s" -Dcurl=disabled ;; --enable-curses) printf "%s" -Dcurses=enabled ;; From 488a8c73fbd72cbf4387ff3150271fe414b0dd4a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 21 Dec 2021 12:38:27 +0100 Subject: [PATCH 09/29] configure, meson: move libnuma detection to meson Signed-off-by: Paolo Bonzini --- configure | 31 ------------------------------- meson.build | 25 ++++++++++++++++++++----- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 4 files changed, 25 insertions(+), 36 deletions(-) diff --git a/configure b/configure index 07ea08cd08..f536f53106 100755 --- a/configure +++ b/configure @@ -332,7 +332,6 @@ debug_stack_usage="no" tls_priority="NORMAL" tpm="$default_feature" live_block_migration=${default_feature:-yes} -numa="$default_feature" replication=${default_feature:-yes} bochs=${default_feature:-yes} cloop=${default_feature:-yes} @@ -1048,10 +1047,6 @@ for opt do ;; --enable-live-block-migration) live_block_migration="yes" ;; - --disable-numa) numa="no" - ;; - --enable-numa) numa="yes" - ;; --disable-replication) replication="no" ;; --enable-replication) replication="yes" @@ -1384,7 +1379,6 @@ cat << EOF live-block-migration Block migration in the main migration stream coroutine-pool coroutine freelist (better performance) tpm TPM support - numa libnuma support replication replication support opengl opengl support qom-cast-debug cast debugging support @@ -2455,26 +2449,6 @@ EOF fi fi -########################################## -# libnuma probe - -if test "$numa" != "no" ; then - cat > $TMPC << EOF -#include -int main(void) { return numa_available(); } -EOF - - if compile_prog "" "-lnuma" ; then - numa=yes - numa_libs="-lnuma" - else - if test "$numa" = "yes" ; then - feature_not_found "numa" "install numactl devel" - fi - numa=no - fi -fi - # check for usbfs have_usbfs=no if test "$linux_user" = "yes"; then @@ -3442,11 +3416,6 @@ if test "$default_targets" = "yes"; then echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak fi -if test "$numa" = "yes"; then - echo "CONFIG_NUMA=y" >> $config_host_mak - echo "NUMA_LIBS=$numa_libs" >> $config_host_mak -fi - if test "$ccache_cpp2" = "yes"; then echo "export CCACHE_CPP2=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 9e1acb98aa..f8b83f64db 100644 --- a/meson.build +++ b/meson.build @@ -1164,14 +1164,28 @@ if lzo.found() and not cc.links(''' endif endif +numa = not_found +if not get_option('numa').auto() or have_system or have_tools + numa = cc.find_library('numa', has_headers: ['numa.h'], + required: get_option('numa'), + kwargs: static_kwargs) +endif +if numa.found() and not cc.links(''' + #include + int main(void) { return numa_available(); } + ''', dependencies: numa) + numa = not_found + if get_option('numa').enabled() + error('could not link numa') + else + warning('could not link numa, disabling') + endif +endif + rdma = not_found if 'CONFIG_RDMA' in config_host rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split()) endif -numa = not_found -if 'CONFIG_NUMA' in config_host - numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split()) -endif xen = not_found if 'CONFIG_XEN_BACKEND' in config_host xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(), @@ -1472,6 +1486,7 @@ config_host_data.set('CONFIG_LIBSSH', libssh.found()) config_host_data.set('CONFIG_LINUX_AIO', libaio.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_NUMA', numa.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()) @@ -3548,7 +3563,7 @@ summary_info += {'snappy support': snappy} summary_info += {'bzip2 support': libbzip2} summary_info += {'lzfse support': liblzfse} summary_info += {'zstd support': zstd} -summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')} +summary_info += {'NUMA host support': numa} summary_info += {'capstone': capstone_opt == 'internal' ? capstone_opt : capstone} summary_info += {'libpmem support': libpmem} summary_info += {'libdaxctl support': libdaxctl} diff --git a/meson_options.txt b/meson_options.txt index 67592d47b3..b903c11be8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -103,6 +103,8 @@ option('libnfs', type : 'feature', value : 'auto', description: 'libnfs block device driver') option('mpath', type : 'feature', value : 'auto', description: 'Multipath persistent reservation passthrough') +option('numa', type : 'feature', value : 'auto', + description: 'libnuma support') option('iconv', type : 'feature', value : 'auto', description: 'Font glyph conversion support') option('curses', type : 'feature', value : 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index a20d40e685..d46d7181e7 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -71,6 +71,7 @@ meson_options_help() { printf "%s\n" ' multiprocess Out of process device emulation support' printf "%s\n" ' netmap netmap network backend support' printf "%s\n" ' nettle nettle cryptography support' + printf "%s\n" ' numa libnuma support' printf "%s\n" ' nvmm NVMM acceleration support' printf "%s\n" ' oss OSS sound support' printf "%s\n" ' pa PulseAudio sound support' @@ -218,6 +219,8 @@ _meson_option_parse() { --disable-netmap) printf "%s" -Dnetmap=disabled ;; --enable-nettle) printf "%s" -Dnettle=enabled ;; --disable-nettle) printf "%s" -Dnettle=disabled ;; + --enable-numa) printf "%s" -Dnuma=enabled ;; + --disable-numa) printf "%s" -Dnuma=disabled ;; --enable-nvmm) printf "%s" -Dnvmm=enabled ;; --disable-nvmm) printf "%s" -Dnvmm=disabled ;; --enable-oss) printf "%s" -Doss=enabled ;; From 0d04c4c9de3f260eb65f832983655d1a1206cc15 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 21 Dec 2021 12:38:27 +0100 Subject: [PATCH 10/29] configure, meson: move TPM check to meson The check is simply for a POSIX system. Signed-off-by: Paolo Bonzini --- backends/tpm/meson.build | 14 ++++++-------- configure | 25 ------------------------- docs/devel/kconfig.rst | 2 +- hw/acpi/meson.build | 4 +++- meson.build | 9 +++++++-- meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ softmmu/meson.build | 5 ++++- 8 files changed, 26 insertions(+), 38 deletions(-) diff --git a/backends/tpm/meson.build b/backends/tpm/meson.build index 857929082e..7f2503f84e 100644 --- a/backends/tpm/meson.build +++ b/backends/tpm/meson.build @@ -1,8 +1,6 @@ -tpm_ss = ss.source_set() - -tpm_ss.add(files('tpm_backend.c')) -tpm_ss.add(files('tpm_util.c')) -tpm_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c')) -tpm_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c')) - -softmmu_ss.add_all(when: 'CONFIG_TPM', if_true: tpm_ss) +if have_tpm + softmmu_ss.add(files('tpm_backend.c')) + softmmu_ss.add(files('tpm_util.c')) + softmmu_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c')) + softmmu_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c')) +endif diff --git a/configure b/configure index f536f53106..54eb954296 100755 --- a/configure +++ b/configure @@ -330,7 +330,6 @@ coroutine="" coroutine_pool="$default_feature" debug_stack_usage="no" tls_priority="NORMAL" -tpm="$default_feature" live_block_migration=${default_feature:-yes} replication=${default_feature:-yes} bochs=${default_feature:-yes} @@ -1039,10 +1038,6 @@ for opt do ;; --disable-pvrdma) pvrdma="no" ;; - --disable-tpm) tpm="no" - ;; - --enable-tpm) tpm="yes" - ;; --disable-live-block-migration) live_block_migration="no" ;; --enable-live-block-migration) live_block_migration="yes" @@ -1378,7 +1373,6 @@ cat << EOF vhost-vdpa vhost-vdpa kernel backend support live-block-migration Block migration in the main migration stream coroutine-pool coroutine freelist (better performance) - tpm TPM support replication replication support opengl opengl support qom-cast-debug cast debugging support @@ -2395,21 +2389,6 @@ if test "$modules" = yes; then fi fi -########################################## -# TPM emulation is only on POSIX - -if test "$tpm" = ""; then - if test "$mingw32" = "yes"; then - tpm=no - else - tpm=yes - fi -elif test "$tpm" = "yes"; then - if test "$mingw32" = "yes" ; then - error_exit "TPM emulation only available on POSIX systems" - fi -fi - ########################################## # fdt probe @@ -3274,10 +3253,6 @@ if test "$live_block_migration" = "yes" ; then echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak fi -if test "$tpm" = "yes"; then - echo 'CONFIG_TPM=y' >> $config_host_mak -fi - if test "$rdma" = "yes" ; then echo "CONFIG_RDMA=y" >> $config_host_mak echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst index a1cdbec751..d6b55a6fe0 100644 --- a/docs/devel/kconfig.rst +++ b/docs/devel/kconfig.rst @@ -301,7 +301,7 @@ and also listed as follows in the top-level meson.build's host_kconfig variable:: host_kconfig = \ - ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \ + (have_tpm ? ['CONFIG_TPM=y'] : []) + \ ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \ (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \ ... diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build index f5b22983bb..8bea2e6933 100644 --- a/hw/acpi/meson.build +++ b/hw/acpi/meson.build @@ -25,7 +25,9 @@ acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c')) acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c')) -acpi_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c')) +if have_tpm + acpi_ss.add(files('tpm.c')) +endif softmmu_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c')) softmmu_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss) softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c', diff --git a/meson.build b/meson.build index f8b83f64db..02137be91e 100644 --- a/meson.build +++ b/meson.build @@ -276,6 +276,10 @@ multiprocess_allowed = get_option('multiprocess') \ .require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \ .allowed() +have_tpm = get_option('tpm') \ + .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \ + .allowed() + # Target-specific libraries and flags libm = cc.find_library('m', required: false) threads = dependency('threads') @@ -1492,6 +1496,7 @@ 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()) config_host_data.set('CONFIG_SNAPPY', snappy.found()) +config_host_data.set('CONFIG_TPM', have_tpm) config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) config_host_data.set('CONFIG_VDE', vde.found()) config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server) @@ -1942,7 +1947,7 @@ endif have_ivshmem = config_host_data.get('CONFIG_EVENTFD') host_kconfig = \ (get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \ - ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \ + (have_tpm ? ['CONFIG_TPM=y'] : []) + \ (spice.found() ? ['CONFIG_SPICE=y'] : []) + \ (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \ ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \ @@ -3556,7 +3561,7 @@ if targetos == 'windows' endif summary_info += {'seccomp support': seccomp} summary_info += {'GlusterFS support': glusterfs} -summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')} +summary_info += {'TPM support': have_tpm} summary_info += {'libssh support': libssh} summary_info += {'lzo support': lzo} summary_info += {'snappy support': snappy} diff --git a/meson_options.txt b/meson_options.txt index b903c11be8..8488528a35 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('tpm', type : 'feature', value : 'auto', + description: 'TPM support') # Do not enable it by default even for Mingw32, because it doesn't # work on Wine. diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index d46d7181e7..3f107e5724 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -86,6 +86,7 @@ meson_options_help() { printf "%s\n" ' spice Spice server support' printf "%s\n" ' spice-protocol Spice protocol support' printf "%s\n" ' tcg TCG support' + printf "%s\n" ' tpm TPM support' printf "%s\n" ' u2f U2F emulation support' printf "%s\n" ' usb-redir libusbredir support' printf "%s\n" ' vde vde network backend support' @@ -256,6 +257,8 @@ _meson_option_parse() { --disable-tcg) printf "%s" -Dtcg=disabled ;; --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;; --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;; + --enable-tpm) printf "%s" -Dtpm=enabled ;; + --disable-tpm) printf "%s" -Dtpm=disabled ;; --enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;; --enable-u2f) printf "%s" -Du2f=enabled ;; --disable-u2f) printf "%s" -Du2f=disabled ;; diff --git a/softmmu/meson.build b/softmmu/meson.build index d8e03018ab..39f766ce7c 100644 --- a/softmmu/meson.build +++ b/softmmu/meson.build @@ -27,6 +27,9 @@ softmmu_ss.add(files( 'qdev-monitor.c', ), sdl, libpmem, libdaxctl) -softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c')) +if have_tpm + softmmu_ss.add(files('tpm.c')) +endif + softmmu_ss.add(when: seccomp, if_true: files('qemu-seccomp.c')) softmmu_ss.add(when: fdt, if_true: files('device_tree.c')) From 87263685936623f3229ead1ca17f9fe8f7ae4baa Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 15 Oct 2021 16:28:29 +0200 Subject: [PATCH 11/29] configure, meson: cleanup qemu-ga libraries Move LIBS_QGA to meson.build, remove dead QGA_VSS_PROVIDER variable. Signed-off-by: Paolo Bonzini --- configure | 7 ------- qga/meson.build | 25 +++++++++++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 54eb954296..ee7c4aed0a 100755 --- a/configure +++ b/configure @@ -240,7 +240,6 @@ block_drv_rw_whitelist="" block_drv_ro_whitelist="" block_drv_whitelist_tools="no" host_cc="cc" -libs_qga="" debug_info="yes" lto="false" stack_protector="" @@ -708,7 +707,6 @@ if test "$mingw32" = "yes" ; then write_c_skeleton; prefix="/qemu" qemu_suffix="" - libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga" fi werror="" @@ -2475,8 +2473,6 @@ EOF if compile_prog "$vss_win32_include" "" ; then guest_agent_with_vss="yes" QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" - libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" - qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" else if test "$vss_win32_sdk" != "" ; then echo "ERROR: Please download and install Microsoft VSS SDK:" @@ -2527,7 +2523,6 @@ int main(void) { EOF if compile_prog "" "" ; then guest_agent_ntddscsi=yes - libs_qga="-lsetupapi -lcfgmgr32 $libs_qga" fi fi @@ -3085,7 +3080,6 @@ if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=y" >> $config_host_mak if test "$guest_agent_with_vss" = "yes" ; then echo "CONFIG_QGA_VSS=y" >> $config_host_mak - echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak fi if test "$guest_agent_ntddscsi" = "yes" ; then @@ -3337,7 +3331,6 @@ echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "STRIP=$strip" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak -echo "LIBS_QGA=$libs_qga" >> $config_host_mak if test "$rng_none" = "yes"; then echo "CONFIG_RNG_NONE=y" >> $config_host_mak diff --git a/qga/meson.build b/qga/meson.build index 1ee9dca60b..56fb6539e5 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -1,3 +1,5 @@ +all_qga = [] + qga_qapi_outputs = [ 'qga-qapi-commands.c', 'qga-qapi-commands.h', @@ -50,19 +52,26 @@ qga_ss.add(when: 'CONFIG_WIN32', if_true: files( qga_ss = qga_ss.apply(config_host, strict: false) +gen_tlb = [] +qga_libs = [] +if targetos == 'windows' + qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32'] + if 'CONFIG_QGA_VSS' in config_host + qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup'] + subdir('vss-win32') + endif + if 'CONFIG_QGA_NTDDSCSI' in config_host + qga_libs += ['-lsetupapi', '-lcfgmgr32'] + endif +endif + qga = executable('qemu-ga', qga_ss.sources(), - link_args: config_host['LIBS_QGA'].split(), + link_args: qga_libs, dependencies: [qemuutil, libudev], install: true) -all_qga = [qga] +all_qga += qga if targetos == 'windows' - if 'CONFIG_QGA_VSS' in config_host - subdir('vss-win32') - else - gen_tlb = [] - endif - qemu_ga_msi_arch = { 'x86': ['-D', 'Arch=32'], 'x86_64': ['-a', 'x64', '-D', 'Arch=64'] From ed793c2c455e1c376ae271d8acc5ac40221ecfd1 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Oct 2021 11:42:25 +0200 Subject: [PATCH 12/29] configure, meson: move image format options to meson_options.txt Signed-off-by: Paolo Bonzini --- block/meson.build | 47 +++++++++++++++------- configure | 73 ----------------------------------- meson.build | 16 ++++---- meson_options.txt | 16 ++++++++ scripts/meson-buildoptions.sh | 24 ++++++++++++ 5 files changed, 80 insertions(+), 96 deletions(-) diff --git a/block/meson.build b/block/meson.build index 90dc9983e5..4afde2ebf8 100644 --- a/block/meson.build +++ b/block/meson.build @@ -45,20 +45,37 @@ block_ss.add(files( softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c')) -block_ss.add(when: 'CONFIG_QCOW1', if_true: files('qcow.c')) -block_ss.add(when: 'CONFIG_VDI', if_true: files('vdi.c')) -block_ss.add(when: 'CONFIG_CLOOP', if_true: files('cloop.c')) -block_ss.add(when: 'CONFIG_BOCHS', if_true: files('bochs.c')) -block_ss.add(when: 'CONFIG_VVFAT', if_true: files('vvfat.c')) -block_ss.add(when: 'CONFIG_DMG', if_true: files('dmg.c')) -block_ss.add(when: 'CONFIG_QED', if_true: files( - 'qed-check.c', - 'qed-cluster.c', - 'qed-l2-cache.c', - 'qed-table.c', - 'qed.c', -)) -block_ss.add(when: 'CONFIG_PARALLELS', if_true: files('parallels.c', 'parallels-ext.c')) +if get_option('qcow1').allowed() + block_ss.add(files('qcow.c')) +endif +if get_option('vdi').allowed() + block_ss.add(files('vdi.c')) +endif +if get_option('cloop').allowed() + block_ss.add(files('cloop.c')) +endif +if get_option('bochs').allowed() + block_ss.add(files('bochs.c')) +endif +if get_option('vvfat').allowed() + block_ss.add(files('vvfat.c')) +endif +if get_option('dmg').allowed() + block_ss.add(files('dmg.c')) +endif +if get_option('qed').allowed() + block_ss.add(files( + 'qed-check.c', + 'qed-cluster.c', + 'qed-l2-cache.c', + 'qed-table.c', + 'qed.c', + )) +endif +if get_option('parallels').allowed() + block_ss.add(files('parallels.c', 'parallels-ext.c')) +endif + block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c')) block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit]) block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c')) @@ -89,7 +106,7 @@ foreach m : [ endforeach # those are not exactly regular block modules, so treat them apart -if 'CONFIG_DMG' in config_host +if get_option('dmg').allowed() foreach m : [ [liblzfse, 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'], [libbzip2, 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c'] diff --git a/configure b/configure index ee7c4aed0a..4ee1567419 100755 --- a/configure +++ b/configure @@ -331,14 +331,6 @@ debug_stack_usage="no" tls_priority="NORMAL" live_block_migration=${default_feature:-yes} replication=${default_feature:-yes} -bochs=${default_feature:-yes} -cloop=${default_feature:-yes} -dmg=${default_feature:-yes} -qcow1=${default_feature:-yes} -vdi=${default_feature:-yes} -vvfat=${default_feature:-yes} -qed=${default_feature:-yes} -parallels=${default_feature:-yes} debug_mutex="no" plugins="$default_feature" rng_none="no" @@ -1044,38 +1036,6 @@ for opt do ;; --enable-replication) replication="yes" ;; - --disable-bochs) bochs="no" - ;; - --enable-bochs) bochs="yes" - ;; - --disable-cloop) cloop="no" - ;; - --enable-cloop) cloop="yes" - ;; - --disable-dmg) dmg="no" - ;; - --enable-dmg) dmg="yes" - ;; - --disable-qcow1) qcow1="no" - ;; - --enable-qcow1) qcow1="yes" - ;; - --disable-vdi) vdi="no" - ;; - --enable-vdi) vdi="yes" - ;; - --disable-vvfat) vvfat="no" - ;; - --enable-vvfat) vvfat="yes" - ;; - --disable-qed) qed="no" - ;; - --enable-qed) qed="yes" - ;; - --disable-parallels) parallels="no" - ;; - --enable-parallels) parallels="yes" - ;; --disable-vhost-user) vhost_user="no" ;; --enable-vhost-user) vhost_user="yes" @@ -1375,14 +1335,6 @@ cat << EOF opengl opengl support qom-cast-debug cast debugging support tools build qemu-io, qemu-nbd and qemu-img tools - bochs bochs image format support - cloop cloop image format support - dmg dmg image format support - qcow1 qcow v1 image format support - vdi vdi image format support - vvfat vvfat image format support - qed qed image format support - parallels parallels image format support debug-mutex mutex debugging support rng-none dummy RNG, avoid using /dev/(u)random and getrandom() gio libgio support @@ -3264,31 +3216,6 @@ if test "$debug_mutex" = "yes" ; then echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak fi -if test "$bochs" = "yes" ; then - echo "CONFIG_BOCHS=y" >> $config_host_mak -fi -if test "$cloop" = "yes" ; then - echo "CONFIG_CLOOP=y" >> $config_host_mak -fi -if test "$dmg" = "yes" ; then - echo "CONFIG_DMG=y" >> $config_host_mak -fi -if test "$qcow1" = "yes" ; then - echo "CONFIG_QCOW1=y" >> $config_host_mak -fi -if test "$vdi" = "yes" ; then - echo "CONFIG_VDI=y" >> $config_host_mak -fi -if test "$vvfat" = "yes" ; then - echo "CONFIG_VVFAT=y" >> $config_host_mak -fi -if test "$qed" = "yes" ; then - echo "CONFIG_QED=y" >> $config_host_mak -fi -if test "$parallels" = "yes" ; then - echo "CONFIG_PARALLELS=y" >> $config_host_mak -fi - if test "$plugins" = "yes" ; then echo "CONFIG_PLUGIN=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 02137be91e..38e3ea46e1 100644 --- a/meson.build +++ b/meson.build @@ -3463,14 +3463,14 @@ if have_block summary_info += {'build virtiofs daemon': have_virtiofsd} summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')} summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')} - summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')} - summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')} - summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')} - summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')} - summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')} - summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')} - summary_info += {'qed support': config_host.has_key('CONFIG_QED')} - summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')} + summary_info += {'bochs support': get_option('bochs').allowed()} + summary_info += {'cloop support': get_option('cloop').allowed()} + summary_info += {'dmg support': get_option('dmg').allowed()} + summary_info += {'qcow v1 support': get_option('qcow1').allowed()} + summary_info += {'vdi support': get_option('vdi').allowed()} + summary_info += {'vvfat support': get_option('vvfat').allowed()} + summary_info += {'qed support': get_option('qed').allowed()} + summary_info += {'parallels support': get_option('parallels').allowed()} summary_info += {'FUSE exports': fuse} endif summary(summary_info, bool_yn: true, section: 'Block layer support') diff --git a/meson_options.txt b/meson_options.txt index 8488528a35..303857fbc7 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -222,3 +222,19 @@ option('fdt', type: 'combo', value: 'auto', option('selinux', type: 'feature', value: 'auto', description: 'SELinux support in qemu-nbd') +option('bochs', type: 'feature', value: 'auto', + description: 'bochs image format support') +option('cloop', type: 'feature', value: 'auto', + description: 'cloop image format support') +option('dmg', type: 'feature', value: 'auto', + description: 'dmg image format support') +option('qcow1', type: 'feature', value: 'auto', + description: 'qcow1 image format support') +option('vdi', type: 'feature', value: 'auto', + description: 'vdi image format support') +option('vvfat', type: 'feature', value: 'auto', + description: 'vvfat image format support') +option('qed', type: 'feature', value: 'auto', + description: 'qed image format support') +option('parallels', type: 'feature', value: 'auto', + description: 'parallels image format support') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 3f107e5724..50a985abec 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -28,16 +28,19 @@ meson_options_help() { printf "%s\n" ' auth-pam PAM access control' printf "%s\n" ' avx2 AVX2 optimizations' printf "%s\n" ' avx512f AVX512F optimizations' + printf "%s\n" ' bochs bochs image format support' printf "%s\n" ' bpf eBPF support' printf "%s\n" ' brlapi brlapi character device driver' printf "%s\n" ' bzip2 bzip2 support for DMG images' printf "%s\n" ' cap-ng cap_ng support' + printf "%s\n" ' cloop cloop image format support' printf "%s\n" ' cocoa Cocoa user interface (macOS only)' printf "%s\n" ' coreaudio CoreAudio sound support' printf "%s\n" ' crypto-afalg Linux AF_ALG crypto backend driver' printf "%s\n" ' curl CURL block device driver' printf "%s\n" ' curses curses UI' printf "%s\n" ' dbus-display -display dbus support' + printf "%s\n" ' dmg dmg image format support' printf "%s\n" ' docs Documentations build support' printf "%s\n" ' dsound DirectSound sound support' printf "%s\n" ' fuse FUSE block device export' @@ -75,6 +78,9 @@ meson_options_help() { printf "%s\n" ' nvmm NVMM acceleration support' printf "%s\n" ' oss OSS sound support' printf "%s\n" ' pa PulseAudio sound support' + printf "%s\n" ' parallels parallels image format support' + printf "%s\n" ' qcow1 qcow1 image format support' + printf "%s\n" ' qed qed image format support' printf "%s\n" ' rbd Ceph block device driver' printf "%s\n" ' sdl SDL user interface' printf "%s\n" ' sdl-image SDL Image support for icons' @@ -90,6 +96,7 @@ meson_options_help() { printf "%s\n" ' u2f U2F emulation support' 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" ' vhost-user-blk-server' printf "%s\n" ' build vhost-user-blk server' printf "%s\n" ' virglrenderer virgl rendering support' @@ -100,6 +107,7 @@ meson_options_help() { printf "%s\n" ' vnc-png PNG compression for VNC server' printf "%s\n" ' vnc-sasl SASL authentication for VNC server' printf "%s\n" ' vte vte support for the gtk UI' + printf "%s\n" ' vvfat vvfat image format support' printf "%s\n" ' whpx WHPX acceleration support' printf "%s\n" ' xen Xen backend support' printf "%s\n" ' xen-pci-passthrough' @@ -119,6 +127,8 @@ _meson_option_parse() { --disable-avx2) printf "%s" -Davx2=disabled ;; --enable-avx512f) printf "%s" -Davx512f=enabled ;; --disable-avx512f) printf "%s" -Davx512f=disabled ;; + --enable-bochs) printf "%s" -Dbochs=enabled ;; + --disable-bochs) printf "%s" -Dbochs=disabled ;; --enable-bpf) printf "%s" -Dbpf=enabled ;; --disable-bpf) printf "%s" -Dbpf=disabled ;; --enable-brlapi) printf "%s" -Dbrlapi=enabled ;; @@ -134,6 +144,8 @@ _meson_option_parse() { --disable-cfi) printf "%s" -Dcfi=false ;; --enable-cfi-debug) printf "%s" -Dcfi_debug=true ;; --disable-cfi-debug) printf "%s" -Dcfi_debug=false ;; + --enable-cloop) printf "%s" -Dcloop=enabled ;; + --disable-cloop) printf "%s" -Dcloop=disabled ;; --enable-cocoa) printf "%s" -Dcocoa=enabled ;; --disable-cocoa) printf "%s" -Dcocoa=disabled ;; --enable-coreaudio) printf "%s" -Dcoreaudio=enabled ;; @@ -146,6 +158,8 @@ _meson_option_parse() { --disable-curses) printf "%s" -Dcurses=disabled ;; --enable-dbus-display) printf "%s" -Ddbus_display=enabled ;; --disable-dbus-display) printf "%s" -Ddbus_display=disabled ;; + --enable-dmg) printf "%s" -Ddmg=enabled ;; + --disable-dmg) printf "%s" -Ddmg=disabled ;; --enable-docs) printf "%s" -Ddocs=enabled ;; --disable-docs) printf "%s" -Ddocs=disabled ;; --enable-dsound) printf "%s" -Ddsound=enabled ;; @@ -228,6 +242,12 @@ _meson_option_parse() { --disable-oss) printf "%s" -Doss=disabled ;; --enable-pa) printf "%s" -Dpa=enabled ;; --disable-pa) printf "%s" -Dpa=disabled ;; + --enable-parallels) printf "%s" -Dparallels=enabled ;; + --disable-parallels) printf "%s" -Dparallels=disabled ;; + --enable-qcow1) printf "%s" -Dqcow1=enabled ;; + --disable-qcow1) printf "%s" -Dqcow1=disabled ;; + --enable-qed) printf "%s" -Dqed=enabled ;; + --disable-qed) printf "%s" -Dqed=disabled ;; --enable-rbd) printf "%s" -Drbd=enabled ;; --disable-rbd) printf "%s" -Drbd=disabled ;; --enable-sdl) printf "%s" -Dsdl=enabled ;; @@ -266,6 +286,8 @@ _meson_option_parse() { --disable-usb-redir) printf "%s" -Dusb_redir=disabled ;; --enable-vde) printf "%s" -Dvde=enabled ;; --disable-vde) printf "%s" -Dvde=disabled ;; + --enable-vdi) printf "%s" -Dvdi=enabled ;; + --disable-vdi) printf "%s" -Dvdi=disabled ;; --enable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=enabled ;; --disable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=disabled ;; --enable-virglrenderer) printf "%s" -Dvirglrenderer=enabled ;; @@ -284,6 +306,8 @@ _meson_option_parse() { --disable-vnc-sasl) printf "%s" -Dvnc_sasl=disabled ;; --enable-vte) printf "%s" -Dvte=enabled ;; --disable-vte) printf "%s" -Dvte=disabled ;; + --enable-vvfat) printf "%s" -Dvvfat=enabled ;; + --disable-vvfat) printf "%s" -Dvvfat=disabled ;; --enable-whpx) printf "%s" -Dwhpx=enabled ;; --disable-whpx) printf "%s" -Dwhpx=disabled ;; --enable-xen) printf "%s" -Dxen=enabled ;; From 406523f6b3e0482c2b3be571db7e979473d09d12 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Oct 2021 11:43:54 +0200 Subject: [PATCH 13/29] configure, meson: move block layer options to meson_options.txt Unlike image formats, these also require an entry in config-host.h. Signed-off-by: Paolo Bonzini --- block/meson.build | 4 +++- configure | 20 -------------------- meson.build | 11 ++++++++--- meson_options.txt | 4 ++++ migration/meson.build | 4 +++- scripts/meson-buildoptions.sh | 7 +++++++ tests/unit/meson.build | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/block/meson.build b/block/meson.build index 4afde2ebf8..8a1ce58c9c 100644 --- a/block/meson.build +++ b/block/meson.build @@ -80,7 +80,9 @@ block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c') block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit]) block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c')) block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c')) -block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c')) +if not get_option('replication').disabled() + block_ss.add(files('replication.c')) +endif block_ss.add(when: libaio, if_true: files('linux-aio.c')) block_ss.add(when: linux_io_uring, if_true: files('io_uring.c')) diff --git a/configure b/configure index 4ee1567419..1a15e2325e 100755 --- a/configure +++ b/configure @@ -329,8 +329,6 @@ coroutine="" coroutine_pool="$default_feature" debug_stack_usage="no" tls_priority="NORMAL" -live_block_migration=${default_feature:-yes} -replication=${default_feature:-yes} debug_mutex="no" plugins="$default_feature" rng_none="no" @@ -1028,14 +1026,6 @@ for opt do ;; --disable-pvrdma) pvrdma="no" ;; - --disable-live-block-migration) live_block_migration="no" - ;; - --enable-live-block-migration) live_block_migration="yes" - ;; - --disable-replication) replication="no" - ;; - --enable-replication) replication="yes" - ;; --disable-vhost-user) vhost_user="no" ;; --enable-vhost-user) vhost_user="yes" @@ -1329,9 +1319,7 @@ cat << EOF vhost-kernel vhost kernel backend support vhost-user vhost-user backend support vhost-vdpa vhost-vdpa kernel backend support - live-block-migration Block migration in the main migration stream coroutine-pool coroutine freelist (better performance) - replication replication support opengl opengl support qom-cast-debug cast debugging support tools build qemu-io, qemu-nbd and qemu-img tools @@ -3195,10 +3183,6 @@ if test "$cmpxchg128" = "yes" ; then echo "CONFIG_CMPXCHG128=y" >> $config_host_mak fi -if test "$live_block_migration" = "yes" ; then - echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak -fi - if test "$rdma" = "yes" ; then echo "CONFIG_RDMA=y" >> $config_host_mak echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak @@ -3208,10 +3192,6 @@ if test "$pvrdma" = "yes" ; then echo "CONFIG_PVRDMA=y" >> $config_host_mak fi -if test "$replication" = "yes" ; then - echo "CONFIG_REPLICATION=y" >> $config_host_mak -fi - if test "$debug_mutex" = "yes" ; then echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 38e3ea46e1..031bbf468c 100644 --- a/meson.build +++ b/meson.build @@ -1539,6 +1539,9 @@ config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf) config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() == 'big') +config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', get_option('live_block_migration').allowed()) +config_host_data.set('CONFIG_REPLICATION', get_option('live_block_migration').allowed()) + # has_header config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h')) config_host_data.set('CONFIG_LINUX_MAGIC_H', cc.has_header('linux/magic.h')) @@ -2684,7 +2687,9 @@ if have_block 'job.c', 'qemu-io-cmds.c', )) - block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c')) + if config_host_data.get('CONFIG_REPLICATION') + block_ss.add(files('replication.c')) + endif subdir('nbd') subdir('scsi') @@ -3461,8 +3466,8 @@ if have_block summary_info += {'Use block whitelist in tools': config_host.has_key('CONFIG_BDRV_WHITELIST_TOOLS')} summary_info += {'VirtFS support': have_virtfs} summary_info += {'build virtiofs daemon': have_virtiofsd} - summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')} - summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')} + summary_info += {'Live block migration': config_host_data.get('CONFIG_LIVE_BLOCK_MIGRATION')} + summary_info += {'replication support': config_host_data.get('CONFIG_REPLICATION')} summary_info += {'bochs support': get_option('bochs').allowed()} summary_info += {'cloop support': get_option('cloop').allowed()} summary_info += {'dmg support': get_option('dmg').allowed()} diff --git a/meson_options.txt b/meson_options.txt index 303857fbc7..f06ba9dfd2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -222,6 +222,10 @@ option('fdt', type: 'combo', value: 'auto', option('selinux', type: 'feature', value: 'auto', description: 'SELinux support in qemu-nbd') +option('live_block_migration', type: 'feature', value: 'auto', + description: 'block migration in the main migration stream') +option('replication', type: 'feature', value: 'auto', + description: 'replication support') option('bochs', type: 'feature', value: 'auto', description: 'bochs image format support') option('cloop', type: 'feature', value: 'auto', diff --git a/migration/meson.build b/migration/meson.build index f8714dcb15..8b5ca5c047 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -28,7 +28,9 @@ softmmu_ss.add(files( ), gnutls) softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c')) -softmmu_ss.add(when: 'CONFIG_LIVE_BLOCK_MIGRATION', if_true: files('block.c')) +if get_option('live_block_migration').allowed() + softmmu_ss.add(files('block.c')) +endif softmmu_ss.add(when: zstd, if_true: files('multifd-zstd.c')) specific_ss.add(when: 'CONFIG_SOFTMMU', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 50a985abec..ffd712936d 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -66,6 +66,8 @@ meson_options_help() { printf "%s\n" ' libusb libusb support for USB passthrough' printf "%s\n" ' linux-aio Linux AIO support' printf "%s\n" ' linux-io-uring Linux io_uring support' + printf "%s\n" ' live-block-migration' + printf "%s\n" ' block migration in the main migration stream' printf "%s\n" ' lzfse lzfse support for DMG images' printf "%s\n" ' lzo lzo compression support' printf "%s\n" ' malloc-trim enable libc malloc_trim() for memory optimization' @@ -82,6 +84,7 @@ meson_options_help() { printf "%s\n" ' qcow1 qcow1 image format support' printf "%s\n" ' qed qed image format support' printf "%s\n" ' rbd Ceph block device driver' + printf "%s\n" ' replication replication support' printf "%s\n" ' sdl SDL user interface' printf "%s\n" ' sdl-image SDL Image support for icons' printf "%s\n" ' seccomp seccomp support' @@ -217,6 +220,8 @@ _meson_option_parse() { --disable-linux-aio) printf "%s" -Dlinux_aio=disabled ;; --enable-linux-io-uring) printf "%s" -Dlinux_io_uring=enabled ;; --disable-linux-io-uring) printf "%s" -Dlinux_io_uring=disabled ;; + --enable-live-block-migration) printf "%s" -Dlive_block_migration=enabled ;; + --disable-live-block-migration) printf "%s" -Dlive_block_migration=disabled ;; --enable-lzfse) printf "%s" -Dlzfse=enabled ;; --disable-lzfse) printf "%s" -Dlzfse=disabled ;; --enable-lzo) printf "%s" -Dlzo=enabled ;; @@ -250,6 +255,8 @@ _meson_option_parse() { --disable-qed) printf "%s" -Dqed=disabled ;; --enable-rbd) printf "%s" -Drbd=enabled ;; --disable-rbd) printf "%s" -Drbd=disabled ;; + --enable-replication) printf "%s" -Dreplication=enabled ;; + --disable-replication) printf "%s" -Dreplication=disabled ;; --enable-sdl) printf "%s" -Dsdl=enabled ;; --disable-sdl) printf "%s" -Dsdl=disabled ;; --enable-sdl-image) printf "%s" -Dsdl_image=enabled ;; diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 64a5e7bfde..0959061faf 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -106,7 +106,7 @@ if have_block if 'CONFIG_POSIX' in config_host tests += {'test-image-locking': [testblock]} endif - if 'CONFIG_REPLICATION' in config_host + if config_host_data.get('CONFIG_REPLICATION') tests += {'test-replication': [testblock]} endif if nettle.found() or gcrypt.found() From 8cc2d231b30799b45ce477e6cb472124456df4a4 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 8 Nov 2021 12:36:29 +0100 Subject: [PATCH 14/29] meson: define qemu_cflags/qemu_ldflags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prepare for moving more compiler tests to Meson. If the full set of compiler flags is needed in a cc.compiles/cc.links test, it will be handy to have a variable analogous to QEMU_CFLAGS. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- meson.build | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 031bbf468c..c520d6af68 100644 --- a/meson.build +++ b/meson.build @@ -163,6 +163,10 @@ endif # Compiler flags # ################## +qemu_cflags = config_host['QEMU_CFLAGS'].split() +qemu_cxxflags = config_host['QEMU_CXXFLAGS'].split() +qemu_ldflags = config_host['QEMU_LDFLAGS'].split() + # Specify linker-script with add_project_link_arguments so that it is not placed # within a linker --start-group/--end-group pair if get_option('fuzzing') @@ -198,12 +202,9 @@ if get_option('fuzzing') endif endif -add_global_arguments(config_host['QEMU_CFLAGS'].split(), - native: false, language: ['c', 'objc']) -add_global_arguments(config_host['QEMU_CXXFLAGS'].split(), - native: false, language: 'cpp') -add_global_link_arguments(config_host['QEMU_LDFLAGS'].split(), - native: false, language: ['c', 'cpp', 'objc']) +add_global_arguments(qemu_cflags, native: false, language: ['c', 'objc']) +add_global_arguments(qemu_cxxflags, native: false, language: ['cpp']) +add_global_link_arguments(qemu_ldflags, native: false, language: ['c', 'cpp', 'objc']) if targetos == 'linux' add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers', From c55cf6ab03f4c4a7187452061f36e23ca03c78ee Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Oct 2021 11:46:09 +0200 Subject: [PATCH 15/29] configure, meson: move some default-disabled options to meson_options.txt These do not depend on --with-default-features, so they become booleans in meson too. Signed-off-by: Paolo Bonzini --- configure | 61 +--------------------------------- crypto/meson.build | 2 +- meson.build | 23 +++++++++---- meson_options.txt | 12 +++++++ scripts/meson-buildoptions.sh | 21 ++++++++++++ tests/check-block.sh | 4 --- tests/qemu-iotests/meson.build | 2 +- 7 files changed, 53 insertions(+), 72 deletions(-) diff --git a/configure b/configure index 1a15e2325e..5a4a642846 100755 --- a/configure +++ b/configure @@ -238,7 +238,6 @@ cross_prefix="" audio_drv_list="default" block_drv_rw_whitelist="" block_drv_ro_whitelist="" -block_drv_whitelist_tools="no" host_cc="cc" debug_info="yes" lto="false" @@ -299,7 +298,6 @@ vhost_user_fs="$default_feature" vhost_vdpa="$default_feature" rdma="$default_feature" pvrdma="$default_feature" -gprof="no" debug_tcg="no" debug="no" sanitizers="no" @@ -311,13 +309,11 @@ modules="no" module_upgrades="no" prefix="/usr/local" qemu_suffix="qemu" -profiler="no" softmmu="yes" linux_user="" bsd_user="" pkgversion="" pie="" -qom_cast_debug="yes" trace_backends="log" trace_file="trace" opengl="$default_feature" @@ -329,9 +325,7 @@ coroutine="" coroutine_pool="$default_feature" debug_stack_usage="no" tls_priority="NORMAL" -debug_mutex="no" plugins="$default_feature" -rng_none="no" secret_keyring="$default_feature" meson="" meson_args="" @@ -806,8 +800,6 @@ for opt do ;; --without-default-features) # processed above ;; - --enable-gprof) gprof="yes" - ;; --enable-gcov) gcov="yes" ;; --static) @@ -848,20 +840,12 @@ for opt do # configure to be used by RPM and similar macros that set # lots of directory switches by default. ;; - --disable-qom-cast-debug) qom_cast_debug="no" - ;; - --enable-qom-cast-debug) qom_cast_debug="yes" - ;; --audio-drv-list=*) audio_drv_list="$optarg" ;; --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') ;; --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g') ;; - --enable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="yes" - ;; - --disable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="no" - ;; --enable-debug-tcg) debug_tcg="yes" ;; --disable-debug-tcg) debug_tcg="no" @@ -869,7 +853,7 @@ for opt do --enable-debug) # Enable debugging options that aren't excessively noisy debug_tcg="yes" - debug_mutex="yes" + meson_option_parse --enable-debug-mutex "" debug="yes" fortify_source="no" ;; @@ -898,8 +882,6 @@ for opt do ;; --enable-tcg) tcg="enabled" ;; - --enable-profiler) profiler="yes" - ;; --disable-system) softmmu="no" ;; --enable-system) softmmu="yes" @@ -1051,10 +1033,6 @@ for opt do --with-git-submodules=*) git_submodules_action="$optarg" ;; - --enable-debug-mutex) debug_mutex=yes - ;; - --disable-debug-mutex) debug_mutex=no - ;; --enable-plugins) if test "$mingw32" = "yes"; then error_exit "TCG plugins not currently supported on Windows platforms" else @@ -1069,10 +1047,6 @@ for opt do ;; --gdb=*) gdb_bin="$optarg" ;; - --enable-rng-none) rng_none=yes - ;; - --disable-rng-none) rng_none=no - ;; --enable-keyring) secret_keyring="yes" ;; --disable-keyring) secret_keyring="no" @@ -1275,8 +1249,6 @@ Advanced options (experts only): --block-drv-ro-whitelist=L set block driver read-only whitelist (by default affects only QEMU, not tools like qemu-img) - --enable-block-drv-whitelist-in-tools - use block whitelist also in tools instead of only QEMU --with-trace-file=NAME Full PATH,NAME of file to store traces Default:trace- --cpu=CPU Build for host CPU [$cpu] @@ -1286,8 +1258,6 @@ Advanced options (experts only): --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) --tls-priority default TLS protocol/cipher priority string - --enable-gprof QEMU profiling with gprof - --enable-profiler profiler support --enable-debug-stack-usage track the maximum stack usage of stacks created by qemu_alloc_stack --enable-plugins @@ -1321,10 +1291,7 @@ cat << EOF vhost-vdpa vhost-vdpa kernel backend support coroutine-pool coroutine freelist (better performance) opengl opengl support - qom-cast-debug cast debugging support tools build qemu-io, qemu-nbd and qemu-img tools - debug-mutex mutex debugging support - rng-none dummy RNG, avoid using /dev/(u)random and getrandom() gio libgio support slirp-smbd use smbd (at path --smbd=*) in slirp networking @@ -2848,11 +2815,6 @@ alpha) ;; esac -if test "$gprof" = "yes" ; then - QEMU_CFLAGS="-p $QEMU_CFLAGS" - QEMU_LDFLAGS="-p $QEMU_LDFLAGS" -fi - if test "$have_asan" = "yes"; then QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS" QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS" @@ -3047,9 +3009,6 @@ fi if test "$static" = "yes" ; then echo "CONFIG_STATIC=y" >> $config_host_mak fi -if test "$profiler" = "yes" ; then - echo "CONFIG_PROFILER=y" >> $config_host_mak -fi if test "$want_tools" = "yes" ; then echo "CONFIG_TOOLS=y" >> $config_host_mak fi @@ -3060,14 +3019,8 @@ if test "$slirp_smbd" = "yes" ; then echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak fi -if test "$gprof" = "yes" ; then - echo "CONFIG_GPROF=y" >> $config_host_mak -fi echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak -if test "$block_drv_whitelist_tools" = "yes" ; then - echo "CONFIG_BDRV_WHITELIST_TOOLS=y" >> $config_host_mak -fi qemu_version=$(head $source_path/VERSION) echo "PKGVERSION=$pkgversion" >>$config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak @@ -3148,10 +3101,6 @@ if [ "$bsd" = "yes" ] ; then echo "CONFIG_BSD=y" >> $config_host_mak fi -if test "$qom_cast_debug" = "yes" ; then - echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak -fi - echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak if test "$coroutine_pool" = "yes" ; then echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak @@ -3192,10 +3141,6 @@ if test "$pvrdma" = "yes" ; then echo "CONFIG_PVRDMA=y" >> $config_host_mak fi -if test "$debug_mutex" = "yes" ; then - echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak -fi - if test "$plugins" = "yes" ; then echo "CONFIG_PLUGIN=y" >> $config_host_mak fi @@ -3239,10 +3184,6 @@ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "STRIP=$strip" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak -if test "$rng_none" = "yes"; then - echo "CONFIG_RNG_NONE=y" >> $config_host_mak -fi - # use included Linux headers if test "$linux" = "yes" ; then mkdir -p linux-headers diff --git a/crypto/meson.build b/crypto/meson.build index 9bf3a431fe..19c44bea89 100644 --- a/crypto/meson.build +++ b/crypto/meson.build @@ -50,7 +50,7 @@ if gcrypt.found() util_ss.add(gcrypt, files('random-gcrypt.c')) elif gnutls.found() util_ss.add(gnutls, files('random-gnutls.c')) -elif 'CONFIG_RNG_NONE' in config_host +elif get_option('rng_none') util_ss.add(files('random-none.c')) else util_ss.add(files('random-platform.c')) diff --git a/meson.build b/meson.build index c520d6af68..8fc23df33d 100644 --- a/meson.build +++ b/meson.build @@ -167,6 +167,12 @@ qemu_cflags = config_host['QEMU_CFLAGS'].split() qemu_cxxflags = config_host['QEMU_CXXFLAGS'].split() qemu_ldflags = config_host['QEMU_LDFLAGS'].split() +if get_option('gprof') + qemu_cflags += ['-p'] + qemu_cxxflags += ['-p'] + qemu_ldflags += ['-p'] +endif + # Specify linker-script with add_project_link_arguments so that it is not placed # within a linker --start-group/--end-group pair if get_option('fuzzing') @@ -1459,6 +1465,7 @@ config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_opti config_host_data.set('HOST_' + host_arch.to_upper(), 1) config_host_data.set('CONFIG_ATTR', libattr.found()) +config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS', get_option('block_drv_whitelist_in_tools')) config_host_data.set('CONFIG_BRLAPI', brlapi.found()) config_host_data.set('CONFIG_COCOA', cocoa.found()) config_host_data.set('CONFIG_FUZZ', get_option('fuzzing')) @@ -1492,6 +1499,7 @@ config_host_data.set('CONFIG_LINUX_AIO', libaio.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_NUMA', numa.found()) +config_host_data.set('CONFIG_PROFILER', get_option('profiler')) 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()) @@ -1540,7 +1548,10 @@ config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf) config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() == 'big') +config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex')) +config_host_data.set('CONFIG_GPROF', get_option('gprof')) config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', get_option('live_block_migration').allowed()) +config_host_data.set('CONFIG_QOM_CAST_DEBUG', get_option('qom_cast_debug')) config_host_data.set('CONFIG_REPLICATION', get_option('live_block_migration').allowed()) # has_header @@ -3340,7 +3351,7 @@ if 'simple' in get_option('trace_backends') summary_info += {'Trace output file': get_option('trace_file') + '-'} endif summary_info += {'D-Bus display': dbus_display} -summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')} +summary_info += {'QOM debugging': get_option('qom_cast_debug')} summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')} summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')} summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')} @@ -3386,18 +3397,18 @@ if link_args.length() > 0 endif summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']} summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']} -summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')} +summary_info += {'profiler': get_option('profiler')} summary_info += {'link-time optimization (LTO)': get_option('b_lto')} summary_info += {'PIE': get_option('b_pie')} summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} summary_info += {'malloc trim support': has_malloc_trim} summary_info += {'membarrier': have_membarrier} summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} -summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')} +summary_info += {'mutex debugging': get_option('debug_mutex')} summary_info += {'memory allocator': get_option('malloc')} summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')} summary_info += {'avx512f optimization': config_host_data.get('CONFIG_AVX512F_OPT')} -summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')} +summary_info += {'gprof enabled': get_option('gprof')} summary_info += {'gcov': get_option('b_coverage')} summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')} summary_info += {'CFI support': get_option('cfi')} @@ -3464,7 +3475,7 @@ summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1 if have_block summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']} summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']} - summary_info += {'Use block whitelist in tools': config_host.has_key('CONFIG_BDRV_WHITELIST_TOOLS')} + summary_info += {'Use block whitelist in tools': get_option('block_drv_whitelist_in_tools')} summary_info += {'VirtFS support': have_virtfs} summary_info += {'build virtiofs daemon': have_virtiofsd} summary_info += {'Live block migration': config_host_data.get('CONFIG_LIVE_BLOCK_MIGRATION')} @@ -3494,7 +3505,7 @@ if nettle.found() summary_info += {' XTS': xts != 'private'} endif summary_info += {'AF_ALG support': have_afalg} -summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} +summary_info += {'rng-none': get_option('rng_none')} summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')} summary(summary_info, bool_yn: true, section: 'Crypto') diff --git a/meson_options.txt b/meson_options.txt index f06ba9dfd2..de4b3e271e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -242,3 +242,15 @@ option('qed', type: 'feature', value: 'auto', description: 'qed image format support') option('parallels', type: 'feature', value: 'auto', description: 'parallels image format support') +option('block_drv_whitelist_in_tools', type: 'boolean', value: false, + description: 'use block whitelist also in tools instead of only QEMU') +option('rng_none', type: 'boolean', value: false, + description: 'dummy RNG, avoid using /dev/(u)random and getrandom()') +option('debug_mutex', type: 'boolean', value: false, + description: 'mutex debugging support') +option('qom_cast_debug', type: 'boolean', value: false, + description: 'cast debugging support') +option('gprof', type: 'boolean', value: false, + description: 'QEMU profiling with gprof') +option('profiler', type: 'boolean', value: false, + description: 'profiler support') diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index ffd712936d..a2d6f34b21 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -1,16 +1,25 @@ # This file is generated by meson-buildoptions.py, do not edit! meson_options_help() { + printf "%s\n" ' --enable-block-drv-whitelist-in-tools' + printf "%s\n" ' use block whitelist also in tools instead of only' + printf "%s\n" ' QEMU' printf "%s\n" ' --enable-capstone[=CHOICE]' printf "%s\n" ' Whether and how to find the capstone library' printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)' printf "%s\n" ' --enable-cfi Control-Flow Integrity (CFI)' printf "%s\n" ' --enable-cfi-debug Verbose errors in case of CFI violation' + printf "%s\n" ' --enable-debug-mutex mutex debugging support' printf "%s\n" ' --enable-fdt[=CHOICE] Whether and how to find the libfdt library' printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)' printf "%s\n" ' --enable-fuzzing build fuzzing targets' + printf "%s\n" ' --enable-gprof QEMU profiling with gprof' printf "%s\n" ' --disable-install-blobs install provided firmware blobs' printf "%s\n" ' --enable-malloc=CHOICE choose memory allocator to use [system] (choices:' printf "%s\n" ' jemalloc/system/tcmalloc)' + printf "%s\n" ' --enable-profiler profiler support' + printf "%s\n" ' --enable-qom-cast-debug cast debugging support' + printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and' + printf "%s\n" ' getrandom()' printf "%s\n" ' --enable-slirp[=CHOICE] Whether and how to find the slirp library' printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)' printf "%s\n" ' --enable-strip Strip targets on install' @@ -130,6 +139,8 @@ _meson_option_parse() { --disable-avx2) printf "%s" -Davx2=disabled ;; --enable-avx512f) printf "%s" -Davx512f=enabled ;; --disable-avx512f) printf "%s" -Davx512f=disabled ;; + --enable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=true ;; + --disable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=false ;; --enable-bochs) printf "%s" -Dbochs=enabled ;; --disable-bochs) printf "%s" -Dbochs=disabled ;; --enable-bpf) printf "%s" -Dbpf=enabled ;; @@ -161,6 +172,8 @@ _meson_option_parse() { --disable-curses) printf "%s" -Dcurses=disabled ;; --enable-dbus-display) printf "%s" -Ddbus_display=enabled ;; --disable-dbus-display) printf "%s" -Ddbus_display=disabled ;; + --enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;; + --disable-debug-mutex) printf "%s" -Ddebug_mutex=false ;; --enable-dmg) printf "%s" -Ddmg=enabled ;; --disable-dmg) printf "%s" -Ddmg=disabled ;; --enable-docs) printf "%s" -Ddocs=enabled ;; @@ -184,6 +197,8 @@ _meson_option_parse() { --disable-glusterfs) printf "%s" -Dglusterfs=disabled ;; --enable-gnutls) printf "%s" -Dgnutls=enabled ;; --disable-gnutls) printf "%s" -Dgnutls=disabled ;; + --enable-gprof) printf "%s" -Dgprof=true ;; + --disable-gprof) printf "%s" -Dgprof=false ;; --enable-gtk) printf "%s" -Dgtk=enabled ;; --disable-gtk) printf "%s" -Dgtk=disabled ;; --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;; @@ -249,14 +264,20 @@ _meson_option_parse() { --disable-pa) printf "%s" -Dpa=disabled ;; --enable-parallels) printf "%s" -Dparallels=enabled ;; --disable-parallels) printf "%s" -Dparallels=disabled ;; + --enable-profiler) printf "%s" -Dprofiler=true ;; + --disable-profiler) printf "%s" -Dprofiler=false ;; --enable-qcow1) printf "%s" -Dqcow1=enabled ;; --disable-qcow1) printf "%s" -Dqcow1=disabled ;; --enable-qed) printf "%s" -Dqed=enabled ;; --disable-qed) printf "%s" -Dqed=disabled ;; + --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;; + --disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;; --enable-rbd) printf "%s" -Drbd=enabled ;; --disable-rbd) printf "%s" -Drbd=disabled ;; --enable-replication) printf "%s" -Dreplication=enabled ;; --disable-replication) printf "%s" -Dreplication=disabled ;; + --enable-rng-none) printf "%s" -Drng_none=true ;; + --disable-rng-none) printf "%s" -Drng_none=false ;; --enable-sdl) printf "%s" -Dsdl=enabled ;; --disable-sdl) printf "%s" -Dsdl=disabled ;; --enable-sdl-image) printf "%s" -Dsdl_image=enabled ;; diff --git a/tests/check-block.sh b/tests/check-block.sh index 720a46bc36..18f7433901 100755 --- a/tests/check-block.sh +++ b/tests/check-block.sh @@ -18,10 +18,6 @@ skip() { exit 0 } -if grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ; then - skip "GPROF is enabled ==> Not running the qemu-iotests." -fi - # Disable tests with any sanitizer except for specific ones SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null ) ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall" diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build index 5be3c74127..9747bb68a5 100644 --- a/tests/qemu-iotests/meson.build +++ b/tests/qemu-iotests/meson.build @@ -1,4 +1,4 @@ -if have_tools and targetos != 'windows' +if have_tools and targetos != 'windows' and not get_option('gprof') qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd] qemu_iotests_env = {'PYTHON': python.full_path()} qemu_iotests_formats = { From 728c0a2ff837a61bb717ccd0e27c735b3684101d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Oct 2021 11:52:03 +0200 Subject: [PATCH 16/29] configure, meson: move coroutine options to meson_options.txt Signed-off-by: Paolo Bonzini --- configure | 31 ------------------------------- meson.build | 11 +++++++++-- meson_options.txt | 4 ++++ scripts/meson-buildoptions.sh | 7 +++++++ 4 files changed, 20 insertions(+), 33 deletions(-) diff --git a/configure b/configure index 5a4a642846..1cc836ee55 100755 --- a/configure +++ b/configure @@ -322,8 +322,6 @@ vss_win32_sdk="$default_feature" win_sdk="no" want_tools="$default_feature" coroutine="" -coroutine_pool="$default_feature" -debug_stack_usage="no" tls_priority="NORMAL" plugins="$default_feature" secret_keyring="$default_feature" @@ -937,12 +935,6 @@ for opt do ;; --with-coroutine=*) coroutine="$optarg" ;; - --disable-coroutine-pool) coroutine_pool="no" - ;; - --enable-coroutine-pool) coroutine_pool="yes" - ;; - --enable-debug-stack-usage) debug_stack_usage="yes" - ;; --disable-vhost-net) vhost_net="no" ;; --enable-vhost-net) vhost_net="yes" @@ -1258,8 +1250,6 @@ Advanced options (experts only): --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) --tls-priority default TLS protocol/cipher priority string - --enable-debug-stack-usage - track the maximum stack usage of stacks created by qemu_alloc_stack --enable-plugins enable plugins via shared library loading --disable-containers don't use containers for cross-building @@ -1289,7 +1279,6 @@ cat << EOF vhost-kernel vhost kernel backend support vhost-user vhost-user backend support vhost-vdpa vhost-vdpa kernel backend support - coroutine-pool coroutine freelist (better performance) opengl opengl support tools build qemu-io, qemu-nbd and qemu-img tools gio libgio support @@ -2498,17 +2487,6 @@ else esac fi -if test "$coroutine_pool" = ""; then - coroutine_pool=yes -fi - -if test "$debug_stack_usage" = "yes"; then - if test "$coroutine_pool" = "yes"; then - echo "WARN: disabling coroutine pool for stack usage debugging" - coroutine_pool=no - fi -fi - ################################################## # SafeStack @@ -3102,15 +3080,6 @@ if [ "$bsd" = "yes" ] ; then fi echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak -if test "$coroutine_pool" = "yes" ; then - echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak -else - echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak -fi - -if test "$debug_stack_usage" = "yes" ; then - echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak -fi if test "$have_asan_iface_fiber" = "yes" ; then echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak diff --git a/meson.build b/meson.build index 8fc23df33d..79ceff64a7 100644 --- a/meson.build +++ b/meson.build @@ -1548,7 +1548,14 @@ config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf) config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() == 'big') +have_coroutine_pool = get_option('coroutine_pool') +if get_option('debug_stack_usage') and have_coroutine_pool + message('Disabling coroutine pool to measure stack usage') + have_coroutine_pool = false +endif +config_host_data.set10('CONFIG_COROUTINE_POOL', have_coroutine_pool) config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex')) +config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage')) config_host_data.set('CONFIG_GPROF', get_option('gprof')) config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', get_option('live_block_migration').allowed()) config_host_data.set('CONFIG_QOM_CAST_DEBUG', get_option('qom_cast_debug')) @@ -3403,7 +3410,7 @@ summary_info += {'PIE': get_option('b_pie')} summary_info += {'static build': config_host.has_key('CONFIG_STATIC')} summary_info += {'malloc trim support': has_malloc_trim} summary_info += {'membarrier': have_membarrier} -summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')} +summary_info += {'debug stack usage': get_option('debug_stack_usage')} summary_info += {'mutex debugging': get_option('debug_mutex')} summary_info += {'memory allocator': get_option('malloc')} summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')} @@ -3471,7 +3478,7 @@ summary(summary_info, bool_yn: true, section: 'Targets and accelerators') # Block layer summary_info = {} summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']} -summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'} +summary_info += {'coroutine pool': have_coroutine_pool} if have_block summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']} summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']} diff --git a/meson_options.txt b/meson_options.txt index de4b3e271e..f5481be655 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -246,8 +246,12 @@ option('block_drv_whitelist_in_tools', type: 'boolean', value: false, description: 'use block whitelist also in tools instead of only QEMU') option('rng_none', type: 'boolean', value: false, description: 'dummy RNG, avoid using /dev/(u)random and getrandom()') +option('coroutine_pool', type: 'boolean', value: true, + description: 'coroutine freelist (better performance)') option('debug_mutex', type: 'boolean', value: false, description: 'mutex debugging support') +option('debug_stack_usage', type: 'boolean', value: false, + description: 'measure coroutine stack usage') option('qom_cast_debug', type: 'boolean', value: false, description: 'cast debugging support') option('gprof', type: 'boolean', value: false, diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index a2d6f34b21..9a6e53a2e7 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -8,7 +8,10 @@ meson_options_help() { printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)' printf "%s\n" ' --enable-cfi Control-Flow Integrity (CFI)' printf "%s\n" ' --enable-cfi-debug Verbose errors in case of CFI violation' + printf "%s\n" ' --disable-coroutine-pool coroutine freelist (better performance)' printf "%s\n" ' --enable-debug-mutex mutex debugging support' + printf "%s\n" ' --enable-debug-stack-usage' + printf "%s\n" ' measure coroutine stack usage' printf "%s\n" ' --enable-fdt[=CHOICE] Whether and how to find the libfdt library' printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)' printf "%s\n" ' --enable-fuzzing build fuzzing targets' @@ -164,6 +167,8 @@ _meson_option_parse() { --disable-cocoa) printf "%s" -Dcocoa=disabled ;; --enable-coreaudio) printf "%s" -Dcoreaudio=enabled ;; --disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;; + --enable-coroutine-pool) printf "%s" -Dcoroutine_pool=true ;; + --disable-coroutine-pool) printf "%s" -Dcoroutine_pool=false ;; --enable-crypto-afalg) printf "%s" -Dcrypto_afalg=enabled ;; --disable-crypto-afalg) printf "%s" -Dcrypto_afalg=disabled ;; --enable-curl) printf "%s" -Dcurl=enabled ;; @@ -174,6 +179,8 @@ _meson_option_parse() { --disable-dbus-display) printf "%s" -Ddbus_display=disabled ;; --enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;; --disable-debug-mutex) printf "%s" -Ddebug_mutex=false ;; + --enable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=true ;; + --disable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=false ;; --enable-dmg) printf "%s" -Ddmg=enabled ;; --disable-dmg) printf "%s" -Ddmg=disabled ;; --enable-docs) printf "%s" -Ddocs=enabled ;; From 35acbb30582ea11cd8e98670fcd9ee90fa5f530b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Oct 2021 13:43:36 +0200 Subject: [PATCH 17/29] configure, meson: move smbd options to meson_options.txt Signed-off-by: Paolo Bonzini --- configure | 26 ++------------------------ meson.build | 15 +++++++++++++-- meson_options.txt | 4 ++++ net/slirp.c | 16 ++++++++-------- scripts/meson-buildoptions.py | 1 + scripts/meson-buildoptions.sh | 3 +++ 6 files changed, 31 insertions(+), 34 deletions(-) diff --git a/configure b/configure index 1cc836ee55..9230ebd4a8 100755 --- a/configure +++ b/configure @@ -330,7 +330,6 @@ meson_args="" ninja="" gio="$default_feature" skip_meson=no -slirp_smbd="$default_feature" # The following Meson options are handled manually (still they # are included in the automatically generated help message) @@ -416,6 +415,7 @@ objcopy="${OBJCOPY-${cross_prefix}objcopy}" ld="${LD-${cross_prefix}ld}" ranlib="${RANLIB-${cross_prefix}ranlib}" nm="${NM-${cross_prefix}nm}" +smbd="$SMBD" strip="${STRIP-${cross_prefix}strip}" windres="${WINDRES-${cross_prefix}windres}" pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}" @@ -535,7 +535,6 @@ darwin) sunos) solaris="yes" make="${MAKE-gmake}" - smbd="${SMBD-/usr/sfw/sbin/smbd}" # needed for CMSG_ macros in sys/socket.h QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" # needed for TIOCWIN* defines in termios.h @@ -1047,10 +1046,6 @@ for opt do ;; --disable-gio) gio=no ;; - --enable-slirp-smbd) slirp_smbd=yes - ;; - --disable-slirp-smbd) slirp_smbd=no - ;; # backwards compatibility options --enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg" ;; @@ -1282,7 +1277,6 @@ cat << EOF opengl opengl support tools build qemu-io, qemu-nbd and qemu-img tools gio libgio support - slirp-smbd use smbd (at path --smbd=*) in slirp networking NOTE: The object files are built at the place where configure is launched EOF @@ -2725,19 +2719,6 @@ case "$slirp" in ;; esac -# Check for slirp smbd dupport -: ${smbd=${SMBD-/usr/sbin/smbd}} -if test "$slirp_smbd" != "no" ; then - if test "$mingw32" = "yes" ; then - if test "$slirp_smbd" = "yes" ; then - error_exit "Host smbd not supported on this platform." - fi - slirp_smbd=no - else - slirp_smbd=yes - fi -fi - ########################################## # check for usable __NR_keyctl syscall @@ -2993,10 +2974,6 @@ fi if test "$guest_agent" = "yes" ; then echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak fi -if test "$slirp_smbd" = "yes" ; then - echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak - echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak -fi echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak qemu_version=$(head $source_path/VERSION) @@ -3355,6 +3332,7 @@ if test "$skip_meson" = no; then -Ddocdir="$docdir" \ -Dqemu_firmwarepath="$firmwarepath" \ -Dqemu_suffix="$qemu_suffix" \ + -Dsmbd="$smbd" \ -Dsphinx_build="$sphinx_build" \ -Dtrace_file="$trace_file" \ -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \ diff --git a/meson.build b/meson.build index 79ceff64a7..7b3cfb6316 100644 --- a/meson.build +++ b/meson.build @@ -1462,6 +1462,17 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') / config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir) config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir')) +have_slirp_smbd = get_option('slirp_smbd') \ + .require(targetos != 'windows', error_message: 'Host smbd not supported on this platform.') \ + .allowed() +if have_slirp_smbd + smbd_path = get_option('smbd') + if smbd_path == '' + smbd_path = (targetos == 'solaris' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd') + endif + config_host_data.set_quoted('CONFIG_SMBD_COMMAND', smbd_path) +endif + config_host_data.set('HOST_' + host_arch.to_upper(), 1) config_host_data.set('CONFIG_ATTR', libattr.found()) @@ -3333,8 +3344,8 @@ summary_info += {'genisoimage': config_host['GENISOIMAGE']} if targetos == 'windows' and config_host.has_key('CONFIG_GUEST_AGENT') summary_info += {'wixl': wixl} endif -if slirp_opt != 'disabled' and 'CONFIG_SLIRP_SMBD' in config_host - summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']} +if slirp_opt != 'disabled' and have_system + summary_info += {'smbd': have_slirp_smbd ? smbd_path : false} endif summary(summary_info, bool_yn: true, section: 'Host binaries') diff --git a/meson_options.txt b/meson_options.txt index f5481be655..368b2cf783 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -8,6 +8,8 @@ option('docdir', type : 'string', value : 'doc', description: 'Base directory for documentation installation (can be empty)') option('qemu_firmwarepath', type : 'string', value : '', description: 'search PATH for firmware files') +option('smbd', type : 'string', value : '', + description: 'Path to smbd for slirp networking') option('sphinx_build', type : 'string', value : '', description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)') option('default_devices', type : 'boolean', value : true, @@ -258,3 +260,5 @@ option('gprof', type: 'boolean', value: false, description: 'QEMU profiling with gprof') option('profiler', type: 'boolean', value: false, description: 'profiler support') +option('slirp_smbd', type : 'feature', value : 'auto', + description: 'use smbd (at path --smbd=*) in slirp networking') diff --git a/net/slirp.c b/net/slirp.c index ad3a838e0b..bc5e9e4f77 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -27,7 +27,7 @@ #include "net/slirp.h" -#if defined(CONFIG_SLIRP_SMBD) +#if defined(CONFIG_SMBD_COMMAND) #include #include #endif @@ -91,7 +91,7 @@ typedef struct SlirpState { Slirp *slirp; Notifier poll_notifier; Notifier exit_notifier; -#if defined(CONFIG_SLIRP_SMBD) +#if defined(CONFIG_SMBD_COMMAND) gchar *smb_dir; #endif GSList *fwd; @@ -104,7 +104,7 @@ static QTAILQ_HEAD(, SlirpState) slirp_stacks = static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp); static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp); -#if defined(CONFIG_SLIRP_SMBD) +#if defined(CONFIG_SMBD_COMMAND) static int slirp_smb(SlirpState *s, const char *exported_dir, struct in_addr vserver_addr, Error **errp); static void slirp_smb_cleanup(SlirpState *s); @@ -377,7 +377,7 @@ static int net_slirp_init(NetClientState *peer, const char *model, struct in6_addr ip6_prefix; struct in6_addr ip6_host; struct in6_addr ip6_dns; -#if defined(CONFIG_SLIRP_SMBD) +#if defined(CONFIG_SMBD_COMMAND) struct in_addr smbsrv = { .s_addr = 0 }; #endif NetClientState *nc; @@ -487,7 +487,7 @@ static int net_slirp_init(NetClientState *peer, const char *model, return -1; } -#if defined(CONFIG_SLIRP_SMBD) +#if defined(CONFIG_SMBD_COMMAND) if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) { error_setg(errp, "Failed to parse SMB address"); return -1; @@ -602,7 +602,7 @@ static int net_slirp_init(NetClientState *peer, const char *model, } } } -#if defined(CONFIG_SLIRP_SMBD) +#if defined(CONFIG_SMBD_COMMAND) if (smb_export) { if (slirp_smb(s, smb_export, smbsrv, errp) < 0) { goto error; @@ -794,7 +794,7 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) } -#if defined(CONFIG_SLIRP_SMBD) +#if defined(CONFIG_SMBD_COMMAND) /* automatic user mode samba server configuration */ static void slirp_smb_cleanup(SlirpState *s) @@ -909,7 +909,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir, return 0; } -#endif /* defined(CONFIG_SLIRP_SMBD) */ +#endif /* defined(CONFIG_SMBD_COMMAND) */ static int guestfwd_can_read(void *opaque) { diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py index 98ae944148..01b10f7ae0 100755 --- a/scripts/meson-buildoptions.py +++ b/scripts/meson-buildoptions.py @@ -32,6 +32,7 @@ SKIP_OPTIONS = { "fuzzing_engine", "qemu_firmwarepath", "qemu_suffix", + "smbd", "sphinx_build", "trace_file", } diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 9a6e53a2e7..fb8812693c 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -101,6 +101,7 @@ meson_options_help() { printf "%s\n" ' sdl-image SDL Image support for icons' printf "%s\n" ' seccomp seccomp support' printf "%s\n" ' selinux SELinux support in qemu-nbd' + printf "%s\n" ' slirp-smbd use smbd (at path --smbd=*) in slirp networking' printf "%s\n" ' smartcard CA smartcard emulation support' printf "%s\n" ' snappy snappy compression support' printf "%s\n" ' sparse sparse checker' @@ -296,6 +297,8 @@ _meson_option_parse() { --enable-slirp) printf "%s" -Dslirp=enabled ;; --disable-slirp) printf "%s" -Dslirp=disabled ;; --enable-slirp=*) quote_sh "-Dslirp=$2" ;; + --enable-slirp-smbd) printf "%s" -Dslirp_smbd=enabled ;; + --disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;; --enable-smartcard) printf "%s" -Dsmartcard=enabled ;; --disable-smartcard) printf "%s" -Dsmartcard=disabled ;; --enable-snappy) printf "%s" -Dsnappy=enabled ;; From 20cf5cb487021dd1bec1eec326af138a8b15d987 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 15 Oct 2021 16:47:43 +0200 Subject: [PATCH 18/29] configure, meson: move guest-agent, tools to meson Signed-off-by: Paolo Bonzini --- configure | 48 ++-------------------------- contrib/vhost-user-gpu/meson.build | 2 +- docs/meson.build | 2 -- meson.build | 50 ++++++++++++++++-------------- meson_options.txt | 4 +++ qga/meson.build | 7 +++++ scripts/meson-buildoptions.sh | 6 ++++ tests/Makefile.include | 2 +- tests/unit/meson.build | 4 +-- 9 files changed, 50 insertions(+), 75 deletions(-) diff --git a/configure b/configure index 9230ebd4a8..a66e2c0d71 100755 --- a/configure +++ b/configure @@ -317,10 +317,8 @@ pie="" trace_backends="log" trace_file="trace" opengl="$default_feature" -guest_agent="$default_feature" vss_win32_sdk="$default_feature" win_sdk="no" -want_tools="$default_feature" coroutine="" tls_priority="NORMAL" plugins="$default_feature" @@ -960,10 +958,6 @@ for opt do ;; --disable-zlib-test) ;; - --enable-guest-agent) guest_agent="yes" - ;; - --disable-guest-agent) guest_agent="no" - ;; --with-vss-sdk) vss_win32_sdk="" ;; --with-vss-sdk=*) vss_win32_sdk="$optarg" @@ -976,10 +970,6 @@ for opt do ;; --without-win-sdk) win_sdk="no" ;; - --enable-tools) want_tools="yes" - ;; - --disable-tools) want_tools="no" - ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 ;; @@ -1256,7 +1246,6 @@ cat << EOF user supported user emulation targets linux-user all linux usermode emulation targets bsd-user all BSD usermode emulation targets - guest-agent build the QEMU Guest Agent pie Position Independent Executables modules modules support (non-Windows) module-upgrades try to load modules from alternate paths for upgrades @@ -1275,7 +1264,6 @@ cat << EOF vhost-user vhost-user backend support vhost-vdpa vhost-vdpa kernel backend support opengl opengl support - tools build qemu-io, qemu-nbd and qemu-img tools gio libgio support NOTE: The object files are built at the place where configure is launched @@ -1678,16 +1666,6 @@ else exit 1 fi -########################################## -# system tools -if test -z "$want_tools"; then - if test "$softmmu" = "no"; then - want_tools=no - else - want_tools=yes - fi -fi - ######################################### # vhost interdependencies and host support @@ -2344,7 +2322,7 @@ fi # check if we have VSS SDK headers for win guest_agent_with_vss="no" -if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ +if test "$mingw32" = "yes" && \ test "$vss_win32_sdk" != "no" ; then case "$vss_win32_sdk" in "") vss_win32_include="-isystem $source_path" ;; @@ -2381,7 +2359,7 @@ fi # VSS provider from the source. It is usually unnecessary because the # pre-compiled .tlb file is included. -if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \ +if test "$mingw32" = "yes" && \ test "$guest_agent_with_vss" = "yes" ; then if test -z "$win_sdk"; then programfiles="$PROGRAMFILES" @@ -2399,7 +2377,7 @@ fi ########################################## # check if mingw environment provides a recent ntddscsi.h guest_agent_ntddscsi="no" -if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then +if test "$mingw32" = "yes"; then cat > $TMPC << EOF #include #include @@ -2825,20 +2803,6 @@ if test "$mingw32" = "yes" ; then done fi -# Probe for guest agent support/options - -if [ "$guest_agent" != "no" ]; then - if [ "$softmmu" = no -a "$want_tools" = no ] ; then - guest_agent=no - elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then - guest_agent=yes - elif [ "$guest_agent" != yes ]; then - guest_agent=no - else - error_exit "Guest agent is not supported on this platform" - fi -fi - # Guest agent Windows MSI package if test "$QEMU_GA_MANUFACTURER" = ""; then @@ -2968,12 +2932,6 @@ fi if test "$static" = "yes" ; then echo "CONFIG_STATIC=y" >> $config_host_mak fi -if test "$want_tools" = "yes" ; then - echo "CONFIG_TOOLS=y" >> $config_host_mak -fi -if test "$guest_agent" = "yes" ; then - echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak -fi echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak qemu_version=$(head $source_path/VERSION) diff --git a/contrib/vhost-user-gpu/meson.build b/contrib/vhost-user-gpu/meson.build index 92c8f3a86a..b4e26045da 100644 --- a/contrib/vhost-user-gpu/meson.build +++ b/contrib/vhost-user-gpu/meson.build @@ -1,4 +1,4 @@ -if 'CONFIG_TOOLS' in config_host and virgl.found() and gbm.found() \ +if have_tools and virgl.found() and gbm.found() \ and 'CONFIG_LINUX' in config_host and pixman.found() executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'), dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl], diff --git a/docs/meson.build b/docs/meson.build index 57b28a3146..831d4aea2b 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -37,8 +37,6 @@ endif if build_docs SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']] - have_ga = have_tools and config_host.has_key('CONFIG_GUEST_AGENT') - man_pages = { 'qemu-ga.8': (have_ga ? 'man8' : ''), 'qemu-ga-ref.7': (have_ga ? 'man7' : ''), diff --git a/meson.build b/meson.build index 7b3cfb6316..b9bedf928a 100644 --- a/meson.build +++ b/meson.build @@ -44,21 +44,7 @@ config_host_data = configuration_data() genh = [] qapi_trace_events = [] -target_dirs = config_host['TARGET_DIRS'].split() -have_linux_user = false -have_bsd_user = false -have_system = false -foreach target : target_dirs - have_linux_user = have_linux_user or target.endswith('linux-user') - have_bsd_user = have_bsd_user or target.endswith('bsd-user') - have_system = have_system or target.endswith('-softmmu') -endforeach -have_user = have_linux_user or have_bsd_user -have_tools = 'CONFIG_TOOLS' in config_host -have_block = have_system or have_tools - -python = import('python').find_installation() - +bsd_oses = ['gnu/kfreebsd', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'darwin'] supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux'] supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64', 'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc', 'sparc64'] @@ -72,6 +58,28 @@ endif targetos = host_machine.system() +target_dirs = config_host['TARGET_DIRS'].split() +have_linux_user = false +have_bsd_user = false +have_system = false +foreach target : target_dirs + have_linux_user = have_linux_user or target.endswith('linux-user') + have_bsd_user = have_bsd_user or target.endswith('bsd-user') + have_system = have_system or target.endswith('-softmmu') +endforeach +have_user = have_linux_user or have_bsd_user +have_tools = get_option('tools') \ + .disable_auto_if(not have_system) \ + .allowed() +have_ga = get_option('guest_agent') \ + .disable_auto_if(not have_system and not have_tools) \ + .require(targetos in ['sunos', 'linux', 'windows'], + error_message: 'unsupported OS for QEMU guest agent') \ + .allowed() +have_block = have_system or have_tools + +python = import('python').find_installation() + if cpu not in supported_cpus host_arch = 'unknown' elif cpu == 'x86' @@ -3214,11 +3222,7 @@ if 'CONFIG_PLUGIN' in config_host install_headers('include/qemu/qemu-plugin.h') endif -if 'CONFIG_GUEST_AGENT' in config_host - subdir('qga') -elif get_option('guest_agent_msi').enabled() - error('Guest agent MSI requested, but the guest agent is not being built') -endif +subdir('qga') # Don't build qemu-keymap if xkbcommon is not explicitly enabled # when we don't build tools or system @@ -3341,7 +3345,7 @@ if config_host.has_key('HAVE_GDB_BIN') summary_info += {'gdb': config_host['HAVE_GDB_BIN']} endif summary_info += {'genisoimage': config_host['GENISOIMAGE']} -if targetos == 'windows' and config_host.has_key('CONFIG_GUEST_AGENT') +if targetos == 'windows' and have_ga summary_info += {'wixl': wixl} endif if slirp_opt != 'disabled' and have_system @@ -3379,7 +3383,7 @@ summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')} summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server} summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')} summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')} -summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')} +summary_info += {'build guest agent': have_ga} summary(summary_info, bool_yn: true, section: 'Configurable features') # Compilation information @@ -3589,7 +3593,7 @@ summary_info += {'GBM': gbm} summary_info += {'libiscsi support': libiscsi} summary_info += {'libnfs support': libnfs} if targetos == 'windows' - if config_host.has_key('CONFIG_GUEST_AGENT') + if have_ga summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')} summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')} endif diff --git a/meson_options.txt b/meson_options.txt index 368b2cf783..be7778b3a2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -36,8 +36,12 @@ option('install_blobs', type : 'boolean', value : true, description: 'install provided firmware blobs') option('sparse', type : 'feature', value : 'auto', description: 'sparse checker') +option('guest_agent', type : 'feature', value : 'auto', + description: 'Build QEMU Guest Agent') option('guest_agent_msi', type : 'feature', value : 'auto', description: 'Build MSI package for the QEMU Guest Agent') +option('tools', type : 'feature', value : 'auto', + description: 'build support utilities that come with QEMU') option('malloc_trim', type : 'feature', value : 'auto', description: 'enable libc malloc_trim() for memory optimization') diff --git a/qga/meson.build b/qga/meson.build index 56fb6539e5..97cc391fe1 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -1,3 +1,10 @@ +if not have_ga + if get_option('guest_agent_msi').enabled() + error('Guest agent MSI requested, but the guest agent is not being built') + endif + subdir_done() +endif + all_qga = [] qga_qapi_outputs = [ diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index fb8812693c..4edc611273 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -62,6 +62,7 @@ meson_options_help() { printf "%s\n" ' glusterfs Glusterfs block device driver' printf "%s\n" ' gnutls GNUTLS cryptography support' printf "%s\n" ' gtk GTK+ user interface' + printf "%s\n" ' guest-agent Build QEMU Guest Agent' printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent' printf "%s\n" ' hax HAX acceleration support' printf "%s\n" ' hvf HVF acceleration support' @@ -108,6 +109,7 @@ meson_options_help() { printf "%s\n" ' spice Spice server support' printf "%s\n" ' spice-protocol Spice protocol support' printf "%s\n" ' tcg TCG support' + printf "%s\n" ' tools build support utilities that come with QEMU' printf "%s\n" ' tpm TPM support' printf "%s\n" ' u2f U2F emulation support' printf "%s\n" ' usb-redir libusbredir support' @@ -209,6 +211,8 @@ _meson_option_parse() { --disable-gprof) printf "%s" -Dgprof=false ;; --enable-gtk) printf "%s" -Dgtk=enabled ;; --disable-gtk) printf "%s" -Dgtk=disabled ;; + --enable-guest-agent) printf "%s" -Dguest_agent=enabled ;; + --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;; --enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;; --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=disabled ;; --enable-hax) printf "%s" -Dhax=enabled ;; @@ -315,6 +319,8 @@ _meson_option_parse() { --disable-tcg) printf "%s" -Dtcg=disabled ;; --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;; --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;; + --enable-tools) printf "%s" -Dtools=enabled ;; + --disable-tools) printf "%s" -Dtools=disabled ;; --enable-tpm) printf "%s" -Dtpm=enabled ;; --disable-tpm) printf "%s" -Dtpm=disabled ;; --enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;; diff --git a/tests/Makefile.include b/tests/Makefile.include index 646c8b1334..e7153c8e91 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -150,7 +150,7 @@ check-acceptance: check-acceptance-deprecated-warning | check-avocado .PHONY: check-block check check-clean get-vm-images check: -ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy) +ifneq ($(.check-block.deps),) check: check-block check-block: run-ninja $(if $(MAKE.n),,+)$(MESON) test $(MTESTARGS) $(.mtestargs) --verbose \ diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 0959061faf..3a51759ebc 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -149,9 +149,7 @@ if have_system endif endif -if 'CONFIG_TSAN' not in config_host and \ - 'CONFIG_GUEST_AGENT' in config_host and \ - 'CONFIG_LINUX' in config_host +if have_ga and targetos == 'linux' and 'CONFIG_TSAN' not in config_host tests += {'test-qga': ['../qtest/libqtest.c']} test_deps += {'test-qga': qga} endif From 0265fe9e21bb98f7401fd2364c2b57c9adaaa4ff Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 17 Dec 2021 12:36:26 +0100 Subject: [PATCH 19/29] meson: refine check for whether to look for virglrenderer The check should be performed even if !have_system, as long as there is some hope that vhost-user-gpu will be built. Store into have_vhost_user_gpu whether vhost-user-gpu will be built; we will also use the variable to decide whether to look for libepoxy. Signed-off-by: Paolo Bonzini --- contrib/vhost-user-gpu/meson.build | 3 +-- meson.build | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/vhost-user-gpu/meson.build b/contrib/vhost-user-gpu/meson.build index b4e26045da..c8883c2d8e 100644 --- a/contrib/vhost-user-gpu/meson.build +++ b/contrib/vhost-user-gpu/meson.build @@ -1,5 +1,4 @@ -if have_tools and virgl.found() and gbm.found() \ - and 'CONFIG_LINUX' in config_host and pixman.found() +if have_vhost_user_gpu executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'), dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl], install: true, diff --git a/meson.build b/meson.build index b9bedf928a..5ad346816e 100644 --- a/meson.build +++ b/meson.build @@ -621,7 +621,9 @@ if not get_option('zstd').auto() or have_block method: 'pkg-config', kwargs: static_kwargs) endif virgl = not_found -if not get_option('virglrenderer').auto() or have_system + +have_vhost_user_gpu = have_tools and targetos == 'linux' and pixman.found() +if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu virgl = dependency('virglrenderer', method: 'pkg-config', required: get_option('virglrenderer'), @@ -1000,6 +1002,7 @@ if (have_system or have_tools) and (virgl.found() or opengl.found()) gbm = dependency('gbm', method: 'pkg-config', required: false, kwargs: static_kwargs) endif +have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and gbm.found() gnutls = not_found gnutls_crypto = not_found From fa142ec89a71a238662474f0643ac22a99712afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 1 Feb 2022 16:21:47 +0400 Subject: [PATCH 20/29] qga/vss-win32: fix midl arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Microsoft midl compiler doesn't take "-options" form, nor does it take OUTPUT filename. The -I option seems needless as well (at least with VS15). It's not clear what was actually used when it was introduced in commit b39297aedfabe9. strings says "Created by MIDL version 7.00.0555 at Fri Dec 21 13:36:39 2012". I doubt the makefile rule actually ever worked. Signed-off-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- qga/vss-win32/meson.build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build index 90825edef3..78bdf5e74a 100644 --- a/qga/vss-win32/meson.build +++ b/qga/vss-win32/meson.build @@ -26,8 +26,7 @@ if midl.found() gen_tlb = custom_target('gen-tlb', input: 'qga-vss.idl', output: 'qga-vss.tlb', - command: [midl, '-tlb', '-I' + config_host['WIN_SDK'], - '@INPUT@', '@OUTPUT@']) + command: [midl, '@INPUT@', '/tlb', '@OUTPUT@']) else gen_tlb = custom_target('gen-tlb', input: 'qga-vss.tlb', From 71bc6dfbe6c0403389908edab073e18646054560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 1 Feb 2022 16:29:22 +0400 Subject: [PATCH 21/29] meson: drop --with-win-sdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's no longer used. Signed-off-by: Marc-André Lureau Signed-off-by: Paolo Bonzini --- configure | 29 ----------------------------- meson.build | 5 ----- 2 files changed, 34 deletions(-) diff --git a/configure b/configure index a66e2c0d71..eab34eb3fd 100755 --- a/configure +++ b/configure @@ -318,7 +318,6 @@ trace_backends="log" trace_file="trace" opengl="$default_feature" vss_win32_sdk="$default_feature" -win_sdk="no" coroutine="" tls_priority="NORMAL" plugins="$default_feature" @@ -964,12 +963,6 @@ for opt do ;; --without-vss-sdk) vss_win32_sdk="no" ;; - --with-win-sdk) win_sdk="" - ;; - --with-win-sdk=*) win_sdk="$optarg" - ;; - --without-win-sdk) win_sdk="no" - ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 ;; @@ -2353,27 +2346,6 @@ EOF fi fi -########################################## -# lookup Windows platform SDK (if not specified) -# The SDK is needed only to build .tlb (type library) file of guest agent -# VSS provider from the source. It is usually unnecessary because the -# pre-compiled .tlb file is included. - -if test "$mingw32" = "yes" && \ - test "$guest_agent_with_vss" = "yes" ; then - if test -z "$win_sdk"; then - programfiles="$PROGRAMFILES" - test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432" - if test -n "$programfiles"; then - win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null - else - feature_not_found "Windows SDK" - fi - elif test "$win_sdk" = "no"; then - win_sdk="" - fi -fi - ########################################## # check if mingw environment provides a recent ntddscsi.h guest_agent_ntddscsi="no" @@ -2905,7 +2877,6 @@ if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=y" >> $config_host_mak if test "$guest_agent_with_vss" = "yes" ; then echo "CONFIG_QGA_VSS=y" >> $config_host_mak - echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak fi if test "$guest_agent_ntddscsi" = "yes" ; then echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak diff --git a/meson.build b/meson.build index 5ad346816e..20d599034b 100644 --- a/meson.build +++ b/meson.build @@ -3403,11 +3403,6 @@ endif if targetos == 'darwin' summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())} endif -if targetos == 'windows' - if 'WIN_SDK' in config_host - summary_info += {'Windows SDK': config_host['WIN_SDK']} - endif -endif summary_info += {'CFLAGS': ' '.join(get_option('c_args') + ['-O' + get_option('optimization')] + (get_option('debug') ? ['-g'] : []))} From 1dbb74e86f15116a72996bf9614baf29a0a43b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 1 Feb 2022 12:53:15 +0400 Subject: [PATCH 22/29] qga/vss-win32: use widl if available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit widl from mingw64-tools and wine can compile a TLB file. Signed-off-by: Marc-André Lureau Reviewed-by: Konstantin Kostiuk Signed-off-by: Paolo Bonzini --- qga/vss-win32/meson.build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build index 78bdf5e74a..8f3aff5fe3 100644 --- a/qga/vss-win32/meson.build +++ b/qga/vss-win32/meson.build @@ -18,15 +18,18 @@ if add_languages('cpp', required: false) all_qga += qga_vss endif -# rules to build qga-vss.tlb -# Currently, only native build is supported because building .tlb -# (TypeLibrary) from .idl requires WindowsSDK and MIDL (and cl.exe in VC++). midl = find_program('midl', required: false) +widl = find_program('widl', required: false) if midl.found() gen_tlb = custom_target('gen-tlb', input: 'qga-vss.idl', output: 'qga-vss.tlb', command: [midl, '@INPUT@', '/tlb', '@OUTPUT@']) +elif widl.found() + gen_tlb = custom_target('gen-tlb', + input: 'qga-vss.idl', + output: 'qga-vss.tlb', + command: [widl, '-t', '@INPUT@', '-o', '@OUTPUT@']) else gen_tlb = custom_target('gen-tlb', input: 'qga-vss.tlb', From 61fb0bd1f6eaec5f9715031df79c7bbba72acbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 31 Jan 2022 23:47:37 +0400 Subject: [PATCH 23/29] qga/vss: use standard windows headers location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stop using special paths with outdated headers from an old SDK. Instead, use standard include paths. You can still build against the old SDK by running configure with --extra-cxxflags="-isystem /path/to/inc/win2003/" (this also allows to build against MinGW headers, which are currently broken as in 9.0) Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- qga/vss-win32/install.cpp | 2 +- qga/vss-win32/provider.cpp | 4 ++-- qga/vss-win32/requester.cpp | 4 ++-- qga/vss-win32/vss-common.h | 6 +----- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp index 40de133774..efc5bb9909 100644 --- a/qga/vss-win32/install.cpp +++ b/qga/vss-win32/install.cpp @@ -13,7 +13,7 @@ #include "qemu/osdep.h" #include "vss-common.h" -#include +#include #include "install.h" #include #include diff --git a/qga/vss-win32/provider.cpp b/qga/vss-win32/provider.cpp index 72d8b0e19d..fd187fb66f 100644 --- a/qga/vss-win32/provider.cpp +++ b/qga/vss-win32/provider.cpp @@ -12,8 +12,8 @@ #include "qemu/osdep.h" #include "vss-common.h" -#include -#include +#include +#include #define VSS_TIMEOUT_MSEC (60*1000) diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp index 940a2c8f55..4513324dd2 100644 --- a/qga/vss-win32/requester.cpp +++ b/qga/vss-win32/requester.cpp @@ -14,8 +14,8 @@ #include "vss-common.h" #include "requester.h" #include "install.h" -#include -#include +#include +#include /* Max wait time for frozen event (VSS can only hold writes for 10 seconds) */ #define VSS_TIMEOUT_FREEZE_MSEC 60000 diff --git a/qga/vss-win32/vss-common.h b/qga/vss-win32/vss-common.h index 61c170b52e..54f8de8c88 100644 --- a/qga/vss-win32/vss-common.h +++ b/qga/vss-win32/vss-common.h @@ -46,11 +46,7 @@ #undef VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED #undef VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED -/* - * VSS headers must be installed from Microsoft VSS SDK 7.2 available at: - * http://www.microsoft.com/en-us/download/details.aspx?id=23490 - */ -#include +#include #include "vss-handles.h" /* Macros to convert char definitions to wchar */ From 8821a389b1fa2b27bf20245ad059f75482e5f25d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 1 Feb 2022 16:53:43 +0400 Subject: [PATCH 24/29] configure, meson: replace VSS SDK checks and options with --enable-vss-sdk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The VSS headers are part of standard MS VS SDK, at least since version 15, and probably before that. They are also included with MinGW, although currently broken. Let's streamline a bit the options, by not making it so special, and instead rely on proper system headers configuration or user --extra-cxxflags. This still requires some extra step to cross-build with MinGW as described in the meson.build file now. Signed-off-by: Marc-André Lureau [Use a "feature"-type option. - Paolo] Signed-off-by: Paolo Bonzini --- configure | 47 ----------------------------------- meson.build | 10 +++++++- meson_options.txt | 2 ++ qga/meson.build | 21 ++++++++++++++-- scripts/meson-buildoptions.sh | 3 +++ 5 files changed, 33 insertions(+), 50 deletions(-) diff --git a/configure b/configure index eab34eb3fd..e4ec021b7d 100755 --- a/configure +++ b/configure @@ -317,7 +317,6 @@ pie="" trace_backends="log" trace_file="trace" opengl="$default_feature" -vss_win32_sdk="$default_feature" coroutine="" tls_priority="NORMAL" plugins="$default_feature" @@ -957,12 +956,6 @@ for opt do ;; --disable-zlib-test) ;; - --with-vss-sdk) vss_win32_sdk="" - ;; - --with-vss-sdk=*) vss_win32_sdk="$optarg" - ;; - --without-vss-sdk) vss_win32_sdk="no" - ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2 ;; @@ -1225,8 +1218,6 @@ Advanced options (experts only): --with-coroutine=BACKEND coroutine backend. Supported options: ucontext, sigaltstack, windows --enable-gcov enable test coverage analysis with gcov - --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent - --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb) --tls-priority default TLS protocol/cipher priority string --enable-plugins enable plugins via shared library loading @@ -2311,41 +2302,6 @@ EOF fi fi -########################################## -# check if we have VSS SDK headers for win - -guest_agent_with_vss="no" -if test "$mingw32" = "yes" && \ - test "$vss_win32_sdk" != "no" ; then - case "$vss_win32_sdk" in - "") vss_win32_include="-isystem $source_path" ;; - *\ *) # The SDK is installed in "Program Files" by default, but we cannot - # handle path with spaces. So we symlink the headers into ".sdk/vss". - vss_win32_include="-isystem $source_path/.sdk/vss" - symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc" - ;; - *) vss_win32_include="-isystem $vss_win32_sdk" - esac - cat > $TMPC << EOF -#define __MIDL_user_allocate_free_DEFINED__ -#include -int main(void) { return VSS_CTX_BACKUP; } -EOF - if compile_prog "$vss_win32_include" "" ; then - guest_agent_with_vss="yes" - QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" - else - if test "$vss_win32_sdk" != "" ; then - echo "ERROR: Please download and install Microsoft VSS SDK:" - echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490" - echo "ERROR: On POSIX-systems, you can extract the SDK headers by:" - echo "ERROR: scripts/extract-vsssdk-headers setup.exe" - echo "ERROR: The headers are extracted in the directory \`inc'." - feature_not_found "VSS support" - fi - fi -fi - ########################################## # check if mingw environment provides a recent ntddscsi.h guest_agent_ntddscsi="no" @@ -2875,9 +2831,6 @@ if test "$debug_tcg" = "yes" ; then fi if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=y" >> $config_host_mak - if test "$guest_agent_with_vss" = "yes" ; then - echo "CONFIG_QGA_VSS=y" >> $config_host_mak - fi if test "$guest_agent_ntddscsi" = "yes" ; then echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 20d599034b..2818b93d32 100644 --- a/meson.build +++ b/meson.build @@ -1926,6 +1926,14 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + ''' return -1; }''')) +have_vss = false +if targetos == 'windows' and link_language == 'cpp' + have_vss = cxx.compiles(''' + #define __MIDL_user_allocate_free_DEFINED__ + #include + int main(void) { return VSS_CTX_BACKUP; }''') +endif + ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target 'HAVE_GDB_BIN'] arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] @@ -3592,7 +3600,7 @@ summary_info += {'libiscsi support': libiscsi} summary_info += {'libnfs support': libnfs} if targetos == 'windows' if have_ga - summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')} + summary_info += {'QGA VSS support': have_qga_vss} summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')} endif endif diff --git a/meson_options.txt b/meson_options.txt index be7778b3a2..3be830cb49 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -42,6 +42,8 @@ option('guest_agent_msi', type : 'feature', value : 'auto', description: 'Build MSI package for the QEMU Guest Agent') option('tools', type : 'feature', value : 'auto', description: 'build support utilities that come with QEMU') +option('qga_vss', type : 'feature', value: 'auto', + description: 'build QGA VSS support (broken with MinGW)') option('malloc_trim', type : 'feature', value : 'auto', description: 'enable libc malloc_trim() for memory optimization') diff --git a/qga/meson.build b/qga/meson.build index 97cc391fe1..a32c141dd0 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -2,9 +2,26 @@ if not have_ga if get_option('guest_agent_msi').enabled() error('Guest agent MSI requested, but the guest agent is not being built') endif + have_qga_vss = false subdir_done() endif +have_qga_vss = get_option('qga_vss') \ + .require(targetos == 'windows', + error_message: 'VSS support requires Windows') \ + .require(link_language == 'cpp', + error_message: 'VSS support requires a C++ compiler') \ + .require(have_vss, error_message: '''VSS support requires VSS headers. + If your Visual Studio installation doesn't have the VSS headers, + Please download and install Microsoft VSS SDK: + http://www.microsoft.com/en-us/download/details.aspx?id=23490 + On POSIX-systems, MinGW doesn't yet provide working headers. + you can extract the SDK headers by: + $ scripts/extract-vsssdk-headers setup.exe + The headers are extracted in the directory 'inc/win2003'. + Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \ + .allowed() + all_qga = [] qga_qapi_outputs = [ @@ -63,7 +80,7 @@ gen_tlb = [] qga_libs = [] if targetos == 'windows' qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32'] - if 'CONFIG_QGA_VSS' in config_host + if have_qga_vss qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup'] subdir('vss-win32') endif @@ -93,7 +110,7 @@ if targetos == 'windows' if wixl.found() deps = [gen_tlb, qga] qemu_ga_msi_vss = [] - if 'CONFIG_QGA_VSS' in config_host + if have_qga_vss qemu_ga_msi_vss = ['-D', 'InstallVss'] deps += qga_vss endif diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 4edc611273..9ee684ef03 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -20,6 +20,7 @@ meson_options_help() { printf "%s\n" ' --enable-malloc=CHOICE choose memory allocator to use [system] (choices:' printf "%s\n" ' jemalloc/system/tcmalloc)' printf "%s\n" ' --enable-profiler profiler support' + printf "%s\n" ' --enable-qga-vss build QGA VSS support' printf "%s\n" ' --enable-qom-cast-debug cast debugging support' printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and' printf "%s\n" ' getrandom()' @@ -282,6 +283,8 @@ _meson_option_parse() { --disable-qcow1) printf "%s" -Dqcow1=disabled ;; --enable-qed) printf "%s" -Dqed=enabled ;; --disable-qed) printf "%s" -Dqed=disabled ;; + --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;; + --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;; --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;; --disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;; --enable-rbd) printf "%s" -Drbd=enabled ;; From 1e1223249d3ae12023cd6ef811979b26ee6d5584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 2 Feb 2022 00:23:33 +0400 Subject: [PATCH 25/29] meson: do not make qga/vss-win32/meson.build conditional on C++ presence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit C++ presence is checked by the qga/ directory, so it can be assumed when building VSS module. Signed-off-by: Marc-André Lureau Reviewed-by: Konstantin Kostiuk Signed-off-by: Paolo Bonzini --- qga/vss-win32/meson.build | 41 +++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build index 8f3aff5fe3..8d4c5708d8 100644 --- a/qga/vss-win32/meson.build +++ b/qga/vss-win32/meson.build @@ -1,22 +1,29 @@ -if add_languages('cpp', required: false) - glib_dynamic = dependency('glib-2.0', static: false) - link_args = cc.get_supported_link_arguments(['-fstack-protector-all', '-fstack-protector-strong', - '-Wl,--add-stdcall-alias', '-Wl,--enable-stdcall-fixup']) +glib_dynamic = dependency('glib-2.0', static: false) +link_args = cc.get_supported_link_arguments([ + '-fstack-protector-all', + '-fstack-protector-strong', + '-Wl,--add-stdcall-alias', + '-Wl,--enable-stdcall-fixup' +]) - qga_vss = shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 'install.cpp'], - name_prefix: '', - cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'], - link_args: link_args, - vs_module_defs: 'qga-vss.def', - dependencies: [glib_dynamic, socket, - cc.find_library('ole32'), - cc.find_library('oleaut32'), - cc.find_library('shlwapi'), - cc.find_library('uuid'), - cc.find_library('intl')]) +qga_vss = shared_module( + 'qga-vss', + ['requester.cpp', 'provider.cpp', 'install.cpp'], + name_prefix: '', + cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'], + link_args: link_args, + vs_module_defs: 'qga-vss.def', + dependencies: [ + glib_dynamic, socket, + cc.find_library('ole32'), + cc.find_library('oleaut32'), + cc.find_library('shlwapi'), + cc.find_library('uuid'), + cc.find_library('intl') + ] +) - all_qga += qga_vss -endif +all_qga += qga_vss midl = find_program('midl', required: false) widl = find_program('widl', required: false) From 23011f44d79aa982b9dbb21ffabadf0fa89066bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Tue, 1 Feb 2022 12:55:21 +0400 Subject: [PATCH 26/29] qga/vss-win32: require widl/midl, remove pre-built TLB file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are no good reason anymore to keep a pre-built file in the repository. Signed-off-by: Marc-André Lureau Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Konstantin Kostiuk Signed-off-by: Paolo Bonzini --- meson.build | 4 ++++ qga/meson.build | 2 ++ qga/vss-win32/meson.build | 9 +-------- qga/vss-win32/qga-vss.tlb | Bin 1528 -> 0 bytes 4 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 qga/vss-win32/qga-vss.tlb diff --git a/meson.build b/meson.build index 2818b93d32..8d9898c5c3 100644 --- a/meson.build +++ b/meson.build @@ -307,8 +307,12 @@ iokit = [] emulator_link_args = [] nvmm =not_found hvf = not_found +midl = not_found +widl = not_found host_dsosuf = '.so' if targetos == 'windows' + midl = find_program('midl', required: false) + widl = find_program('widl', required: false) socket = cc.find_library('ws2_32') winmm = cc.find_library('winmm') diff --git a/qga/meson.build b/qga/meson.build index a32c141dd0..4ac781cb33 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -20,6 +20,8 @@ have_qga_vss = get_option('qga_vss') \ $ scripts/extract-vsssdk-headers setup.exe The headers are extracted in the directory 'inc/win2003'. Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \ + .require(midl.found() or widl.found(), + error_message: 'VSS support requires midl or widl') \ .allowed() all_qga = [] diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build index 8d4c5708d8..c064a4e245 100644 --- a/qga/vss-win32/meson.build +++ b/qga/vss-win32/meson.build @@ -25,21 +25,14 @@ qga_vss = shared_module( all_qga += qga_vss -midl = find_program('midl', required: false) -widl = find_program('widl', required: false) if midl.found() gen_tlb = custom_target('gen-tlb', input: 'qga-vss.idl', output: 'qga-vss.tlb', command: [midl, '@INPUT@', '/tlb', '@OUTPUT@']) -elif widl.found() +else gen_tlb = custom_target('gen-tlb', input: 'qga-vss.idl', output: 'qga-vss.tlb', command: [widl, '-t', '@INPUT@', '-o', '@OUTPUT@']) -else - gen_tlb = custom_target('gen-tlb', - input: 'qga-vss.tlb', - output: 'qga-vss.tlb', - command: ['cp', '@INPUT@', '@OUTPUT@']) endif diff --git a/qga/vss-win32/qga-vss.tlb b/qga/vss-win32/qga-vss.tlb deleted file mode 100644 index 226452a1861371ffe0cad1019cf90fdfdcd5ef49..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1528 zcmeYbb_-!*U}OLRP8Kl5;0UB3A_y8H!@$4OPh6a(1_GM|T)fx!kz-UGh_rLWKC!yoBjb#vz`9Lwu4+R-SJ!kIOX4xLBUUGN9-NyTyP76j}@n z2f!qQ8-xepfXD+7rW+{SKz4&@7#qX~^1#sn3O|tFK>%ciE<&_Q3PuKoMqI)S5zj9Ngog_= gXfrXehlhjmFbIJB4$8MKU>*YlD1Z9^F{m5{03Vre%>V!Z From e23460ce921168b4172af83043e87ca9bd85e43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 2 Feb 2022 10:14:49 +0100 Subject: [PATCH 27/29] meson: require dynamic linking for VSS support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The glib_dynamic detection does not work because the dependency is overridden in the main meson.build. Signed-off-by: Marc-André Lureau [Rewritten commit message, added requirement in qga/meson.build - Paolo] Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Konstantin Kostiuk Signed-off-by: Paolo Bonzini --- qga/meson.build | 2 ++ qga/vss-win32/meson.build | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qga/meson.build b/qga/meson.build index 4ac781cb33..d22ecb4187 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -22,6 +22,8 @@ have_qga_vss = get_option('qga_vss') \ Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \ .require(midl.found() or widl.found(), error_message: 'VSS support requires midl or widl') \ + .require(not enable_static, + error_message: 'VSS support requires dynamic linking with GLib') \ .allowed() all_qga = [] diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build index c064a4e245..71c50d0866 100644 --- a/qga/vss-win32/meson.build +++ b/qga/vss-win32/meson.build @@ -1,4 +1,3 @@ -glib_dynamic = dependency('glib-2.0', static: false) link_args = cc.get_supported_link_arguments([ '-fstack-protector-all', '-fstack-protector-strong', @@ -14,7 +13,8 @@ qga_vss = shared_module( link_args: link_args, vs_module_defs: 'qga-vss.def', dependencies: [ - glib_dynamic, socket, + glib, + socket, cc.find_library('ole32'), cc.find_library('oleaut32'), cc.find_library('shlwapi'), From b7e4ab15c37424aac14a3492662fa26364269eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 2 Feb 2022 10:19:04 +0100 Subject: [PATCH 28/29] meson, configure: move ntddscsi API check to meson MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau Reviewed-by: Konstantin Kostiuk Signed-off-by: Paolo Bonzini --- configure | 23 ----------------------- meson.build | 18 +++++++++++++++++- qga/commands-win32.c | 6 +++--- qga/meson.build | 2 +- 4 files changed, 21 insertions(+), 28 deletions(-) diff --git a/configure b/configure index e4ec021b7d..8b078c21e2 100755 --- a/configure +++ b/configure @@ -2302,26 +2302,6 @@ EOF fi fi -########################################## -# check if mingw environment provides a recent ntddscsi.h -guest_agent_ntddscsi="no" -if test "$mingw32" = "yes"; then - cat > $TMPC << EOF -#include -#include -int main(void) { -#if !defined(IOCTL_SCSI_GET_ADDRESS) -#error Missing required ioctl definitions -#endif - SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; - return addr.Lun; -} -EOF - if compile_prog "" "" ; then - guest_agent_ntddscsi=yes - fi -fi - ########################################## # capstone @@ -2831,9 +2811,6 @@ if test "$debug_tcg" = "yes" ; then fi if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=y" >> $config_host_mak - if test "$guest_agent_ntddscsi" = "yes" ; then - echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak - fi echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak diff --git a/meson.build b/meson.build index 8d9898c5c3..aefe8681b9 100644 --- a/meson.build +++ b/meson.build @@ -1938,6 +1938,22 @@ if targetos == 'windows' and link_language == 'cpp' int main(void) { return VSS_CTX_BACKUP; }''') endif +have_ntddscsi = false +if targetos == 'windows' + have_ntddscsi = cc.compiles(''' + #include + #include + int main(void) { + #if !defined(IOCTL_SCSI_GET_ADDRESS) + #error Missing required ioctl definitions + #endif + SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 }; + return addr.Lun; + } +''') +endif +config_host_data.set('HAVE_NTDDSCSI', have_ntddscsi) + ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target 'HAVE_GDB_BIN'] arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] @@ -3605,7 +3621,7 @@ summary_info += {'libnfs support': libnfs} if targetos == 'windows' if have_ga summary_info += {'QGA VSS support': have_qga_vss} - summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')} + summary_info += {'QGA w32 disk info': have_ntddscsi} endif endif summary_info += {'seccomp support': seccomp} diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 484cb1c6bd..4fbbad793f 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -18,7 +18,7 @@ #include #include #include -#ifdef CONFIG_QGA_NTDDSCSI +#ifdef HAVE_NTDDSCSI #include #include #endif @@ -474,7 +474,7 @@ void qmp_guest_file_flush(int64_t handle, Error **errp) } } -#ifdef CONFIG_QGA_NTDDSCSI +#ifdef HAVE_NTDDSCSI static GuestDiskBusType win2qemu[] = { [BusTypeUnknown] = GUEST_DISK_BUS_TYPE_UNKNOWN, @@ -1111,7 +1111,7 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp) return NULL; } -#endif /* CONFIG_QGA_NTDDSCSI */ +#endif /* HAVE_NTDDSCSI */ static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp) { diff --git a/qga/meson.build b/qga/meson.build index d22ecb4187..54f2da5b07 100644 --- a/qga/meson.build +++ b/qga/meson.build @@ -88,7 +88,7 @@ if targetos == 'windows' qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup'] subdir('vss-win32') endif - if 'CONFIG_QGA_NTDDSCSI' in config_host + if have_ntddscsi qga_libs += ['-lsetupapi', '-lcfgmgr32'] endif endif From 5dc4618e781f36c4bea1b0cdd1bea75b48640c5a Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 13 Oct 2021 13:19:00 +0200 Subject: [PATCH 29/29] configure, meson: move CONFIG_IASL to a Meson option Signed-off-by: Paolo Bonzini --- configure | 4 +--- meson.build | 12 ++++++++---- meson_options.txt | 2 ++ scripts/meson-buildoptions.py | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 8b078c21e2..6d34ff8873 100755 --- a/configure +++ b/configure @@ -2969,9 +2969,6 @@ echo "MESON=$meson" >> $config_host_mak echo "NINJA=$ninja" >> $config_host_mak echo "CC=$cc" >> $config_host_mak echo "HOST_CC=$host_cc" >> $config_host_mak -if $iasl -h > /dev/null 2>&1; then - echo "CONFIG_IASL=$iasl" >> $config_host_mak -fi echo "AR=$ar" >> $config_host_mak echo "AS=$as" >> $config_host_mak echo "CCAS=$ccas" >> $config_host_mak @@ -3189,6 +3186,7 @@ if test "$skip_meson" = no; then -Daudio_drv_list=$audio_drv_list \ -Ddefault_devices=$default_devices \ -Ddocdir="$docdir" \ + -Diasl="$($iasl -h >/dev/null 2>&1 && printf %s "$iasl")" \ -Dqemu_firmwarepath="$firmwarepath" \ -Dqemu_suffix="$qemu_suffix" \ -Dsmbd="$smbd" \ diff --git a/meson.build b/meson.build index aefe8681b9..8df40bfac4 100644 --- a/meson.build +++ b/meson.build @@ -1463,7 +1463,9 @@ foreach k : get_option('trace_backends') config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true) endforeach config_host_data.set_quoted('CONFIG_TRACE_FILE', get_option('trace_file')) - +if get_option('iasl') != '' + config_host_data.set_quoted('CONFIG_IASL', get_option('iasl')) +endif config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_option('bindir')) config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix')) config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir) @@ -1957,7 +1959,6 @@ config_host_data.set('HAVE_NTDDSCSI', have_ntddscsi) ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target 'HAVE_GDB_BIN'] arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST'] -strings = ['CONFIG_IASL'] foreach k, v: config_host if ignored.contains(k) # do nothing @@ -1966,8 +1967,6 @@ foreach k, v: config_host v = '"' + '", "'.join(v.split()) + '", ' endif config_host_data.set(k, v) - elif strings.contains(k) - config_host_data.set_quoted(k, v) elif k.startswith('CONFIG_') config_host_data.set(k, v == 'y' ? 1 : v) endif @@ -3375,6 +3374,11 @@ summary_info += {'sphinx-build': sphinx_build} if config_host.has_key('HAVE_GDB_BIN') summary_info += {'gdb': config_host['HAVE_GDB_BIN']} endif +if get_option('iasl') != '' + summary_info += {'iasl': get_option('iasl')} +else + summary_info += {'iasl': false} +endif summary_info += {'genisoimage': config_host['GENISOIMAGE']} if targetos == 'windows' and have_ga summary_info += {'wixl': wixl} diff --git a/meson_options.txt b/meson_options.txt index 3be830cb49..52b11cead4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -12,6 +12,8 @@ option('smbd', type : 'string', value : '', description: 'Path to smbd for slirp networking') option('sphinx_build', type : 'string', value : '', description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)') +option('iasl', type : 'string', value : '', + description: 'Path to ACPI disassembler') option('default_devices', type : 'boolean', value : true, description: 'Include a default selection of devices in emulators') option('audio_drv_list', type: 'array', value: ['default'], diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py index 01b10f7ae0..693be7b966 100755 --- a/scripts/meson-buildoptions.py +++ b/scripts/meson-buildoptions.py @@ -30,6 +30,7 @@ SKIP_OPTIONS = { "default_devices", "docdir", "fuzzing_engine", + "iasl", "qemu_firmwarepath", "qemu_suffix", "smbd",