From nobody Sun Nov 16 16:28:49 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1600852845; cv=none; d=zohomail.com; s=zohoarc; b=jinwrouZj0Z5xVcm1/eZbFzW9VVm9R2FCqOWT0EU0/iTMn02zQYE+o+55xwv2HJAi0935QCV3LDtnlBXHDQfTzDEY+Ue8AMugArXHZKV9eaAAG+JAxEvZ9bf00TLg6dmACYkT5Oea0YaQE6otbgdqlDgpZljIx6wHQf4PfOURxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600852845; h=Content-Type: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=csQxNiFZcnC9TBP3b4tvHjusdp7fACDXz4/V7nvvILU=; b=ZDAiBV9Og6ckw2KPeZH0vEihjMSS4RhEyk1qvmCvrAaakB8nOlKGRMKWRCA3yYlirltax1dO8mVbIIshSfeEtlB/+9tH1Kilb8Ov11ji7hmUf9+OddE3TJSuIsqwLNG08yQBdLh+rWQ7m1Grm2XZEQC8n4TU4weIAphVld+nXyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1600852845951805.2788380212972; Wed, 23 Sep 2020 02:20:45 -0700 (PDT) Received: from localhost ([::1]:51990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL0xA-0004Wg-Hw for importer@patchew.org; Wed, 23 Sep 2020 05:20:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL0oW-0001Bt-Fn for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:11:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20534) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kL0oP-0002Ml-DM for qemu-devel@nongnu.org; Wed, 23 Sep 2020 05:11:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-354-7wHGC4N5MKC1zuZ_z7hQhA-1; Wed, 23 Sep 2020 05:11:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 89EBC1005E76; Wed, 23 Sep 2020 09:11:34 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F0805D9CC; Wed, 23 Sep 2020 09:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600852297; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=csQxNiFZcnC9TBP3b4tvHjusdp7fACDXz4/V7nvvILU=; b=UO8ZcUCrqEqJIMRRlwu+rxf15oPD/c7TS0MdTq7vCEfwXZlk3s+unKpJF4Ymce3rWY2VkX uMm6rQKNNs/cuMuqOrCiprTu3iFJbjc88DR6NUEm7lDPnK0ZGN/oL6kUu93Go4AkARxYhq 9brGTM2BGHW4AGEbBgjslp481cQxIVI= X-MC-Unique: 7wHGC4N5MKC1zuZ_z7hQhA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 04/12] configure: move accelerator logic to meson Date: Wed, 23 Sep 2020 05:11:23 -0400 Message-Id: <20200923091131.1591563-5-pbonzini@redhat.com> In-Reply-To: <20200923091131.1591563-1-pbonzini@redhat.com> References: <20200923091131.1591563-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 00:53:58 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.455, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) 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 --- configure | 19 --------- meson.build | 108 ++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 93 insertions(+), 34 deletions(-) diff --git a/configure b/configure index 04cc25f7c8..5df58c4b89 100755 --- a/configure +++ b/configure @@ -6863,7 +6863,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 @@ -7645,24 +7644,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 02593bc787..641378c1d9 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,63 @@ 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' +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 @@ -640,17 +718,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[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 + endif + have_accel =3D true + 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 @@ -676,11 +759,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