From patchwork Tue Mar 25 04:59:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 875979 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp2476442wrb; Mon, 24 Mar 2025 22:07:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWDViYOl51U8Bdc/6ja5HOn1dmH4E3GS739b6YNxMyfMhvNKVfvtBMsSEiZzxTQS3hbIlKtBA==@linaro.org X-Google-Smtp-Source: AGHT+IFoJa7UIz1glRzBy4Qhclw1Z1TsgX4O2L7QQgwhx7e5wZNYvpQXj47ZoALG+6shjLBZuLoY X-Received: by 2002:ad4:5ca1:0:b0:6e8:fb94:b9bf with SMTP id 6a1803df08f44-6eb3f279857mr207436436d6.4.1742879229142; Mon, 24 Mar 2025 22:07:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742879229; cv=none; d=google.com; s=arc-20240605; b=dHf9VuCf/xHaUkG7zH3k0O0qnfns9Qh3hqtYlA/2enPEk2e1CeZDkOAaD5dMZ/tLNa U3bCfG9UeaWMk2qbkvi1TdM6Qc6ymMOECJMTjBDzTqcPLWO9DRi4LfcgefcY6LmYotqe AVpkEhA2yr95wCJGmLOdn/YwwMUwDhM3oEm3ZWwT0Mh7gcjdcv6jbMdXpuersgWfzvpB dcLGYtfVUSrNyDRGLaw8l4uRzBR76H3LPEd3sEkG7EgmRrgVBBvHyaUVJTwSt1agDkgc 2cSyfO0n9v/uq5iE6mnhDzVhPoKj7nzLU71nH5KJSGmdBIyNykzp+CN4kFZOIyWO8Gs/ n1TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kI6HALsdQGcYyIHmM8Ppnw0EYvYwjf9AgyEFGP9MumA=; fh=4u/c2NXRKQFGmORD9593hqU0qV4lyoIHSldniogVCFE=; b=h/sw6vbGyfLF4Zyx5e5HGhbyjrXEBm9k/ngj+aXurJORhmIO4c14sHlqHMkDVdG5SQ C53CDx5iFfFw3JhfdMlSnANYwLnn/Iuk0v8pVvjiFta3p2dZSIrr3lJeKS/XInhEPHbO yzw0/qjwEYfiYtqg1VGT88S156A5bTxGgSQxRCAKjRTH90JnOJ6/TMHU57b5dFpaJ0XL LIHe4JgBEJtVUufLYNCOQ9qU1vElimVfJmiTg7yAChQZ28bPN13CByaeUR5NJabnQ+tU P2UGQZhXkNz6sbFVbDi2WtNpLdlAAF6Qo426EWlssho5QEOlBJbiNDzL5c3V3v0iq4Hj wUoQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jwo/0ENX"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6ed0e3bc907si6119546d6.114.2025.03.24.22.07.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Mar 2025 22:07:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jwo/0ENX"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1twwQW-0006gT-4I; Tue, 25 Mar 2025 01:02:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1twwOA-00041f-Tn for qemu-devel@nongnu.org; Tue, 25 Mar 2025 00:59:48 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1twwO9-0005yR-56 for qemu-devel@nongnu.org; Tue, 25 Mar 2025 00:59:46 -0400 Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2ff69365e1dso7102779a91.3 for ; Mon, 24 Mar 2025 21:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742878784; x=1743483584; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kI6HALsdQGcYyIHmM8Ppnw0EYvYwjf9AgyEFGP9MumA=; b=jwo/0ENXfDGGU13ghgCw2kF2ba88BoXTFYY/6RZQvA/KZ1tKvcCd/hJdZ9EiqtLD55 zLOH8Yo4gP9m+1RqnBWloTNxFy1H/5l3s/RPlYRzoE/iLxW4g1+vgAqze2xMifgqqthZ PM7IcB2mREORcSVIH8PR5HVkJS4FsGvJBFS3vs1upw4kth6pn4dCTfjXdvu6V012SqRR oZgm/mpco6133EFSrJtlgpjheCXXHH5pnX0iMZ4VoqLBoJBgZcjal52Kl7wtkfpzUOIP HEfyv3V1aprjidHad6l99JfkxclfgzVvbR3A0NLb/9KBwSU2nlZWdKUVOzrRG5OP2Kku D9wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742878784; x=1743483584; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kI6HALsdQGcYyIHmM8Ppnw0EYvYwjf9AgyEFGP9MumA=; b=A5wgpQrdoLh42EDKDxKyxIDfadQ7bH8VCJrlv7LARoBdWait4H8Q8yOaI/9l+MF2tW 5mFhZjWd2fr1DFJYamk6BoP2vdGlUHzbajkq96NKqy3iDrMMWk2Ky6GvsJZyJ/8Ico26 fkcHUJFW4B+QGHKBD3hXQTxRo2cl75eVF8eacSnRDX+7tcNk+LVOK8CZhGTFy/pL2EaY KLP6HnJ2brBDEr3vfbTNr8We+LcB3EjGqXHFe2jGkuYnSJlIbgNN1+tJFkcDEF3TU5gf 9GFCh+WcUbXrliHVq8+ptHdqmcbytFj5ElFL9Tl6v2psCZo9JbZaRtmHfvsaAj47N1tE vXQg== X-Gm-Message-State: AOJu0Ywxf7LsfxDSS0kcaSGmgfCdKC9ZZ2Lhery8k6hjmoB2wpknUzCK +jqVvmZsrW9DZgwVjEVI1tOhLxNaWATbQhGjNL9CvVJ1DWP1uOOWFQvJDggOapKYUcffe7viYJ4 R X-Gm-Gg: ASbGncuAtqWdK6uPHkOsgeO4zC34NmbCSj6mdBDSXowwvrmi5iEc2BokU0zL8oSMVP2 gKxSBda+vhyk4MeHimE0KeX6OrcnKAzUFIkBKrQepgmLj0YRgcwPVt/SvlSXpFNeBHvEhXmfObc tw/LGkZUJgiLdtkbUGLpoAbf1UNvRrAre+oOfspuuOT3HDBKJppnpJvFkqos0Mrt+ensBNXfFet 4k9HugM+67BJNsV5gCk7NapsKYIpadXp+EJwCCF7tYq752wiGJFjhemXNx2HdVnCIX3MZkYJ579 j6TNfpS0xdOx3SKjefoI3evF3F8za/qUUVaYYhuotxPW X-Received: by 2002:a17:90b:3847:b0:2ff:79ca:24b7 with SMTP id 98e67ed59e1d1-3030fe9804emr16981073a91.21.1742878783768; Mon, 24 Mar 2025 21:59:43 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-301bf58b413sm14595120a91.13.2025.03.24.21.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Mar 2025 21:59:43 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier Subject: [PATCH v3 23/29] meson: add common hw files Date: Mon, 24 Mar 2025 21:59:08 -0700 Message-Id: <20250325045915.994760-24-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250325045915.994760-1-pierrick.bouvier@linaro.org> References: <20250325045915.994760-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Those files will be compiled once per base architecture ("arm" in this case), instead of being compiled for every variant/bitness of architecture. We make sure to not include target cpu definitions (exec/cpu-defs.h) by defining header guard directly. This way, a given compilation unit can access a specific cpu definition, but not access to compile time defines associated. Previous commits took care to clean up some headers to not rely on cpu-defs.h content. Acked-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- meson.build | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index c21974020dd..994d3e5d536 100644 --- a/meson.build +++ b/meson.build @@ -3691,6 +3691,7 @@ hw_arch = {} target_arch = {} target_system_arch = {} target_user_arch = {} +hw_common_arch = {} # NOTE: the trace/ subdirectory needs the qapi_trace_events variable # that is filled in by qapi/. @@ -4089,6 +4090,34 @@ common_all = static_library('common', implicit_include_directories: false, dependencies: common_ss.all_dependencies()) +# construct common libraries per base architecture +hw_common_arch_libs = {} +foreach target : target_dirs + config_target = config_target_mak[target] + target_base_arch = config_target['TARGET_BASE_ARCH'] + + # check if already generated + if target_base_arch in hw_common_arch_libs + continue + endif + + if target_base_arch in hw_common_arch + target_inc = [include_directories('target' / target_base_arch)] + src = hw_common_arch[target_base_arch] + lib = static_library( + 'hw_' + target_base_arch, + build_by_default: false, + sources: src.all_sources() + genh, + include_directories: common_user_inc + target_inc, + implicit_include_directories: false, + # prevent common code to access cpu compile time + # definition, but still allow access to cpu.h + c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'], + dependencies: src.all_dependencies()) + hw_common_arch_libs += {target_base_arch: lib} + endif +endforeach + if have_rust # We would like to use --generate-cstr, but it is only available # starting with bindgen 0.66.0. The oldest supported versions @@ -4254,8 +4283,14 @@ foreach target : target_dirs arch_deps += t.dependencies() target_common = common_ss.apply(config_target, strict: false) - objects = common_all.extract_objects(target_common.sources()) + objects = [common_all.extract_objects(target_common.sources())] arch_deps += target_common.dependencies() + if target_type == 'system' and target_base_arch in hw_common_arch_libs + src = hw_common_arch[target_base_arch].apply(config_target, strict: false) + lib = hw_common_arch_libs[target_base_arch] + objects += lib.extract_objects(src.sources()) + arch_deps += src.dependencies() + endif target_specific = specific_ss.apply(config_target, strict: false) arch_srcs += target_specific.sources()