From nobody Mon Nov 23 04:36:06 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1793905481; cv=none; d=zohomail.com; s=zohoarc; b=lD9sDPt54Tzo0P8wlLMYd64fUmf+vHIMsTs/p+53YDEzBOgg0sFdEL8W4RnZmVYPT0AU7gZbmb4gALCuHtXio8szC7/qj2od48WozaEjqxKUflvd0LIT71vwQr6IsbM4W4LY/4YYssZ5psXNm3Ayf/DeUR9h39TtomPM6fqdWmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793905481; h=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=am9rKxkmJI56O/AW/S6W/T2yFW6Ysjk6dcvPsZuNnUg=; b=HkPnMiYxa9oB1XSZTcIS9ysYvc4K3gOev5z+NecsBOM5N9ux8pUTfIQ7bvmg0KNks3oGMsa4l05pZZd+sqprFN5ByYZeKSJWIhR5S2IqwSZyDswWB5SGNv2c5dkEVGg96pI69yxj2VvvWQRa97YY6KUOUKCAOKaMnW0k8BxfsBg= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793905481874332.870887320837; Thu, 5 Nov 2026 11:04:41 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xP2l5-0004rM-OS; Thu, 05 Nov 2026 14:04:27 -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 1xP2km-0004qW-1v for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:04 -0500 Received: from mail-dl1-x122f.google.com ([2607:f8b0:4864:20::122f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xP2kh-0003kb-QF for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:03 -0500 Received: by mail-dl1-x122f.google.com with SMTP id a92af1059eb24-1ae18eb9b69so2347856c88.0 for ; Thu, 05 Nov 2026 11:03:59 -0800 (PST) Received: from DESKTOP-Q716RM7 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-1b245c4706bsm22924284c88.15.2026.11.05.11.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2026 11:03:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793905438; x=1794510238; 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:content-type; bh=am9rKxkmJI56O/AW/S6W/T2yFW6Ysjk6dcvPsZuNnUg=; b=LlCwEuDIjLBgEPFe2EA+SVwgTtVN1rwto/sa/KbYBOxS3yccZCVpD+Difp7HXnBl93 wjeF0n5WKVZssmfmY8Vou+GPk6EPfDwHZyFBBD67RQiQlVzr3TnrsC2j7c3LH8zQPQCt KU2agXnJ9UdKS0ic/38Z7hay5diuddgXyQhOwQoC7WEzKgo111VmFfyn8LEyyFu0W2Qf wQ/WyptqiJdSf6hXwxOjpADNFxVaYsocW9/uPXEjgHIqiDOXn57h6781c9DznXXyNMa6 4QxL0jpbQ8aC89cmhMVxxVbezAY+HizamFAR+wUyN67NXsjNv/2tWaOQU65OZY9RpYwx oTJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793905438; x=1794510238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=am9rKxkmJI56O/AW/S6W/T2yFW6Ysjk6dcvPsZuNnUg=; b=vFwGOpx7AaW0WYP1plsTtHb1s62yZ5S9mF7h+dyP3rSahfpFx+3JkkJ/zU30p3UT+h DZ5JcPo04E9VJUoci1wVT7BmHaz3hJdl8GusFvOZ6C4Rn9wLuaqxG8yDID6r8J6+gL5b FRkqNIvfCjK2pe1+Bi+gU/3051uMcJoQmUnKpvI03oez1Guti/YGWMSygqcMHvTxcuyu ZW1YsmPY04eIbCtYfrsqmOGjXwZ9UK6nCv2RV64BeXY+jZXlFz9qowjZYMU10+mN6Bac bTn4GxaENQE2ug3nydFnmi6D+cI8XtzQ2dKW4UzrrWg5eLhbpuwFB/48yklKpFH1dSgb baNg== X-Gm-Message-State: APuU4Z9SAwuDVExOks/hsetV/0cYBwkkAg0gciJGaV5iBjCTakirMeHa zyt6n0rrxbrfX/3yCXWChfMbxuudGRoNFXjfnfF6r1iKCM2qc7n3NrU2n79WtNmiXZY= X-Gm-Gg: AYBFou0PVf5fpyRJYC+rv10Nl1IKlJruqvvNbyQqUEESO6gzZiLlA0p3OyU/0FugaPw FhFxrXUnjVxAN5xonCpKkuPvXyUKOhOjGZF0QU3SQ0GqDy/acjLpTBhSnGBxAFa+QbaiyLDg6Y6 ZXwRRJxchF6iYvyfmwYIVCAmdhCo9j2LYrG5DjaOveWz7Z+Teb7Kp59HhujMHMOOyg133rMYGKB yK0O2nPkItwES7GWdYEdWW0A5CyuGr0xKleBRWuqTxEIdcDIxBcWYnV8E+Bi5qxw8CzRf0tTNzS GvGZwsUrLh7Sd5MDie89leO0TmvCZfjb99F5S9oaE3RmQ9EZobD/QQip+gOdXOJu1ggOxKfsEAl fPo1ohobU3TIIGCO0oTfARVEV+PBSHEH/5wKHZ3wAjO0TeKwVdV7fLEDmUMy+yP+/Dl360s3usZ YpUAHHh0CYEfAcxwe65v2c4lpmXsqeYgUXG+z+I6+HsarLYs+N7Ah92fmeSa3dQlzs8E24eco45 OMViNo/+Vd32BVZgwQc/tDGOAeYVHF2n/Hrsgh0uqZgwX80d9qSENcbcC6Ck0zIvmRtlPkqQICg GbccrAOmFPOQJbYdTjBQKt8fjbt1TO05TRaLyw3OD7hCVcmf X-Received: by 2002:a05:701b:4283:10b0:166:f097:6f12 with SMTP id a92af1059eb24-1ac5cb1a303mr30062890c88.15.1793905437781; Thu, 05 Nov 2026 11:03:57 -0800 (PST) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Philippe Mathieu-Daude Subject: [PATCH 1/5] qom: store registration targets on TypeImpl Date: Fri, 6 Nov 2026 03:03:42 +0800 Message-ID: <20261105190346.1539-2-luoyonggang@gmail.com> X-Mailer: git-send-email 2.55.0.windows.3 In-Reply-To: <20261105190346.1539-1-luoyonggang@gmail.com> References: <20261105190346.1539-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::122f; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x122f.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, FREEMAIL_FROM=0.001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1793905483101158500 Content-Type: text/plain; charset="utf-8" type_new() and type_register_internal() take a QEMU_ARCH_* mask and save it on the new TypeImpl. type_register_static() and the built-in object and interface types pass QEMU_ARCH_ALL. An interface type copies the mask from the concrete type that implements it. Signed-off-by: Yonggang Luo --- qom/object.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/qom/object.c b/qom/object.c index cd0590c3fd..b7e1924e81 100644 --- a/qom/object.c +++ b/qom/object.c @@ -71,6 +71,8 @@ struct TypeImpl bool abstract; bool secure; =20 + uint64_t targets; + const char *parent; TypeImpl *parent_type; =20 @@ -97,7 +99,7 @@ static TypeImpl *type_table_lookup(const char *name) return g_hash_table_lookup(type_table, name); } =20 -static TypeImpl *type_new(const TypeInfo *info) +static TypeImpl *type_new(const TypeInfo *info, uint64_t targets) { TypeImpl *ti =3D g_malloc0(sizeof(*ti)); int i; @@ -126,6 +128,7 @@ static TypeImpl *type_new(const TypeInfo *info) =20 ti->abstract =3D info->abstract; ti->secure =3D info->secure; + ti->targets =3D targets; =20 for (i =3D 0; info->interfaces && info->interfaces[i].type; i++) { ti->interfaces[i].typename =3D g_strdup(info->interfaces[i].type); @@ -158,7 +161,7 @@ static bool type_name_is_valid(const char *name) return plen =3D=3D slen; } =20 -static TypeImpl *type_register_internal(const TypeInfo *info) +static TypeImpl *type_register_internal(const TypeInfo *info, uint64_t tar= gets) { TypeImpl *ti; =20 @@ -171,7 +174,7 @@ static TypeImpl *type_register_internal(const TypeInfo = *info) return NULL; } =20 - ti =3D type_new(info); + ti =3D type_new(info, targets); =20 type_table_add(ti); return ti; @@ -180,7 +183,7 @@ static TypeImpl *type_register_internal(const TypeInfo = *info) TypeImpl *type_register_static(const TypeInfo *info) { assert(info->parent); - return type_register_internal(info); + return type_register_internal(info, QEMU_ARCH_ALL); } =20 void type_register_static_array(const TypeInfo *infos, int nr_infos) @@ -310,7 +313,7 @@ static void type_initialize_interface(TypeImpl *ti, Typ= eImpl *interface_type, info.name =3D g_strdup_printf("%s::%s", ti->name, interface_type->name= ); info.abstract =3D true; =20 - iface_impl =3D type_new(&info); + iface_impl =3D type_new(&info, ti->targets); iface_impl->parent_type =3D parent_type; type_initialize(iface_impl); g_free((char *)info.name); @@ -3239,6 +3242,6 @@ static void __attribute__((constructor)) register_typ= es(void) }; =20 type_table =3D g_hash_table_new(g_str_hash, g_str_equal); - type_interface =3D type_register_internal(&interface_info); - type_register_internal(&object_info); + type_interface =3D type_register_internal(&interface_info, QEMU_ARCH_A= LL); + type_register_internal(&object_info, QEMU_ARCH_ALL); } --=20 2.55.0.windows.3 From nobody Mon Nov 23 04:36:06 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1793905558; cv=none; d=zohomail.com; s=zohoarc; b=K59rGBoFcABMqURHu5agXMFrpIGT4iey6kuaXtKiR+9TycHcjwM0PtBX6NUJPuIL5ox91eK+FN1Z5ATVC7ZySZgRdOWfipFurbT+UdFexxH5asqRHT2eplufJ+b/6HuPtivDYMr6CQtBpQuQQgDkPQ7MPdZNbw+5EljPK5LS0DI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793905558; h=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=bkzwqMJPNAcV6xuA38vl9g5vvmf0U7gVJCHn4dto4HA=; b=LVNfY4jN2fPyNtHqGFhmd0WP9+B1Mf8Se6uuxvP/OHtsUofQDskSPZGVsVJDSj7quHxRQGL0cqOJ9FmyBIh5S5eDnm34OVx/IUbgEyNORcMEIELBXytCFayKyV0ag/6ToPZQX4I1a0WBU70+uDd4yVs9LuWOCLnk4FQPtKCwLrA= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793905558057859.5538825021742; Thu, 5 Nov 2026 11:05:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xP2lZ-0004wZ-NN; Thu, 05 Nov 2026 14:04:53 -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 1xP2kn-0004qz-U4 for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:06 -0500 Received: from mail-dl1-x1235.google.com ([2607:f8b0:4864:20::1235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xP2kk-0003ki-Sh for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:05 -0500 Received: by mail-dl1-x1235.google.com with SMTP id a92af1059eb24-15ea896ddc8so3736856c88.0 for ; Thu, 05 Nov 2026 11:04:02 -0800 (PST) Received: from DESKTOP-Q716RM7 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-1b245c4706bsm22924284c88.15.2026.11.05.11.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2026 11:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793905441; x=1794510241; 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:content-type; bh=bkzwqMJPNAcV6xuA38vl9g5vvmf0U7gVJCHn4dto4HA=; b=nOwCFp/bNkgcNuRwzkQLN/y0YcJDvkbM0mnTr+sSV5epcMIYQf5OzS0P//z5cE6KEK s4zc8ka0ZaZSYf4KWRcpOwCEJMbQDbqzUw2JfPEDp/blv+19qonS5/Kwz19u31LSRGeG p9Z1s/a87o/60j9HWw08v5iuFB+JhxmhyAHlSqCgP/TqMKHrHoKE1hxhPdT+yequ07kv vycXTqT8PZJJiXE9ZH1plyhALq4Y+555zKNiMoTMt+S4oNUFLP20APQ8f8kpSKvpivoE SKFB/nBAzhykee1ptValEQm7n5mYWpgcKC8KCmCEbj9Hl8gHLsOvoPONYzRYg1WIIEyf mTMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793905441; x=1794510241; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=bkzwqMJPNAcV6xuA38vl9g5vvmf0U7gVJCHn4dto4HA=; b=Mw+rzLCcD7h48CaAnx9rOk2f2fKiRX9bMvm9afAwLH6pwV3oLwj4d7OByPmdBS6Z7C AtOi3yQBpOG0yZXcY+1eORBzJXyJ7NHRzMfm7rwjiIbxopX2gZTZEZORGlPPhjiTung+ GbHq+lD19VSouIUJNep/vp4YnZSrdB0EUygRRJ+PKq5zQ4k4kt9YsPog8ne0qoCB1QHB 11Pg6DtSnvH2FZFln1SZh47axLJt1KmQ+763v/gKHVvYvy5v+7xRRoZpn6wXdOjrTlMX zixFJlnMoUmSAkRiM4LGJ1S+aKqzkrWgr4bd3kAoXAGOZLN2jamj8Jr+iBlqirFwJbBq v40w== X-Gm-Message-State: APuU4Z/ByZb+slYkJ4lc6gMrE6r+EmWNJ1PjRfpMGSlb3hrvk8gozovJ dQR7FTL71Ea1KSBoUjVBLsOni/maDELF9fIgNWVwXiYjUphiCx+U55VzBYQ3nc8dR3I= X-Gm-Gg: AYBFou36iGQETF7pTRdyntFrpuawUL0RkAf1bR+G2MU1abycjMlNKRuwE+5Qzx32vo5 N3xcHobgOTWBylSHpJVSQ/mSfPTd9u0eKEAtbHY6gy8Bn0GyIQRHQirqMjQMAxYsxX95OfQtM22 GOhaK4J60EnpByDnp2H+fr8LlFQ2Q9TA6yJA8hMWuWErVQm9YlGN7EjUz2UeCbYBLxr/RX/DdbN AklSlMaI4ufFDRBpCmCSEVBlILWY6J2JE9vCee9D+qsYbxb6RoPiE+XI8riXgVXYS+XwHgVx22Z GHXMp2wHNu9Zu3mBDu1oXjBsYqRxeKSJE+1WBOKvDJXL9WcqZykXGunmHLoVjaW7fKHn4cYsioi xiqIY3PDJkc/H9qtQt9ZqJM+BtqwCctWy7WBgCPgha4XuBAAex/AJ4W1Dk6QqFF443ra494iTer XgxJ8e6kEmBywF2/h4/PdRV7Qn67c6+iUgTYZ/NlLzapFRqawq7C1mpGF0vkpsEIijftVgAqLlC jI+6A63Q9sm+MgTpfyeUgfp8sPYUhTRwOF0Zv+6wzWfMDJvMJSC9ITrVWr+inA8yPGN5UdKpohU oFe38B+jVRVisbF5jYZVcIPaUqr95+QjbkxLTHRkHWMOrYvt X-Received: by 2002:a05:701b:21db:b0:1b1:251f:d732 with SMTP id a92af1059eb24-1b23f20d4b8mr12520251c88.31.1793905441068; Thu, 05 Nov 2026 11:04:01 -0800 (PST) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Philippe Mathieu-Daude Subject: [PATCH 2/5] target-info: add target_mask_selected() Date: Fri, 6 Nov 2026 03:03:43 +0800 Message-ID: <20261105190346.1539-3-luoyonggang@gmail.com> X-Mailer: git-send-email 2.55.0.windows.3 In-Reply-To: <20261105190346.1539-1-luoyonggang@gmail.com> References: <20261105190346.1539-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1235; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x1235.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, FREEMAIL_FROM=0.001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1793905560251158500 Content-Type: text/plain; charset="utf-8" Return the QEMU_ARCH_* mask of the selected target. System mode returns QEMU_ARCH_ALL until a target is selected. User mode returns that target's bit. Tools return 0. Signed-off-by: Yonggang Luo Reviewed-by: Daniel P. Berrang=C3=A9 --- include/qemu/target-info-init.h | 15 ++++++++++----- include/qemu/target-info.h | 9 +++++++++ stubs/meson.build | 1 + stubs/target-mask-selected.c | 13 +++++++++++++ target-info-def.c | 3 +++ target-info-qom.c | 10 ++++++++++ 6 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 stubs/target-mask-selected.c diff --git a/include/qemu/target-info-init.h b/include/qemu/target-info-ini= t.h index b7024c9fae..8492986832 100644 --- a/include/qemu/target-info-init.h +++ b/include/qemu/target-info-init.h @@ -24,12 +24,17 @@ module_init(do_qemu_init_target_info, MODULE_INIT_TARGE= T_INFO) =20 /* * User mode does not support multiple targets in the same binary, so just - * define target_info(). + * define target_info() and target_mask_selected(). The target is always + * selected. */ -#define target_info_init(ti_var) \ -const TargetInfo *target_info(void) \ -{ \ - return &ti_var; \ +#define target_info_init(ti_var) \ +const TargetInfo *target_info(void) \ +{ \ + return &ti_var; \ +} \ +uint64_t target_mask_selected(void) \ +{ \ + return QEMU_ARCH_BIT((ti_var).target_arch); \ } =20 #else /* CONFIG_USER_ONLY */ diff --git a/include/qemu/target-info.h b/include/qemu/target-info.h index 2cd4cc5671..5673d10eba 100644 --- a/include/qemu/target-info.h +++ b/include/qemu/target-info.h @@ -134,4 +134,13 @@ bool target_base_riscv(void); */ bool target_riscv64(void); =20 +/** + * target_mask_selected: + * + * Returns the QEMU_ARCH_* mask of the selected target. System mode + * returns QEMU_ARCH_ALL until a target is selected. User mode returns + * that target's bit. Tools return 0. + */ +uint64_t target_mask_selected(void); + #endif diff --git a/stubs/meson.build b/stubs/meson.build index 744fb759a2..49cede8582 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -12,6 +12,7 @@ stub_ss.add(files('monitor-hmp.c')) stub_ss.add(files('qapi-event-emit.c')) stub_ss.add(files('replay-mode.c')) stub_ss.add(files('trace-control.c')) +stub_ss.add(files('target-mask-selected.c')) =20 if have_block stub_ss.add(files('bdrv-next-monitor-owned.c')) diff --git a/stubs/target-mask-selected.c b/stubs/target-mask-selected.c new file mode 100644 index 0000000000..510a515851 --- /dev/null +++ b/stubs/target-mask-selected.c @@ -0,0 +1,13 @@ +/* + * Tools have no selected target. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qemu/target-info.h" + +uint64_t target_mask_selected(void) +{ + return 0; +} diff --git a/target-info-def.c b/target-info-def.c index bcf9cfe1e4..a992019626 100644 --- a/target-info-def.c +++ b/target-info-def.c @@ -9,6 +9,9 @@ #include "qemu/osdep.h" #include "qemu/target-info.h" #include "qemu/target-info-def.h" +#ifdef CONFIG_USER_ONLY +#include "qemu/base-arch-defs.h" +#endif #include "qemu/target-info-init.h" #include "hw/core/boards.h" #include "cpu.h" diff --git a/target-info-qom.c b/target-info-qom.c index aeeedb7e81..fb4c9835e5 100644 --- a/target-info-qom.c +++ b/target-info-qom.c @@ -9,6 +9,8 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qom/object.h" +#include "qemu/base-arch-defs.h" +#include "qemu/target-info.h" #include "qemu/target-info-def.h" #include "qemu/target-info-init.h" #include "qemu/target-info-qom.h" @@ -40,6 +42,14 @@ const TargetInfo *target_info(void) return target_info_ptr; } =20 +uint64_t target_mask_selected(void) +{ + if (!target_info_ptr) { + return QEMU_ARCH_ALL; + } + return QEMU_ARCH_BIT(target_info_ptr->target_arch); +} + void target_info_qom_set_target(void) { g_autoptr(GSList) targets =3D object_class_get_list(TYPE_TARGET_INFO, = false); --=20 2.55.0.windows.3 From nobody Mon Nov 23 04:36:06 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1793905561; cv=none; d=zohomail.com; s=zohoarc; b=M8WLSUYk7ScgFtnDC5XmHYbBvEiikdqF737ZXkjfcEnbu5KMSKjI//z+YnS5/R6txggCeboDvimqPPTh3BZ6hS2PDOCA06us13gsbc5JfeDzI7c6MWZgqzsLcsCJKLL7FGPm3GTXh/m1nYuS4l+G4DDMlI1O2/w88zRIhCj2Dtk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793905561; h=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=TkyI+3liRauuD4xqvrjmkWmJgNooOrv+V/mBylavtjw=; b=MkBZouaNGpJc9Dmm9hn5S1AwcILou8P/TlCltzxE+GfAsCdEkeSbu0e5oxQqtDgz6KCnAcsEvOf73Q/L+xMBkoLFvmbOxUnlFP/xBdO+qADGcTFtBDGs5L31tzfdTVj6klY2NWrOAOL3BH8QnQuyiaP224YwXHw80QEwtQyNzSw= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793905561301129.29370702355618; Thu, 5 Nov 2026 11:06:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xP2lh-0004yA-Fz; Thu, 05 Nov 2026 14:05:01 -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 1xP2kr-0004rL-Mc for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:11 -0500 Received: from mail-dl1-x122d.google.com ([2607:f8b0:4864:20::122d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xP2ko-0003lA-4y for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:08 -0500 Received: by mail-dl1-x122d.google.com with SMTP id a92af1059eb24-15ea896ddc8so3736964c88.0 for ; Thu, 05 Nov 2026 11:04:05 -0800 (PST) Received: from DESKTOP-Q716RM7 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-1b245c4706bsm22924284c88.15.2026.11.05.11.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2026 11:04:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793905444; x=1794510244; 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:content-type; bh=TkyI+3liRauuD4xqvrjmkWmJgNooOrv+V/mBylavtjw=; b=SOwQK4NY92NkbsdqZEG9mc3Oze/gZ5g+XvDrWg1zvrFdpLV1oMe8nsUEEaKQ5bEGo2 UfGZTnvT2QV0YCAgOcCuip2s77qOzUNKPY4ySw1kwSLE16knKU5o7/sNuq+CQ04ADiZY w/CPEPyYrXur6ogpVJL6N/Qsm1bGvbxriVhPBemkrpq4ONOFcITIyw2tR4ZFkp18HniG KpZ/NHGI7OO7N7waFxvPhlekgDvEgD7qreQTsSTiDWviNyCkVbF2Rj6p0aPm9BFyx8+P A5fFkP4Gre3AwcOus8U35l14G9wnN+Nyxfq7KEnHJsXXgAatxAH6Orz4E7sd9CvBlILR HJxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793905444; x=1794510244; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=TkyI+3liRauuD4xqvrjmkWmJgNooOrv+V/mBylavtjw=; b=PziA+xiHsNu8UGQNYgSWtDsflje+mG6JaecxGFXJHvxk6uevaaqn+zIB3RaZ15uKPd 8vUlyMBOJtzfNrywqaBjkGZVcQ5Dp3efFD7BYFnpHCvxFpcrdlkCa5rgCysWgX00fs1u Kf/YpTbWFdWcIEhExjsq5OGrczlqBkayB2g5ejQGEAs1Fykveqle3ndxu916hbR6RtCx FpJCOrbKK+gFLVHTtisL/smXsq8KBDIgH/WTkKlDtelFp/SHx+V4fCSlqpW6s6TZtKDB 2MmxWg4ppShIUMTYVKsLWRLcJWYnD9ciBO9RMwGh8tDjKSN6HI5FHcGvJxab9Novl8fb 1bWw== X-Gm-Message-State: APuU4Z+ENJ4qL+BdqTEvZbmjWDsYhcWa2Ltz24QlufOxpr9DK371LpAR XaCSn98xXfRa7f7G/7+dFPSzCN/Pr3HHRxJom0DJtssDiR3Rvzbyby0mMDIiCJqDbIE= X-Gm-Gg: AYBFou1ASLK6IEO3qM+R72lKS0/zlFCBsB0y6FbKCTF8C1+aMrkBcOivknx579A+wMy 296UlQ7LF3VtLZ3sfmE3LXzOR4lIfvrV6ZYiXHxr6gqbi82branl8AFhILpgQCF1mbyyK7BfqKR A9CfnWqJ4t8oH+XOrTvF3iBXfQrmM+XsXJE7L8cAVPbFGBNrF8bXseaOXstjPHiUknSQKWeh0+d MLPE8R8b7+WJyiNQJvtD96fwUTLuY+Z/DKXZ1adkjMfZU4H6V6TTYBsiRrXZB4e3yoJxEDSey/V LMBoqjzSWE35wQD+vMyQhkAoWlCe6/DSplM9QQuSML62hjnD5pIAKwVa7msl7H0au0ZDCpEzUj/ zF5oLt4cEGUKaPoLTfUdux6o2p11/gl6+sz0wFb++UnKhIwgq3GRV1ASXLbW9cqQhz0FEiEHXrf PsKa/2wrIRU5UW0V21ONkEm9+URCfI3dtkgdVp5D+iqHhpBXyA2YSvVBlt5cljAvwLcvcfnGGMh vKBRu8Hv+q/k3ATml0WP9LD6Q83qqpuO2Z24jFffhXI8cFpwXtsIMO7qjpsEC23+vSnuzJav6ZI M0U2foZ62Bwy5WPUOZwFci2D4NjYORidpvkeUAhtQ2n+Zi0F X-Received: by 2002:a05:7022:f513:b0:1a7:e1c6:6f33 with SMTP id a92af1059eb24-1ac5bbb5457mr24768113c88.30.1793905444414; Thu, 05 Nov 2026 11:04:04 -0800 (PST) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Philippe Mathieu-Daude Subject: [PATCH 3/5] qom: add target_mask_filter() Date: Fri, 6 Nov 2026 03:03:44 +0800 Message-ID: <20261105190346.1539-4-luoyonggang@gmail.com> X-Mailer: git-send-email 2.55.0.windows.3 In-Reply-To: <20261105190346.1539-1-luoyonggang@gmail.com> References: <20261105190346.1539-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::122d; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x122d.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, FREEMAIL_FROM=0.001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1793905562268158500 Content-Type: text/plain; charset="utf-8" target_mask_filter() intersects any other mask with target_mask_selected(). QEMU_ARCH_ALL stays unchanged. Tools cannot select a target, so a mask other than QEMU_ARCH_ALL aborts registration. System mode keeps the mask until a target is selected, then keeps only that target's bit. Registration returns NULL when the filtered mask is empty. Signed-off-by: Yonggang Luo --- qom/object.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/qom/object.c b/qom/object.c index b7e1924e81..c224263112 100644 --- a/qom/object.c +++ b/qom/object.c @@ -16,6 +16,8 @@ #include "qom/object.h" #include "qom/object_interfaces.h" #include "qemu/cutils.h" +#include "qemu/base-arch-defs.h" +#include "qemu/target-info.h" #include "qemu/memalign.h" #include "qapi/visitor.h" #include "qapi/string-input-visitor.h" @@ -88,6 +90,29 @@ static GHashTable *type_table; =20 static bool enumerating_types; =20 +/** + * target_mask_filter: + * @mask: QEMU_ARCH_* mask to filter. + * + * QEMU_ARCH_ALL is unchanged for tools, user mode, and system mode. + * + * Tools return 0 from target_mask_selected() and cannot select a + * target, so any other mask aborts registration. + * + * Before system mode selects a target, target_mask_selected() is + * QEMU_ARCH_ALL and @mask is unchanged. + * + * When a target is selected, any other mask is intersected with + * QEMU_ARCH_BIT() of that target. User mode always has a target. + */ +static uint64_t target_mask_filter(uint64_t mask) +{ + if (mask =3D=3D QEMU_ARCH_ALL) { + return mask; + } + return mask & target_mask_selected(); +} + static void type_table_add(TypeImpl *ti) { assert(!enumerating_types); @@ -174,6 +199,19 @@ static TypeImpl *type_register_internal(const TypeInfo= *info, uint64_t targets) return NULL; } =20 + /* Tools cannot select a target, so targets must be QEMU_ARCH_ALL. */ + if (target_mask_selected() =3D=3D 0 && targets !=3D QEMU_ARCH_ALL) { + fprintf(stderr, + "Registering '%s' with targets other than QEMU_ARCH_ALL " + "in tools\n", info->name); + abort(); + } + + targets =3D target_mask_filter(targets); + if (!targets) { + return NULL; + } + ti =3D type_new(info, targets); =20 type_table_add(ti); --=20 2.55.0.windows.3 From nobody Mon Nov 23 04:36:06 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1793905561; cv=none; d=zohomail.com; s=zohoarc; b=U3U4HowtrnGKfMIKrS5vl/mdob7nqSdNJr5cyF/fUAAQWvjznvru1/LSpMa6ocxT9STPaHsC3JSs+anvGiVPvhhnzPSbbFVpXDujdm5XXw1tBzntZ4KQj0axC98JBYrRu+LRQbe+P8KOjkDR1tTjwC9jGJEVHetxNReZLRk4Hu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793905561; h=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=IHT+WPtb//sv+C4Z0/0CcEv9y3TcznwdA9jfvTtJKdo=; b=EhGe8zCKGemYQzKLIk54+8VtQ30WAhV5q3nL96VtwPcben4mlXGX3ketkTl9kKfYBbMF30rPQlUZrlxEZWVIkPOTuR18Kig1NgZAya9IIHDRx4SKoUJ+PNBAouLUlfkcimiBEalCocMPR+rvFzWehRQLIY0orgvrrvn1wb0HPww= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1793905561273778.8967356988001; Thu, 5 Nov 2026 11:06:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xP2lh-0004yJ-I5; Thu, 05 Nov 2026 14:05:01 -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 1xP2kx-0004rg-Ao for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:23 -0500 Received: from mail-dl1-x1235.google.com ([2607:f8b0:4864:20::1235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xP2kr-0003lU-Ey for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:11 -0500 Received: by mail-dl1-x1235.google.com with SMTP id a92af1059eb24-1b244fb7fffso2939439c88.1 for ; Thu, 05 Nov 2026 11:04:08 -0800 (PST) Received: from DESKTOP-Q716RM7 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-1b245c4706bsm22924284c88.15.2026.11.05.11.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2026 11:04:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793905448; x=1794510248; 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:content-type; bh=IHT+WPtb//sv+C4Z0/0CcEv9y3TcznwdA9jfvTtJKdo=; b=cYFvzZ8l62LPlbUq3H4oOPeRiYaLqdxR+tHXqivQI/BlWSDKSbI77hnfyPDPzMXwuN aaUbtTV85DsyA8/qGjBFqJEOX/bDKXqetemrSrD01geRMQWegquYMKfud6dPMIiBJApW ZgkSzuLVwHTdvse4GZ2oopY3LUDj7Kg/GRaiHOP0z6LqYsfhJWzIztkmLbhw9TCjMhDm MgaG+0luhTQFcptODYseQcAyAuD8tSpLkHG8eE9c4i7KwMiyWtDkiin3pO6sn7GJJF+H CcvvNE6XEPn4NU2dkSWmldOoxQnj0Z+ar8dXu0SuGw2CY9YTzU0cHOsZA2QW/aV1l2nW BKcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793905448; x=1794510248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=IHT+WPtb//sv+C4Z0/0CcEv9y3TcznwdA9jfvTtJKdo=; b=pLFQQFwzPe+nadDp3nQIUUxD8BDtM6racBW4gxiiwMuju1CxvukgR95OcVCOyabnTa rFkURXCqBUINDwl8ErfteFECYoxqeIMCLqoe9L02BjPZQW5/cs/1Ni03XV90GTOxwug7 /uOgQ7tcH0tP7I5OR4UZD2dodzQ97gE/znesXTbvLG0tETaJi/XwwmeFCO0xLgMvDZlv 7gNQ3Bv0Hri6CiLRbArg+3u+DtHRblzQ2p21zn16GT2s9BtVA93r1Jy472Yug4N9gNIo uTwJPmv1orPZCveaGPH0JuZqoA+yathSdifxnvB2Ztdib5cw/UiJ1UvS1FpiC15OpyZy e5yg== X-Gm-Message-State: APuU4Z8MDkgWOVj9emqtAMZK3kczOu+/n7Mz3hal3yEoE+ul6bnb/kpr +uRZoLwfeeOV+xlCdsIqNMb2tISfApBD+D17VjqMTEaK5woWxnnPd9jEKJrxWUZJcEU= X-Gm-Gg: AYBFou3PV1dQngpY3+hMbtziC5aUkis/b2bLYpJ6D+lSH2ClA7eyvhs4/ETLO6luljK SdawyWH7ajyP/v/Js8neJyno3smchEbt/zZn0dZikIFiQ7Xlc7+lcwR/024Q9K87YG4GYSqRC1w tzKnqGsaLgv1vSeLLinXw+XUA2YlR6R821Zwnp33S4/sUT6nJkxQXMx6qwXhwWhPI+XFRQk1c4V yQfeLUq3R5FaFzyAZ/0CrPG6NLY12BcDIKq422xiZW0vp6nrwELOJrB1NNlHCI9+X+0WIXtPceO pmdQLrHF4eRkEj/FCt1zwchsBAXgEF1A2ETaTcgyeuUHmWmXb+IqhUfRGP3HjZQMf651h4alb4z ZSH0J9ZCt7ze1iaYKpdsg+SNTxk9t9z7qH9IG50MTWUAxyOCqfReFpJrdKetNCjtqqkqoEFA0ps +KjCK1ELVDM4MyxszrcJ9mls7M+ljNoBxN3ZZXcfnyn1FVSbd2bb0BrVvX7a6Z8N6IQzC4UoEdA xeYHMFaJldkOTVGncG7KrIBfPk9sJxDUO9OFmgBo9iswNwAljU6OyR3K8ZFuGdhuqnv2VfbnFMQ 4tZ2gh48CthckXitsoccJxk6OH2RxjrDYM7STIMbr/ZLFa7H X-Received: by 2002:a05:7022:68f:b0:169:3706:d61b with SMTP id a92af1059eb24-1ac5bbba040mr39986535c88.16.1793905447520; Thu, 05 Nov 2026 11:04:07 -0800 (PST) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Philippe Mathieu-Daude Subject: [PATCH 4/5] qom: filter type lookup with TypeBucket Date: Fri, 6 Nov 2026 03:03:45 +0800 Message-ID: <20261105190346.1539-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.55.0.windows.3 In-Reply-To: <20261105190346.1539-1-luoyonggang@gmail.com> References: <20261105190346.1539-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1235; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x1235.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, FREEMAIL_FROM=0.001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1793905562360158500 Content-Type: text/plain; charset="utf-8" type_table maps each name to a TypeBucket of TypeImpl variants and the union of their target masks. Registration aborts when the new mask overlaps a variant already in the bucket, so same-name types for disjoint targets can coexist. Bare-name lookup, class enumeration, and parent, interface, and dynamic cast resolution walk that bucket. Enumeration and bare-name lookup keep a variant when target_mask_filter() of its mask is non-empty. With no target selected, bare-name lookup returns the variant only when the bucket holds one. type_list_lookup() returns those variants. need =3D=3D 0 does not require any architecture bits. Any other need keeps the variant whose mask contains every bit of need, which is at most one. type_lookup_current() passes 0 and returns that variant only when one remains. type_table_lookup() passes the class mask for parent, interface, and dynamic cast resolution. Signed-off-by: Yonggang Luo --- qom/object.c | 107 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 85 insertions(+), 22 deletions(-) diff --git a/qom/object.c b/qom/object.c index c224263112..265cf19041 100644 --- a/qom/object.c +++ b/qom/object.c @@ -19,6 +19,7 @@ #include "qemu/base-arch-defs.h" #include "qemu/target-info.h" #include "qemu/memalign.h" +#include "qemu/queue.h" #include "qapi/visitor.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" @@ -74,6 +75,7 @@ struct TypeImpl bool secure; =20 uint64_t targets; + QSLIST_ENTRY(TypeImpl) next; =20 const char *parent; TypeImpl *parent_type; @@ -84,6 +86,11 @@ struct TypeImpl InterfaceImpl interfaces[MAX_INTERFACES]; }; =20 +typedef struct TypeBucket { + uint64_t targets; + QSLIST_HEAD(, TypeImpl) variants; +} TypeBucket; + static Type type_interface; =20 static GHashTable *type_table; @@ -113,15 +120,56 @@ static uint64_t target_mask_filter(uint64_t mask) return mask & target_mask_selected(); } =20 -static void type_table_add(TypeImpl *ti) +static void type_table_add(TypeBucket *bucket, TypeImpl *ti) { assert(!enumerating_types); - g_hash_table_insert(type_table, (void *)ti->name, ti); + if (!bucket) { + bucket =3D g_new0(TypeBucket, 1); + g_hash_table_insert(type_table, (void *)ti->name, bucket); + } + bucket->targets |=3D ti->targets; + QSLIST_INSERT_HEAD(&bucket->variants, ti, next); +} + +static GSList *type_list_lookup(const char *name, uint64_t need) +{ + TypeBucket *bucket; + TypeImpl *ti; + GSList *list =3D NULL; + + if (!name) { + return NULL; + } + bucket =3D g_hash_table_lookup(type_table, name); + if (!bucket) { + return NULL; + } + QSLIST_FOREACH(ti, &bucket->variants, next) { + if (!target_mask_filter(ti->targets)) { + continue; + } + /* need =3D=3D 0 keeps all variants; any other need matches at mos= t one mask. */ + if ((ti->targets & need) !=3D need) { + continue; + } + list =3D g_slist_append(list, ti); + } + return list; +} + +static TypeImpl *type_table_lookup(const char *name, uint64_t need) +{ + g_autoptr(GSList) list; + + g_assert(need !=3D 0); + list =3D type_list_lookup(name, need); + return list ? list->data : NULL; } =20 -static TypeImpl *type_table_lookup(const char *name) +static TypeImpl *type_lookup_current(const char *name) { - return g_hash_table_lookup(type_table, name); + g_autoptr(GSList) list =3D type_list_lookup(name, 0); + return g_slist_length(list) =3D=3D 1 ? list->data : NULL; } =20 static TypeImpl *type_new(const TypeInfo *info, uint64_t targets) @@ -131,11 +179,6 @@ static TypeImpl *type_new(const TypeInfo *info, uint64= _t targets) =20 g_assert(info->name !=3D NULL); =20 - if (type_table_lookup(info->name) !=3D NULL) { - fprintf(stderr, "Registering `%s' which already exists\n", info->n= ame); - abort(); - } - ti->name =3D g_strdup(info->name); ti->parent =3D g_strdup(info->parent); =20 @@ -188,6 +231,7 @@ static bool type_name_is_valid(const char *name) =20 static TypeImpl *type_register_internal(const TypeInfo *info, uint64_t tar= gets) { + TypeBucket *bucket; TypeImpl *ti; =20 if (!type_name_is_valid(info->name)) { @@ -212,9 +256,15 @@ static TypeImpl *type_register_internal(const TypeInfo= *info, uint64_t targets) return NULL; } =20 + bucket =3D g_hash_table_lookup(type_table, info->name); + if (bucket && (bucket->targets & targets)) { + fprintf(stderr, "Registering '%s' which already exists\n", info->n= ame); + abort(); + } + ti =3D type_new(info, targets); =20 - type_table_add(ti); + type_table_add(bucket, ti); return ti; } =20 @@ -233,24 +283,24 @@ void type_register_static_array(const TypeInfo *infos= , int nr_infos) } } =20 -static TypeImpl *type_get_by_name_noload(const char *name) +static TypeImpl *type_get_by_name_noload(const char *name, uint64_t need) { if (name =3D=3D NULL) { return NULL; } =20 - return type_table_lookup(name); + return type_table_lookup(name, need); } =20 static TypeImpl *type_get_or_load_by_name(const char *name, Error **errp) { - TypeImpl *type =3D type_get_by_name_noload(name); + TypeImpl *type =3D type_lookup_current(name); =20 #ifdef CONFIG_MODULES if (!type) { int rv =3D module_load_qom(name, errp); if (rv > 0) { - type =3D type_get_by_name_noload(name); + type =3D type_lookup_current(name); } else { error_prepend(errp, "could not load a module for type '%s'", n= ame); return NULL; @@ -267,7 +317,7 @@ static TypeImpl *type_get_or_load_by_name(const char *n= ame, Error **errp) static TypeImpl *type_get_parent(TypeImpl *type) { if (!type->parent_type && type->parent) { - type->parent_type =3D type_get_by_name_noload(type->parent); + type->parent_type =3D type_get_by_name_noload(type->parent, type->= targets); if (!type->parent_type) { fprintf(stderr, "Type '%s' is missing its parent '%s'\n", type->name, type->parent); @@ -422,7 +472,7 @@ static void type_initialize(TypeImpl *ti) } =20 for (i =3D 0; i < ti->num_interfaces; i++) { - TypeImpl *t =3D type_get_by_name_noload(ti->interfaces[i].type= name); + TypeImpl *t =3D type_get_by_name_noload(ti->interfaces[i].type= name, ti->targets); if (!t) { error_report("missing interface '%s' for object '%s'", ti->interfaces[i].typename, parent->name); @@ -1097,7 +1147,7 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *c= lass, return class; } =20 - target_type =3D type_get_by_name_noload(typename); + target_type =3D type_get_by_name_noload(typename, type->targets); if (!target_type) { /* target class type unknown, so fail the cast */ return NULL; @@ -1201,7 +1251,7 @@ const char *object_class_get_name(ObjectClass *klass) =20 ObjectClass *object_class_by_name(const char *typename) { - TypeImpl *type =3D type_get_by_name_noload(typename); + TypeImpl *type =3D type_lookup_current(typename); =20 if (!type) { return NULL; @@ -1246,13 +1296,14 @@ typedef struct OCFData void *opaque; } OCFData; =20 -static void object_class_foreach_tramp(gpointer key, gpointer value, - gpointer opaque) +static void object_class_foreach_type(TypeImpl *type, OCFData *data) { - OCFData *data =3D opaque; - TypeImpl *type =3D value; ObjectClass *k; =20 + if (!target_mask_filter(type->targets)) { + return; + } + type_initialize(type); k =3D type->class; =20 @@ -1268,6 +1319,18 @@ static void object_class_foreach_tramp(gpointer key,= gpointer value, data->fn(k, data->opaque); } =20 +static void object_class_foreach_tramp(gpointer key, gpointer value, + gpointer opaque) +{ + OCFData *data =3D opaque; + TypeBucket *bucket =3D value; + TypeImpl *type; + + QSLIST_FOREACH(type, &bucket->variants, next) { + object_class_foreach_type(type, data); + } +} + void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque), const char *implements_type, bool include_abstra= ct, void *opaque) --=20 2.55.0.windows.3 From nobody Mon Nov 23 04:36:06 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1793905502; cv=none; d=zohomail.com; s=zohoarc; b=lDGcx+xIeKCMqhnEj3hnJcir0KMdIN6peD94ctpTGnuuv1h4Obz3SvlCGT2Dy1RNIIptXE3fdsFW0+OrO0zoDgITtgD2c1EWBCXHy0JH43ujxDPVNbW82hVDQH9yg51HHT5fvcR5/1+g4PJqAQlFnayLd0v2EX3nCBBtTQxvpcM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1793905502; h=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=WYnK/5FUcuPI98SgD7lnkqCIUD6xFC/0llqmlHc4wws=; b=i82SI8AyBbMrhradlMO3hQuGpkfBWpwXm3jJL2JWEDU2/+r4g+JbXO7SpfVhkeSJ7cZgTpq32MZBjnhyhU7wVlqdcFlaXWi01Bzg4eiBaNs3tDSAL93e4B9Dmk2tfPdRExGOEFQMTPu9nZWVfLJWnFoJxoJdwjakatxTq42ZRVI= 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 lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 179390550267374.58013027048719; Thu, 5 Nov 2026 11:05:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xP2lT-0004sx-NJ; Thu, 05 Nov 2026 14:04: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 1xP2l3-0004s3-5E for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:23 -0500 Received: from mail-dl1-x1229.google.com ([2607:f8b0:4864:20::1229]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xP2kx-0003m3-68 for qemu-devel@nongnu.org; Thu, 05 Nov 2026 14:04:17 -0500 Received: by mail-dl1-x1229.google.com with SMTP id a92af1059eb24-19305bcb72cso2064500c88.1 for ; Thu, 05 Nov 2026 11:04:13 -0800 (PST) Received: from DESKTOP-Q716RM7 ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id a92af1059eb24-1b245c4706bsm22924284c88.15.2026.11.05.11.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2026 11:04:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793905452; x=1794510252; 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:content-type; bh=WYnK/5FUcuPI98SgD7lnkqCIUD6xFC/0llqmlHc4wws=; b=ekZGFJchKTHLlyrq+PjHFDJDp2uEgJQ4XCz75yJtxS5n7y/BZa7CFEt7eZtesOc8V6 phaXT/2glX52vfOb+eS9NVasDWW1pLKg4LzPTnH5jrP/XyT9+NGocdDTclO2neVCoqyI QnlCL3ObMGxKwJ2gR/5CtMlBaBobZVhivEbtWbUbn236a5k+gF6zPZyD9yhnV/BNC4wO hUA83UDUYcWzYC0TImNzb5UQ3wCSZkJLYFEEySV5E7kx7EqZh8izKkPo0P/K9pTElrh8 kYA/3feDitOao1efVujHUUvNCfjBQUtrGIsKgkFgoF5t+9BE4nklhu6UJPsJ+d1s9TWK UUGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793905452; x=1794510252; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=WYnK/5FUcuPI98SgD7lnkqCIUD6xFC/0llqmlHc4wws=; b=aV0fTkVrZW3HxMAiot1JHR0wLtvyOy0nDge+X7el9XYMk8qDRNcxKsNy4H3CK6dXZA oCoW/qxOPqd3NuRBC7dTAI4zJlZgVaUe5b+oi7A3xgTKD9TDX7DxTqHTTNnzA7kWw8uv CksOcPGtZl9DVln7BRlnulDaAfECTxriU3k+X/QXYi6aZj73K2WS1ZMXMv1DeSoWw5TH 62x3+igX+D+izyWd/Vbn6UEVq1eSYAg+ZpSsgQ/C7+CIudcpiQQataSaoNIw0CPniM30 SL7pna4CrL9biYBxkxNtTC1N9zOzmQHAC7rpv1Y6Xo/z+VDN4B6pA+/Gi4IBKzQXyZrH HWwg== X-Gm-Message-State: APuU4Z+EOqBRw3GmHnP6tIZ0iE3zumwQ24nPNwxlfhwK9HQupttA+LKt 9Ii0h03Akhu0DIomBjAGJgy3YAcHShmdOztZjmkNPG7f23GmOmPZhM02w7bqxVAt/xE= X-Gm-Gg: AYBFou1jO2ILo1wi7iSIYaSq+e4KQHDLW+MUAoT5IsRt/FHXQxtse1fQ41eT53zqMqN 5Oon2+SpcWxEEU+3W9Mh7cBSkSCoIyD+TSA75mHnrfgi1M4HBJGzyIXFsbjjOGSq2AMwa/TBULY 8YE29xAhonTWNj10hF2Te+Y0MwlAjmcuIUJD4vGyInsnX+CdBo4wNZ0Hs3NMOZZ3PUswrNX1YQm leikvV6WzQb2qdrSwFeOTBkL0WO5ljxnuVk5BZOkYlGnwbxnao987gQuk0L4RRN5txm8U03r3JT CHsV/p9Ld+LzzTUXjuBnadYieGBIn/Di1JK8LFCfZgqpTzCd5VpBItlL6PWKST409u4GoFwXgcb rdwCBAR40ej38YbX3B5XMDJkGQ2dR8swhg1OsWBMIkJsGiif/VlDulRJvS30+2PMdaTtdAqDJfK 1axgrY1v6YD7Iub+55luvdf4cgeK88N7V3Wbt/K88eyGRRNeGVs0wuc8n4agxJLEO/hbeVaBObM nf+eoRfAjpWckqD0Hu16rn4MgNfQx4rMxk6rQrA1ukN6Q7cJ6RKsiRt+APfP6wkmfLuRmVSUon0 mRGsFC565tkYD8nCbw27IrvN/TUUFpxSgHXps4Lbv5nzAfq7 X-Received: by 2002:a05:701b:2806:b0:196:bf5f:8bb with SMTP id a92af1059eb24-1ac5d69f9ccmr26423629c88.45.1793905452433; Thu, 05 Nov 2026 11:04:12 -0800 (PST) From: Yonggang Luo To: qemu-devel@nongnu.org Cc: Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Philippe Mathieu-Daude Subject: [PATCH 5/5] qom: add type_register_targets() Date: Fri, 6 Nov 2026 03:03:46 +0800 Message-ID: <20261105190346.1539-6-luoyonggang@gmail.com> X-Mailer: git-send-email 2.55.0.windows.3 In-Reply-To: <20261105190346.1539-1-luoyonggang@gmail.com> References: <20261105190346.1539-1-luoyonggang@gmail.com> MIME-Version: 1.0 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=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1229; envelope-from=luoyonggang@gmail.com; helo=mail-dl1-x1229.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, FREEMAIL_FROM=0.001, 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: 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 @gmail.com) X-ZM-MESSAGEID: 1793905503724158500 Content-Type: text/plain; charset="utf-8" type_register_static() always registers with QEMU_ARCH_ALL. type_register_targets() takes a QEMU_ARCH_* mask and passes it to type_register_internal(), which filters the mask and returns NULL when nothing remains. As call to this function needs QEMU_ARCH_*, so include "qemu/base-arch-defs.h" in object.h Signed-off-by: Yonggang Luo --- include/qom/object.h | 12 ++++++++++++ qom/object.c | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/include/qom/object.h b/include/qom/object.h index 70d8ea3e29..bda9b8901e 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -16,6 +16,7 @@ =20 #include "qapi/qapi-builtin-types.h" #include "qapi/qapi-type-info.h" +#include "qemu/base-arch-defs.h" #include "qemu/module.h" =20 struct TypeImpl; @@ -988,6 +989,17 @@ const char *object_get_typename(const Object *obj); */ Type type_register_static(const TypeInfo *info); =20 +/** + * type_register_targets: + * @info: The #TypeInfo of the new type. + * @targets: QEMU_ARCH_* mask of targets that may use this type. + * + * @targets is passed through target_mask_filter(). QEMU_ARCH_ALL stays + * QEMU_ARCH_ALL. Returns the new #Type, or %NULL when the filtered + * mask is empty. + */ +Type type_register_targets(const TypeInfo *info, uint64_t targets); + /** * type_register_static_array: * @infos: The array of the new type #TypeInfo structures. diff --git a/qom/object.c b/qom/object.c index 265cf19041..0e50b0011b 100644 --- a/qom/object.c +++ b/qom/object.c @@ -274,6 +274,12 @@ TypeImpl *type_register_static(const TypeInfo *info) return type_register_internal(info, QEMU_ARCH_ALL); } =20 +TypeImpl *type_register_targets(const TypeInfo *info, uint64_t targets) +{ + assert(info->parent); + return type_register_internal(info, targets); +} + void type_register_static_array(const TypeInfo *infos, int nr_infos) { int i; --=20 2.55.0.windows.3