From nobody Mon Nov 23 04:26:13 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793874301; cv=none; d=zohomail.com; s=zohoarc; b=T9cv9jD/Gx5XdpKoepUG4+p15BJSCQAt+5co/sJ6sdBY5xo5yQudhLpTIRuCZC0etmNMzU4SMnP3oHBhciRclJRYIcb2NUCu2u1+TVYPhJBkgO2Z9FWJ4waTXy8J5+5aher3hyp3Z2oOAjDK2sjdhqEzeBtpjdpATceeRnkVlIY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793874301; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sR+wXFPR6i+NwMqhpcdylfpyBY8NGxv9YC8FJiIdC30=; b=cHL+iLuBwhU61om8lA6xSDuth+AScFMBledfUcSI6enNNxXf+wtxo+hKXQUwdKXDt0JbzxmuB6o+jja+piBzRqkvqMZNhNMWe6t5i11RirLBZ9Rvr3QwtSRfy61iJCDOA+7VH2GTLy4yn0aZd2cC5OlQYBVcUyhaMnu/ZEg9DkU= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793874301664117.42279835313695; Thu, 5 Nov 2026 02:25:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xOueE-0001ty-No; Thu, 05 Nov 2026 05:24:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueD-0001tg-LL for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:45 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueB-0003rA-NO for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:45 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-l13fXoxQObWXO7qPTO7r5A-1; Thu, 05 Nov 2026 05:24:39 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F40621955E8F; Thu, 5 Nov 2026 10:24:36 +0000 (UTC) Received: from berrange.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B970B187C36B; Thu, 5 Nov 2026 10:24:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793874282; 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=sR+wXFPR6i+NwMqhpcdylfpyBY8NGxv9YC8FJiIdC30=; b=VVrFX5uEtNi2z/rpPmmTqvSL+Q7wr+Hm0f0RfQ285/MlahGZTN47xSlmcMXDn13QKd5iUW gTD32U8V7se0QIGNWL+5q2KMtLj4VlCJvY6LZcLxwU/W8wC/3gnlmoKwP9TMPpqYNVaYuL Z1Di9ZV82uyq+qoLR/6NdLr8+gZk34A= X-MC-Unique: l13fXoxQObWXO7qPTO7r5A-1 X-Mimecast-MFC-AGG-ID: l13fXoxQObWXO7qPTO7r5A_1793874277 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Yonggang Luo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 1/4] hw/core: record permitted targets against MachineClass Date: Thu, 5 Nov 2026 10:24:29 +0000 Message-ID: <20261105102432.1131493-2-berrange@redhat.com> In-Reply-To: <20261105102432.1131493-1-berrange@redhat.com> References: <20261105102432.1131493-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793874303938158500 Record a bitmask of QEMU_ARCH_nnnn in the 'targets' field of MachineClass. When a request is made to create a machine, it will be validated against machine_class_is_available(MachineClass), which checks target_arch() against the 'targets' field. This prevents realization of, for example, an aarch64-only machine linked into the arm emulator binary. Signed-off-by: Daniel P. Berrang=C3=A9 --- hw/core/machine-qmp-cmds.c | 18 ++++++++++++++++++ hw/core/machine.c | 13 +++++++++++++ include/hw/core/boards.h | 3 +++ qapi/machine.json | 12 +++++++++++- system/vl.c | 9 +++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index 0558d6d703c..3a33a046622 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -33,6 +33,7 @@ #include "system/runstate.h" #include "system/system.h" #include "hw/s390x/storage-keys.h" +#include "qemu/base-arch-defs.h" =20 /* * QMP query for enabled and present accelerators @@ -153,6 +154,7 @@ qmp_query_cpu_model_expansion(CpuModelExpansionType typ= e, } =20 MachineInfoList *qmp_query_machines(bool has_compat_props, bool compat_pro= ps, + bool has_all_targets, bool all_targets, Error **errp) { GSList *el, *machines; @@ -164,6 +166,10 @@ MachineInfoList *qmp_query_machines(bool has_compat_pr= ops, bool compat_props, const char *default_cpu_type =3D machine_class_default_cpu_type(mc= ); MachineInfo *info; =20 + if (!all_targets && !machine_class_is_available(mc)) { + continue; + } + info =3D g_malloc0(sizeof(*info)); if (mc->is_default) { info->has_is_default =3D true; @@ -188,6 +194,18 @@ MachineInfoList *qmp_query_machines(bool has_compat_pr= ops, bool compat_props, } info->secure =3D object_class_is_secure(OBJECT_CLASS(mc)); =20 + if (all_targets) { + SysEmuTargetList **targets; + size_t i; + info->has_targets =3D true; + targets =3D &info->targets; + for (i =3D 0; i < SYS_EMU_TARGET__MAX; i++) { + if (mc->targets & QEMU_ARCH_BIT(i)) { + QAPI_LIST_APPEND(targets, i); + } + } + } + if (compat_props && mc->compat_props) { int i; info->compat_props =3D NULL; diff --git a/hw/core/machine.c b/hw/core/machine.c index ed9bf8f5008..9743754fc7f 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -40,6 +40,8 @@ #include "hw/acpi/generic_event_device.h" #include "qemu/audio.h" #include "hw/arm/smmuv3.h" +#include "qemu/base-arch-defs.h" +#include "qemu/target-info-qapi.h" =20 GlobalProperty hw_compat_11_1[] =3D { { "sysbus-ehci-usb", "x-migrate-fetch-addr-64bit", "off" }, @@ -711,6 +713,17 @@ bool device_type_is_dynamic_sysbus(MachineClass *mc, c= onst char *type) return allowed; } =20 +bool machine_class_is_available(MachineClass *mc) +{ + /* + * XXX: Once all machines have 'targets' set, we + * can remove the 'mc->targets =3D=3D 0' check + */ + return mc->targets =3D=3D 0 || + QEMU_ARCH_BIT(target_arch()) & mc->targets; +} + + static char *machine_get_audiodev(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); diff --git a/include/hw/core/boards.h b/include/hw/core/boards.h index d0e4ad98201..cb493397b13 100644 --- a/include/hw/core/boards.h +++ b/include/hw/core/boards.h @@ -37,6 +37,8 @@ const char *machine_default_cpu_type(const MachineState *= ms); */ const char *machine_class_default_cpu_type(MachineClass *mc); =20 +bool machine_class_is_available(MachineClass *mc); + void machine_add_audiodev_property(MachineClass *mc); void machine_run_board_init(MachineState *machine, const char *mem_path, E= rror **errp); bool machine_usb(MachineState *machine); @@ -282,6 +284,7 @@ struct MachineClass { int default_ipa_size, int max_ipa_size); bool (*get_kernel_irqchip_default) (const MachineState *machine); =20 + int targets; /* QEMU_ARCH_xxx bitmask */ BlockInterfaceType block_default_type; int units_per_default_bus; int max_cpus; diff --git a/qapi/machine.json b/qapi/machine.json index 18d9dce849b..95b02043768 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -194,6 +194,10 @@ # not providing a security boundary, or its status is undefined. # (since 11.2) # +# @targets: list of targets that the machine can be used with. Only +# present when `query-machines` argument @all-targets is true. +# (since 12.0) +# # Features: # # @unstable: Member @compat-props is experimental. @@ -205,6 +209,7 @@ '*is-default': 'bool', 'cpu-max': 'int', 'hotpluggable-cpus': 'bool', 'numa-mem-supported': 'bool', 'deprecated': 'bool', '*default-cpu-type': 'str', + '*targets': ['SysEmuTarget'], '*default-ram-id': 'str', 'acpi': 'bool', '*compat-props': { 'type': ['CompatProperty'], 'features': ['unstable'] }, @@ -217,6 +222,10 @@ # @compat-props: if true, also return compatibility properties. # (default: false) (since 9.1) # +# @all-targets: if true, return info about all machines present +# instead of only those available with the current active +# target (since 12.0) +# # Features: # # @unstable: Argument @compat-props is experimental. @@ -248,7 +257,8 @@ ## { 'command': 'query-machines', 'data': { '*compat-props': { 'type': 'bool', - 'features': [ 'unstable' ] } }, + 'features': [ 'unstable' ] }, + '*all-targets': 'bool' }, 'returns': ['MachineInfo'] } =20 ## diff --git a/system/vl.c b/system/vl.c index e7b759d5442..ace64284ae4 100644 --- a/system/vl.c +++ b/system/vl.c @@ -1583,6 +1583,9 @@ static void machine_help_func(const QDict *qdict) machines =3D g_slist_sort_with_data(machines, machine_class_cmp, NULL); for (el =3D machines; el; el =3D el->next) { MachineClass *mc =3D el->data; + if (!machine_class_is_available(mc)) { + continue; + } if (mc->alias) { printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc, mc->na= me); } @@ -2208,6 +2211,12 @@ static bool qemu_create_machine(QDict *qdict) MachineClass *machine_class =3D select_machine(qdict, &error_fatal); object_set_machine_compat_props(machine_class->compat_props); =20 + if (!machine_class_is_available(machine_class)) { + error_report("Machine '%s' is not available with this target", + machine_class->name); + return false; + } + if (!object_class_check_security(OBJECT_CLASS(machine_class), &local_err)) { error_report_err(local_err); --=20 2.56.0 From nobody Mon Nov 23 04:26:13 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793874320; cv=none; d=zohomail.com; s=zohoarc; b=ZFnIXVkiZ0vXxxmur5eQYRC9nhE6UYZm44Reb3w8fTkZr4Yxdap//DlQ5czFHGCzupr/E/vJItwG5Ev/Vx/9Sbz3mh2Isrio7bzo0XRQ4M/4LIclvWfjKWOflcLBz42hSp1hQx2t5jzgHK5sFKUUeCDUyBqs5nW/NOz2a7D08js= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793874320; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uxkG8FdSnx716mHQej0cEaVVUjxJkreNf5QXvAI+7pM=; b=WSU/W1d93fg8HcgF/hPaSNVmTEeCZlvYO14WHGGR2Yge1R4GFcGLgKsfOSarQO67WlR9BonppraZkeBmPooExNiAJSnHYwI/KGy2lXkBi7f/1WOF2t1YM79gB0mo1ER3XliCSJ8JWrV+CIpRzq4qnOFCgBBiZ5IFn1qiM91pLtw= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179387432083490.98754033836201; Thu, 5 Nov 2026 02:25:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xOueI-0001w6-Vi; Thu, 05 Nov 2026 05:24:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueH-0001vD-Ot for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueF-0003ra-7w for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:49 -0500 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-240-1HUtS2iZOnOf1vLjPUdQtw-1; Thu, 05 Nov 2026 05:24:39 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8E5D41801214; Thu, 5 Nov 2026 10:24:38 +0000 (UTC) Received: from berrange.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5053D187C36B; Thu, 5 Nov 2026 10:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793874286; 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=uxkG8FdSnx716mHQej0cEaVVUjxJkreNf5QXvAI+7pM=; b=AmcDeEkIDh3OPyn8L6g4FYopJQicz5GiPHxcKC3k5182ZLwEIZ9SxQ/2Pp/q1vz/TFismv y1F9Ek+cgsIxLFqUeFjW+SZuHHr4BxVMoNijaSh5qMYIoX+5cYZ+Zgg+TdwGBSjncEo3MN vwOnlR5JtUkXcLCe4Fsvz/PvmGXEYZY= X-MC-Unique: 1HUtS2iZOnOf1vLjPUdQtw-1 X-Mimecast-MFC-AGG-ID: 1HUtS2iZOnOf1vLjPUdQtw_1793874278 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Yonggang Luo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 2/4] hw: replace 'is_available' with 'targets' in machines Date: Thu, 5 Nov 2026 10:24:30 +0000 Message-ID: <20261105102432.1131493-3-berrange@redhat.com> In-Reply-To: <20261105102432.1131493-1-berrange@redhat.com> References: <20261105102432.1131493-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793874322198158500 For every machine which currently has an 'is_available' callback set on the TypeInfo, set the 'targets' field on the MachineClass to the equivalent arch list, and remove 'is_available'. Signed-off-by: Daniel P. Berrang=C3=A9 --- hw/arm/aspeed_ast27x0-fc.c | 3 ++- hw/arm/aspeed_ast27x0_evb.c | 5 +++-- hw/arm/raspi.c | 21 +++++++++++++-------- hw/arm/raspi4b.c | 3 ++- hw/arm/virt.c | 5 +++-- hw/hexagon/virt.c | 3 ++- hw/m68k/virt.c | 4 ++-- hw/or1k/virt.c | 3 ++- hw/riscv/virt.c | 4 +++- 9 files changed, 32 insertions(+), 19 deletions(-) diff --git a/hw/arm/aspeed_ast27x0-fc.c b/hw/arm/aspeed_ast27x0-fc.c index 73362b60d2a..ea340c6f1cf 100644 --- a/hw/arm/aspeed_ast27x0-fc.c +++ b/hw/arm/aspeed_ast27x0-fc.c @@ -22,6 +22,7 @@ #include "hw/arm/boot.h" #include "hw/block/flash.h" #include "hw/arm/aspeed_coprocessor.h" +#include "qemu/base-arch-defs.h" =20 #define TYPE_AST2700FC MACHINE_TYPE_NAME("ast2700fc") OBJECT_DECLARE_SIMPLE_TYPE(Ast2700FCState, AST2700FC); @@ -226,6 +227,7 @@ static void ast2700fc_class_init(ObjectClass *oc, const= void *data) mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->min_cpus =3D mc->max_cpus =3D mc->default_cpus =3D 6; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64); } =20 static const TypeInfo ast2700fc_types[] =3D { @@ -234,7 +236,6 @@ static const TypeInfo ast2700fc_types[] =3D { .parent =3D TYPE_MACHINE, .class_init =3D ast2700fc_class_init, .instance_size =3D sizeof(Ast2700FCState), - .is_available =3D target_aarch64, }, }; =20 diff --git a/hw/arm/aspeed_ast27x0_evb.c b/hw/arm/aspeed_ast27x0_evb.c index 460c9ff0d2e..b252edc5103 100644 --- a/hw/arm/aspeed_ast27x0_evb.c +++ b/hw/arm/aspeed_ast27x0_evb.c @@ -11,6 +11,7 @@ #include "hw/arm/aspeed.h" #include "hw/arm/aspeed_soc.h" #include "hw/sensor/tmp105.h" +#include "qemu/base-arch-defs.h" =20 /* AST2700 evb hardware value */ /* SCU HW Strap1 */ @@ -45,6 +46,7 @@ static void aspeed_machine_ast2700a1_evb_class_init(Objec= tClass *oc, amc->i2c_init =3D ast2700_evb_i2c_init; amc->vbootrom =3D true; mc->default_ram_size =3D 1 * GiB; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64); aspeed_machine_class_init_cpus_defaults(mc); } =20 @@ -67,6 +69,7 @@ static void aspeed_machine_ast2700a2_evb_class_init(Objec= tClass *oc, amc->i2c_init =3D ast2700_evb_i2c_init; amc->vbootrom =3D true; mc->default_ram_size =3D 2 * GiB; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64); aspeed_machine_class_init_cpus_defaults(mc); } =20 @@ -75,13 +78,11 @@ static const TypeInfo aspeed_ast27x0_evb_types[] =3D { .name =3D MACHINE_TYPE_NAME("ast2700a1-evb"), .parent =3D TYPE_ASPEED_MACHINE, .class_init =3D aspeed_machine_ast2700a1_evb_class_init, - .is_available =3D target_aarch64, }, { .name =3D MACHINE_TYPE_NAME("ast2700a2-evb"), .parent =3D TYPE_ASPEED_MACHINE, .class_init =3D aspeed_machine_ast2700a2_evb_class_init, - .is_available =3D target_aarch64, } }; =20 diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index fadbacb2534..b1d2eece2c0 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -25,6 +25,8 @@ #include "hw/core/boards.h" #include "hw/core/loader.h" #include "qom/object.h" +#include "qemu/base-arch-defs.h" + =20 #define TYPE_RASPI_MACHINE MACHINE_TYPE_NAME("raspi-common") OBJECT_DECLARE_SIMPLE_TYPE(RaspiMachineState, RASPI_MACHINE) @@ -330,10 +332,15 @@ void raspi_machine_class_common_init(MachineClass *mc, }; =20 static void raspi_machine_class_init(MachineClass *mc, - uint32_t board_rev) + uint32_t board_rev, + bool arch64bitonly) { raspi_machine_class_common_init(mc, board_rev); mc->init =3D raspi_machine_init; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64); + if (!arch64bitonly) { + mc->targets |=3D QEMU_ARCH_BIT(SYS_EMU_TARGET_ARM); + } }; =20 static void raspi0_machine_class_init(ObjectClass *oc, const void *data) @@ -343,7 +350,7 @@ static void raspi0_machine_class_init(ObjectClass *oc, = const void *data) =20 mc->auto_create_sdcard =3D true; rmc->board_rev =3D 0x920092; /* Revision 1.2 */ - raspi_machine_class_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev, false); }; =20 static void raspi1ap_machine_class_init(ObjectClass *oc, const void *data) @@ -353,7 +360,7 @@ static void raspi1ap_machine_class_init(ObjectClass *oc= , const void *data) =20 mc->auto_create_sdcard =3D true; rmc->board_rev =3D 0x900021; /* Revision 1.1 */ - raspi_machine_class_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev, false); }; =20 static void raspi2b_machine_class_init(ObjectClass *oc, const void *data) @@ -363,7 +370,7 @@ static void raspi2b_machine_class_init(ObjectClass *oc,= const void *data) =20 mc->auto_create_sdcard =3D true; rmc->board_rev =3D 0xa21041; - raspi_machine_class_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev, false); }; =20 static void raspi3ap_machine_class_init(ObjectClass *oc, const void *data) @@ -373,7 +380,7 @@ static void raspi3ap_machine_class_init(ObjectClass *oc= , const void *data) =20 mc->auto_create_sdcard =3D true; rmc->board_rev =3D 0x9020e0; /* Revision 1.0 */ - raspi_machine_class_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev, true); }; =20 static void raspi3b_machine_class_init(ObjectClass *oc, const void *data) @@ -383,7 +390,7 @@ static void raspi3b_machine_class_init(ObjectClass *oc,= const void *data) =20 mc->auto_create_sdcard =3D true; rmc->board_rev =3D 0xa02082; - raspi_machine_class_init(mc, rmc->board_rev); + raspi_machine_class_init(mc, rmc->board_rev, true); }; =20 static const TypeInfo raspi_machine_types[] =3D { @@ -403,12 +410,10 @@ static const TypeInfo raspi_machine_types[] =3D { .name =3D MACHINE_TYPE_NAME("raspi3ap"), .parent =3D TYPE_RASPI_MACHINE, .class_init =3D raspi3ap_machine_class_init, - .is_available =3D target_aarch64, }, { .name =3D MACHINE_TYPE_NAME("raspi3b"), .parent =3D TYPE_RASPI_MACHINE, .class_init =3D raspi3b_machine_class_init, - .is_available =3D target_aarch64, }, { .name =3D TYPE_RASPI_MACHINE, .parent =3D TYPE_RASPI_BASE_MACHINE, diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c index 600dfe686f2..92c3f580f96 100644 --- a/hw/arm/raspi4b.c +++ b/hw/arm/raspi4b.c @@ -21,6 +21,7 @@ #include "hw/arm/boot.h" #include "qom/object.h" #include "hw/arm/bcm2838.h" +#include "qemu/base-arch-defs.h" #include =20 #define TYPE_RASPI4B_MACHINE MACHINE_TYPE_NAME("raspi4b") @@ -93,6 +94,7 @@ static void raspi4b_machine_class_init(ObjectClass *oc, c= onst void *data) raspi_machine_class_common_init(mc, rmc->board_rev); mc->auto_create_sdcard =3D true; mc->init =3D raspi4b_machine_init; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64); } =20 static const TypeInfo raspi4b_machine_type =3D { @@ -100,7 +102,6 @@ static const TypeInfo raspi4b_machine_type =3D { .parent =3D TYPE_RASPI_BASE_MACHINE, .instance_size =3D sizeof(Raspi4bMachineState), .class_init =3D raspi4b_machine_class_init, - .is_available =3D target_aarch64, }; =20 static void raspi4b_machine_register_type(void) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0b11f7e328c..bd38e3262a4 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -94,6 +94,7 @@ #include "hw/cxl/cxl_host.h" #include "qemu/guest-random.h" #include "hw/watchdog/sbsa_gwdt.h" +#include "qemu/base-arch-defs.h" =20 static GlobalProperty arm_virt_compat_defaults[] =3D { { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "48" }, @@ -131,7 +132,6 @@ static void arm_virt_compat_default_set(MachineClass *m= c) .name =3D MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ .parent =3D TYPE_VIRT_MACHINE, \ .class_init =3D MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ - .is_available =3D target_base_arm, \ .secure =3D true, \ }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ @@ -4204,6 +4204,8 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) hc->unplug =3D virt_machine_device_unplug_cb; mc->nvdimm_supported =3D true; mc->smp_props.clusters_supported =3D true; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_AARCH64) | + QEMU_ARCH_BIT(SYS_EMU_TARGET_ARM); =20 /* Supported caches */ mc->smp_props.cache_supported[CACHE_LEVEL_AND_TYPE_L1D] =3D true; @@ -4444,7 +4446,6 @@ static const TypeInfo virt_machine_info =3D { { TYPE_HOTPLUG_HANDLER }, { } }, - .is_available =3D target_base_arm, }; =20 static void machvirt_machine_init(void) diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index d8e91770595..57ef8b5e736 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -17,6 +17,7 @@ #include "qemu/units.h" #include "machine_cfg_v68n_1024.h.inc" #include "system/device_tree.h" +#include "qemu/base-arch-defs.h" =20 enum { VIRT_UART0, @@ -115,6 +116,7 @@ static void virt_class_init(ObjectClass *oc, const void= *data) mc->no_cdrom =3D 1; mc->numa_mem_supported =3D false; mc->default_nic =3D "virtio-mmio-bus"; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_HEXAGON); } =20 =20 @@ -123,7 +125,6 @@ static const TypeInfo virt_machine_types[] =3D { { .parent =3D TYPE_HEXAGON_COMMON_MACHINE, .instance_size =3D sizeof(HexagonVirtMachineState), .class_init =3D virt_class_init, - .is_available =3D target_hexagon, } }; =20 DEFINE_TYPES(virt_machine_types) diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index e52546e4fab..f35eac74147 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -36,6 +36,7 @@ #include "hw/intc/goldfish_pic.h" #include "hw/virtio/virtio-mmio.h" #include "hw/virtio/virtio-blk.h" +#include "qemu/base-arch-defs.h" =20 /* * 6 goldfish-pic for CPU IRQ #1 to IRQ #6 @@ -320,6 +321,7 @@ static void virt_machine_class_init(ObjectClass *oc, co= nst void *data) mc->no_floppy =3D 1; mc->no_parallel =3D 1; mc->default_ram_id =3D "m68k_virt.ram"; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_M68K); } =20 static const TypeInfo virt_machine_info =3D { @@ -327,7 +329,6 @@ static const TypeInfo virt_machine_info =3D { .parent =3D TYPE_MACHINE, .abstract =3D true, .class_init =3D virt_machine_class_init, - .is_available =3D target_m68k, }; =20 static void virt_machine_register_types(void) @@ -355,7 +356,6 @@ type_init(virt_machine_register_types) .name =3D MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \ .parent =3D MACHINE_TYPE_NAME("virt"), \ .class_init =3D MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \ - .is_available =3D target_m68k, \ }; \ static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \ { \ diff --git a/hw/or1k/virt.c b/hw/or1k/virt.c index a3ff903839b..f5580f3c3da 100644 --- a/hw/or1k/virt.c +++ b/hw/or1k/virt.c @@ -28,6 +28,7 @@ #include "system/system.h" #include "system/qtest.h" #include "system/reset.h" +#include "qemu/base-arch-defs.h" =20 #include =20 @@ -552,6 +553,7 @@ static void openrisc_virt_machine_init(ObjectClass *oc,= const void *data) mc->max_cpus =3D VIRT_CPUS_MAX; mc->is_default =3D false; mc->default_cpu_type =3D OPENRISC_CPU_TYPE_NAME("or1200"); + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_OR1K); } =20 static const TypeInfo or1ksim_machine_typeinfo =3D { @@ -559,7 +561,6 @@ static const TypeInfo or1ksim_machine_typeinfo =3D { .parent =3D TYPE_MACHINE, .class_init =3D openrisc_virt_machine_init, .instance_size =3D sizeof(OR1KVirtState), - .is_available =3D target_or1k, }; =20 static void or1ksim_machine_init_register_types(void) diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 8bc5a7b0728..6b3d6a764f3 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -61,6 +61,7 @@ #include "qapi/qapi-type-infos-common.h" #include "hw/virtio/virtio-iommu.h" #include "hw/uefi/var-service-api.h" +#include "qemu/base-arch-defs.h" =20 #include "aia.h" =20 @@ -1140,6 +1141,8 @@ static void virt_machine_class_init(ObjectClass *oc, = const void *data) mc->default_ram_id =3D "riscv_virt_board.ram"; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler =3D virt_machine_get_hotplug_handler; + mc->targets =3D QEMU_ARCH_BIT(SYS_EMU_TARGET_RISCV64) | + QEMU_ARCH_BIT(SYS_EMU_TARGET_RISCV32); =20 hc->plug =3D virt_machine_device_plug_cb; =20 @@ -1195,7 +1198,6 @@ static const TypeInfo virt_machine_typeinfo =3D { .instance_init =3D virt_machine_instance_init, .instance_finalize =3D virt_machine_instance_finalize, .instance_size =3D sizeof(RISCVVirtState), - .is_available =3D target_base_riscv, .interfaces =3D (const InterfaceInfo[]) { { TYPE_HOTPLUG_HANDLER }, { } --=20 2.56.0 From nobody Mon Nov 23 04:26:13 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793874353; cv=none; d=zohomail.com; s=zohoarc; b=Mr5k8RnPEfrKkTnaAqVnYP+ruZNG226J6f4OYCt3MMK4dB9UIjBD/BAPRe5y8pvwAl0twvkwq/LaKLByZNxmlo+ADUzM/Z/yHRVuaHy+CioottDLLc9x4f3VgjORV7yV5hvGmB9gGp1FD7VWco4gRf6qmUE+3GrN+CjX6WHF/aY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793874353; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xy10kbEswNZkcfR2bdPDk1CtSR3z7t5DJt7rQe8Yw38=; b=bOOZ9o9D7v3jX8i0dbnCE45P3inji9s+8YnmhTK4lJHrQk+WU4y3ulFt0Bbh7tXM4/T7twCrUV0gdDnNLjdkiZrwEuydFOIInVoMJhyRExvtf6cv4NqaZmZETsRjxmm97zmv+TIL/fYTBiCEjjOqfYkaBwPoBeFOgsIdJcGJ5hQ= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793874353204796.3421434790679; Thu, 5 Nov 2026 02:25:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xOueH-0001vA-7N; Thu, 05 Nov 2026 05:24:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueG-0001v0-3T for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueE-0003rY-Gy for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:47 -0500 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-307-mJ5AtYnGMdiwKLljHG1gKg-1; Thu, 05 Nov 2026 05:24:41 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9563E1955F25; Thu, 5 Nov 2026 10:24:40 +0000 (UTC) Received: from berrange.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 18957187C36F; Thu, 5 Nov 2026 10:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793874285; 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=xy10kbEswNZkcfR2bdPDk1CtSR3z7t5DJt7rQe8Yw38=; b=iCaZbt7QUhCquVgyTahhWBGqpX8KUZgbg+z5lmcGeq+nGq1PGaufixL6Ke71JcEABDQaFj Jnk8cWS9u5gR/g/W+TvO0B8KePXqX0/6biZgYWtUCizm9RlTbLybNhrOZyNzdEE8hG6sUt 2/9X1PL+QMJpRC+LOVM8tP73sns56iw= X-MC-Unique: mJ5AtYnGMdiwKLljHG1gKg-1 X-Mimecast-MFC-AGG-ID: mJ5AtYnGMdiwKLljHG1gKg_1793874280 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Yonggang Luo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 3/4] target/riscv: remove 'is_available' from riscv CPUs Date: Thu, 5 Nov 2026 10:24:31 +0000 Message-ID: <20261105102432.1131493-4-berrange@redhat.com> In-Reply-To: <20261105102432.1131493-1-berrange@redhat.com> References: <20261105102432.1131493-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793874354831158501 Allow CPU classes to always be registered, with any logic about which CPUs are usable in which machines to be done in code, if it is needed. Signed-off-by: Daniel P. Berrang=C3=A9 --- target/riscv/kvm/kvm-cpu.c | 1 - target/riscv/tcg/tcg-cpu.c | 1 - 2 files changed, 2 deletions(-) diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c index 5beb6023380..bf9504635e0 100644 --- a/target/riscv/kvm/kvm-cpu.c +++ b/target/riscv/kvm/kvm-cpu.c @@ -2241,7 +2241,6 @@ static const TypeInfo kvm_cpu_accel_type_info =3D { =20 .parent =3D TYPE_ACCEL_CPU, .class_init =3D kvm_cpu_accel_class_init, - .is_available =3D target_base_riscv, .abstract =3D true, }; static void kvm_cpu_accel_register_types(void) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 5834ec1524f..3d9c9973292 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -1755,7 +1755,6 @@ static const TypeInfo riscv_tcg_cpu_accel_type_info = =3D { =20 .parent =3D TYPE_ACCEL_CPU, .class_init =3D riscv_tcg_cpu_accel_class_init, - .is_available =3D target_base_riscv, .abstract =3D true, }; =20 --=20 2.56.0 From nobody Mon Nov 23 04:26:13 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1793874298; cv=none; d=zohomail.com; s=zohoarc; b=aBlkIrSe2y59yUh+k4WZ2HLWQm6McRi9lIRlEIepzw+4imcK+oJveyMRoLjUuY7s3Z5pBgmmFx6fMBcEUfAiijV5jZpG2zNpOROq0QL9MNgsJfKLLhtiMG3nkHGHwGKzcaKL6bsSOiQ7SA6fYS4aR6V4aWRlyIoZ34sFtx6HtJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793874298; 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:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BbVrHsRcVMsOA6+C5iktF9vRLfijlzcX16e6cHIyDvg=; b=jszJHRtF57LDtAfsUG8PYORIAFRbPXpq/D93kuHZEaB+cCFJgzUg1IVQNQF65iC9e9SXMrnykB4qtE5AN1NoHZIdwdyuuJcv8A0sJ2Z0v7/n2qvRgcEXtu0qPIPMRqFVo9uCUr282zQ/BR5Selz22L8XHV0StobgMSaaQABL6Z8= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793874298875362.5693226111463; Thu, 5 Nov 2026 02:24:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xOueG-0001v8-L0; Thu, 05 Nov 2026 05:24:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueF-0001un-FH for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xOueD-0003rM-Kd for qemu-devel@nongnu.org; Thu, 05 Nov 2026 05:24:47 -0500 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-357-rndoIj6DMzClx2CWH_oQ2g-1; Thu, 05 Nov 2026 05:24:43 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 466F11956071; Thu, 5 Nov 2026 10:24:42 +0000 (UTC) Received: from berrange.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0AA86187C36B; Thu, 5 Nov 2026 10:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1793874284; 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=BbVrHsRcVMsOA6+C5iktF9vRLfijlzcX16e6cHIyDvg=; b=LepHpc7EYwvZzeumJMnj7ipAPs6QYmvCAsZzBf/tqi5VDr9uGypbmy5q+f7KgY2OM4GGkB GqGqfctAjV4Qt7GC5UVsSDaochhy1lm8g3oSaxQp73OZXdyc7idNqALp+axYM+W2n9mAtO mxxM3Z68XC2g6b73U5Z7KzLu0SjzrvQ= X-MC-Unique: rndoIj6DMzClx2CWH_oQ2g-1 X-Mimecast-MFC-AGG-ID: rndoIj6DMzClx2CWH_oQ2g_1793874282 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Yonggang Luo , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 4/4] qom: drop the 'is_available' callback from TypeInfo Date: Thu, 5 Nov 2026 10:24:32 +0000 Message-ID: <20261105102432.1131493-5-berrange@redhat.com> In-Reply-To: <20261105102432.1131493-1-berrange@redhat.com> References: <20261105102432.1131493-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 5 X-Spam_score: 0.5 X-Spam_bar: / X-Spam_report: (0.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1793874300051158500 For the purposes of introspection, a binary must always register all compiled in types (classes). Any filtering of what is permitted with a given selected target should happen at time of use/query. As such the 'is_available' callback on TypeInfo is an undesirable design pattern and with Machine classes converted it can be removed. Signed-off-by: Daniel P. Berrang=C3=A9 --- include/qom/object.h | 3 --- qom/object.c | 4 ---- rust/qom/src/qom.rs | 1 - 3 files changed, 8 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 70d8ea3e299..06a55b410ba 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -475,8 +475,6 @@ struct Object * @class_data: Data to pass to the @class_init, * @class_base_init. This can be useful when building dynamic * classes. - * @is_available: callback invoked at registration time, to dynamically ch= eck if - * this type should be available or not. * @interfaces: The list of interfaces associated with this type. This * should point to a static array that's terminated with a zero filled * element. @@ -500,7 +498,6 @@ struct TypeInfo void (*class_base_init)(ObjectClass *klass, const void *data); const void *class_data; =20 - bool (*is_available)(void); const InterfaceInfo *interfaces; }; =20 diff --git a/qom/object.c b/qom/object.c index cd0590c3fd0..1d9ff06cacf 100644 --- a/qom/object.c +++ b/qom/object.c @@ -167,10 +167,6 @@ static TypeImpl *type_register_internal(const TypeInfo= *info) abort(); } =20 - if (info->is_available && !info->is_available()) { - return NULL; - } - ti =3D type_new(info); =20 type_table_add(ti); diff --git a/rust/qom/src/qom.rs b/rust/qom/src/qom.rs index 81449eeefad..372be188622 100644 --- a/rust/qom/src/qom.rs +++ b/rust/qom/src/qom.rs @@ -695,7 +695,6 @@ pub trait ObjectImpl: ObjectType + IsA { class_init: Some(rust_class_init::), class_base_init: Self::CLASS_BASE_INIT, class_data: core::ptr::null(), - is_available: None, interfaces: core::ptr::null(), }; =20 --=20 2.56.0