From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622006; cv=none; d=zohomail.com; s=zohoarc; b=Ug7fWzcsXBeyJ/Ffpfe7F5+Y8VXFVdWw+0tviACFJtirBOEW7P2kII8WbuPwYXaqFCUJ11GPePhFFXTpjb5SzFsgnDE7o6g/tz7IPHV6K0N4sZEDiZvY0Ok5I90ukZIIiRhYgX1c+k0qHc5yuNBrX7BIjMOuBCu/nPN4cjRHUHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622006; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=74z+WGcQbZrnUWzO8IpesNYQCkBFwkcCNQpXzRgkRAQ=; b=CHpd60sDVLZfESREx210gD5LVUs2fAUgtiGL4Gy+Zin2Khrus4C2JyvlyDeJ6QSr3lW4I8lOxczpuD/y+KZb6otGFotdZ2bkLQJrf+U6eBLbChjAp7IR95rifxfC8LAkcueWIrO3jTPnzzC9KqktqTc60TBgW08pYoOETZCu5xI= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622006470891.125673303106; Tue, 21 Jul 2026 01:20:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gb-0000og-Hu; Tue, 21 Jul 2026 04:18:45 -0400 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 1wm5gZ-0000ia-JB; Tue, 21 Jul 2026 04:18:43 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gV-0001Zo-1y; Tue, 21 Jul 2026 04:18:43 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBk050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:31 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=74z+WGcQbZrnUWzO8IpesNYQCkBFwkcCNQpXzRgkRAQ=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621851; v=1; b=pWDaHLGP2CiznhGzBGdTfYlStxGLZCRdbtbpO5ZqhvmY2GqWTnLWMwlSEoUqF7OF g/Z2K+e+1rhz128DMEP2AOdHEDusKPgw1KfF15QDZ7ef3fva7TnHefKx3IuVfij/ In/NWhhsW+qUHHwQR0HtrL1g2ZyAMvVifJXgs2oZxXe0JyV2on4gDVZtmak2NIdn 1Yi1YtXiLQE5+RuyCSZlTB8yjVXkRZA+0XLdC8PPqBoz3/o9mnobXmnN87Pb6hNv oSWtW9PC1Z0Wehg0vIc/Lps+hMgMvEXtvjE3LT3iOXBKpps3PgWybyJ5dyM1HY+F AtkUOLwxGYXhO2lKKPjIAQ== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:51 +0900 Subject: [PATCH for-11.2 v3 01/15] qdev: Clarify instantiation and realization MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-1-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=5766; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=iN4gJbhjAWNYi0fkVyPjLxZU5zRhIVoCJvLYK+5ZGWs=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8toDk7vR0l1dNrYbcRSt+ZUjPUnVe4LFlSnbZgY+zd gb8i7DqKGVhEONikBVTZEkp2s2tEV37qTAhvgVmDisTyBAGLk4BmMirTYwMh0P1XM/5B5lnPjmz t/ipT/3aa9cdHEIkdxb7Fa0K+uu0n+F/ktc/31yRiNCwotYts3zePsz/mvK+8EH9tdllR3/yfLv OBAA= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622008177158500 The distinction of instantiation and realization was vague in the old documentation so this change clarifies it. The old documentation said: > The former may not fail (and must not abort or exit, since it is > called during device introspection already), and the latter may return > error information to the caller and must be re-entrant. > Trivial field initializations should go into #TypeInfo.instance_init. > Operations depending on @props static properties should go into > @realize. The first problem with the old documentation is that it is unclear what "trivial field initializations" means and why triviality makes initialization appropriate for #TypeInfo.instance_init. Another problem is that the documentation is not comprehensive enough; for example, it mentions @props static properties, but it does not say anything about the other properties. The keys to distinguish instantiation and realization are property setting and device introspection. The fact that property setting happens after #TypeInfo.instance_init and before realization implies that operations depending on properties should go into @realize. The fact that instantiation happens during device introspection but realization does not implies: - Instance properties should be added in #TypeInfo.instance_init. - Instantiation must not have any side effect not contained in the instance. - Any operations without special requirements should go into @realize so that they can be skipped during device introspection. Note these two facts to guide appropriate instantiation and realization. We also omit mention of the realized property because it is a QOM interface detail, not part of the device API. Signed-off-by: Akihiko Odaki --- include/hw/core/qdev.h | 52 ++++++++++++++++++++++++++++------------------= ---- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index e14762234115..aba7072131c4 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -22,27 +22,35 @@ * Realization * ----------- * - * Devices are constructed in two stages: - * - * 1) object instantiation via object_initialize() and - * 2) device realization via the #DeviceState.realized property - * - * The former may not fail (and must not abort or exit, since it is called - * during device introspection already), and the latter may return error - * information to the caller and must be re-entrant. - * Trivial field initializations should go into #TypeInfo.instance_init. - * Operations depending on @props static properties should go into @realiz= e. + * Devices are constructed in the following order: + * + * 1) #TypeInfo.instance_init + * 2) pre-realize property value setting + * 3) device realization + * + * #TypeInfo.instance_init may not fail. #DeviceClass.realize can + * fail, returning error information to the caller. A device realize + * method should handle being called again after it has failed once. + * #TypeInfo.instance_init should add instance properties but must not + * have any side effect not contained in the instance, since it happens + * during device introspection already. Any operations without special + * requirements should go @realize so that they can be skipped during + * device introspection. * After successful realization, setting static properties will fail. * - * As an interim step, the #DeviceState.realized property can also be - * set with qdev_realize(). In the future, devices will propagate this - * state change to their children and along busses they expose. The - * point in time will be deferred to machine creation, so that values - * set in @realize will not be introspectable beforehand. Therefore - * devices must not create children during @realize; they should - * initialize them via object_initialize() in their own - * #TypeInfo.instance_init and forward the realization events - * appropriately. + * In the future, devices will propagate this state change to their + * children and along busses they expose. The point in time will be + * deferred to machine creation, so that values set in @realize will not + * be introspectable beforehand. Therefore devices should not create + * children during @realize; they should initialize them (e.g. by + * calling object_initialize_child()) in their own + * #TypeInfo.instance_init method, and then realize them (e.g. by + * calling qdev_realize()) in their own #DeviceClass.realize method. + * + * Occasionally a device may need to decide whether or not to create + * a child object based on the value of a property. In this case it + * will need to both create and realize the child in its realize method, + * because the property value is not known until that point. * * Any type may override the @realize and/or @unrealize callbacks but needs * to call the parent type's implementation if keeping their functionality @@ -101,10 +109,8 @@ typedef int (*DeviceSyncConfig)(DeviceState *dev, Erro= r **errp); /** * struct DeviceClass - The base class for all devices. * @props: Properties accessing state fields. - * @realize: Callback function invoked when the #DeviceState:realized - * property is changed to %true. - * @unrealize: Callback function invoked when the #DeviceState:realized - * property is changed to %false. + * @realize: Callback function to realize the device. + * @unrealize: Callback function to unrealize the device. * @sync_config: Callback function invoked when QMP command device-sync-co= nfig * is called. Should synchronize device configuration from host to guest p= art * and notify the guest about the change. --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622075; cv=none; d=zohomail.com; s=zohoarc; b=CI0VEJoJbnsqLv4YLu4sGE2QRU9/syhGVfLP/xLiYL09cmyDi2Rc+yRXyD/3aCg/kwTogdkWDeCCAQexQH2nujUw1+qjehW/jlmABa1okVKloQ5F72F8NWIVvfB8xbJzaUsAMhMrHZJ2/4sWWK84xe4kAOjsohfby0nOtnHglhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622075; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EJkHV2s0GXDHJ/nv2t/lNaPG4brj3e8w2SRhfpoDRgs=; b=bpnUmrm5wz3r+smY2odWdq59SzCMNbbNv2WHT63kekEZ1VQVHfwnU8ulhqkGVQITgGHU7ukBhVVQoS7YelBGfmdPfQxY6u09ouK44BQ1grSykGTj6MHlTACZiDDCkY0FFyQFpCsSAxbeAHD7pdkW4Pkyaw6/TkpKxmQBdkzQCJ0= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622075571265.1047394476353; Tue, 21 Jul 2026 01:21:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gd-0000rg-H9; Tue, 21 Jul 2026 04:18:47 -0400 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 1wm5gZ-0000hH-3H; Tue, 21 Jul 2026 04:18:43 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zn-C9; Tue, 21 Jul 2026 04:18:42 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBl050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:31 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=EJkHV2s0GXDHJ/nv2t/lNaPG4brj3e8w2SRhfpoDRgs=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621852; v=1; b=vjbVZT/KlSXZjhmU6TeVbEQ2WuBKoV5E7yaxBH5a9BdAzvokj95o0vL35X1MR6wC EtI1O6LNQkQonP0GflgU/BsF+CBVVSCArKD/xKbGbWyJV6DyMhhvriTsRkYofbHX Fiso5SUjDxe42QuSu6BlskHou56vmU06o36S8pqYl6NMAstNBWvh4p9Opzec3PCN 62qI8mueDvqPJWKWDfZui1vn3orfpL1fXTzHX/lrGZ/I3+EXgJvX4lzWaWg0N2NL TONrfkcxNrGMU7woTonr0kbJ6BzN84gq3nqEJnVLdHsdLGKbkpIzwGpyohrAzl70 T32YatluLk3BbBwL4qALEQ== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:52 +0900 Subject: [PATCH for-11.2 v3 02/15] qdev: Make qdev_is_realized() take a const DeviceState * MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-2-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=832; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=UB3C/P5S8Rdd+yOhuVkWMGvp9D9roZmSCruzuwAk7CA=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tmCK4hyLL17Hb/cvOjvX4N3X/7kWf1JnnDR/I/QgM vhC7ptzHaUsDGJcDLJiiiwpRbu5NaJrPxUmxLfAzGFlAhnCwMUpABPxF2RkuBd1R391m6Tu/I2p c693ngo0j9rwN/vfeUbPV3sPuERnMjMyHOkOmcl2/Zr9pjePtvzw9r5u4XfgePHWJdPrN815G3/ qHisA X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622076153158500 qdev_is_realized() only reads DeviceState. Make its parameter const so a later caller with a const DeviceState * can use it. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/core/qdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index aba7072131c4..3f47ea72c009 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -443,7 +443,7 @@ DeviceState *qdev_try_new(const char *name); * Context: May be called outside big qemu lock. * Return: true if the device has been fully constructed, false otherwise. */ -static inline bool qdev_is_realized(DeviceState *dev) +static inline bool qdev_is_realized(const DeviceState *dev) { return qatomic_load_acquire(&dev->realized); } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784621983; cv=none; d=zohomail.com; s=zohoarc; b=VjkfJJ3wbyr67I9+9GDzMipy5SsGtgNSqeuw7bvqP8dk9m+2ErbS5WQy4Ctxuh3CHKOJlSx+LWRbCYUjMXddct0tTyyCCkfUP2SYq76H9eKrY3Z1tl/Sqfq3SvQyeQno2Ge3xISOBe7GYHjWp6XOkIqHIzP1H23H6S5BBypyUCw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784621983; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QJdO8kWEJWFrWQEmsjHLFwL4fD5SiN3l+Gq/RjxUgpo=; b=cQ2WgfiaXWtesDIIborpopEc8jLiATBHZBLeNwFOEWbi6ux7t0hPr3wbBQaCL+/KYV1oE0i7z37WV3XMSEWuRBQmYq8Ww9LDeM1wK8glFlqHlifh+agQ7g1vI5TQIJNCSizU0XmKmXa4EkxNViyo4rLHqhI4JTqDEa8XZWSNm+o= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784621983787679.7061764622376; Tue, 21 Jul 2026 01:19:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gb-0000n7-52; Tue, 21 Jul 2026 04:18:45 -0400 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 1wm5gX-0000dk-T1; Tue, 21 Jul 2026 04:18:41 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zl-6L; Tue, 21 Jul 2026 04:18:41 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBm050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:32 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=QJdO8kWEJWFrWQEmsjHLFwL4fD5SiN3l+Gq/RjxUgpo=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621852; v=1; b=dK99hcyYXJ6a8iHRnL5exEp8q41Z8CKznHj0jA/F4JNqRyFu+D2uOqSnO/ekpVcP xUIO3d6VV2VnU2iWScvvg1RTFy0JbwmuazNF/Nu9xib3DMuAZLWik4FSnjy4+52h VGuh6dnirwhDb5dzJsV0BBE7d0Ubk4CSs7RJp0SVX+teh3PxvIGblmOXS+8EMepf rqf0r8WWrsN1DNPPXurGbMZZcRenqo31uZ9QrJHt5+zw1G1LWiz2Mw7XRXdVx41h wX8cx+XJyp2a70W1Q5FgWM5IC6my5c4izGwdSkueSi67C5NjtL3muhobO0TfHkFm GGI5uqFT61UiEOzdxIEhsQ== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:53 +0900 Subject: [PATCH for-11.2 v3 03/15] hw/hyperv/balloon: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-3-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=865; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=qcidLoOOEYgyPb6/Qv1h9Ul1icQVToMMquS9cbdMc4I=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tvBEltpjEnOlYi9NrTmSMPXRBMGnCSzOCTyCoknKs msdBH51lLIwiHExyIopsqQU7ebWiK79VJgQ3wIzh5UJZAgDF6cATOShGSPDqSn7enqn/3FkmbYx MVW11uKJ9aLYRasMXs++ptdr809JmeGf1gQz8YiQpj+Xgudknf4ccddz7uOqvO0T/fQ9XJbcTnb lBgA= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784621985932158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/hyperv/hv-balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/hyperv/hv-balloon.c b/hw/hyperv/hv-balloon.c index 9dd759f11e8a..b8664a246b47 100644 --- a/hw/hyperv/hv-balloon.c +++ b/hw/hyperv/hv-balloon.c @@ -197,7 +197,7 @@ static int build_dimm_list(Object *obj, void *opaque) =20 if (object_dynamic_cast(obj, TYPE_PC_DIMM)) { DeviceState *dev =3D DEVICE(obj); - if (dev->realized) { /* only realized DIMMs matter */ + if (qdev_is_realized(dev)) { /* only realized DIMMs matter */ *list =3D g_slist_prepend(*list, dev); } } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622149; cv=none; d=zohomail.com; s=zohoarc; b=QtMyXJ+D0JypV0UecMvr+QabK2yh0yCkmOCHWS/f8ixI4WjbQLtMPkfeciK1LVwWaTOhNOzbQzTQrD3pDDhuVfUWWqtDzFxH/2sR0qZKSyJUrw9SFS+S7yuwpflCWxqCq3V78xsv8VzfNjFz0krTf+nQIGH0O5AcQ3r7X1G06yg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622149; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Qm0KCgdjNWN3/4rY6uOZMm1bBvH4T7mmByt4GK9FWds=; b=Z8FO0XqwG6NLEicjiRj2FvWEJkRdhPLdD7MY9D/GzX4sFlFmirwxj6HtvLcGN84RY1UxLl0MBIiJYWsCvnPCUAeJrPQYVUxyABIo2E6WvYiO5TRrMHZ+s4iVWWu/yR52NhPHSc0+7QRSO0Bowa8ogH6Puhkr5tEhwvbxI+keTbM= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622149143920.9026162829769; Tue, 21 Jul 2026 01:22:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5hD-0001Xv-R9; Tue, 21 Jul 2026 04:19:23 -0400 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 1wm5h7-0001CP-BJ; Tue, 21 Jul 2026 04:19:17 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5h5-0001Zk-L3; Tue, 21 Jul 2026 04:19:17 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBn050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:32 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=Qm0KCgdjNWN3/4rY6uOZMm1bBvH4T7mmByt4GK9FWds=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621853; v=1; b=jFxPqGX+wJIPGM9EppX10L5OEIcJ+RdUCf9a9b1WyCJuPihwygYUpaIUA2gWhE8I M7Q8t4V5/oIpkhmAo0EMnmlSHqny5x4fLvlf1hAsnTxYI+hgSY2qf+rb8Tm02KOo Kfp5JmKbPvfsR+uCLBYpuAta6GXxm/bMxlxwzjBXvoA6gYOsSjqv5o/jxYN2WRUo BK4B8STURUUOfFPVRqLVkeox4q+6lCYta7vGtcDf0LRkMGuS/VmGbegUVjcop/fY +ePfTE25wthu6WflSLosfgpPikAx3qhN3QKcvA7h902fXviY8uqaf1+4/EAGOnMK KKQQDQXqAm0veEVI32OOpg== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:54 +0900 Subject: [PATCH for-11.2 v3 04/15] hw/intc/apic: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-4-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=783; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=6xaEst1ifxTPryAZRYkFzDZDZuy7Ge03ST3gODOsoM8=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8toie7M6w1ZcfM0x8JPQhteM1t2bjuy2hHXJrC40nv L7983BrRykLgxgXg6yYIktK0W5ujejaT4UJ8S0wc1iZQIYwcHEKwEQ2TmD4K3/k+cu4K4mWf049 Vt/+eglni9bCpqTD0R/WnImSqttwLYyRYeLSQNWpjxUXm+o/7NrXYOGUVHW1bHLWtCeGf/5d82P bxgIA X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622150874158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/intc/apic_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index 49c03a5bceef..0f0f37d45734 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -424,7 +424,7 @@ static void apic_common_set_id(Object *obj, Visitor *v,= const char *name, DeviceState *dev =3D DEVICE(obj); uint32_t value; =20 - if (dev->realized) { + if (qdev_is_realized(dev)) { qdev_prop_set_after_realize(dev, name, errp); return; } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622005; cv=none; d=zohomail.com; s=zohoarc; b=Bhvkr23hCARGjtRqosSvbaCzAsNMgZsM0K19S86mixCPEpNuIIQlJpgL/Ur3wr/gQ1yRJCfII1LDUW0pmmaXcvwCF8cQHsQvmoaRhf8/3Ng5TgnXZAOkB+AkgWar3DcgP3mfSXpY8pmGWeoRZ08BJj1XGd+F+uplfZjxkZ32EIo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622005; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KCkvLBJ8aCkGl3UnV8nuvJrHcJ4tFIcRZ/oODyRyGkA=; b=XqMxvONker0xygXIg1j0PesVOmqObyxLpORttywCGAirmwpy7i+7tHPnvRDw1hAObec5BfiOA0c5wCBdO9f6bHvyEqxRiqcSZWH3HLIf5paGhKYtmDYKd8UacPFw+wDIODsy4A9C922NwYx/zHGVBv/XuyTG1aLX8O1vjKcFDkI= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622005049590.5246923458224; Tue, 21 Jul 2026 01:20:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5hC-0001SX-EE; Tue, 21 Jul 2026 04:19:22 -0400 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 1wm5h9-0001FW-7R; Tue, 21 Jul 2026 04:19:19 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5h5-0001Zc-OZ; Tue, 21 Jul 2026 04:19:18 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBo050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:33 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=KCkvLBJ8aCkGl3UnV8nuvJrHcJ4tFIcRZ/oODyRyGkA=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621853; v=1; b=DlhQ9n3r2fBtwhHK5SVRatUR7zcz1i0OyPi1SyVWtAj0C1kzFUjc3HBBuCZPXzD1 BvtbK/nucm1L6ocrvMFwnZ2P3dzmirG/90z4OtUQUt7qewnmnjRgRPWaEUChK96u vwp2siMoDR7xfrSVJAEi9WJoa1FKj3pEbxlK0+/NDjTyqVC7O0cdlzqMM7u3Mw/o Ha1I+pEFJWidTZQ7wvTxQuFGjYjPJd4xcLI05cZZsEbmVx6TmOiEsd8TpE49ttNc mDqWSjzKqrx+UqUdr1aUCNTElJdmmB35QP2M0gQMq0HeptxBIqGtznH5vKSlYv5Q bfFRhGCCrV+C6VCXUBhXQg== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:55 +0900 Subject: [PATCH for-11.2 v3 05/15] hw/mem/memory-device: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-5-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=1325; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=80CkMV8WZ5hqRVetX6Z0kr6XzMUsXkxBMrdyWT951R8=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tsj9sIPxynKSfizrnWb/dpO6wSFw20C3aj3PNs+lT Q8+tS3qKGVhEONikBVTZEkp2s2tEV37qTAhvgVmDisTyBAGLk4BmEikN8N/D6kf1SeMv/yIZdob Wlpbpav7v9N/2Z9QI033pdMktx37wPDPRO6JcIVPuUrsKi7D/f92W/eIWGpb2Yle/RhtwHg6V5s bAA== X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622005901158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/mem/memory-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index 9cf82b84cf44..24bebfb6b31e 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -59,7 +59,7 @@ static int memory_device_build_list(Object *obj, void *op= aque) =20 if (object_dynamic_cast(obj, TYPE_MEMORY_DEVICE)) { DeviceState *dev =3D DEVICE(obj); - if (dev->realized) { /* only realized memory devices matter */ + if (qdev_is_realized(dev)) { *list =3D g_slist_insert_sorted(*list, dev, memory_device_addr= _sort); } } @@ -326,7 +326,7 @@ static int memory_device_plugged_size(Object *obj, void= *opaque) const MemoryDeviceState *md =3D MEMORY_DEVICE(obj); const MemoryDeviceClass *mdc =3D MEMORY_DEVICE_GET_CLASS(obj); =20 - if (dev->realized && !memory_device_is_empty(md)) { + if (qdev_is_realized(dev) && !memory_device_is_empty(md)) { *size +=3D mdc->get_plugged_size(md, &error_abort); } } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622102; cv=none; d=zohomail.com; s=zohoarc; b=Y6HpQD/Ypfi2vaTFpWsSZfsh1pgV9KxM4TqQPsXmV42sfJjzuDMErbMKpFmkJmPpXQ8t4PhWRuvPW9mSTN0r+wMkL/EFDsDRV0oNw9YYUyqkfpRG2nfYw9e6d7LmZV7fNFbrV7oFYnDaiBsffP/PBb3qYiWnq3Ne6g+MDzbJ5MM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622102; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cTuRMtbL9jufwSyK4Xgx/NhwBP5KIoJknvtAuzelzyY=; b=ViF4RIW8o3yHtju6JrimiM6VqTBEwbqw55kc3k7YdQoL5nb+5euHX0M7gDud4CvAKfFuClhdwgQQGWabJL591WAVfFjj6HfYUFtU0OGbwoC5cE0D2BOOiBI/rq0hul1Qrabz/2nNZPyXXE3pnBJTRqnM1ZlkIS22LZLMC+8FhHo= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622102905626.2067038232663; Tue, 21 Jul 2026 01:21:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gZ-0000hu-Jx; Tue, 21 Jul 2026 04:18:43 -0400 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 1wm5gX-0000ak-3h; Tue, 21 Jul 2026 04:18:41 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zf-H5; Tue, 21 Jul 2026 04:18:40 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBp050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:33 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=cTuRMtbL9jufwSyK4Xgx/NhwBP5KIoJknvtAuzelzyY=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621854; v=1; b=vKbufuQ9m2mlqqx7MKnGZly+EJu1trVt6QFVgdaMgXzwQXbKZqGiO8JzbckiF3b9 /RsozPiMruDWP1GNbRJsh3vcnnxfdCXk/khcD+kSEwXfhXkomMvTGJaSo3A+A77E 8V5Grux18bD+ou4t59y1t4rdW5SSooE6VW119K1mX9XCdpLc2A4ESA4SCO6Nj/+U Pi58S33Dym1alzNxQun9B4bBsB9kK97yI5A+tFqjhdZMBQBd5V0zFS9Yc5nhZk1o jXceFqti7/Mnndkyqh05yVAtNrDk041lL+XOkbgBhYhAJo4juruDU7B1xNL6rWQI Kg+5deRHjoenqKASLQ0cJw== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:56 +0900 Subject: [PATCH for-11.2 v3 06/15] hw/mem/pc-dimm: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-6-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=864; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=9wdSFwotjPBzFkSiCoujhCpruEIq3LIWI+kYE3DgFnY=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tui+qysXdkyJ4JFInnXqe7f9nmj5g/e0edmn7iz7t /J81KnLHaUsDGJcDLJiiiwpRbu5NaJrPxUmxLfAzGFlAhnCwMUpABMp6WJk+KfqEMgcmeg8e0tG rN3K1W89ninETWdXcF7hufhHQfPkDkaGS993vPkVLBVnuts0QaOp84XcmxvGBb+/J2a8XcifWbe YBQA= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622104329158501 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/mem/pc-dimm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c index 3efe47f499a3..68862926ee2d 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -103,7 +103,7 @@ static int pc_dimm_slot2bitmap(Object *obj, void *opaqu= e) =20 if (object_dynamic_cast(obj, TYPE_PC_DIMM)) { DeviceState *dev =3D DEVICE(obj); - if (dev->realized) { /* count only realized DIMMs */ + if (qdev_is_realized(dev)) { /* count only realized DIMMs */ PCDIMMDevice *d =3D PC_DIMM(obj); set_bit(d->slot, bitmap); } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784621975; cv=none; d=zohomail.com; s=zohoarc; b=DP5wyzzVa37phQokC4YEcMKfzUsYrExV8g8h2VFDpmP1mARvf48F22NF27pyE9pDMOFaJh8n3RemmdOPfPxbEocMf5d+53lKi5zumumtNBS4Tobaxtt+u1NAjJCnG5WjY1qQ8PBORi0jXi7RQEmanq6XPz88gDAt38sK+4B0tvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784621975; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ayV5U0AkguNWQXEJrrEujyrrGzP6cg1PsUJnuJHlcfs=; b=Ni9lR22Hz94R+zGV6bxEiynCNjc+dmQjhoR0aXsK6rF4CHPKLj0vINjKf3n45CkHcJ6cVyO9BXuIpYxAQ0fAGGJPJKlhyNrZ5dtsCZ86ksi/Hqwx+pdojUP2OQu/OqXIzZSANgmGYxzgelMmbixMV7K3h7fi/SUrqkp+fDEfT7o= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784621975142162.48110133903492; Tue, 21 Jul 2026 01:19:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gc-0000pi-1h; Tue, 21 Jul 2026 04:18:46 -0400 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 1wm5gZ-0000he-9D; Tue, 21 Jul 2026 04:18:43 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zm-Lu; Tue, 21 Jul 2026 04:18:42 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBq050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:34 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=ayV5U0AkguNWQXEJrrEujyrrGzP6cg1PsUJnuJHlcfs=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621854; v=1; b=i4WuNMf3paC5wVXYUgo+Mxz+vbOpwTYZYwn2GVWfHV16yDSWouTy0ss3ISLC6Nbp Tfo0JC197tqzDhLlQ2w+IG5bIsWTPJn7pqYNNJQIrfb11IHPFy3hsK/MMlu4jYok N/vRRyvtROBLOI1RFIXqfTqEAEDzk6nMAMEXoIBW367YkNlgxwe89a/YY0PAYJQc PXRrItVDAQwuYOi6nwv+4CQnilPz0LLWQ+DQAn1MT7hPqgXiVb8rcWnpvjNO6CIA O8GejFeLs60QuN5SDI6etsUiZ/8/hNnrtueZufWuT7+Dm40LuMT2hSDCekKXkwxe Wxj0XNkWmbaxdg+HNdNbcQ== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:57 +0900 Subject: [PATCH for-11.2 v3 07/15] hw/nvram: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-7-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=1368; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=GhEbcxfFd0c90bqsnl8dfQymBOUb4OlEMTs1trflWMU=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tqjxVJEJVZeaxH7kCdw8yssq99T7qfwJP1uxxhfrw v4dn7euo5SFQYyLQVZMkSWlaDe3RnTtp8KE+BaYOaxMIEMYuDgFYCLP6hn+8O+6vWil1U0dxwWL bCZuY57NtKgnTGHjiYr/GrcOl71uuM/IsCxN1mvTv4cW2crsiXNjyvO/bzotuEqp4fqUQzXuU0r O8AAA X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784621978001158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/nvram/xlnx-bbram.c | 2 +- hw/nvram/xlnx-efuse.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/nvram/xlnx-bbram.c b/hw/nvram/xlnx-bbram.c index edfb592a5ec9..e336874bdef4 100644 --- a/hw/nvram/xlnx-bbram.c +++ b/hw/nvram/xlnx-bbram.c @@ -468,7 +468,7 @@ static void bbram_prop_set_drive(Object *obj, Visitor *= v, const char *name, qdev_prop_drive.set(obj, v, name, opaque, errp); =20 /* Fill initial data if backend is attached after realized */ - if (dev->realized) { + if (qdev_is_realized(dev)) { bbram_bdrv_read(XLNX_BBRAM(obj), errp); } } diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c index 1a9650ba128d..03c9fbc0d076 100644 --- a/hw/nvram/xlnx-efuse.c +++ b/hw/nvram/xlnx-efuse.c @@ -233,7 +233,7 @@ static void efuse_prop_set_drive(Object *obj, Visitor *= v, const char *name, qdev_prop_drive.set(obj, v, name, opaque, errp); =20 /* Fill initial data if backend is attached after realized */ - if (dev->realized) { + if (qdev_is_realized(dev)) { efuse_bdrv_read(XLNX_EFUSE(obj), errp); } } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622102; cv=none; d=zohomail.com; s=zohoarc; b=L84KShRcXLLHLFAWW/HJJbFODgYjJcdTyoBSDycUw1TCSNzlHoQuoBDiAg4ZXOFI5szib+QTWlFsxqLKp7115Zu9P7Vp/65hdAppdiS/KyteR3yUHw1tatKUKC/Un1ZpEUNai55WP0GzFSaGjG3qA9Qn9pnsiJ3u/wjQ5JkANd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622102; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=1+Q0gM0m/5wtZS8DTvxZyd2mJsJSViM4tttw9b7y4ME=; b=TLvVtlV8KVi+0B9HZkm5BegklSf1HpduUeDnuYimUPQhHmw/UY127+Ay+QYOIqXH/c+Pj5AO0Jcned4gbXiC4jASxXtL/f4BFIfiNfgsfE7HtICxVKGQ7gTpxCiKD4LSGmclEUygjEScKHULaJb9//sYTDD7peHgwjGrl2e2VxI= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622102420855.1898116491075; Tue, 21 Jul 2026 01:21:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gd-0000s2-R2; Tue, 21 Jul 2026 04:18:47 -0400 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 1wm5gZ-0000hN-4h; Tue, 21 Jul 2026 04:18:43 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zp-QT; Tue, 21 Jul 2026 04:18:42 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBr050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:34 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=1+Q0gM0m/5wtZS8DTvxZyd2mJsJSViM4tttw9b7y4ME=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621854; v=1; b=rcSso+16BQY1CxUcgByFOIFFXrd07pGDNcqetVrZRzgqMvxpvGMUkGEkF6Kf9bHL qmx6H+bmfO7ttWibSC2MkH+V8rTqf/nPXlA8+2BBjGK+4bJH5YwDMjL1aIVhRhYD gQWLs5VZdPYgg1yYPHVpoSvJnuBsowGPASG12aUO8jUtqSNQc4OFEL2ZhgQG6gvb GHLLEeOS3am4U7tGBVWLW1rZwi/7X4I/Q7tnPLeUPSbb0ZQuqwlKfgM32o8p1Jz8 v6G9lp97+UKpyVJf2EA2RCKIj4IyHzGsPD6COkwRb6FlkyYl/5EvmD/aklxbI9tV WvgQ96HLHxTCBwcvBAoy3Q== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:58 +0900 Subject: [PATCH for-11.2 v3 08/15] hw/ppc/pnv_xscom: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-8-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=850; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=TvwbU3DfZ+01MjNYza79qDHcgcPZ4wt6XCANops45eo=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8ttiX4hNRM97MPMHi/I2/ltMgYbVbS9Y05uqIrltvi 299jLXtKGVhEONikBVTZEkp2s2tEV37qTAhvgVmDisTyBAGLk4BmMglMYY/PFeOivqEFV2IOs3L v0fk0p6TWsp9KutlZGf/am9w2yPOycjw03bemZNdby+6x6meWp7oG/3gw+xX61/tLWlvD5v61nY iMwA= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622104329158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/ppc/pnv_xscom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/pnv_xscom.c b/hw/ppc/pnv_xscom.c index dc1ffc6c014f..7af722584e29 100644 --- a/hw/ppc/pnv_xscom.c +++ b/hw/ppc/pnv_xscom.c @@ -253,7 +253,7 @@ static int xscom_dt_child(Object *child, void *opaque) /* * Only "realized" devices should be configured in the DT */ - if (xc->dt_xscom && DEVICE(child)->realized) { + if (xc->dt_xscom && qdev_is_realized(DEVICE(child))) { _FDT((xc->dt_xscom(xd, args->fdt, args->xscom_offset))); } } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622104; cv=none; d=zohomail.com; s=zohoarc; b=eOj6TcZcjzuqpyQafRlETx5vCVd4O8WNohx5KqmArYkXLi+Hc6woEsgwTGYSJw7AcWoZIVKOeAqkZALfDQAWeQgkoymuCv/VQvsPSzLRSiZoW31rXoeSidgDKpQ5gxolRIKedpadqGAFshI2z+0Nk2jN2vSet5zg8APlhcvjcZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622104; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=B44uFrmxRfhYGb5k8pU6lVLkvRUw3cNMaPCaQQlmDFM=; b=GojCjPflGKjOYxYjO+oqyhbQ0/m0TRVsrhee4f8W2MAdHcM599D65AVfiki1TpP1namEjUU8XOs6nx5dmLqJm6v4PVLAoT+xG4/3XvRNaio5Mm6Sx/PvX2cGFYaP0ls2r67XIZ9tNnISoKheEO2DsiJoVizhBI3stPGDWlWSJeQ= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622104584969.9261095616814; Tue, 21 Jul 2026 01:21:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5ge-0000sq-D7; Tue, 21 Jul 2026 04:18:48 -0400 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 1wm5ga-0000m5-ES; Tue, 21 Jul 2026 04:18:44 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zb-Vl; Tue, 21 Jul 2026 04:18:44 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBs050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:35 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=B44uFrmxRfhYGb5k8pU6lVLkvRUw3cNMaPCaQQlmDFM=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621855; v=1; b=MGaY1UmFW4a3EqUPL77YF0HC8OAqs90vJVI4YdAnv3Dcjr5cN5jP3dJfQX6jM1Iq ae2+ynTwGo/CW4d2qJgNif1wgMDuxcAzXI7mZhrhwEWpedV0SKuB5igX9f7s08WA 2aTRMgG99YZl+saKkwH4eRL2+BHdyrQ154zyBV4Q1RkDCDvakx/OonoKXcRPo6qx xq5GxK7R/uMAFA+i15IeRowb2kEC13yUtZXoJu6n+X8+xXaOCPQB/uuK+J4/04cw xhj0Guce5wQ+GsPUZTX1rKNOJnP6r+22oG+awvEXLmSErGG9B0l6EItloLXuk3FY Zthhp0GbnZdNvC9XzSvd9g== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:16:59 +0900 Subject: [PATCH for-11.2 v3 09/15] hw/vfio: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-9-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=2638; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=dW/+Mp6HznhHde/NuhrAUCtUJzM3vwYiHzzfCC/pIMA=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tnh4urju2mWLq5m9/yZHPq49tUNn/quEmhdvVL5nf vd2kDPtKGVhEONikBVTZEkp2s2tEV37qTAhvgVmDisTyBAGLk4BmEj4EUaGPrHwQtfrX+bs+771 vvi+UyGNXhJXm7sFLQIPc145UdD5hZFhavHHpZ8WdLVzfulMYo7i5nSJ/KStey6VT+honO7q8Me 8AA== X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622106458158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/vfio/container-legacy.c | 4 ++-- hw/vfio/device.c | 4 ++-- hw/vfio/iommufd.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/vfio/container-legacy.c b/hw/vfio/container-legacy.c index d301b27aa652..7ac7b3721458 100644 --- a/hw/vfio/container-legacy.c +++ b/hw/vfio/container-legacy.c @@ -1075,7 +1075,7 @@ static int vfio_legacy_pci_hot_reset(VFIODevice *vbas= edev, bool single) =20 /* Prep dependent devices for reset and clear our marker. */ QLIST_FOREACH(vbasedev_iter, &group->device_list, next) { - if (!vbasedev_iter->dev->realized || + if (!qdev_is_realized(vbasedev_iter->dev) || !vfio_pci_from_vfio_device(vbasedev_iter)) { continue; } @@ -1160,7 +1160,7 @@ out: } =20 QLIST_FOREACH(vbasedev_iter, &group->device_list, next) { - if (!vbasedev_iter->dev->realized || + if (!qdev_is_realized(vbasedev_iter->dev) || !vfio_pci_from_vfio_device(vbasedev_iter)) { continue; } diff --git a/hw/vfio/device.c b/hw/vfio/device.c index 1a7f8088aad9..4f119596336f 100644 --- a/hw/vfio/device.c +++ b/hw/vfio/device.c @@ -59,13 +59,13 @@ void vfio_device_reset_handler(void *opaque) =20 trace_vfio_device_reset_handler(); QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) { - if (vbasedev->dev->realized) { + if (qdev_is_realized(vbasedev->dev)) { vbasedev->ops->vfio_compute_needs_reset(vbasedev); } } =20 QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) { - if (vbasedev->dev->realized && vbasedev->needs_reset) { + if (qdev_is_realized(vbasedev->dev) && vbasedev->needs_reset) { vbasedev->ops->vfio_hot_reset_multi(vbasedev); } } diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index 6ff668d2597e..242644aa0010 100644 --- a/hw/vfio/iommufd.c +++ b/hw/vfio/iommufd.c @@ -829,7 +829,7 @@ iommufd_cdev_dep_get_realized_vpdev(struct vfio_pci_dep= endent_device *dep_dev, =20 vbasedev_tmp =3D iommufd_cdev_pci_find_by_devid(dep_dev->devid); if (!vfio_pci_from_vfio_device(vbasedev_tmp) || - !vbasedev_tmp->dev->realized) { + !qdev_is_realized(vbasedev_tmp->dev)) { return NULL; } =20 --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622003; cv=none; d=zohomail.com; s=zohoarc; b=HCSsz5E7VP0ZOhq4RBO6X68/6GZJYCaJYl0OsTLzuXyN4lWtfxoPyhOy2Qbg6qNMtFutIfXsyq2IoQzO1DwHzgmHerc3jr3GWddEWOaTpk7HPUOJ+kgef+VXvW3+9+yOTEaNdJuAOunXESvMAMNKv+fLDYWgMLyTwmoIdzOsA5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622003; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Iv7enNv9vL+vKj7nCr+LWhCY/F9M6rCau2rEhwbdDCk=; b=Q5nbCMQtM7KbUafyPgGt0v7HrE6rHlQdMX0oeFZrzigesmb7nffY/H62BI4x2dYbzpbTiojvMnA4hnVf8rN8UVsGvmTmR3SWtirUzmQ5biBiAo+1gp8q+0MRDJoJVAK6/GQLGjdn/n7BvEr0WDFQLOOdVQNLtRqCq4Z8OVlFCHI= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622003092782.8021350847068; Tue, 21 Jul 2026 01:20:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gc-0000qx-Uc; Tue, 21 Jul 2026 04:18:47 -0400 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 1wm5gX-0000dr-Vj; Tue, 21 Jul 2026 04:18:41 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zi-9o; Tue, 21 Jul 2026 04:18:41 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBt050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:35 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=Iv7enNv9vL+vKj7nCr+LWhCY/F9M6rCau2rEhwbdDCk=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621855; v=1; b=UHQwlkhj9VChpI9WpiKHcxUBPyqRY7YleNYkT/wkybwBMCxHilYoZDMXHwwqeRQI KtMIqfE+Gb8HziF4NVU/UjbhFRWtahFBL+mxjc+DSjz0XfA0cPPRUVlJs3EEMVqp TbefWJ8XxKuY80CCz4l4Q6UXTBrGixiGtoh6b9Vm4PvG3/yqebYDx+jQ5yoPKQ9x odNJZhUZIyxJTpEG1GiHfemCVfXGmd7B4SKs8nBI5jJ1U8zYqjS3DAy3lH3vlslJ +tF/kqGWXFsPwNfMSAA/sy5rwa1NBJXqvt9pDlRx5gfKc15yMQUX1myniO+q9oGY dT6+Ial50nY0rz0GT0rT2Q== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:17:00 +0900 Subject: [PATCH for-11.2 v3 10/15] hw/virtio/virtio-mem: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-10-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=1345; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=OLHddyMfdGW1CwQ4LuGxhyAlMkypNtaeD0eH7Ze+1Ww=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tvi2kC0X9xS8uKRd84yrTuet2KSSoOdT/p0s2X4jU N/xhZR9RykLgxgXg6yYIktK0W5ujejaT4UJ8S0wc1iZQIYwcHEKwESKehkZtq2891BuL5fuOd9z +1bFb9100uvGsZdfQhes4tLxt3Hmi2X4X6vIcOQa+6SQvYzrzl9meZo6k6O5p3aLxUm+x1e+i6x y4wcA X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622005898158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/virtio/virtio-mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index 35e03ed75998..7130ed852d9c 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -1453,7 +1453,7 @@ static void virtio_mem_set_requested_size(Object *obj= , Visitor *v, * The block size and memory backend are not fixed until the device was * realized. realize() will verify these properties then. */ - if (DEVICE(obj)->realized) { + if (qdev_is_realized(DEVICE(obj))) { if (!QEMU_IS_ALIGNED(value, vmem->block_size)) { error_setg(errp, "'%s' has to be multiples of '%s' (0x%" PRIx64 ")", name, VIRTIO_MEM_BLOCK_SIZE_PROP, @@ -1507,7 +1507,7 @@ static void virtio_mem_set_block_size(Object *obj, Vi= sitor *v, const char *name, VirtIOMEM *vmem =3D VIRTIO_MEM(obj); uint64_t value; =20 - if (DEVICE(obj)->realized) { + if (qdev_is_realized(DEVICE(obj))) { error_setg(errp, "'%s' cannot be changed", name); return; } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622143; cv=none; d=zohomail.com; s=zohoarc; b=nczepJtJzseQrVazU1MjROxr8EPDrXaEV+tEfqvZWc12ahceg1o31qZX9ROPoTCB8NSa498UgKtI1GPwGiX/CN2wFFa6nn7K7WYfaW/g1ZiesN+J1SqOWdlHkJBJMD+kJjQ+5zFx6mqJ0L4LeMIzH9jLG9AQbzrc1EoLrGHSQno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622143; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qr12/M6lbYDf+7AnVDzZbYSym2sDNfQQ9a1KvRY5EX4=; b=JglG/1pnfplq+8VtlcLhRkU7ar/0AMO2xRl88mwLgiCvfYAHHb7Z6UWcXL2JeslzceTq2aTy2YvNuWXEm/04N2MgXkVwGMkmjny9UOvY3apPaPBgzE5xRZOr7vJtHLWP1Pc74TWQtnBKuOhmT4P/9TrdSva5obky89tGaqKw2k0= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622143188451.954477000603; Tue, 21 Jul 2026 01:22:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5hD-0001WO-F5; Tue, 21 Jul 2026 04:19:23 -0400 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 1wm5h7-0001Cd-HF; Tue, 21 Jul 2026 04:19:17 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5h5-0001Zh-N2; Tue, 21 Jul 2026 04:19:17 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBu050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:35 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=qr12/M6lbYDf+7AnVDzZbYSym2sDNfQQ9a1KvRY5EX4=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621856; v=1; b=WuDYTUBKGes7+Pa7UDLXDI4DwSdPAvSMZW3OfIvVis+LGzmOAKpfZwEGx1ztf3Ji wprIjVvzCgJ8DrtcZqes5+Dj/ktI86FGlVKpsO7VegfAEnzeJxkpSghlYq4uLa8p e5BlwXL+axCanDQM7/EWUcbZpOXtyeDWAKRmsUeEwOMukMknyT9ljXUoq8Pa8CyN beY5rCABc0tChRuaChGFqHA/wM5ep3dtKDttmO1WKtOplrnXNxZqH8jN5leF4+XR vUlbp+8ttsWNn7lzLzs+jfJqtIq18zJNG2fAlhK59nfyB6fDbhYhYgSMAYXbueBO qUay5gUVPoFUptwLA86OlA== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:17:01 +0900 Subject: [PATCH for-11.2 v3 11/15] hw/virtio/virtio-qmp: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-11-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=1327; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=ldAgNopv4I6FfobXrVBsQQc7NuHhNYI0ZZ22r2DBTpQ=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tkRGntfeB0uPsn+Ydsrr+cr4OtUHEx8st3qmmrgoo s3kM9vEjlIWBjEuBlkxRZaUot3cGtG1nwoT4ltg5rAygQxh4OIUgIkc+8LwP/stw4Ut3H3Texeb r9BVrngx83t98q6VHqkvtiZl/ZideJDhf/D6JYmiXBLcW5vSq0W6CvYWzvJ0mH34ft+Jutm7uPe 5MAIA X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622144496158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/virtio/virtio-qmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-qmp.c b/hw/virtio/virtio-qmp.c index 57cc03828c2b..5aaeebdd96af 100644 --- a/hw/virtio/virtio-qmp.c +++ b/hw/virtio/virtio-qmp.c @@ -659,7 +659,7 @@ static int query_dev_child(Object *child, void *opaque) { VirtioInfoList **vdevs =3D opaque; Object *dev =3D object_dynamic_cast(child, TYPE_VIRTIO_DEVICE); - if (dev !=3D NULL && DEVICE(dev)->realized) { + if (dev !=3D NULL && qdev_is_realized(DEVICE(dev))) { VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); VirtioInfo *info =3D g_new(VirtioInfo, 1); =20 @@ -688,7 +688,7 @@ VirtIODevice *qmp_find_virtio_device(const char *path) /* Verify the canonical path is a realized virtio device */ Object *dev =3D object_dynamic_cast(object_resolve_path(path, NULL), TYPE_VIRTIO_DEVICE); - if (!dev || !DEVICE(dev)->realized) { + if (!dev || !qdev_is_realized(DEVICE(dev))) { return NULL; } return VIRTIO_DEVICE(dev); --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622121; cv=none; d=zohomail.com; s=zohoarc; b=jFCZmZBwwdCcYHBx+HLTP7SfHI895FqYMXmeK72K3FuIK8CCuWsThez3vHzZTKdm6Vivom/av1g5Uzq46FAjHxN4IGirNPtCiZb+iqEzyRr3Tute8H9p+ehUUE5yFvFHSLcPXxNtj0g+cQdLVPz+cWSk5QKVBcjddE20IIAQ6+8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622121; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LFFC+0JsdcYcEqh6Xk6nm4iRRSP9OjDVyJmRqU0t/a8=; b=H2ITNynoIW/1GANd5+HAb9/bwJ1/kwWIcThRr2rakX1nv1uc4gatsX4n/UwBJm0EaAzwCdNeRIYz8jUaqJHE5lHbCwG0pg6uGdcdX+BkjeeKsUVZCLRjtRcroQjR0Rblyn98LxDEBRpdlyFV4LtiBbEbXxRcaR4+4xIQTFSULfA= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622121877797.9151249119042; Tue, 21 Jul 2026 01:22:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5hA-0001KD-Tw; Tue, 21 Jul 2026 04:19:20 -0400 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 1wm5h8-0001F2-Je; Tue, 21 Jul 2026 04:19:19 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5h5-0001Ze-Ns; Tue, 21 Jul 2026 04:19:18 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBv050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:36 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=LFFC+0JsdcYcEqh6Xk6nm4iRRSP9OjDVyJmRqU0t/a8=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621856; v=1; b=L+oOOVnGo3YNnvvnBSUYU7wgUONnW7/KrHO0qfnlP0E1tKpdSFaIu8T/s2ISUy9u 8qJoa8UjWLz/jgxPyQiFfS1X9yZO6TbYCGFnir2JEsuKrdMtYaaK6m/lp7u9GlK2 DD/kjAKb8iB0+TKi4RICa8OT4SnCmwZ0O6SEozTrl844IMZaM3flBYlCg0vKHleo glHH55P/lUiLOVZq5wnPf8Ih4G41L2AqYOO4gJHLOH4Ogoj9vAJgFXtvNZxJ6sbM pNfG3cHH2071goh0nCxbpLBHKWeh81qGxrrlOoiXBkdyjhYfbFgdvOQw3fbl6mAh joKlzh5/vyFplMRG36yPgg== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:17:02 +0900 Subject: [PATCH for-11.2 v3 12/15] target/i386/cpu: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-12-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=759; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=Q2S5H8jS+4kWUgVvqeR+WvnwxdLZafl0U/7KpflvRws=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tkTxL5erJ0vSGJZnHuYw+XNn54mtnSus8+9Mbzn2Y f1D5vbNHaUsDGJcDLJiiiwpRbu5NaJrPxUmxLfAzGFlAhnCwMUpABOpPMDwP8Ziba23xDaVZT8n veH4/u/xjL/f2/5dO7I1il1+qeT+p1EM/wuUNPo3GXwsZ6vSMAmQ3KGq98otJnBW27xD7uKWtes 5GAA= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622122376158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 5805d33ab92d..7a2c3cf358d3 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10387,7 +10387,7 @@ static void x86_cpu_set_bit_prop(Object *obj, Visit= or *v, const char *name, BitProperty *fp =3D opaque; bool value; =20 - if (dev->realized) { + if (qdev_is_realized(dev)) { qdev_prop_set_after_realize(dev, name, errp); return; } --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622132; cv=none; d=zohomail.com; s=zohoarc; b=NDZXxNKr40FePP0cfdevPv0QoJlFSYiEDH6qQfGH9TwWDVw2P6mc10MvPC4Co2i4O47SdCWSXfUPg7O8brtzub73hsZspxkVK0hF2IHDOE4r7gWR/u7Ajkrlt3A3weDZFg88bAxRuG2/1GX9vjw4WDtegfYJKhuu4h1YpQaFH6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622132; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5NvR3Q8D8NrfTHlBvLFX8Ufpot1HwlDYDMtRmK8x6FA=; b=CLfcQVck2W1uXmXvoB6WI5hkCA3jZXwOAn3VeLx3v2GbANj+edUHGxzqZUx8X9Wfou/A3BcsqriKcOLbNqeF4NBzaIqK8UQyIacXDstm6VpJBaS0owE2aclu5ldrW/QIwYocl9+hBt313su3IKMuVlPyRgM98dIp3ZThXIxFge4= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622132630887.5356677982461; Tue, 21 Jul 2026 01:22:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5ga-0000lf-9V; Tue, 21 Jul 2026 04:18:44 -0400 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 1wm5gX-0000aq-46; Tue, 21 Jul 2026 04:18:41 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zd-Fd; Tue, 21 Jul 2026 04:18:40 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBw050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:36 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=5NvR3Q8D8NrfTHlBvLFX8Ufpot1HwlDYDMtRmK8x6FA=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621857; v=1; b=TTGJm8D80zFXzC8pg9x6G+Z8KP4l9RBebOpFP5TKklvpLUB2CbMH3FRku4x4AJSG /Pl04XMT6hC7bs/RHDuG3T3FDo8s+iI+YKw2c8WHR+WbNvbJq9nQJZhG3OPN97KF 5QDhl92kZ+GtsQmE4siHz8XBRGplf9IvjyFbc4o8ij17Ss0AKOatCpLYwt+2EOFL GgMuhLCICgDeQjtrl33M2UGz8zC6clVdZ/UBM/NGLmuHiFLgoYDd8vmI65cvnIaA VjX6LQcyzWSzkfcshChvIUQ8W+4i8GrOPul4wgjitRxmPYCKDUynvYPUGlj8IpoM vMOnl00beMQnUbZCQoxNtA== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:17:03 +0900 Subject: [PATCH for-11.2 v3 13/15] target/s390x: Use qdev_is_realized() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-13-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=1253; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=OoCnJ8l56oi15ay9xCs5zNFtiLrLO0igmJFyUjSr1dA=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tqRK4PWle9h/qb3X6gv73MI7X2mv4z7bmj29jvJFi aH2P+92lLIwiHExyIopsqQU7ebWiK79VJgQ3wIzh5UJZAgDF6cATGSrDiPDNqXrAl84Njzf/Nw7 ZAGb09PrkzjL099LffNnvLi778u/nQx/5c6Y96s0XE/Z3Hntw8VtqcIHlfouPm/pWe144DGDoYM fIwA= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622134517158500 DeviceState fields should be accessed through qdev helpers rather than directly. Use qdev_is_realized() instead of reading DeviceState::realized directly. Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/s390x/cpu_models.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 2dd9aac8078c..f292af7ad01c 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -714,7 +714,7 @@ static void set_feature(Object *obj, Visitor *v, const = char *name, S390CPU *cpu =3D S390_CPU(obj); bool value; =20 - if (dev->realized) { + if (qdev_is_realized(dev)) { error_setg(errp, "Attempt to set property '%s' on '%s' after " "it was realized", name, object_get_typename(obj)); return; @@ -770,7 +770,7 @@ static void set_feature_group(Object *obj, Visitor *v, = const char *name, S390CPU *cpu =3D S390_CPU(obj); bool value; =20 - if (dev->realized) { + if (qdev_is_realized(dev)) { error_setg(errp, "Attempt to set property '%s' on '%s' after " "it was realized", name, object_get_typename(obj)); return; --=20 2.55.0 From nobody Sat Jul 25 09:50:38 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622118; cv=none; d=zohomail.com; s=zohoarc; b=MeEMHPcrgtuQ/PfMRdWAuCb89UXXRSvBD/6pu5IkgSCTawH22aoYQBCtzpKef+Q6ncqBkoxrb7/nhLGVM6tVr5MmESML+N2b9+ZYgOD9gqznnvD2qptAMlCS00qo3Iu7XleK/7XmmNtVkeU8Zs/UQR0SvY8Lj9odMonxiKJ4ZEQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622118; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fHYL5P1BOJ9TV/JCQGzQIxAFP6FUfhC05vOo19O9zcA=; b=aKYDFxdvzqKhKeMNri8U7yDIxP7oDffn39KcmMThQz2AxhY1DGWPOPfZqu3ei3fvTNORrVhUqgt3hXMxgwegu7ETpmuDAuRCER/bby0FQDwUsjczt/x8KzKvWUpj5KyrHznvWXSgcjPIJTBvweDFf0i+ko7/t4rSF34uyNJchTE= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622118406329.2742003105925; Tue, 21 Jul 2026 01:21:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5hE-0001c5-Dn; Tue, 21 Jul 2026 04:19:24 -0400 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 1wm5h9-0001Fr-8V; Tue, 21 Jul 2026 04:19:19 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5h5-0001Zj-Ny; Tue, 21 Jul 2026 04:19:18 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsBx050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:37 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=fHYL5P1BOJ9TV/JCQGzQIxAFP6FUfhC05vOo19O9zcA=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621857; v=1; b=BQvDy7O2SP31uLNa8PTieTvwzRWd1q+DQeDoAqwvPhhrO0sHfHue921tHtgExXkg W7pYKx0A6VW9zkgfXzwCGrKRvFSRrwFWH/iDSaax/8GKKmefLinqD4bwRL04/8y5 WhNFCO2SPncDUQAZrdpvbAWEE3J8K9MH96/1ywv8bWDvzo4iwoNWnDqxe9aIIFSh SkT8HvsEObRwo/DR2LsNEfjbyceF8NE0mxECID3kI8tv3iygsBEgsJV57w2C4Bwp 4YM8/tzIH7TC7UOpE0Kc+3EQ4EQXyvFFHMtodM8rVXfffkOLXiYr07cnX1TVEXBs 8OwOFWZ6Jn5HHUsQWDe2WQ== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:17:04 +0900 Subject: [PATCH for-11.2 v3 14/15] hw/qdev: Parent device before setting parent bus MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-14-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=5472; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=QNg0Y4Mcg/1wVq3yfR6imXwr9ak2ks5bgpXU1rSTWws=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tmSTa1510ZTGda3lDZf+LNZbVWKbMDczs2tpss4Hd wX7pzIdpSwMYlwMsmKKLClFu7k1oms/FSbEt8DMYWUCGcLAxSkAE2mZyvBXML7/++nIWysyLjgk cNQ4a3HxHO27c19kqRD3+sL/76q6GRnmZhT4/lqrf0LMRn1zd0RpwaUdG58xaHeXbYl8YVR4PpU LAA== X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622120423158501 Commit 9940b2cfbc05 ("qdev: New qdev_new(), qdev_realize(), etc.") says "device state 'no QOM parent, but plugged into bus' is dangerous". In such a case, unrealizing the bus will hang in bus_unparent(): while ((kid =3D QTAILQ_FIRST(&bus->children)) !=3D NULL) { DeviceState *dev =3D kid->child; object_unparent(OBJECT(dev)); } object_unparent() does nothing when its argument has no QOM parent, and the loop spins forever. However, that commit did not completely eliminate such a situation. When the device is not parented, device_set_realized() lets /machine/unattached parent it, but it happens after setting parent bus. Therefore, any failure between the two operations can leave the device in a dangerous state. qdev_realize() at least asserts that the device is not already realized and prevents one realization failure pattern, but it is not comprehensive. Besides, it will trip with a command line like the following: qemu-system-x86_64 -M none -nodefaults -nographic \ -device ipmi-bmc-sim,realized=3Don Eliminate the dangerous state by ensuring that the device is parented before calling qdev_set_parent_bus(). Also, stop asserting that the device is not already realized in qdev_realize(); it is broken and no longer serves any purpose. Fixes: 9940b2cfbc05 ("qdev: New qdev_new(), qdev_realize(), etc.") Signed-off-by: Akihiko Odaki Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/qdev.c | 51 ++++++++++++++++++++++++++++------------------= ---- tests/unit/test-qdev.c | 13 +++++++++++++ 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index e2aab3d1fc61..0b0f2f47fa78 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -264,17 +264,43 @@ static void device_reset_child_foreach(Object *obj, R= esettableChildCallback cb, =20 bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp) { - assert(!dev->realized && !dev->parent_bus); + static int unattached_count; + bool unattached_parent =3D false; + + assert(!dev->parent_bus); + + if (!OBJECT(dev)->parent) { + gchar *name =3D g_strdup_printf("device[%d]", unattached_count++); + + object_property_add_child(machine_get_container("unattached"), + name, OBJECT(dev)); + unattached_parent =3D true; + g_free(name); + } =20 if (bus) { if (!qdev_set_parent_bus(dev, bus, errp)) { - return false; + goto fail; } } else { assert(!DEVICE_GET_CLASS(dev)->bus_type); } =20 - return object_property_set_bool(OBJECT(dev), "realized", true, errp); + if (object_property_set_bool(OBJECT(dev), "realized", true, errp)) { + return true; + } + +fail: + if (unattached_parent) { + /* + * Beware, this doesn't just revert + * object_property_add_child(), it also runs bus_remove()! + */ + object_unparent(OBJECT(dev)); + unattached_count--; + } + + return false; } =20 bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp) @@ -479,8 +505,6 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) BusState *bus; NamedClockList *ncl; Error *local_err =3D NULL; - bool unattached_parent =3D false; - static int unattached_count; =20 if (dev->hotplugged && !dc->hotpluggable) { error_setg(errp, "Device '%s' does not support hotplugging", @@ -493,15 +517,6 @@ static void device_set_realized(Object *obj, bool valu= e, Error **errp) goto fail; } =20 - if (!obj->parent) { - gchar *name =3D g_strdup_printf("device[%d]", unattached_count= ++); - - object_property_add_child(machine_get_container("unattached"), - name, obj); - unattached_parent =3D true; - g_free(name); - } - hotplug_ctrl =3D qdev_get_hotplug_handler(dev); if (hotplug_ctrl) { hotplug_handler_pre_plug(hotplug_ctrl, dev, &local_err); @@ -627,14 +642,6 @@ post_realize_fail: =20 fail: error_propagate(errp, local_err); - if (unattached_parent) { - /* - * Beware, this doesn't just revert - * object_property_add_child(), it also runs bus_remove()! - */ - object_unparent(OBJECT(dev)); - unattached_count--; - } } =20 static bool device_get_hotpluggable(Object *obj, Error **errp) diff --git a/tests/unit/test-qdev.c b/tests/unit/test-qdev.c index 20eae38e03f4..77c3eee71713 100644 --- a/tests/unit/test-qdev.c +++ b/tests/unit/test-qdev.c @@ -78,6 +78,16 @@ static void test_qdev_free_properties(void) object_unref(mt); } =20 +static void test_qdev_double_realization(void) +{ + MyDev *mt =3D STATIC_TYPE(object_new(TYPE_MY_DEV)); + + qdev_realize(DEVICE(mt), NULL, &error_fatal); + qdev_realize(DEVICE(mt), NULL, &error_fatal); + object_unparent(OBJECT(mt)); + object_unref(OBJECT(mt)); +} + =20 int main(int argc, char **argv) { @@ -90,6 +100,9 @@ int main(int argc, char **argv) g_test_add_func("/qdev/free-properties", test_qdev_free_properties); =20 + g_test_add_func("/qdev/double-realization", + test_qdev_double_realization); + g_test_run(); =20 return 0; --=20 2.55.0 From nobody Sat Jul 25 09:50:39 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=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp ARC-Seal: i=1; a=rsa-sha256; t=1784622114; cv=none; d=zohomail.com; s=zohoarc; b=k0n7/TbZ7VmQlqjToxi98wT2JuU2u+63TOzerPHbDvHhsq0TT6oPIjbUTiXZkdSW8ipcWhmk8bL4SOVzI+SDEZdtn9erZffftfGFO7WoCeymMrBWi3vWh71Epr2Tr6q0g34G15xog33Ja5b/X0hX6bK2eUiwiw016JNyJW2M6Ls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784622114; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KdG8UYuPxSjtyAfCgYV2dAyRjnB2kW2wTApGftqXlKQ=; b=g9pfysRglfO7n5qd0M8SQo8BcREfYpeACceegX2aPpsKGVYCV2jdx1E6kmYTWHlOYxffM+NftP/615wlEFJ7UPgPabTWQnyjZkTjru2ENYbq+secu1FxH0+jwHwgIZUlOptCmzky8dpR8J7YutRWOeqAOdrpuH1tGAg56t4GNtg= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1784622114407956.4087248803447; Tue, 21 Jul 2026 01:21:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wm5gd-0000qy-2h; Tue, 21 Jul 2026 04:18:47 -0400 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 1wm5gZ-0000iB-Ep; Tue, 21 Jul 2026 04:18:43 -0400 Received: from www3579.sakura.ne.jp ([49.212.243.89]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wm5gU-0001Zq-67; Tue, 21 Jul 2026 04:18:43 -0400 Received: from h183.csg.ci.i.u-tokyo.ac.jp (h183.csg.ci.i.u-tokyo.ac.jp [133.11.54.183]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 66L8GsC0050170 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Jul 2026 17:17:37 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=KdG8UYuPxSjtyAfCgYV2dAyRjnB2kW2wTApGftqXlKQ=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Message-Id:To:Subject:Date; s=rs20250326; t=1784621858; v=1; b=hQKvbFAAqK6A0Ipu8R3mBCCxDVdON+lpaxdM9zIgAm2yekhVtzEf+p5H/Z3HpLg5 lbyZxDeH6u8d764HwYOrap5ZrvvehfjYJDmmsdRsmEQj8ZPZvq+5VwJXX3d2XCBv +I4rkoe0vbrBrFxjcyWthk2m/kZ2eTg5ZnTPbSFVUq16S8AXLbI3BEYcpptiHHDi HHGzk3I0s6Y2eOqtZSrNlgiQFl92HxCjh1jotmTaZT6gEPE2+nJvD0282/11txrp C4bNkiOOPsIZANhS6x0wpb3G9YoMnXvE8Wy6HIL041hi3WzKxzWACWXRoXF38cQs HthWigkQKRkBTJcxAxqKig== From: Akihiko Odaki Date: Tue, 21 Jul 2026 17:17:05 +0900 Subject: [PATCH for-11.2 v3 15/15] hw/qdev: Prevent devices from being realized more than once MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-qdev-v3-15-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> References: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20260721-qdev-v3-0-d2e226fa002e@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: BALATON Zoltan , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , "Maciej S. Szmigiero" , "Michael S. Tsirkin" , David Hildenbrand , Igor Mammedov , FangSheng Huang , Alistair Francis , "Edgar E. Iglesias" , Peter Maydell , qemu-arm@nongnu.org, Nicholas Piggin , Aditya Gupta , Glenn Miles , Harsh Prateek Bora , qemu-ppc@nongnu.org, Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zhao Liu , Hendrik Brueckner , Richard Henderson , Ilya Leoshkevich , Cornelia Huck , Eric Farman , Matthew Rosato , qemu-s390x@nongnu.org, Luc Michel , Fam Zheng , Eric Blake , Markus Armbruster , Akihiko Odaki X-Mailer: b4 0.16-dev-925f5 X-Developer-Signature: v=1; a=openpgp-sha256; l=21879; i=odaki@rsg.ci.i.u-tokyo.ac.jp; h=from:subject:message-id; bh=1ve/6whPmh8L1TD3oKRaRGHIJkEEri1ZNlFUN7ibfj8=; b=owGbwMvMwCWmMbc20y1CyJDxtFoSQ1a8tlTC05zH65aderxgckLNp6epv170NCRclmWsnH1j9 1URxc/ZHaUsDGJcDLJiiiwpRbu5NaJrPxUmxLfAzGFlAhnCwMUpABMR7WJkWLJh04vtwb/OsSdE H3UOijh50aoz0ijB3XCCu56a0fSS9Qz/M6ddvy67r6LDk9HuxexVdVeyJqno/Xn/l219o+uGg42 qzAA= X-Developer-Key: i=odaki@rsg.ci.i.u-tokyo.ac.jp; a=openpgp; fpr=AEDC03C9AF734F2EC26A7BFFA4BAEAA73536753C 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=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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 @rsg.ci.i.u-tokyo.ac.jp) X-ZM-MESSAGEID: 1784622116557158500 qdev currently permits reentrant realization of the same device. It also permits another realization attempt after a device has been unrealized or a previous attempt has failed. Either path can invoke DeviceClass::realize() more than once. Supporting repeated realization adds complexity to device implementations. It is untested and likely broken. Replace the bool DeviceState::realized field with the enum-valued DeviceState::phase field. The enum has four values: - initialized - realizing - realized - retired Realization can start only in the initialized phase. It moves the device to the realizing phase before invoking callbacks, preventing another realization attempt. Successful realization moves it to the realized phase; failure after realization has started moves it to the retired phase. Unrealization also moves a realized device to the retired phase. The QOM realized property is an internal lifecycle property, not for end users. Replace it with the enum-valued phase property. Signed-off-by: Akihiko Odaki --- qapi/common.json | 19 ++++++++ include/hw/core/qdev.h | 12 ++--- hw/core/qdev-clock.c | 4 +- hw/core/qdev-properties.c | 4 +- hw/core/qdev.c | 98 ++++++++++++++++++++++++++-------------- hw/scsi/scsi-bus.c | 4 +- qom/qom-qmp-cmds.c | 2 +- system/qdev-monitor.c | 5 ++- tests/unit/test-qdev.c | 112 ++++++++++++++++++++++++++++++++++++++++++= +++- 9 files changed, 212 insertions(+), 48 deletions(-) diff --git a/qapi/common.json b/qapi/common.json index af7e3d618a7c..88a308cbd172 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -7,6 +7,25 @@ # ***************** ## =20 +## +# @DevicePhase: +# +# An enumeration of the device phases +# +# @initialized: the initial phase +# +# @realizing: the phase during realization +# +# @realized: the phase after realization +# +# @retired: the terminal phase entered when unrealization begins or +# realization fails after starting +# +# Since: 11.1 +## +{ 'enum': 'DevicePhase', + 'data': [ 'initialized', 'realizing', 'realized', 'retired' ] } + ## # @IoOperationType: # diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index 3f47ea72c009..c9012155a6ec 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -1,6 +1,7 @@ #ifndef QDEV_CORE_H #define QDEV_CORE_H =20 +#include "qapi/qapi-types-common.h" #include "qemu/atomic.h" #include "qemu/queue.h" #include "qemu/bitmap.h" @@ -29,8 +30,9 @@ * 3) device realization * * #TypeInfo.instance_init may not fail. #DeviceClass.realize can - * fail, returning error information to the caller. A device realize - * method should handle being called again after it has failed once. + * fail, returning error information to the caller. A device's realize + * method is called at most once, even if realization fails or the + * device is later unrealized. * #TypeInfo.instance_init should add instance properties but must not * have any side effect not contained in the instance, since it happens * during device introspection already. Any operations without special @@ -239,9 +241,9 @@ struct DeviceState { */ char *canonical_path; /** - * @realized: has device been realized? + * @phase: the current phase */ - bool realized; + DevicePhase phase; /** * @pending_deleted_event: track pending deletion events during unplug */ @@ -445,7 +447,7 @@ DeviceState *qdev_try_new(const char *name); */ static inline bool qdev_is_realized(const DeviceState *dev) { - return qatomic_load_acquire(&dev->realized); + return qatomic_load_acquire(&dev->phase) =3D=3D DEVICE_PHASE_REALIZED; } =20 /** diff --git a/hw/core/qdev-clock.c b/hw/core/qdev-clock.c index 861f78f94c64..efb33a3a27e7 100644 --- a/hw/core/qdev-clock.c +++ b/hw/core/qdev-clock.c @@ -30,7 +30,7 @@ static NamedClockList *qdev_init_clocklist(DeviceState *d= ev, const char *name, * Clock must be added before realize() so that we can compute the * clock's canonical path during device_realize(). */ - assert(!dev->realized); + assert(dev->phase !=3D DEVICE_PHASE_REALIZED); =20 /* * The ncl structure is freed by qdev_finalize_clocklist() which will @@ -186,6 +186,6 @@ Clock *qdev_alias_clock(DeviceState *dev, const char *n= ame, =20 void qdev_connect_clock_in(DeviceState *dev, const char *name, Clock *sour= ce) { - assert(!dev->realized); + assert(dev->phase !=3D DEVICE_PHASE_REALIZED); clock_set_source(qdev_get_clock_in(dev, name), source); } diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index 34d7b26a7303..66cff4b9338c 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -33,7 +33,7 @@ static bool qdev_prop_allow_set(Object *obj, const char *= name, { DeviceState *dev =3D DEVICE(obj); =20 - if (dev->realized && !info->realized_set_allowed) { + if (dev->phase =3D=3D DEVICE_PHASE_REALIZED && !info->realized_set_all= owed) { qdev_prop_set_after_realize(dev, name, errp); return false; } @@ -46,7 +46,7 @@ void qdev_prop_allow_set_link_before_realize(const Object= *obj, { DeviceState *dev =3D DEVICE(obj); =20 - if (dev->realized) { + if (dev->phase =3D=3D DEVICE_PHASE_REALIZED) { error_setg(errp, "Attempt to set link property '%s' on device '%s'= " "(type '%s') after it was realized", name, dev->id, object_get_typename(obj)); diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 0b0f2f47fa78..994af2bec4fc 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -134,7 +134,7 @@ bool qdev_set_parent_bus(DeviceState *dev, BusState *bu= s, Error **errp) dev->parent_bus =3D bus; object_ref(OBJECT(bus)); bus_add_child(bus, dev); - if (dev->realized) { + if (dev->phase =3D=3D DEVICE_PHASE_REALIZED) { resettable_change_parent(OBJECT(dev), OBJECT(bus), OBJECT(old_parent_bus)); } @@ -230,7 +230,7 @@ bool qdev_should_hide_device(const QDict *opts, bool fr= om_json, Error **errp) void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id, int required_for_version) { - assert(!dev->realized); + assert(dev->phase !=3D DEVICE_PHASE_REALIZED); dev->instance_id_alias =3D alias_id; dev->alias_required_for_version =3D required_for_version; } @@ -286,7 +286,7 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Erro= r **errp) assert(!DEVICE_GET_CLASS(dev)->bus_type); } =20 - if (object_property_set_bool(OBJECT(dev), "realized", true, errp)) { + if (object_property_set_str(OBJECT(dev), "phase", "realized", errp)) { return true; } =20 @@ -314,7 +314,7 @@ bool qdev_realize_and_unref(DeviceState *dev, BusState = *bus, Error **errp) =20 void qdev_unrealize(DeviceState *dev) { - object_property_set_bool(OBJECT(dev), "realized", false, &error_abort); + object_property_set_str(OBJECT(dev), "phase", "retired", &error_abort); } =20 static int qdev_assert_realized_properly_cb(Object *obj, void *opaque) @@ -324,7 +324,7 @@ static int qdev_assert_realized_properly_cb(Object *obj= , void *opaque) =20 if (dev) { dc =3D DEVICE_GET_CLASS(dev); - assert(dev->realized); + assert(dev->phase =3D=3D DEVICE_PHASE_REALIZED); assert(dev->parent_bus || !dc->bus_type); } return 0; @@ -477,10 +477,10 @@ bool qdev_unplug_blocked(DeviceState *dev, Error **er= rp) return false; } =20 -static bool device_get_realized(Object *obj, Error **errp) +static int device_get_phase(Object *obj, Error **errp) { DeviceState *dev =3D DEVICE(obj); - return dev->realized; + return dev->phase; } =20 static bool check_only_migratable(Object *obj, Error **errp) @@ -497,14 +497,29 @@ static bool check_only_migratable(Object *obj, Error = **errp) return true; } =20 -static void device_set_realized(Object *obj, bool value, Error **errp) +static void device_set_phase(Object *obj, int value, Error **errp) { + ERRP_GUARD(); DeviceState *dev =3D DEVICE(obj); DeviceClass *dc =3D DEVICE_GET_CLASS(dev); + DevicePhase old_value =3D dev->phase; HotplugHandler *hotplug_ctrl; BusState *bus; NamedClockList *ncl; - Error *local_err =3D NULL; + + if (value =3D=3D old_value) { + return; + } + + if (old_value =3D=3D DEVICE_PHASE_REALIZING) { + error_setg(errp, "The device is currently realizing"); + return; + } + + if (old_value =3D=3D DEVICE_PHASE_RETIRED) { + error_setg(errp, "A device cannot transition from retired to anoth= er phase"); + return; + } =20 if (dev->hotplugged && !dc->hotpluggable) { error_setg(errp, "Device '%s' does not support hotplugging", @@ -512,22 +527,33 @@ static void device_set_realized(Object *obj, bool val= ue, Error **errp) return; } =20 - if (value && !dev->realized) { + switch (value) { + case DEVICE_PHASE_INITIALIZED: + error_setg(errp, "A device cannot transition from another phase to= initialized"); + return; + + case DEVICE_PHASE_REALIZING: + error_setg(errp, "The realizing phase cannot be set via property"); + return; + + case DEVICE_PHASE_REALIZED: + qatomic_set(&dev->phase, DEVICE_PHASE_REALIZING); + if (!check_only_migratable(obj, errp)) { goto fail; } =20 hotplug_ctrl =3D qdev_get_hotplug_handler(dev); if (hotplug_ctrl) { - hotplug_handler_pre_plug(hotplug_ctrl, dev, &local_err); - if (local_err !=3D NULL) { + hotplug_handler_pre_plug(hotplug_ctrl, dev, errp); + if (*errp) { goto fail; } } =20 if (dc->realize) { - dc->realize(dev, &local_err); - if (local_err !=3D NULL) { + dc->realize(dev, errp); + if (*errp) { goto fail; } } @@ -554,7 +580,7 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) qdev_get_vmsd(dev), dev, dev->instance_id_alias, dev->alias_required_for_ver= sion, - &local_err) < 0) { + errp) < 0) { goto post_realize_fail; } } @@ -583,25 +609,30 @@ static void device_set_realized(Object *obj, bool val= ue, Error **errp) dev->pending_deleted_event =3D false; =20 if (hotplug_ctrl) { - hotplug_handler_plug(hotplug_ctrl, dev, &local_err); - if (local_err !=3D NULL) { + hotplug_handler_plug(hotplug_ctrl, dev, errp); + if (*errp) { goto child_realize_fail; } } =20 - qatomic_store_release(&dev->realized, value); - - } else if (!value && dev->realized) { + qatomic_store_release(&dev->phase, value); + return; =20 + case DEVICE_PHASE_RETIRED: /* * Change the value so that any concurrent users are aware - * that the device is going to be unrealized + * that the device is going to be retired * - * TODO: change .realized property to enum that states - * each phase of the device realization/unrealization + * TODO: change .phase property to state + * each sub-phase of the device realization/unrealization */ =20 - qatomic_set(&dev->realized, value); + qatomic_set(&dev->phase, value); + + if (old_value =3D=3D DEVICE_PHASE_INITIALIZED) { + return; + } + /* * Ensure that concurrent users see this update prior to * any other changes done by unrealize. @@ -619,10 +650,11 @@ static void device_set_realized(Object *obj, bool val= ue, Error **errp) } dev->pending_deleted_event =3D true; DEVICE_LISTENER_CALL(unrealize, Reverse, dev); - } + return; =20 - assert(local_err =3D=3D NULL); - return; + default: + g_assert_not_reached(); + } =20 child_realize_fail: QLIST_FOREACH(bus, &dev->child_bus, sibling) { @@ -641,7 +673,7 @@ post_realize_fail: } =20 fail: - error_propagate(errp, local_err); + qatomic_store_release(&dev->phase, DEVICE_PHASE_RETIRED); } =20 static bool device_get_hotpluggable(Object *obj, Error **errp) @@ -670,7 +702,6 @@ static void device_initfn(Object *obj) } =20 dev->instance_id_alias =3D -1; - dev->realized =3D false; dev->allow_unplug_during_migration =3D false; =20 QLIST_INIT(&dev->gpios); @@ -736,7 +767,7 @@ static void device_unparent(Object *obj) DeviceState *dev =3D DEVICE(obj); BusState *bus; =20 - if (dev->realized) { + if (dev->phase =3D=3D DEVICE_PHASE_REALIZED) { qdev_unrealize(dev); } while (dev->num_child_bus) { @@ -768,7 +799,7 @@ static void device_class_init(ObjectClass *class, const= void *data) =20 /* by default all devices were considered as hotpluggable, * so with intent to check it in generic qdev_unplug() / - * device_set_realized() functions make every device + * device_set_phase() functions make every device * hotpluggable. Devices that shouldn't be hotpluggable, * should override it in their class_init() */ @@ -786,8 +817,9 @@ static void device_class_init(ObjectClass *class, const= void *data) */ dc->legacy_reset =3D NULL; =20 - object_class_property_add_bool(class, "realized", - device_get_realized, device_set_realize= d); + object_class_property_add_enum(class, "phase", "DevicePhase", + &DevicePhase_lookup, + device_get_phase, device_set_phase); object_class_property_add_bool(class, "hotpluggable", device_get_hotpluggable, NULL); object_class_property_add_bool(class, "hotplugged", diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index dccb2f25b2af..3a83a8457527 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -57,8 +57,8 @@ static SCSIDevice *do_scsi_device_find(SCSIBus *bus, /* * This function might run on the IO thread and we might race against * main thread hot-plugging the device. - * We assume that as soon as .realized is set to true we can let - * the user access the device. + * We assume that as soon as the device is realized we can let + * the user access it. */ =20 if (retval && !include_unrealized && !qdev_is_realized(&retval->qdev))= { diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c index 48b38d2b7f73..5acbeac024e4 100644 --- a/qom/qom-qmp-cmds.c +++ b/qom/qom-qmp-cmds.c @@ -211,7 +211,7 @@ ObjectPropertyInfoList *qmp_device_list_properties(cons= t char *typename, =20 /* Skip Object and DeviceState properties */ if (strcmp(prop->name, "type") =3D=3D 0 || - strcmp(prop->name, "realized") =3D=3D 0 || + strcmp(prop->name, "phase") =3D=3D 0 || strcmp(prop->name, "hotpluggable") =3D=3D 0 || strcmp(prop->name, "hotplugged") =3D=3D 0 || strcmp(prop->name, "parent_bus") =3D=3D 0) { diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index 00fed791cce1..8641f5f72dff 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -596,7 +596,7 @@ const char *qdev_set_id(DeviceState *dev, char *id, Err= or **errp) { ObjectProperty *prop; =20 - assert(!dev->id && !dev->realized); + assert(!dev->id && dev->phase !=3D DEVICE_PHASE_REALIZED); =20 /* * object_property_[try_]add_child() below will assert the device @@ -1078,7 +1078,8 @@ static int qdev_add_hotpluggable_device(Object *obj, = void *opaque) return 0; } =20 - if (dev->realized && object_property_get_bool(obj, "hotpluggable", NUL= L)) { + if (dev->phase =3D=3D DEVICE_PHASE_REALIZED && + object_property_get_bool(obj, "hotpluggable", NULL)) { *list =3D g_slist_append(*list, dev); } =20 diff --git a/tests/unit/test-qdev.c b/tests/unit/test-qdev.c index 77c3eee71713..14935f4d3d9e 100644 --- a/tests/unit/test-qdev.c +++ b/tests/unit/test-qdev.c @@ -10,6 +10,8 @@ typedef struct MyDev MyDev; DECLARE_INSTANCE_CHECKER(MyDev, STATIC_TYPE, TYPE_MY_DEV) =20 +#define TYPE_REENTRANT_REALIZATION "reentrant-realization" + struct MyDev { DeviceState parent_obj; =20 @@ -17,6 +19,9 @@ struct MyDev { char *prop_string; uint32_t *prop_array_u32; uint32_t prop_array_u32_nb; + uint16_t realization_count; + uint16_t unrealization_count; + Error *realization_err; }; =20 static const Property my_dev_props[] =3D { @@ -26,11 +31,25 @@ static const Property my_dev_props[] =3D { qdev_prop_uint32, uint32_t), }; =20 +static void my_dev_realize(DeviceState *dev, Error **errp) +{ + MyDev *mt =3D STATIC_TYPE(dev); + mt->realization_count++; + error_propagate(errp, g_steal_pointer(&mt->realization_err)); +} + +static void my_dev_unrealize(DeviceState *dev) +{ + MyDev *mt =3D STATIC_TYPE(dev); + mt->unrealization_count++; +} + static void my_dev_class_init(ObjectClass *oc, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); =20 - dc->realize =3D NULL; + dc->realize =3D my_dev_realize; + dc->unrealize =3D my_dev_unrealize; device_class_set_props(dc, my_dev_props); } =20 @@ -41,6 +60,25 @@ static const TypeInfo my_dev_type_info =3D { .class_init =3D my_dev_class_init, }; =20 +static void reentrant_realization_realize(DeviceState *dev, Error **errp) +{ + g_assert_false(qdev_realize(dev, NULL, NULL)); +} + +static void reentrant_realization_class_init(ObjectClass *oc, const void *= data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + + dc->realize =3D reentrant_realization_realize; +} + +static const TypeInfo reentrant_realization_type_info =3D { + .name =3D TYPE_REENTRANT_REALIZATION, + .parent =3D TYPE_DEVICE, + .instance_size =3D sizeof(DeviceState), + .class_init =3D reentrant_realization_class_init, +}; + /* * Initialize a fake machine, being prepared for future tests. * @@ -82,8 +120,64 @@ static void test_qdev_double_realization(void) { MyDev *mt =3D STATIC_TYPE(object_new(TYPE_MY_DEV)); =20 + g_assert_cmpint(mt->realization_count, =3D=3D, 0); qdev_realize(DEVICE(mt), NULL, &error_fatal); + g_assert_cmpint(mt->realization_count, =3D=3D, 1); + qdev_realize(DEVICE(mt), NULL, &error_fatal); + g_assert_cmpint(mt->realization_count, =3D=3D, 1); + object_unparent(OBJECT(mt)); + object_unref(OBJECT(mt)); +} + +static void test_qdev_realize_after_unrealization(void) +{ + Object *mt =3D object_new(TYPE_MY_DEV); + + qdev_unrealize(DEVICE(mt)); + g_assert_false(qdev_realize(DEVICE(mt), NULL, NULL)); + object_unparent(mt); + object_unref(mt); +} + +static void test_qdev_reentrant_realization(void) +{ + Object *obj =3D object_new(TYPE_REENTRANT_REALIZATION); + + qdev_realize(DEVICE(obj), NULL, &error_fatal); + object_unparent(OBJECT(obj)); + object_unref(obj); +} + +static void test_qdev_retry_realization(void) +{ + MyDev *mt =3D STATIC_TYPE(object_new(TYPE_MY_DEV)); + + error_setg(&mt->realization_err, "error"); + g_assert_false(qdev_realize(DEVICE(mt), NULL, NULL)); + g_assert_false(qdev_realize(DEVICE(mt), NULL, NULL)); + object_unparent(OBJECT(mt)); + object_unref(OBJECT(mt)); +} + +static void test_qdev_unrealize_after_realization(void) +{ + MyDev *mt =3D STATIC_TYPE(object_new(TYPE_MY_DEV)); + qdev_realize(DEVICE(mt), NULL, &error_fatal); + g_assert_cmpint(mt->unrealization_count, =3D=3D, 0); + qdev_unrealize(DEVICE(mt)); + g_assert_cmpint(mt->unrealization_count, =3D=3D, 1); + object_unparent(OBJECT(mt)); + object_unref(OBJECT(mt)); +} + +static void test_qdev_unrealize_without_realization(void) +{ + MyDev *mt =3D STATIC_TYPE(object_new(TYPE_MY_DEV)); + + g_assert_cmpint(mt->unrealization_count, =3D=3D, 0); + qdev_unrealize(DEVICE(mt)); + g_assert_cmpint(mt->unrealization_count, =3D=3D, 0); object_unparent(OBJECT(mt)); object_unref(OBJECT(mt)); } @@ -95,6 +189,7 @@ int main(int argc, char **argv) =20 module_call_init(MODULE_INIT_QOM); type_register_static(&my_dev_type_info); + type_register_static(&reentrant_realization_type_info); test_init_machine(); =20 g_test_add_func("/qdev/free-properties", @@ -103,6 +198,21 @@ int main(int argc, char **argv) g_test_add_func("/qdev/double-realization", test_qdev_double_realization); =20 + g_test_add_func("/qdev/realize-after-unrealization", + test_qdev_realize_after_unrealization); + + g_test_add_func("/qdev/reentrant-realization", + test_qdev_reentrant_realization); + + g_test_add_func("/qdev/retry-realization", + test_qdev_retry_realization); + + g_test_add_func("/qdev/unrealize-after-realization", + test_qdev_unrealize_after_realization); + + g_test_add_func("/qdev/unrealize-without-realization", + test_qdev_unrealize_without_realization); + g_test_run(); =20 return 0; --=20 2.55.0