From patchwork Thu Apr 3 23:48:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 877981 Delivered-To: patch@linaro.org Received: by 2002:a5d:6dae:0:b0:38f:210b:807b with SMTP id u14csp3527430wrs; Thu, 3 Apr 2025 16:51:08 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXlit4v6lcwHLEe3vbrtZD3NjkGhgV0Yyip8Ef5sEsW56AjISfu4NdNquMIuvEc4U3EO16nAQ==@linaro.org X-Google-Smtp-Source: AGHT+IHz/NgNzxkiHheBmGm5Hdv6rW1mKn9B0IH7DEMZEw28xelSGzEnTTsq9bNMk+Ltrt8qKC7U X-Received: by 2002:ac8:5d4d:0:b0:472:801:3e74 with SMTP id d75a77b69052e-479249b5286mr22450051cf.41.1743724267796; Thu, 03 Apr 2025 16:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1743724267; cv=none; d=google.com; s=arc-20240605; b=Jq/w85aHkoym7jhJbhn8Ja5RgJdRWzBQYcPh1JhgrGXS47oZH8lyf4yq93lGBbYFMs ggGPGSPUsgeG5VYnw0kdhmhlGC7wejZu4WYyRdJxWkxba7bz1JrQu3pvblNmWemEq7IC JqKxbwK5L1cVCkGGYnZUHwpOKNhEm2TO9zKBviEv6C8UXh17TLYAezC6/JqpAxq3XIz7 1WvDYtFHgKNDdyZ2DY2Mpooyh3K5uPspD3bXRR67NdwGl0KDLbUq8sNHX+qFuLf3oy9G rUIW3q9nk11iNz8hZ+JG+YCRhY3dBF3xGj34CmohezE/uEzhYnIgSGyMjxD/sIZJh/P/ yk0A== 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=Dx4NIP+q6gK1PYGs8UG7pypdnmjUfZxa4IekdB6BGgc=; fh=ISslU+6AOAPvfm3mmMuq/p0l7xeUGlnJLjUVX+iCVao=; b=cR8ajOyNuMY4RYa07BrJJoJcg42fQ0UKfQHugwlRa3/rG/P4kh3HyD9YLidUA3p8Vn ZhYPjMHiiKhLEbpyYxZy4WeIJ76F1Nr3J73N1Kfo7f/nkiTHdEC1L18niUz6YlVpIdF3 FwBDgzroWp6RPt5ppbISSqyk5K0YiF+BSRUGGS7hjoFvbbTTBqYO2QHijGPOdyHqoV4B cNN5QX1OU6mwNYRWMQGy3pv35+0MW43zlou/ke1j0LnFYgmM0gkVPooGPMcuYEAlfFhl XbZL8ZELlIPme5V4z0lDbwDCpiYJ2tWA6Qlph8VjsOc3sUVtaqAkWn8RbAWeKmeeRszt jGAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NF6zbHKD; 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-7c76e95ce26si212802385a.191.2025.04.03.16.51.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Apr 2025 16:51:07 -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=NF6zbHKD; 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 1u0UJU-0000bw-00; Thu, 03 Apr 2025 19:49:36 -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 1u0UJR-0000bV-Vm for qemu-devel@nongnu.org; Thu, 03 Apr 2025 19:49:33 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u0UJM-0000PH-VO for qemu-devel@nongnu.org; Thu, 03 Apr 2025 19:49:30 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-43cf848528aso10991845e9.2 for ; Thu, 03 Apr 2025 16:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1743724165; x=1744328965; 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=Dx4NIP+q6gK1PYGs8UG7pypdnmjUfZxa4IekdB6BGgc=; b=NF6zbHKDyPPBVCYsbfWUhZA7grba/DnEr0WsaLlg+zogqvweXJFNi9NyfCckEZs2UB 0WMqolRXfPtdyWdTUGykbznBlJPTQrglmwDeCM9ydp7u0Pg9MAHW365iPEPS0R2SiJCn Ob3W4KkdcCK0E+c6ASGKyEL0ZXf21HPOr1GzStVt/anJntAJ1f+RaC9z3swcg7ZHlqp4 /o6g6FtywvEivrQSpWbe4p/oOmg40HfmUdl3lr7esFxxrImYSnjthNjWiiKPux0Ni6Ck dtIWGuLPDLQ6s+3M/rhiknP1cDq6Ma3efEL3+wX+rgPVwscX99C4rrE6b610P27EzJWs x+sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743724165; x=1744328965; 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=Dx4NIP+q6gK1PYGs8UG7pypdnmjUfZxa4IekdB6BGgc=; b=UEv33pWFR+B3Fvt/oFP41tynEkKcFja/fL62A7PGudhlRpDyQ3aUHbL5wT8PTvx0vL YgOloPbT8ufpJla4UCIXL0+bSjJJe9M48x5R53EA+adoYzI0ik8o7D/IDP5wMN4VKw0s 81WU7gYfreh++0ytpzUolbr1uTIn29h4xX3afIYnGUNW1+ochuNGoiljDqijRJfS3Nxb vtxf4lUjTT/p9X/alakf1GdmnLgK/ApzDYY868hOm7XU4d2RhWEaNvhQu6iVkY0n0Hvw rNGzJZ07JmHOg/FkG1XII0G6+K8LHBJj3Ufb3QDMMsAp7w8fbmX1B4igJYELIy0bb+F6 U1og== X-Gm-Message-State: AOJu0YwX9P6xLbanMWNTO2rW0sUo/FNLPzCfcNgWKMNldFGji4+ic1Ul rjuSHJ7crMyrFio+/aLtKc5aSQrg9f6YKvURsYht2mpukoAKt48AvBT2oUXtuKnm0KLjKM3dmaW K X-Gm-Gg: ASbGnctJGTNVp12sTXOxP/yZrn8S/W5Im9PkFZ2otwnhi4wwjQ320Kj8Zyk8wa/wzzW B5LuVRdaE2jx3QYzQFdjnaw3sZOLPdnVDKWcGIEO7VJiggRafMpZK5eU3x2tN2uCJ3fg/fGXZET Av2dztWFFm7kpWra0Xto2PUgsnmS4UnIi4PUOGmXyYf/fAfbnBgTNWwEhoMLl3yLWegFyrg/ATS pZvi4jre4mdE+E+uUQKA5J7miEKZOGNb3atpaSlRYpJCnvr0IRKRfW/Tj4kpnO1b+74P0qDYLj6 fApSC2qYScQOTKUWKSZn31pcD0sCnwnnMF91ymC2MVIjwcpBKOJP236Of7cDGydf7m6uT/5iygj mu/ZnrJN2dR1yXcMaJ6s= X-Received: by 2002:a05:600c:4503:b0:43c:f78d:82eb with SMTP id 5b1f17b1804b1-43ecf8eb2bbmr7242435e9.15.1743724165091; Thu, 03 Apr 2025 16:49:25 -0700 (PDT) Received: from localhost.localdomain (184.170.88.92.rev.sfr.net. [92.88.170.184]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c301a76cesm2969306f8f.37.2025.04.03.16.49.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 03 Apr 2025 16:49:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Markus Armbruster , Richard Henderson , Pierrick Bouvier Subject: [RFC PATCH-for-10.1 01/19] qemu: Introduce TargetInfo API in 'target_info.h' Date: Fri, 4 Apr 2025 01:48:56 +0200 Message-ID: <20250403234914.9154-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250403234914.9154-1-philmd@linaro.org> References: <20250403234914.9154-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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 Signed-off-by: Philippe Mathieu-Daudé --- meson.build | 9 +++++++++ include/exec/poison.h | 1 + include/qemu/target_info-impl.h | 21 +++++++++++++++++++++ include/qemu/target_info.h | 18 ++++++++++++++++++ target_info-stub.c | 23 +++++++++++++++++++++++ target_info.c | 16 ++++++++++++++++ 6 files changed, 88 insertions(+) create mode 100644 include/qemu/target_info-impl.h create mode 100644 include/qemu/target_info.h create mode 100644 target_info-stub.c create mode 100644 target_info.c diff --git a/meson.build b/meson.build index bcb9d39a387..de9c9dacd35 100644 --- a/meson.build +++ b/meson.build @@ -3262,6 +3262,9 @@ host_kconfig = \ ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ] +target_info = [ +] + default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host actual_target_dirs = [] fdt_required = [] @@ -3368,6 +3371,9 @@ foreach target : target_dirs config_target_data.set(k, v) endif endforeach + if target not in target_info + config_target_data.set('TARGET_INFO_STUB_NEEDED', 1) + endif config_target_data.set('QEMU_ARCH', 'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper()) config_target_h += {target: configure_file(output: target + '-config-target.h', @@ -3807,6 +3813,9 @@ endif common_ss.add(pagevary) specific_ss.add(files('page-target.c', 'page-vary-target.c')) +specific_ss.add(files('target_info-stub.c')) +common_ss.add(files('target_info.c')) + subdir('backends') subdir('disas') subdir('migration') diff --git a/include/exec/poison.h b/include/exec/poison.h index bc422719d80..00aedc41d82 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -38,6 +38,7 @@ #pragma GCC poison TARGET_BIG_ENDIAN #pragma GCC poison TCG_GUEST_DEFAULT_MO #pragma GCC poison TARGET_HAS_PRECISE_SMC +#pragma GCC poison TARGET_INFO_STUB_NEEDED #pragma GCC poison TARGET_LONG_BITS #pragma GCC poison TARGET_FMT_lx diff --git a/include/qemu/target_info-impl.h b/include/qemu/target_info-impl.h new file mode 100644 index 00000000000..b340e192fce --- /dev/null +++ b/include/qemu/target_info-impl.h @@ -0,0 +1,21 @@ +/* + * QEMU binary helpers + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_TARGET_INFO_IMPL_H +#define QEMU_TARGET_INFO_IMPL_H + +#include "qemu/target_info.h" + +struct BinaryTargetInfo { + + /* runtime equivalent of TARGET_INFO_STUB_NEEDED definition */ + bool is_stub; + +}; + +#endif diff --git a/include/qemu/target_info.h b/include/qemu/target_info.h new file mode 100644 index 00000000000..fab3f3153ea --- /dev/null +++ b/include/qemu/target_info.h @@ -0,0 +1,18 @@ +/* + * QEMU binary helpers + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef QEMU_TARGET_INFO_H +#define QEMU_TARGET_INFO_H + +typedef struct BinaryTargetInfo BinaryTargetInfo; + +const BinaryTargetInfo *target_info(void); + +bool target_info_is_stub(void); + +#endif diff --git a/target_info-stub.c b/target_info-stub.c new file mode 100644 index 00000000000..d683a05977d --- /dev/null +++ b/target_info-stub.c @@ -0,0 +1,23 @@ +/* + * QEMU target info stubs + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/target_info-impl.h" + +#ifdef TARGET_INFO_STUB_NEEDED + +static const BinaryTargetInfo target_info_stub = { + .is_stub = true, +}; + +const BinaryTargetInfo *target_info(void) +{ + return &target_info_stub; +} + +#endif /* TARGET_INFO_STUB_NEEDED */ diff --git a/target_info.c b/target_info.c new file mode 100644 index 00000000000..cb17d29b86d --- /dev/null +++ b/target_info.c @@ -0,0 +1,16 @@ +/* + * QEMU legacy binary helpers + * + * Copyright (c) Linaro + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/target_info-impl.h" +#include "qemu/target_info.h" + +bool target_info_is_stub(void) +{ + return target_info()->is_stub; +}