From nobody Sat Nov 15 23:54:25 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1746134765; cv=none; d=zohomail.com; s=zohoarc; b=O7GLXfqkoyGM3ukGPf2bWXDVnuOnESxCIGdH0INPDogA8knKOwGOWjO3zSnL27MxGV9qGcCID942ecLZbBxn6e87aZTh5TdPd6oGZfLJTCOV8657ERE8VULgoMiuLenhn5ef0LhwBJzTegTJD3+9xXxulIovPUp3BCMFEY/Pyv0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1746134765; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iQ4d9VytMAyaMdEQkNc3+qF4cN/HnIg5sNtYWblQ1ok=; b=MiArEN9vlivxYdKiEMmaUGz0Yy3qCylrKglN0uBw7Qh319XiwD9jpwdQTmPE/ZE6aWp6jbIxsjfZtDsYgR6ajhykRViv9gutmCb7JPzH3xmYsMU+8f5n9eiT9/rc15+/UjlmwsCsCoNSvOAuJTA+Jtd0AQGfTXOWSZpJexK4QAQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1746134765159873.3797043489644; Thu, 1 May 2025 14:26:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uAbOq-0004bd-2U; Thu, 01 May 2025 17:24:56 -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 1uAbOl-0004Lo-GU for qemu-devel@nongnu.org; Thu, 01 May 2025 17:24:51 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uAbOj-0002Ai-9g for qemu-devel@nongnu.org; Thu, 01 May 2025 17:24:51 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-72d3b48d2ffso1656439b3a.2 for ; Thu, 01 May 2025 14:24:48 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-740590610desm135897b3a.146.2025.05.01.14.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 May 2025 14:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746134687; x=1746739487; 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=iQ4d9VytMAyaMdEQkNc3+qF4cN/HnIg5sNtYWblQ1ok=; b=W5AvDSFVRywxzDxgULyeO141looRy6yTbT7gnj3zjZ5wbe+4FzoHRBG3PB2T73ARZP SNtdry3lsW7v/IEWJ7SbGa3sVMJ1m7MAVYtX5qWlF8y0CL5hum6hu7Y8PGht9JH/Od/Y XqNY96nd1U2ny6RZBpJ2lJWSJAi4Z1Pas/RIZodn45OE8qsnSgqDAUNozKym5hqjPxx4 NVQ9pVM0w8IhZlknhor30LEJwdv+yl0i9Eah9F0LSu26P3zSPwSb9KNHzItBAc1mbO15 s7NSKPL0HPTcdeIA+B7Ozkiap1TNUyfRxcLNQX2/7oDlC5D+5BRRBUrKeBDkxq/7nCO7 yihg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746134687; x=1746739487; 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=iQ4d9VytMAyaMdEQkNc3+qF4cN/HnIg5sNtYWblQ1ok=; b=nuEKubPH+XV4fi4krGbne1v4JLceFKI4vc3n7iFndM1AAswPtOFI4oQaANPs2doFXF /RE3Ht5X2Fj4/ZkfMOU3ZEDV17A9yYPkfgCJSB8uCfq2x30kRXV0NIZxLEB0hW0qbt+u 6QdbcQqv9LyjLCGx/hVNNm1pFUjnH0uB1vECWpWOboPW9jKE3mK3FoZ/bcaQ333KKelA saCFAE+CvxxiRWCfPALJ7TX0WkdbOji2srxUlyr3fD2elb2Hj2xT+2dP/gR4tc2ja12W SPLFg3JN2/d1sCC2SI0hiXWcGRKvrEYWbdUcLeJ1AQtnlP/SfiOg2PfYZlTB/hfwJoej yf5Q== X-Gm-Message-State: AOJu0YyVyS5N93DomWomhSqV7EGM1XH8fsfKuzTngcgcheaZSclEONJu eV6b+kktUOIKUjnvmBP0P3MjdrxQAWR1YALMefiqbZsaHzKCSdaNJnzOPvXtc8FKSTVakYgx5Kl K X-Gm-Gg: ASbGncvn8L0UpDRGkPu/weXVfAhQzelRDSmVYcucmx3QOgH+dPbBSoLPPexLQLb1QtZ lnlycZWaAIY8NTao0HWFwHe1Vo2d4Wb9h9kprt5QNnoyQ1xUuRrtAaTqKatc16t0rOsLlZHQ44W 0GU1fb7hJgFnasXR77XzFDQwLYO8ozuiLNPPadHWJTt9SXB2ePCE86qHqTzJbkzy97A9EKd3nkK b5khNct+qumxaCLLBXqwnW76Op5xZ5+8nXon5UhXACP51u3QQvLItpkI7MpcVedX/WLTITsHeUE oxrpk7+pZZRr9QMf7p/tSPGir0jCrvR9W82iDC3NywJ57LZThHLLJtdT+8L0LsXi27oMAxUAwvq ppWlLNGLR3w== X-Google-Smtp-Source: AGHT+IEIFvDHIPpmVOYQKZDhA6VfBbl0atE9ys4hVp5TySxvaTO4GH2W1mNMkUA+HSWdHe31e9akBQ== X-Received: by 2002:a05:6a00:4482:b0:739:4a93:a5db with SMTP id d2e1a72fcca58-74058b510aemr586109b3a.22.1746134687646; Thu, 01 May 2025 14:24:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 40/59] system/vl: Filter machine list available for a particular target binary Date: Thu, 1 May 2025 14:20:54 -0700 Message-ID: <20250501212113.2961531-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250501212113.2961531-1-richard.henderson@linaro.org> References: <20250501212113.2961531-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1746134770763124100 From: Philippe Mathieu-Daud=C3=A9 Binaries can register a QOM type to filter their machines by filling their TargetInfo::machine_typename field. This can be used by example by main() -> machine_help_func() to filter the machines list. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- include/qemu/target-info-impl.h | 2 ++ include/qemu/target-info.h | 8 ++++++++ system/vl.c | 3 ++- target-info-stub.c | 2 ++ target-info.c | 5 +++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-imp= l.h index d30805f7f2..d0e8c86176 100644 --- a/include/qemu/target-info-impl.h +++ b/include/qemu/target-info-impl.h @@ -14,6 +14,8 @@ typedef struct TargetInfo { /* runtime equivalent of TARGET_NAME definition */ const char *target_name; + /* QOM typename machines for this binary must implement */ + const char *machine_typename; } TargetInfo; =20 /** diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index 58d4136897..2b6ccabb11 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -16,6 +16,14 @@ */ const char *target_name(void); =20 +/** + * target_machine_typename: + * + * Returns: Name of the QOM interface implemented by machines + * usable on this target binary. + */ +const char *target_machine_typename(void); + /** * target_cpu_type: * diff --git a/system/vl.c b/system/vl.c index 520956f4a1..7223f1ff17 100644 --- a/system/vl.c +++ b/system/vl.c @@ -27,6 +27,7 @@ #include "qemu/datadir.h" #include "qemu/units.h" #include "qemu/module.h" +#include "qemu/target-info.h" #include "exec/cpu-common.h" #include "exec/page-vary.h" #include "hw/qdev-properties.h" @@ -1564,7 +1565,7 @@ static void machine_help_func(const QDict *qdict) GSList *el; const char *type =3D qdict_get_try_str(qdict, "type"); =20 - machines =3D object_class_get_list(TYPE_MACHINE, false); + machines =3D object_class_get_list(target_machine_typename(), false); if (type) { ObjectClass *machine_class =3D OBJECT_CLASS(find_machine(type, mac= hines)); if (machine_class) { diff --git a/target-info-stub.c b/target-info-stub.c index 773a10188c..bcf834f71d 100644 --- a/target-info-stub.c +++ b/target-info-stub.c @@ -9,10 +9,12 @@ #include "qemu/osdep.h" #include "qemu/target-info.h" #include "qemu/target-info-impl.h" +#include "hw/boards.h" #include "cpu.h" =20 static const TargetInfo target_info_stub =3D { .target_name =3D TARGET_NAME, + .machine_typename =3D TYPE_MACHINE, }; =20 const TargetInfo *target_info(void) diff --git a/target-info.c b/target-info.c index 84b18931e7..0042769e3a 100644 --- a/target-info.c +++ b/target-info.c @@ -14,3 +14,8 @@ const char *target_name(void) { return target_info()->target_name; } + +const char *target_machine_typename(void) +{ + return target_info()->machine_typename; +} --=20 2.43.0