From patchwork Thu Mar 20 22:29:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 874996 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp575140wrb; Thu, 20 Mar 2025 15:36:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVXbDQ1SVuEWTZNjN1J10SaXoYPMtMlsHAUVeaco0C4ADjxYnpNSNXzAsIRKhfNH/dVxfkQ1w==@linaro.org X-Google-Smtp-Source: AGHT+IHxWFgxt1RJ5YNG8YnGZAuOLFX+3jnnCegtyvbkN93UdUy+BDucblDooJbBaUeS8W2LdEX6 X-Received: by 2002:a05:620a:1a19:b0:7c5:5f38:ba59 with SMTP id af79cd13be357-7c5ba139d5emr136412585a.3.1742510216008; Thu, 20 Mar 2025 15:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742510215; cv=none; d=google.com; s=arc-20240605; b=JfZsd54AvVyiulNkWrY6TTL1aK6JUqC0dQK8Q9Nj1oFJdBSRsNFpVnyOgAvTDMLRvH HImU5CYJPGjZt3gh2EYmOHOIVI9olxbqnHq0OwfT7hMYkjC/wztUeBSY3tNthZjW3Wib vlqQml87pNc4xOkGG9Der6qfvw/3D3QtA0vKnvYAQf/wqgQBPzhcexQ/Dia4rVCPiW8C phTvw81UfFb30u8nf9wExbwfTkyiYwSvgZKzlk0K/eAx8SdPnavHTk64ga/XcCIGnJ/+ kO1YjWh6qAv0v+yUfftafeKVIkUuVN3XBH/XHP2CN4AOaDJVWU24Aj8cqmHJZDPky2vK 2PUQ== 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=Fni5tdTWafvZot1y+akur3pFHYiAMm3JM0mRyhC4D90=; fh=nOkKbActdBXNisDSrdwXLE2FHRvxbNZxRZo5bVBICcQ=; b=j1DABpILuGgml1NCkdUFeF6AfvYcYi5i4ELQtHXNpruF+lGOWX/Icqu2pk6T0XzP+K O0DaQvEocByEnAHJ4PsOexxm66rxxCZ2Ps5OXxs2KYMCnnTZc1YH6v2mODRD43LifEoh iNE2TH4p9HwHmtKmwyEDisfbYXdDFZS2+z/Gv+wzAQwLeq/p1AlaGo2IMXvPDSYe35ny mxsPd4QoUb+jZk/GcKDKX84/ErzWeRe/xrI6zU0d5qu+a1OWZWvo5YfduzayXtZC1m7L shTTq4HUU8qsAu+MGvX2Q95WL2ni3PNO/0GAU9g+Wio1ewQSCzNnelk0pQ8yTdn7ZeJp qVzA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dRVsf7Hz; 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 af79cd13be357-7c5b9383c8bsi72035485a.612.2025.03.20.15.36.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Mar 2025 15:36:55 -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=dRVsf7Hz; 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 1tvOSO-0006mm-HR; Thu, 20 Mar 2025 18:33:44 -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 1tvOPz-0002kq-HZ for qemu-devel@nongnu.org; Thu, 20 Mar 2025 18:31:21 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvOPQ-0007C1-MP for qemu-devel@nongnu.org; Thu, 20 Mar 2025 18:31:13 -0400 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2260c91576aso24280405ad.3 for ; Thu, 20 Mar 2025 15:30:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742509835; x=1743114635; 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=Fni5tdTWafvZot1y+akur3pFHYiAMm3JM0mRyhC4D90=; b=dRVsf7HzVvSlesHK5fqkieqtxatfG+18XTNCuTX6x5RZ6nDPWQCRwWZOgkojQkz/Ks hV3juquDAgvar1bm3m3FSs/PTt7oEGwa2kHAIRmHNgpQFBYJ+nzEFp6BkP421tZI95BN 1lcy/RWwV8bzqdiJOlrmQV6uR0YDw4W4s4VCMzY5XNS/8yBJhVOQDKtw2RjJqyx1U/I0 4IHb3ycWQVLnIubRNiADy92p5/jf7XRRw8JM4Hv2v4CFzoaJqsISWIAsZzTtWm0HzCev bHpPYotkGu7LdxoFPNk0jnEupaZ+3T7HXKI0WlnCz3zRKLVP9jdCPbTpo7AfJGeC5cTV qylg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742509835; x=1743114635; 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=Fni5tdTWafvZot1y+akur3pFHYiAMm3JM0mRyhC4D90=; b=X0xzLpMpKTOxF3RUo93WBN86rbFZAeifKItFfir8b3Nkl+S/tCU+prtrT8xVXWr9mW 0IY9/nqSoKDsFq/ay6MnoAhL2xRYlwIjnizCndo+RNWlL59l6c+vph5ISpfWSxkS6+8y V1LKIJAAhSpLMyXtBubGeNe8vNudKHhx4GqYS0bbsTRvHIKgtmBExhhXTcSJWJ6EX/6h t9fqzJyezt/OmO2iO35SxuAKVCOnifXmmG23MXjRYtcs7EW/9RA3lzR42fxqkqBy27UG twvQJbh0DklAT8Fbeei9u0kwcotc4jy6TuQl5wBJ07I18JNUqedVoxqkOB8vJU32kAlE vkNQ== X-Gm-Message-State: AOJu0YzuP8OqwM1zQhxHcBROe+4Y2YEPuH2ctLa+m3bBdfMGUmmGDJP1 k7pW5R70VZaDtVKqikrCrjB5NxaUQ/6yv/YH/mpC/3tcRQyllGHgSR2e7oDvEEnlyhCYwWDUuUM e X-Gm-Gg: ASbGncvm4xt5EyBOCD6WmyB1WtBQqjt0zHtsfV1jxxKNEPJ61zIRBuN2h0YbHcycbgq GUbdyB97PReHubAyeGdnVqy85gf0vnRDkblK4Qki/VdmudpRjdkKX/iJka06idqoQTVwcmw2+GF 4J7hZuCA2my8pQLB9MxCZS82gJVlIsj9R0eiRY7ePQsQLocvRG8/Z38PwMJGArPdIKlLncGS2xq da+H2EFsZTavw6Dg8sZTMV+v3qKv2NI+plFeJrcP7YWDIz6M47C0uA6pLyLP2rUI+MhQyxSAOjN Ga32Mc2I8EDuEjnCwAQYlNGz3jCQkD3YKM27URaXagiz X-Received: by 2002:a17:902:ccc2:b0:224:a79:5fe4 with SMTP id d9443c01a7336-22780c54d58mr15290515ad.2.1742509835392; Thu, 20 Mar 2025 15:30:35 -0700 (PDT) Received: from pc.. ([38.39.164.180]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22780f4581csm3370145ad.59.2025.03.20.15.30.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Mar 2025 15:30:35 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Pierrick Bouvier Subject: [PATCH v2 24/30] meson: add common hw files Date: Thu, 20 Mar 2025 15:29:56 -0700 Message-Id: <20250320223002.2915728-25-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250320223002.2915728-1-pierrick.bouvier@linaro.org> References: <20250320223002.2915728-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x634.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=unavailable 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. Signed-off-by: Pierrick Bouvier Acked-by: Richard Henderson --- 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()