From nobody Mon Feb 9 23:58:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601887088; cv=none; d=zohomail.com; s=zohoarc; b=Uo2a68qOBN76N0YBN076deMLxcG3mbDw5xZLOmvYt7ZjLVJ0mGXlx/6YZJrnj6J072e0I0tiHX9de40Wb4b9AEJtjJ61RPiv+ze1jsipRF27aMp9zYeh/buTzXhurf2vqqIULg8TMDH3exZZCVSmwlaz4d/ZreXAckgfa7Bwj6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601887088; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yyAn2X5gNLEr4LrjnrhwbqSu3U/sDgUOjbCKHr97wSo=; b=YhqNa4l9jNT4y9lqFKpt4oSUyoFQ3wLffMhYDLdyIOFIqkItLizDcz0GBqyu878TiJDC+/MTWuGApIHiSMM6/gv+2KUGeCyjW2Igj05RByxoWhCA2KGXLrvxlOBclOG5kxswncFu82jGkvgmAqKHRQDPOCgjpQgmA7EADloJiE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1601887088903972.9950807818691; Mon, 5 Oct 2020 01:38:08 -0700 (PDT) Received: from localhost ([::1]:60768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPM0V-0006Wn-M6 for importer@patchew.org; Mon, 05 Oct 2020 04:38:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPLmq-00081X-3T for qemu-devel@nongnu.org; Mon, 05 Oct 2020 04:24:00 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:40873) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPLmm-0007JB-Bt for qemu-devel@nongnu.org; Mon, 05 Oct 2020 04:23:59 -0400 Received: by mail-wr1-x432.google.com with SMTP id j2so8483745wrx.7 for ; Mon, 05 Oct 2020 01:23:53 -0700 (PDT) Received: from localhost.localdomain ([2001:b07:6468:f312:2e86:3d8b:8b70:920c]) by smtp.gmail.com with ESMTPSA id z15sm11931434wrv.94.2020.10.05.01.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Oct 2020 01:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yyAn2X5gNLEr4LrjnrhwbqSu3U/sDgUOjbCKHr97wSo=; b=JLBT0IdU02Z0gqMJcrZPlVl+RWAqkdopzgLLWp8qcKCzTo8sEd4KhtwjtylcrT1+SW 738Vmn6M4hNvO8f8lJs+OP44JnLfs+FL+YjFNsT74LZ3yVZLj7ho95lx9KQ6bEgvnsNP KyTrKHACtcs4iGDTr1YhuWJY1tTn5rcN78d4/jZpKrpy8Dm+/xjNw7gVwXpvwo1bLlOk NIt13RsGNCmIcd8pQMA48YfVr7vObcjKGUH8ywK5+ELgrFlV/B9CjX9eokdHM4sDIky3 lEyua4PtMhACkZPg1FKcNDkMP17NSo1cGTaa2e/mnTN2RxD4ZmGtMpWYLHSgcoT2ekNa xwiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yyAn2X5gNLEr4LrjnrhwbqSu3U/sDgUOjbCKHr97wSo=; b=NLTiDdt4qM7UEE+Au6fu90RJ3g1mNPJgOIAfe/5/njdN5sun9J6uhvbSq+pxveVTBY +ZKM8lD/nsoXxP96cuNppbML+vhDLfBjJ8pfggR53feUKqoLvO/FF3SLTSMtaOrdiriY kFNvS/ZlmA3kHjtR6GYkvqHhDv9A7lmOCkhzafoxHzpB1CgTn0rftF0hoxbcjx016nuZ GqCy/cv3AwOtUtmaDE76+01LSOr0vwdupUyhNRLhVjuHf5edoyKFpAuEIODjT1cVY71R zsDSOJwARigrpYnnVkGQTwAbM6GmidcO6EqkKpp+4UmwsYimxEaEJ8VGHM/pesLUjvNN bpuQ== X-Gm-Message-State: AOAM532edjqM4A6yoHCiareQ+wWEVoko0J/IPb2I5kjwmg8d1ZmpKIbF 7/ee7MXm7wegtTw597DLE9gDqtLrE2w= X-Google-Smtp-Source: ABdhPJy4A58slc0PyiCivANm8UK2nW7UW9Ftke0kA3ZQauOeqn6ATlQX4XTRYHLuxMwpo9wEM6cCsg== X-Received: by 2002:a5d:5486:: with SMTP id h6mr16640318wrv.415.1601886232794; Mon, 05 Oct 2020 01:23:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/19] configure: move accelerator logic to meson Date: Mon, 5 Oct 2020 10:23:35 +0200 Message-Id: <20201005082349.354095-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201005082349.354095-1-pbonzini@redhat.com> References: <20201005082349.354095-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x432.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Move to meson the code to detect the presence of accelerators, and to define accelerator-specific config-target.h symbols. The logic for now is duplicated in configure because it is still in use to build the list of targets (which is in turn used to create the config-target.mak files). The next patches remove it. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- configure | 19 --------- meson.build | 109 ++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 94 insertions(+), 34 deletions(-) diff --git a/configure b/configure index 9dec87e186..9224ac47e6 100755 --- a/configure +++ b/configure @@ -6842,7 +6842,6 @@ if test "$optreset" =3D "yes" ; then echo "HAVE_OPTRESET=3Dy" >> $config_host_mak fi if test "$tcg" =3D "enabled"; then - echo "CONFIG_TCG=3Dy" >> $config_host_mak if test "$tcg_interpreter" =3D "yes" ; then echo "CONFIG_TCG_INTERPRETER=3Dy" >> $config_host_mak fi @@ -7622,24 +7621,6 @@ if [ "$TARGET_SYSTBL_ABI" !=3D "" ]; then echo "TARGET_SYSTBL=3D$TARGET_SYSTBL" >> $config_target_mak fi =20 -if supported_xen_target $target; then - echo "CONFIG_XEN=3Dy" >> $config_target_mak - if test "$xen_pci_passthrough" =3D enabled; then - echo "CONFIG_XEN_PCI_PASSTHROUGH=3Dy" >> "$config_target_mak" - fi -fi -if supported_kvm_target $target; then - echo "CONFIG_KVM=3Dy" >> $config_target_mak -fi -if supported_hax_target $target; then - echo "CONFIG_HAX=3Dy" >> $config_target_mak -fi -if supported_hvf_target $target; then - echo "CONFIG_HVF=3Dy" >> $config_target_mak -fi -if supported_whpx_target $target; then - echo "CONFIG_WHPX=3Dy" >> $config_target_mak -fi if test "$target_aligned_only" =3D "yes" ; then echo "TARGET_ALIGNED_ONLY=3Dy" >> $config_target_mak fi diff --git a/meson.build b/meson.build index 41e5763e75..43ce1272b9 100644 --- a/meson.build +++ b/meson.build @@ -50,6 +50,28 @@ configure_file(input: files('scripts/ninjatool.py'), output: 'ninjatool', configuration: config_host) =20 +if cpu in ['x86', 'x86_64'] + kvm_targets =3D ['i386-softmmu', 'x86_64-softmmu'] +elif cpu =3D=3D 'aarch64' + kvm_targets =3D ['aarch64-softmmu'] +elif cpu =3D=3D 's390x' + kvm_targets =3D ['s390x-softmmu'] +elif cpu in ['ppc', 'ppc64'] + kvm_targets =3D ['ppc-softmmu', 'ppc64-softmmu'] +else + kvm_targets =3D [] +endif + +accelerator_targets =3D { 'CONFIG_KVM': kvm_targets } +if cpu in ['x86', 'x86_64'] + accelerator_targets +=3D { + 'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'], + 'CONFIG_HVF': ['x86_64-softmmu'], + 'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'], + } +endif + ################## # Compiler flags # ################## @@ -103,7 +125,7 @@ version_res =3D [] coref =3D [] iokit =3D [] cocoa =3D not_found -hvf =3D [] +hvf =3D not_found if targetos =3D=3D 'windows' socket =3D cc.find_library('ws2_32') winmm =3D cc.find_library('winmm') @@ -116,7 +138,6 @@ elif targetos =3D=3D 'darwin' coref =3D dependency('appleframeworks', modules: 'CoreFoundation') iokit =3D dependency('appleframeworks', modules: 'IOKit') cocoa =3D dependency('appleframeworks', modules: 'Cocoa', required: get_= option('cocoa')) - hvf =3D dependency('appleframeworks', modules: 'Hypervisor') elif targetos =3D=3D 'sunos' socket =3D [cc.find_library('socket'), cc.find_library('nsl'), @@ -127,6 +148,64 @@ elif targetos =3D=3D 'haiku' cc.find_library('bsd')] endif =20 +accelerators =3D [] +if not get_option('kvm').disabled() and targetos =3D=3D 'linux' + accelerators +=3D 'CONFIG_KVM' +endif +if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host + accelerators +=3D 'CONFIG_XEN' + have_xen_pci_passthrough =3D not get_option('xen_pci_passthrough').disab= led() and targetos =3D=3D 'linux' +else + have_xen_pci_passthrough =3D false +endif +if not get_option('whpx').disabled() and targetos =3D=3D 'windows' + if get_option('whpx').enabled() and cpu !=3D 'x86_64' + error('WHPX requires 64-bit host') + elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \ + cc.has_header('WinHvEmulation.h', required: get_option('whpx')) + accelerators +=3D 'CONFIG_WHPX' + endif +endif +if not get_option('hvf').disabled() + hvf =3D dependency('appleframeworks', modules: 'Hypervisor', + required: get_option('hvf')) + if hvf.found() + accelerators +=3D 'CONFIG_HVF' + endif +endif +if not get_option('hax').disabled() + if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'net= bsd'] + accelerators +=3D 'CONFIG_HAX' + endif +endif +if not get_option('tcg').disabled() + if cpu not in supported_cpus + if 'CONFIG_TCG_INTERPRETER' in config_host + warning('Unsupported CPU @0@, will use TCG with TCI (experimental)'.= format(cpu)) + else + error('Unsupported CPU @0@, try --enable-tcg-interpreter'.format(cpu= )) + endif + endif + accelerators +=3D 'CONFIG_TCG' + config_host +=3D { 'CONFIG_TCG': 'y' } +endif + +if 'CONFIG_KVM' not in accelerators and get_option('kvm').enabled() + error('KVM not available on this platform') +endif +if 'CONFIG_HVF' not in accelerators and get_option('hvf').enabled() + error('HVF not available on this platform') +endif +if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled() + error('WHPX not available on this platform') +endif +if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enab= led() + if 'CONFIG_XEN' in accelerators + error('Xen PCI passthrough not available on this platform') + else + error('Xen PCI passthrough requested but Xen not enabled') + endif +endif if not cocoa.found() and get_option('cocoa').enabled() error('Cocoa not available on this platform') endif @@ -641,17 +720,22 @@ kconfig_external_symbols =3D [ ] ignored =3D ['TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_DIRS'] =20 -accel_symbols =3D [ - 'CONFIG_KVM', - 'CONFIG_HAX', - 'CONFIG_HVF', - 'CONFIG_TCG', - 'CONFIG_WHPX' -] - foreach target : target_dirs config_target =3D keyval.load(meson.current_build_dir() / target / 'conf= ig-target.mak') =20 + have_accel =3D false + foreach sym: accelerators + if sym =3D=3D 'CONFIG_TCG' or target in accelerator_targets.get(sym, [= ]) + config_target +=3D { sym: 'y' } + config_all +=3D { sym: 'y' } + if sym =3D=3D 'CONFIG_XEN' and have_xen_pci_passthrough + config_target +=3D { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' } + endif + have_accel =3D true + endif + endforeach + assert(have_accel) + foreach k, v: disassemblers if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARC= H'].startswith(k) foreach sym: v @@ -677,11 +761,6 @@ foreach target : target_dirs config_target_data.set(k, v) endif endforeach - foreach sym: accel_symbols - if config_target.has_key(sym) - config_all +=3D { sym: 'y' } - endif - endforeach config_target_h +=3D {target: configure_file(output: target + '-config-t= arget.h', configuration: config_targe= t_data)} =20 --=20 2.26.2