From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175670717439691.0155060204014; Sun, 31 Aug 2025 23:12:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxmB-0001CF-5r; Mon, 01 Sep 2025 02:12:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxld-0000nW-VU; Mon, 01 Sep 2025 02:11:51 -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 1usxlU-0002Z9-0o; Mon, 01 Sep 2025 02:11:49 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAV076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:24 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=KWZuHmR5Opr2FHdoc3YFYaIEvZvc0eLGVYohiqlmGQE=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707025; v=1; b=tjuUATsJbyfXaiqKgI4WZ7NFV3ZDDJA7dz9dZQRaZHLaDRCpj7qPSlu9nSnF5UH4 VXmpfnSnvwrNGfcq7Aqdf67eAOCpAPvpIqQwBupNk8gs/+2Am8C9vgYbtTfQp+GV J+GGPZYgFByYLcQ25Ih6Mg3mHyJQqMtLsvtS0gDIHfKftrM6EKHjsfUE/ZMWJHYH +B/o/zIJxaowQGpV9rOHrjHcT3GgftD1d3N9aIqbjg3dqW10cXmL27Io8BWBS2/y Qr1nDk1etywoJuUSKZIzNMypYpqsmIsvBdGWVryHdr0zmTLO8IDjGkKefNKpu26j QZBTGUOxaN9sj3ENASOHrA== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:09:59 +0900 Subject: [PATCH 01/16] docs/devel: Do not unparent in instance_finalize MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-1-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707178505116600 Children are automatically unparented so manually unparenting is unnecessary. Worse, automatic unparenting happens before the insntance_finalize callback of the parent gets called, so object_unparent() calls in the callback will refer to objects that are already unparented, which is semantically incorrect. Remove the instruction to call object_unparent(), and the exception of the "do not call object_unparent()" rule for instance_finalize. Signed-off-by: Akihiko Odaki --- docs/devel/memory.rst | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/devel/memory.rst b/docs/devel/memory.rst index 57fb2aec76e066236d33efe1033d2e73c7f7c295..749f11d8a4ddc80f2d44b66fa41= fb12c0fa54006 100644 --- a/docs/devel/memory.rst +++ b/docs/devel/memory.rst @@ -161,18 +161,11 @@ or never. Destruction of a memory region happens automatically when the owner object dies. =20 -If however the memory region is part of a dynamically allocated data -structure, you should call object_unparent() to destroy the memory region -before the data structure is freed. For an example see VFIOMSIXInfo -and VFIOQuirk in hw/vfio/pci.c. - You must not destroy a memory region as long as it may be in use by a device or CPU. In order to do this, as a general rule do not create or -destroy memory regions dynamically during a device's lifetime, and only -call object_unparent() in the memory region owner's instance_finalize -callback. The dynamically allocated data structure that contains the -memory region then should obviously be freed in the instance_finalize -callback as well. +destroy memory regions dynamically during a device's lifetime. +The dynamically allocated data structure that contains the +memory region should be freed in the instance_finalize callback. =20 If you break this rule, the following situation can happen: =20 @@ -198,9 +191,9 @@ this exception is rarely necessary, and therefore it is= discouraged, but nevertheless it is used in a few places. =20 For regions that "have no owner" (NULL is passed at creation time), the -machine object is actually used as the owner. Since instance_finalize is -never called for the machine object, you must never call object_unparent -on regions that have no owner, unless they are aliases or containers. +machine object is actually used as the owner. You must never call +object_unparent on regions that have no owner, unless they are aliases +or containers. =20 =20 Overlapping regions and priority --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707446499103.31317554250643; Sun, 31 Aug 2025 23:17:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxqc-0001aJ-WC; Mon, 01 Sep 2025 02:16:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxq8-0000hX-Bi; Mon, 01 Sep 2025 02:16:29 -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 1usxq5-0003Z5-AX; Mon, 01 Sep 2025 02:16:28 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAW076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:25 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=mh1rQxxaQRm6volubP/55MFePhXgAS5EUt21ThmJ2tU=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707025; v=1; b=hMHoFeRWDbGazxtjcsfIR+tfqmOYR7EBnchyPhrjiGRZOzf+OKyzR5s2OtcZtogX PFuFvrnPPdTeo4HEojkdUPEXe0hKSXQHKzBxEQ7NlZ1IXx15ghzS+y7oUH/Rhrab AcKQoRG92oRX21QjGuH5WxRcqybfwMOc46jhITyJC5/Iy4WC5Qgp76OY/rH1NEeO q3EV4S0IjYB7PhCMJ+FauowJ0QpiPUfLGObvqv6ZBaZoMtbdwDj1D8BYF0EXzshj BwqA7YqZuWBmFx9ZQDGt9aiuG+y09fwwkiogEI43DPdQXv/v9YC9kGRoV2HduDUq X+PPf9VrRUC/uaTXw9Lwvg== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:00 +0900 Subject: [PATCH 02/16] vfio/pci: Do not unparent in instance_finalize MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-2-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707448738124100 This reflects a recent change of: docs/devel/memory.rst Signed-off-by: Akihiko Odaki --- hw/vfio/pci.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 07257d0fa049b09fc296ac2279a6fafbdf93d277..2e909c190f86a722e1022fa7c45= a96d2dde8d58e 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -2000,7 +2000,6 @@ static void vfio_bars_finalize(VFIOPCIDevice *vdev) vfio_region_finalize(&bar->region); if (bar->mr) { assert(bar->size); - object_unparent(OBJECT(bar->mr)); g_free(bar->mr); bar->mr =3D NULL; } @@ -2008,9 +2007,6 @@ static void vfio_bars_finalize(VFIOPCIDevice *vdev) =20 if (vdev->vga) { vfio_vga_quirk_finalize(vdev); - for (i =3D 0; i < ARRAY_SIZE(vdev->vga->region); i++) { - object_unparent(OBJECT(&vdev->vga->region[i].mem)); - } g_free(vdev->vga); } } --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707264365981.5178265620283; Sun, 31 Aug 2025 23:14:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxm0-0000vh-82; Mon, 01 Sep 2025 02:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlb-0000me-QI; Mon, 01 Sep 2025 02:11:49 -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 1usxlU-0002Yu-0q; Mon, 01 Sep 2025 02:11:47 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAX076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:25 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=Jqr8P+bWn9/t6f+kXj3iAqWRCxcJIhzvpyYZplXrOeo=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707025; v=1; b=rss782Ak4QRV616rnZzznzDZ+KU1TyzWzJtyB347whZIJHUDP1UdBB+ptHsz7FAJ 0CLMJ1Z2n4YNqKuH+664JZEMPV+i05L2PMBMT394cpHTi7fyeXqjC1ZVOu97jSea QMocdpjhM7j3ZHHdprv4tnZ9z8Gf7vthwZRUd179+CLQ0ivgEzZf1nxsdV2tQWqK aAmCTXzjd0SD5qWRlra8LPomKeqxQLd51WU9k9gmgrmLNDWECY4oI24XHwpjeDFG D/X7zDI3UEKk/19Or2pP1cWT2IvcArUG0TlyZBuJZY6eeA0MeifbljvPpwRxlmOK xVOWiNP9rgL922zfYmviqQ== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:01 +0900 Subject: [PATCH 03/16] qdev: Automatically delete memory subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-3-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707266834116600 A common pattern is that to delete memory subregions during realization error handling and unrealization. pci automatically automatically deletes the IO subregions, but the pattern is manually implemented in other places, which is tedious and error-prone. Implement the logic to delete subregions in qdev to cover all devices. Signed-off-by: Akihiko Odaki --- include/hw/qdev-core.h | 2 ++ hw/core/qdev.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 530f3da70218df59da72dc7a975dca8265600e00..c2582a4d59b38152a00d0663514= 92c2e2ae0718f 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -226,6 +226,7 @@ typedef QLIST_HEAD(, BusState) BusStateHead; struct DeviceState { /* private: */ Object parent_obj; + /* public: */ =20 /** @@ -526,6 +527,7 @@ bool qdev_realize_and_unref(DeviceState *dev, BusState = *bus, Error **errp); * - unrealize any child buses by calling qbus_unrealize() * (this will recursively unrealize any devices on those buses) * - call the unrealize method of @dev + * - remove @dev from memory * * The device can then be freed by causing its reference count to go * to zero. diff --git a/hw/core/qdev.c b/hw/core/qdev.c index f600226176871361d7ff3875f5d06bd4e614be6e..8fdf6774f87ec8424348e8c9652= dc4c99a2faeb5 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -451,6 +451,17 @@ static bool check_only_migratable(Object *obj, Error *= *errp) return true; } =20 +static int del_memory_region(Object *child, void *opaque) +{ + MemoryRegion *mr =3D (MemoryRegion *)object_dynamic_cast(child, TYPE_M= EMORY_REGION); + + if (mr && mr->container) { + memory_region_del_subregion(mr->container, mr); + } + + return 0; +} + static void device_set_realized(Object *obj, bool value, Error **errp) { DeviceState *dev =3D DEVICE(obj); @@ -582,6 +593,7 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) if (dc->unrealize) { dc->unrealize(dev); } + object_child_foreach(OBJECT(dev), del_memory_region, NULL); dev->pending_deleted_event =3D true; DEVICE_LISTENER_CALL(unrealize, Reverse, dev); } @@ -606,6 +618,8 @@ post_realize_fail: } =20 fail: + object_child_foreach(OBJECT(dev), del_memory_region, NULL); + error_propagate(errp, local_err); if (unattached_parent) { /* --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707145754951.6494032037045; Sun, 31 Aug 2025 23:12:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxln-0000sx-26; Mon, 01 Sep 2025 02:11:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlb-0000ma-OQ; Mon, 01 Sep 2025 02:11:49 -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 1usxlU-0002Yo-Hd; Mon, 01 Sep 2025 02:11:45 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAY076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:26 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=C011D3nEi4gnvkKvq30wWt2rhwDFSibnUsxSm7LxoTk=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707026; v=1; b=CAEusT5y0bOiKbVw3q4ZjWEq90nxtfCC7lzVg4XydDe66LXoS3+44DWc6snn+DRG jmgcMA/qUq3HcUYZ29OxczTsE221CLxhXELhKUJEfLrQuoZWuOiGRYyjHfJAs2g6 dJY1ZgV8EDpk3APAPKlk4bfHIKRM5z716J7boYkPo6mT2HffyBD4ZfPJQQYwTVgG aZ2EORdks/x7LT440u09yPT7g+5isPXyY1IHJbb2PB2Bu6zCacSpQm/sL6pM4A90 /9A3pEL348HXhCGWgAxStzaSfJkeS/4k7YwujDsaRxnyrNxScsa8jsAvrU/LpXvD TMRC4M7VItFyaRNrrBiYZg== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:02 +0900 Subject: [PATCH 04/16] hw/char/diva-gsp: Do not delete the subregion MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-4-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707150443124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/char/diva-gsp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/char/diva-gsp.c b/hw/char/diva-gsp.c index e1f0713cb794d0442c56935dfe56d784d96949f0..1ae472e879b53555d4751b6a484= 8354f81c27fee 100644 --- a/hw/char/diva-gsp.c +++ b/hw/char/diva-gsp.c @@ -63,7 +63,6 @@ static void diva_pci_exit(PCIDevice *dev) for (i =3D 0; i < pci->ports; i++) { s =3D pci->state + i; qdev_unrealize(DEVICE(s)); - memory_region_del_subregion(&pci->membar, &s->io); g_free(pci->name[i]); } qemu_free_irqs(pci->irqs, pci->ports); --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707175591611.2480732761207; Sun, 31 Aug 2025 23:12:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxlk-0000r5-CV; Mon, 01 Sep 2025 02:11:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlY-0000lb-Ud; Mon, 01 Sep 2025 02:11:45 -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 1usxlT-0002Yq-Ik; Mon, 01 Sep 2025 02:11:42 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAZ076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:26 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=yVddGPFKHGH7ywDN+5LX7u8IS3es11FFm1EZQqc1z24=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707026; v=1; b=H9NTIrmwAe0UW9Uooyiq6xPk8zIPc5sgks810/ELOGDrLQMkYrABbsw9fvhhGsIy 3rcBLQqUF3iJFOvQ+ve3updYTXOdWDbrD6kKX6rBojXnITpxsmvovuwOhXdV+as2 2HXikpMjgsMTl6DiT1/VEWlA4CRAQTAUYqze6dMnB1cBV0FTsATomNZLvh7+9CEV KzFppy6+jeMPwG2irBoJ9j3Dfwgx1AuIs84ibf6InIPSsEB+yOmZYq4tCG1SFLYg P/CehvqT2ugBPfzuGhUUFRg+N5/AfpHTL0oFNHQOcwd0QDWVXRparxxXkgWh7vhD GijqJAWQ7el5WEFChagxGw== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:03 +0900 Subject: [PATCH 05/16] hw/char/serial-pci-multi: Do not delete the subregion MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-5-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707177740124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/char/serial-pci-multi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 13df272691a64f14ca3597174815653a01fbd381..3132ca90cebfe411cd3333b62ed= 75dd01f501067 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -57,7 +57,6 @@ static void multi_serial_pci_exit(PCIDevice *dev) for (i =3D 0; i < pci->ports; i++) { s =3D pci->state + i; qdev_unrealize(DEVICE(s)); - memory_region_del_subregion(&pci->iobar, &s->io); g_free(pci->name[i]); } } --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707146143320.82439703807245; Sun, 31 Aug 2025 23:12:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxli-0000oB-PX; Mon, 01 Sep 2025 02:11:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlY-0000la-Un; Mon, 01 Sep 2025 02:11:45 -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 1usxlS-0002Z0-U5; Mon, 01 Sep 2025 02:11:43 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAa076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:26 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=kn8Bqoxi+tjKwwRXg2cZTs8dYOv2Ly9ES2G+ar9juS0=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707027; v=1; b=Y3kcLJ5oTnSlfTdMd3rOLQN2cfelr/S84HOh0mrETvGvKTv/Q5EyaXsuJP8WbWP2 io+vp/5ShC9Lj6NdIhfU9kDwE79ChBpMJtGarCnP0efdZeKU+ve6dCsUm3K9MebZ LbiykgsKIewOozoW+ddKNdk4N+vAaVMXziEFZtm4aeD+AvepiEQq6OLh/jQpF+5G hCjb2JeA/nemUb+Vv5iaKbEIyddmee/YDm3gSFDsE/JZ45zed0p/MhsydrORXYhP NDim3u3te/Pa5AEXXO1NafqQ0Eifm0emL3KsOyKyALc1G/+cGSe4zy7UNzP/QRO9 zyUx+E7GdcXPDjDQYHBEHQ== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:04 +0900 Subject: [PATCH 06/16] secondary-vga: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-6-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707150441124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/display/vga-pci.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index b81f7fd2d0fd11913e6b132897028ca490e74b95..90b4545d382135b109e3bbc880b= b8fe1a4fc5275 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -307,14 +307,6 @@ static void pci_secondary_vga_exit(PCIDevice *dev) VGACommonState *s =3D &d->vga; =20 graphic_console_close(s->con); - memory_region_del_subregion(&d->mmio, &d->mrs[0]); - memory_region_del_subregion(&d->mmio, &d->mrs[1]); - if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_QEXT)) { - memory_region_del_subregion(&d->mmio, &d->mrs[2]); - } - if (d->flags & (1 << PCI_VGA_FLAG_ENABLE_EDID)) { - memory_region_del_subregion(&d->mmio, &d->mrs[3]); - } } =20 static void pci_secondary_vga_init(Object *obj) --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707329038810.764715889441; Sun, 31 Aug 2025 23:15:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxmA-00019b-5h; Mon, 01 Sep 2025 02:12:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlb-0000mb-OR; Mon, 01 Sep 2025 02:11:49 -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 1usxlU-0002Yt-I8; Mon, 01 Sep 2025 02:11:47 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAb076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:27 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=Ku5gTVgI2eFOcSa5Fx00WOVlDLfLzBXwYcYASIz2wj0=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707027; v=1; b=Z6Bcu1P7d+ZrM03RcSjRgid/vQE1l/yJ7pBdCfGJDAaRxt+87XZzhaaSDk0y9iJF RD7lAX1xp3J5sbjc5oxIyTdb3OYXgf4mXkVHbdeSSo4a8FEZVizdoyJm/Qnubi4N DLqt3fqsRIKakUdNZjn1mZ0EWFn9FxipBHeEEJKmaYiVKFTQavZnLZKcR9pekSEi mFjIV5S+cv/FJDO+d2eDoujDLpmXQuLZWCA/lBrbZMcH2xAs5SyxTFEJx8N9l4LR Y/nmt/SkdBcvYijb7eKMMD4twZsqoRTTSJjI0lupCODfkjiCcQl2Q2PHGWgBWas9 pxvtpIF42WR+92kikHEQOg== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:05 +0900 Subject: [PATCH 07/16] cmd646: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-7-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707331322124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/ide/cmd646.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index 2a59516a9ddbc0a7d40400f521b9cef07006b76a..ea4d501c5e40b0f7f5fcd5c025c= 113d97d89f5b7 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -302,17 +302,6 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Err= or **errp) } } =20 -static void pci_cmd646_ide_exitfn(PCIDevice *dev) -{ - PCIIDEState *d =3D PCI_IDE(dev); - unsigned i; - - for (i =3D 0; i < 2; ++i) { - memory_region_del_subregion(&d->bmdma_bar, &d->bmdma[i].extra_io); - memory_region_del_subregion(&d->bmdma_bar, &d->bmdma[i].addr_iopor= t); - } -} - static const Property cmd646_ide_properties[] =3D { DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0), }; @@ -325,7 +314,6 @@ static void cmd646_ide_class_init(ObjectClass *klass, c= onst void *data) device_class_set_legacy_reset(dc, cmd646_reset); dc->vmsd =3D &vmstate_ide_pci; k->realize =3D pci_cmd646_ide_realize; - k->exit =3D pci_cmd646_ide_exitfn; k->vendor_id =3D PCI_VENDOR_ID_CMD; k->device_id =3D PCI_DEVICE_ID_CMD_646; k->revision =3D 0x07; --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707325799997.1191968301616; Sun, 31 Aug 2025 23:15:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxmQ-0001dd-NI; Mon, 01 Sep 2025 02:12:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxmO-0001a7-Qi; Mon, 01 Sep 2025 02:12:36 -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 1usxmM-0002nd-Ev; Mon, 01 Sep 2025 02:12:36 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAc076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:27 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=AMIrLUwGb20DCX2QJ9sI6hzRgdwLBWo6KaejLtXVMas=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707028; v=1; b=EPI5e3H6ZCbxa4uEPZrmDdhwQ7j+w6vubkdzRJmkMWhPjRxAmOZ6ZUDW26roWf1i wU5k8EadpCQqLPdHVGxnjY41PKZKVFqt5+/8smjv77HDCLPYeQvnedfVvPvcxjzO 1iT/MqaCFH3rq5dBrdtNpEav4WUpNjjNkUefyTC90x7Es+loJyv36DcZXffpEpK6 ERAQRf9ddzHONcNRSCtFqaSL+Cq6JHSJ1uRovNYDDFSEEB9VtTK/5ltb6VmHr9Qv PyVSq+iNLB8kqmLatAcRVDKZNNIFPtyD5ydNT9UqAKQKDqwlOF3NWHgYhNx+hW2W eYIg6mYjlQ1YWmEe2u4gCw== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:06 +0900 Subject: [PATCH 08/16] hw/ide/piix: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-8-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707327342116600 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/ide/piix.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/hw/ide/piix.c b/hw/ide/piix.c index a0f2709c6973420b9e07fc5cc3fa1ef12a8e3d42..138f8e1936b448cb9185018ba57= 44d3c5445abd9 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -166,17 +166,6 @@ static void pci_piix_ide_realize(PCIDevice *dev, Error= **errp) } } =20 -static void pci_piix_ide_exitfn(PCIDevice *dev) -{ - PCIIDEState *d =3D PCI_IDE(dev); - unsigned i; - - for (i =3D 0; i < 2; ++i) { - memory_region_del_subregion(&d->bmdma_bar, &d->bmdma[i].extra_io); - memory_region_del_subregion(&d->bmdma_bar, &d->bmdma[i].addr_iopor= t); - } -} - /* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */ static void piix3_ide_class_init(ObjectClass *klass, const void *data) { @@ -186,7 +175,6 @@ static void piix3_ide_class_init(ObjectClass *klass, co= nst void *data) device_class_set_legacy_reset(dc, piix_ide_reset); dc->vmsd =3D &vmstate_ide_pci; k->realize =3D pci_piix_ide_realize; - k->exit =3D pci_piix_ide_exitfn; k->vendor_id =3D PCI_VENDOR_ID_INTEL; k->device_id =3D PCI_DEVICE_ID_INTEL_82371SB_1; k->class_id =3D PCI_CLASS_STORAGE_IDE; @@ -209,7 +197,6 @@ static void piix4_ide_class_init(ObjectClass *klass, co= nst void *data) device_class_set_legacy_reset(dc, piix_ide_reset); dc->vmsd =3D &vmstate_ide_pci; k->realize =3D pci_piix_ide_realize; - k->exit =3D pci_piix_ide_exitfn; k->vendor_id =3D PCI_VENDOR_ID_INTEL; k->device_id =3D PCI_DEVICE_ID_INTEL_82371AB; k->class_id =3D PCI_CLASS_STORAGE_IDE; --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707319026281.95262052627527; Sun, 31 Aug 2025 23:15:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxm8-00017h-ER; Mon, 01 Sep 2025 02:12:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlZ-0000lm-Oz; Mon, 01 Sep 2025 02:11:47 -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 1usxlU-0002Ys-0n; Mon, 01 Sep 2025 02:11:45 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAd076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:28 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=Sc8FTNaJ6chbtPcBo7M9g5GEXppq2W5QBLE99E5rkoE=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707028; v=1; b=Pbi0lDfE7A6QEs5U3QZixHoK2FBzYhrtiB8IWa78gxsErNovnbhCPfaFhDAL1NF4 gHEWOdaaQCXoJn0KpoGVSk49wZx+GbdzC1Ac7xHySR6YFOYP4ciRzNc0YQxpvovh UNWBDXnPWujcvxmjL0jQRi0LOZj9JxTph42k7OnLekHohLWj/VUyzNQeX0bqc2II hJOSDqgGfAqcACw6p0YTMN2r6VBriJ87cZNqbdZFlDj/CDfO08kSc8a3pwX2EEEi DCupjMHmxrP84dK0K0vmEt3oQ/RKQfx3CYZJ7Kvqa3ocWBJHrmRY4SZA2wzzz+Cu VDiu1jmncN0/uWZCACVXlg== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:07 +0900 Subject: [PATCH 09/16] hw/ide/via: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-9-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707319275116600 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/ide/via.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/hw/ide/via.c b/hw/ide/via.c index dedc2674c002f9de8894e6c49cdb3989cb0deccc..cbaf4ad1548b94afa1480993072= 9eba169f1b061 100644 --- a/hw/ide/via.c +++ b/hw/ide/via.c @@ -234,17 +234,6 @@ static void via_ide_realize(PCIDevice *dev, Error **er= rp) } } =20 -static void via_ide_exitfn(PCIDevice *dev) -{ - PCIIDEState *d =3D PCI_IDE(dev); - unsigned i; - - for (i =3D 0; i < ARRAY_SIZE(d->bmdma); ++i) { - memory_region_del_subregion(&d->bmdma_bar, &d->bmdma[i].extra_io); - memory_region_del_subregion(&d->bmdma_bar, &d->bmdma[i].addr_iopor= t); - } -} - static void via_ide_class_init(ObjectClass *klass, const void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -258,7 +247,6 @@ static void via_ide_class_init(ObjectClass *klass, cons= t void *data) k->config_read =3D via_ide_cfg_read; k->config_write =3D via_ide_cfg_write; k->realize =3D via_ide_realize; - k->exit =3D via_ide_exitfn; k->vendor_id =3D PCI_VENDOR_ID_VIA; k->device_id =3D PCI_DEVICE_ID_VIA_IDE; k->revision =3D 0x06; --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707546356814.1708243467308; Sun, 31 Aug 2025 23:19:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxsZ-0003vR-F6; Mon, 01 Sep 2025 02:18:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxr9-0002OB-Qv; Mon, 01 Sep 2025 02:17:37 -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 1usxr6-0003gt-It; Mon, 01 Sep 2025 02:17:31 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAe076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:28 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=A2GlR2TJmK/k+sr8q7+ruESRjTfRwEx+idAZUzdfRKY=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707028; v=1; b=ajmKJyuOHXz/1WIHwFjM5C+8kywLbx3NNxg9J+77ihbjwNxHDxZXsY+HE/4MCp3h KbNNUkSs11QMXKnIxyr9NOfrVzwcVHEFlKaaXZEBHQFmvazLFWWR/pI4QlLUck++ JqqHbg+YmL/avpCmTNwOHM0PagdWBV6O9dbNwo2D8zBgvIC9BdRGPI7MnNdlS8we KehUU0AhaZknJU/QX4wSZ5QX6F20ywZau/T/YPr78zTWL4a6bNaLwRgrlkGM82eX 8WsRXWj2BntN5SzoEazMQ6m23h/s04IP4NkOmBJuaMADBMXou+G4e26GIgCcw29A ZwprSyqb67Cazki2/2QjjA== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:08 +0900 Subject: [PATCH 10/16] hw/nvme: Do not delete the subregion MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-10-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707548023124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/nvme/ctrl.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index f5ee6bf260f159249204571a366472f3e0d16dea..eebce1f787f464978f535356533= 294c5a0c7bea8 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -9058,8 +9058,6 @@ static void nvme_exit(PCIDevice *pci_dev) } else { msix_uninit(pci_dev, &n->bar0, &n->bar0); } - - memory_region_del_subregion(&n->bar0, &n->iomem); } =20 static const Property nvme_props[] =3D { --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707205488264.68276441564933; Sun, 31 Aug 2025 23:13:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxmS-0001gP-S5; Mon, 01 Sep 2025 02:12:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxmQ-0001dm-V3; Mon, 01 Sep 2025 02:12:38 -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 1usxmO-0002oG-Rv; Mon, 01 Sep 2025 02:12:38 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAf076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:28 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=a9y4Uz2vRhIfhworOPPwHJGJ+Fl7vXHFoarWH13fJvM=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707029; v=1; b=n3WBRCVPtkQGMlsdzqb5PJ7kTAIaadyC6RQEetatvpyFPkBNiO2aj3ougFWQyrlb 4hPz0yxNfS19H4CCyYccfIoNEXaBmGcb5G6d2p4aTkvRWZbT3rnFQPyH6OW02Nj9 LZBLzZitg+LEFozQsL3U6rY8Y7CD1fXZlkN/OhDjkCdRPgm6JJ0bK+P+ppsZw2rO GPgYfm8PPJmtUK/Y3Kwjgp+/PPiGJd+CvCDEFKc7xBXai9vdzDRjrEnJiUnf4WBE pcc1r2XDIByHKWAjtnWcjq59SFSirpE6JR0D7GL+tfoCVWOt39CMamH1by34fZ+p yebK5Z3YN1uGAhg57H6LIQ== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:09 +0900 Subject: [PATCH 11/16] pci: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-11-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707208047124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/pci/pci.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index c70b5ceebaf1f2b10768bd030526cbb518da2b8d..1dd577ca20ab204b5f38469c801= e421398660718 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1188,10 +1188,6 @@ static void do_pci_unregister_device(PCIDevice *pci_= dev) if (xen_mode =3D=3D XEN_EMULATE) { xen_evtchn_remove_pci_device(pci_dev); } - if (memory_region_is_mapped(&pci_dev->bus_master_enable_region)) { - memory_region_del_subregion(&pci_dev->bus_master_container_region, - &pci_dev->bus_master_enable_region); - } address_space_destroy(&pci_dev->bus_master_as); } =20 @@ -1417,27 +1413,11 @@ static PCIDevice *do_pci_register_device(PCIDevice = *pci_dev, return pci_dev; } =20 -static void pci_unregister_io_regions(PCIDevice *pci_dev) -{ - PCIIORegion *r; - int i; - - for(i =3D 0; i < PCI_NUM_REGIONS; i++) { - r =3D &pci_dev->io_regions[i]; - if (!r->size || r->addr =3D=3D PCI_BAR_UNMAPPED) - continue; - memory_region_del_subregion(r->address_space, r->memory); - } - - pci_unregister_vga(pci_dev); -} - static void pci_qdev_unrealize(DeviceState *dev) { PCIDevice *pci_dev =3D PCI_DEVICE(dev); PCIDeviceClass *pc =3D PCI_DEVICE_GET_CLASS(pci_dev); =20 - pci_unregister_io_regions(pci_dev); pci_del_option_rom(pci_dev); pcie_sriov_unregister_device(pci_dev); =20 --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707205571277.3702293459579; Sun, 31 Aug 2025 23:13:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxmG-0001Mq-BB; Mon, 01 Sep 2025 02:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlm-0000tK-TW; Mon, 01 Sep 2025 02:11:59 -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 1usxlk-0002ds-PZ; Mon, 01 Sep 2025 02:11:58 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAg076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:29 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=Qvj4+hZAXQ+HATM7aKOWvKVpmlqyAC4ni6CowomDhZk=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707029; v=1; b=DVy8vPnfeINZkIJXqVRqPN+8TliAxFg0TVUxOxnacYy2TjRwZqgdgP2H2urTuZ5+ X6thdD2ZmYuL8ZNS1iZ7xnf4+8xadjxZr4vCE696+qBoFdeH6GvqQ1/e8FKrx1VD b7KXdoZRs6VsiRHY/IQWkkowGwZuQCDLBrStjM5pEmsnHaW1/uE3okYAbhsJG82N gdlXUdEAIvHcJa/AvZYv1cVPS9r1RRW8RFT3/hic3YbLeA6vNveftqvlErJeqTlw PJWpg6I5PYMxdnjRxJ5CVCNo17XV66UO1BXAZFiCSgpbxWAV/LgbNi35R/UWiWch /0tuInix7dN49goOgrgEpg== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:10 +0900 Subject: [PATCH 12/16] hw/ppc/spapr_pci: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-12-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707208141116600 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/ppc/spapr_pci.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 1ac1185825e84ca908fd878f6cbe7e8cacac1d89..b4043ee752c5f9ab2c0f5800dff= a809d3c182225 100644 --- a/hw/ppc/spapr_pci.c +++ b/hw/ppc/spapr_pci.c @@ -1735,27 +1735,13 @@ static void spapr_phb_unrealize(DeviceState *dev) SysBusDevice *s =3D SYS_BUS_DEVICE(dev); PCIHostState *phb =3D PCI_HOST_BRIDGE(s); SpaprPhbState *sphb =3D SPAPR_PCI_HOST_BRIDGE(phb); - SpaprTceTable *tcet; int i; - const unsigned windows_supported =3D spapr_phb_windows_supported(sphb); =20 if (sphb->msi) { g_hash_table_unref(sphb->msi); sphb->msi =3D NULL; } =20 - /* - * Remove IO/MMIO subregions and aliases, rest should get cleaned - * via PHB's unrealize->object_finalize - */ - for (i =3D windows_supported - 1; i >=3D 0; i--) { - tcet =3D spapr_tce_find_by_liobn(sphb->dma_liobn[i]); - if (tcet) { - memory_region_del_subregion(&sphb->iommu_root, - spapr_tce_get_iommu(tcet)); - } - } - remove_drcs(sphb, phb->bus); =20 for (i =3D PCI_NUM_PINS - 1; i >=3D 0; i--) { @@ -1767,8 +1753,6 @@ static void spapr_phb_unrealize(DeviceState *dev) =20 QLIST_REMOVE(sphb, list); =20 - memory_region_del_subregion(&sphb->iommu_root, &sphb->msiwindow); - /* * An attached PCI device may have memory listeners, eg. VFIO PCI. We = have * unmapped all sections. Remove the listeners now, before destroying = the @@ -1779,12 +1763,6 @@ static void spapr_phb_unrealize(DeviceState *dev) =20 qbus_set_hotplug_handler(BUS(phb->bus), NULL); pci_unregister_root_bus(phb->bus); - - memory_region_del_subregion(get_system_memory(), &sphb->iowindow); - if (sphb->mem64_win_pciaddr !=3D (hwaddr)-1) { - memory_region_del_subregion(get_system_memory(), &sphb->mem64windo= w); - } - memory_region_del_subregion(get_system_memory(), &sphb->mem32window); } =20 static void spapr_phb_destroy_msi(gpointer opaque) --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707537222312.0642564363558; Sun, 31 Aug 2025 23:18:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxs7-0003Er-Je; Mon, 01 Sep 2025 02:18:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxrQ-0002ag-JL; Mon, 01 Sep 2025 02:17:52 -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 1usxrI-0003hq-5v; Mon, 01 Sep 2025 02:17:46 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAh076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:29 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=YjEOA88OVLGi9vWo20mvtb9700xqRArT+mSkxNVX9R4=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707030; v=1; b=dQZa4RMKkqR5iuP1dJkn4ANuFG6iNqeC9em74t0QiFkh38Q04mhhs9uVVz83xTbx fd1lCIasYxFx6uxMtFUiiUCLqcrg2omA5kJZqs+us1C/6Ekct4IfLjfDvbAaeuLV /weFbMWXZEbVflX3Izx4Ima347TDxhmUm7Ds2yUyPudSddLjQ15UzndsY//Ygaaq Blbte97cJNYq3V41HE3KN7Er0S2o87o0p6CEJ3y7Iqede2/GxKE8fuVWll95MXzY XGu44NbgzTBmWSxsw/rF4U6Yd4hqnJ5ngBiGMxWI53egBPiXYC8sw8sy4/L5uTfP lDWu4QU4PmGR3mGt0C+tIg== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:11 +0900 Subject: [PATCH 13/16] hw/usb/hcd-ehci: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-13-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707537930116600 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/usb/hcd-ehci.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index b090f253656ba17c7c6b3b805235a9360334baf5..21c3501455b5705b5e155acf9df= 2156b653f69bf 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -2557,10 +2557,6 @@ void usb_ehci_unrealize(EHCIState *s, DeviceState *d= ev) ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); =20 - memory_region_del_subregion(&s->mem, &s->mem_caps); - memory_region_del_subregion(&s->mem, &s->mem_opreg); - memory_region_del_subregion(&s->mem, &s->mem_ports); - usb_bus_release(&s->bus); =20 if (s->vmstate) { --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707156077694.5751617082308; Sun, 31 Aug 2025 23:12:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxm5-00013r-Qm; Mon, 01 Sep 2025 02:12:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlb-0000mc-OV; Mon, 01 Sep 2025 02:11:49 -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 1usxlU-0002Yp-0p; Mon, 01 Sep 2025 02:11:47 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAi076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:30 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=mKUX+37+W6DCHXaSHKP3HQpAh7aEXoOw1LuL7ABZjxU=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707030; v=1; b=m69qb5TmXNwJGkbuvdQmp9EO2QhjywesNDDoBKi1YQA0736hO4HHw0jibTwrlltq CAknF1nURy59h1cA/6zw2n6iJ02XsKdkdvEPQTOD0M6l8p4nBj+IyJMR4V/RaDyc G1gjnkJaun+CQcb4OmUQ9sQqozoq1Rq20hUbbHHClZUMC5fjJv5IEu+5Dw/jhTQf EkkBU3jjWLKosC0uW/bduh0d/zNpj6ycFHX+4G13uIb9nkcRDZNtiNWXJU+SiGKA Ym28iXfsehNCuTL7RQ4+Zk+fB8H80+97ePWDRCeg/mT+YwmoNYfRKXV32yLFu39Y eoqLO6r0Ibv4FG5qRRKBTQ== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:12 +0900 Subject: [PATCH 14/16] hw/usb/hcd-xhci: Do not delete the subregions MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-14-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707157614124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/usb/hcd-xhci.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 292c378bfc98bf458f7f760cdb6f1f21f23a7633..b68a2aec317107ec36736f762b9= dccd71b53dc3e 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -3454,16 +3454,6 @@ static void usb_xhci_unrealize(DeviceState *dev) xhci->mfwrap_timer =3D NULL; } =20 - memory_region_del_subregion(&xhci->mem, &xhci->mem_cap); - memory_region_del_subregion(&xhci->mem, &xhci->mem_oper); - memory_region_del_subregion(&xhci->mem, &xhci->mem_runtime); - memory_region_del_subregion(&xhci->mem, &xhci->mem_doorbell); - - for (i =3D 0; i < xhci->numports; i++) { - XHCIPort *port =3D &xhci->ports[i]; - memory_region_del_subregion(&xhci->mem, &port->mem); - } - usb_bus_release(&xhci->bus); } =20 --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707510602175.91875293483054; Sun, 31 Aug 2025 23:18:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxqY-0001EX-Ce; Mon, 01 Sep 2025 02:16:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxq6-0000ZQ-Sw; Mon, 01 Sep 2025 02:16:27 -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 1usxq4-0003Yj-LR; Mon, 01 Sep 2025 02:16:26 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAj076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:30 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=JRn9IlAuuwcjgZFjdSaO6s+DIIBhc0p+mDtciOTKUsA=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707031; v=1; b=VqVR4H5xOjlCA3t9YXRuwBmcOSH0AOYJ8LficXdOn/GDhIkAwYjv5/4TTZcuphkh 0HIHeJG/lwz4zoo8R2nx6jaTkiZYAy3S6ES76rbsupQzTfgyONIkHKSKSqjW/UAd QNPQ39jlKmYNIcamGGWdzLw7heYgxlgsSz359MWQ3ODehq1zWnAlKkv4V+rZfc0p teVzxQHO12mkA9mfWt8FKIr0OPVyrb8FliiN68z6v4heOWcRYxCJPnOiTDhn+tgk sRuVwnwTM417hO039y32W14CpLBsLV11+SQ36GUNmnpK6RqUUrFqq9Tsm3EhYPiy 891pZhYEuxbMAZEYcj6fXg== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:13 +0900 Subject: [PATCH 15/16] vfio-user: Do not delete the subregion MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-15-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707513677124100 It is no longer necessary. Signed-off-by: Akihiko Odaki --- hw/vfio-user/pci.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c index be71c777291f0c68b01b54029612c4dbc6aa86e2..0b6c6a1c5ed327ec53b119a7999= 76a0823e304c3 100644 --- a/hw/vfio-user/pci.c +++ b/hw/vfio-user/pci.c @@ -73,12 +73,6 @@ static void vfio_user_msix_setup(VFIOPCIDevice *vdev) =20 static void vfio_user_msix_teardown(VFIOPCIDevice *vdev) { - MemoryRegion *mr, *sub; - - mr =3D vdev->bars[vdev->msix->pba_bar].mr; - sub =3D vdev->msix->pba_region; - memory_region_del_subregion(mr, sub); - g_free(vdev->msix->pba_region); vdev->msix->pba_region =3D NULL; } --=20 2.51.0 From nobody Sun Sep 28 15:28:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=reject dis=none) header.from=rsg.ci.i.u-tokyo.ac.jp Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756707291361469.4154355901459; Sun, 31 Aug 2025 23:14:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1usxmE-0001JI-Er; Mon, 01 Sep 2025 02:12:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1usxlc-0000mg-DL; Mon, 01 Sep 2025 02:11:49 -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 1usxlY-0002aX-9O; Mon, 01 Sep 2025 02:11:48 -0400 Received: from h205.csg.ci.i.u-tokyo.ac.jp (h205.csg.ci.i.u-tokyo.ac.jp [133.11.54.205]) (authenticated bits=0) by www3579.sakura.ne.jp (8.16.1/8.16.1) with ESMTPSA id 5816ACAk076640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 1 Sep 2025 15:10:31 +0900 (JST) (envelope-from odaki@rsg.ci.i.u-tokyo.ac.jp) DKIM-Signature: a=rsa-sha256; bh=iGdH8z3BWY4aeVno3WKHTvunvaA5O+8C3rxcrDsvFq4=; c=relaxed/relaxed; d=rsg.ci.i.u-tokyo.ac.jp; h=From:Date:Subject:Message-Id:To; s=rs20250326; t=1756707031; v=1; b=hz2SAbXoQZZT8aXOmqDyWHr13ytqPcjT8zJ8FejEmllqZCELnflCBKUW7WS5HCdU nsdjd+76Z8RO/uqlytEOfDkQAjxJr0JdJtVQnLAdNdKOs/kDDHueyQeLnsVEyJjt 4Ga8xCzehcInGpDBIaJ098lS/Q1M0ORhVOD7Y7dF590xMKGWPh+KtfhgGskOpu8n i9njeWtMgKoLB8NXObF6IbMp/nYOjn3KxKJMj+pMcXu3RwNZDhGMLYwcQPkyPDrF uKshBgiIsc6m4paxGjH9lEBpYiVgKPBI0x0BUhd/RURcDcWpXX5jg8MElr6d/Sil Dz9WnTzl2h2x9bF9HZdkqQ== From: Akihiko Odaki Date: Mon, 01 Sep 2025 15:10:14 +0900 Subject: [PATCH 16/16] memory: Stop piggybacking on memory region owners MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250901-mr-v1-16-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> References: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> In-Reply-To: <20250901-mr-v1-0-dd7cb6b1480b@rsg.ci.i.u-tokyo.ac.jp> To: qemu-devel@nongnu.org Cc: Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Paolo Bonzini , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Eduardo Habkost , Peter Xu , David Hildenbrand , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson , Helge Deller , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Gerd Hoffmann , John Snow , qemu-block@nongnu.org, Keith Busch , Klaus Jensen , Jesper Devantier , Marcel Apfelbaum , Nicholas Piggin , Harsh Prateek Bora , qemu-ppc@nongnu.org, John Levon , Thanos Makatos , Yanan Wang , BALATON Zoltan , Jiaxun Yang , Daniel Henrique Barboza , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy , =?utf-8?q?Alex_Benn=C3=A9e?= , Fabiano Rosas , Thomas Huth , Laurent Vivier , Peter Maydell , Akihiko Odaki X-Mailer: b4 0.14.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=49.212.243.89; envelope-from=odaki@rsg.ci.i.u-tokyo.ac.jp; helo=www3579.sakura.ne.jp X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: 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-ZM-MESSAGEID: 1756707293284116600 MemoryRegions used to "piggyback" on their owners instead of using their own reference counters due to the circular dependencies between them, which caused a few problems. Stop piggybacking, showing that the circular dependencies are actually broken. Problems with piggybacking =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D Piggybacking obscured the fact that a MemoryRegion used memory allocated to its owner, as it didn't take a reference to the owner. It also created another circular reference when an owner referred to its MemoryRegion via memory_region_ref(). This could happen in two scenarios: - A subregion and its container had the same owner. In this case, the container would use memory_region_ref() to take a reference to the subregion. - An owner called address_space_map() with a guest-controlled address that points back to its MemoryRegion. This scenario is similar to what MemReentrancyGuard handles. Avoiding such a circular reference required checking if the referrer is the owner, complicating the code further. Insight =3D=3D=3D=3D=3D=3D=3D This change challenges the underlying assumption that circulare dependencies exist and can be tolerated. The deletable MemoryRegions are of hotpluggable devices. A device and its MemoryRegion have the following dependencies: QOM tree -> Device Container -> MemoryRegion Device <-> MemoryRegion Techniques like piggybacking or a hypothetical garbage collector can finalize the device and the MemoryRegion once the QOM tree and container lose their dependencies. However, these methods are fundamentally insufficient because the MemoryRegion and the device have finalizers, and they do not respect the dependencies these objects may have during finalization. As long as the object model based on the device and the MemoryRegion is correct, one of them should lose its dependency on the first, establishing a valid finalization order. Understanding this allows using standard reference counting, which is immune to the problems of piggybacking. Analysis reveals that the device no longer depends on the MemoryRegion after unrealization. The device needs the MemoryRegion to add it to a container and expose it to an AddressSpace. Once unrealized, the device is hidden from the AddresSpaces and thus no longer needs the MemoryRegion. This suggests that the circular dependencies are broken and that the device should be finalized *after*: - It is unrealized. - The MemoryRegion is finalized. Solution =3D=3D=3D=3D=3D=3D=3D=3D Fortunately, this requirement can be coded with minimal complexity. Hotpluggable devices already explicitly call memory_region_del_subregion() to stop accepting new accesses to its MemoryRegions after unrealization. This change lets object_unparent() calls follow that, permitting the MemoryRegions to be finalized earlier than the device. This enforces a valid finalization order, allows MemoryRegions to rely on standard reference counting, and eliminates the entire class of memory leaks caused by piggybacking. Signed-off-by: Akihiko Odaki --- MAINTAINERS | 1 + docs/devel/memory.rst | 32 +++++++++++++++---------------- include/system/memory.h | 51 ++++++++++++++++++++++++---------------------= ---- hw/core/qdev.c | 25 +++++++++++++++++++----- stubs/memory.c | 9 +++++++++ system/memory.c | 11 +++-------- stubs/meson.build | 1 + 7 files changed, 75 insertions(+), 55 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 8147fff3523eaa45c4a0d2c21d40b4ade3f419ff..4665f0a4b7a513c5863f6d5227a= 0173c836505e6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3212,6 +3212,7 @@ F: include/system/memory.h F: include/system/ram_addr.h F: include/system/ramblock.h F: include/system/memory_mapping.h +F: stubs/memory.c F: system/dma-helpers.c F: system/ioport.c F: system/memory.c diff --git a/docs/devel/memory.rst b/docs/devel/memory.rst index 749f11d8a4ddc80f2d44b66fa41fb12c0fa54006..c7bb5602e9c20e19dd8dfe4a814= e958cc0518598 100644 --- a/docs/devel/memory.rst +++ b/docs/devel/memory.rst @@ -158,30 +158,31 @@ ioeventfd) can be changed during the region lifecycle= . They take effect as soon as the region is made visible. This can be immediately, later, or never. =20 -Destruction of a memory region happens automatically when the owner -object dies. +You should call object_unparent() if the memory region becomes +unnecessary for its owner. If its owner is a device, object_unparent() +will be called automatically after unrealization. =20 -You must not destroy a memory region as long as it may be in use by a -device or CPU. In order to do this, as a general rule do not create or -destroy memory regions dynamically during a device's lifetime. +You must not free a memory region as long as it may be in use by a +device or CPU. In order to do this, as a general rule do not allocate or +free memory regions dynamically during a device's lifetime. The dynamically allocated data structure that contains the memory region should be freed in the instance_finalize callback. =20 If you break this rule, the following situation can happen: =20 -- the memory region's owner had a reference taken via memory_region_ref +- the memory region had a reference taken via memory_region_ref (for example by address_space_map) =20 -- the region is unparented, and has no owner anymore +- the region is freed =20 -- when address_space_unmap is called, the reference to the memory region's - owner is leaked. +- when the mapped memory is used, the use of the memory region + results in use-after-free. =20 =20 -There is an exception to the above rule: it is okay to call -object_unparent at any time for an alias or a container region. It is -therefore also okay to create or destroy alias and container regions -dynamically during a device's lifetime. +There is an exception to the above rule: it is okay to free at any time +for an alias or a container region. It is therefore also okay to +allocate or free alias and container regions dynamically during a +device's lifetime. =20 This exceptional usage is valid because aliases and containers only help QEMU building the guest's memory map; they are never accessed directly. @@ -191,9 +192,8 @@ this exception is rarely necessary, and therefore it is= discouraged, but nevertheless it is used in a few places. =20 For regions that "have no owner" (NULL is passed at creation time), the -machine object is actually used as the owner. You must never call -object_unparent on regions that have no owner, unless they are aliases -or containers. +machine object is actually used as the owner. You must never free +regions that have no owner, unless they are aliases or containers. =20 =20 Overlapping regions and priority diff --git a/include/system/memory.h b/include/system/memory.h index e2cd6ed126144abaed6f3035e3ef091d747b4c34..1fc773ca49e26d605a4e152b5b4= 1426ad7666912 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -1307,7 +1307,7 @@ static inline bool memory_region_section_intersect_ra= nge(MemoryRegionSection *s, * memory_region_add_subregion() to add subregions. * * @mr: the #MemoryRegion to be initialized - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: used for debugging; not visible to the user or ABI * @size: size of the region; any subregions beyond this size will be clip= ped */ @@ -1320,14 +1320,14 @@ void memory_region_init(MemoryRegion *mr, * memory_region_ref: Add 1 to a memory region's reference count * * Whenever memory regions are accessed outside the BQL, they need to be - * preserved against hot-unplug. MemoryRegions actually do not have their - * own reference count; they piggyback on a QOM object, their "owner". - * This function adds a reference to the owner. + * preserved against hot-unplug. This function adds a reference to the + * memory region. * - * All MemoryRegions must have an owner if they can disappear, even if the - * device they belong to operates exclusively under the BQL. This is beca= use - * the region could be returned at any time by memory_region_find, and this - * is usually under guest control. + * We do not ref/unref memory regions without an owner because it slows + * down DMA sensibly. All MemoryRegions must have an owner if they can + * disappear, even if the device they belong to operates exclusively + * under the BQL. This is because the region could be returned at any + * time by memory_region_find, and this is usually under guest control. * * @mr: the #MemoryRegion */ @@ -1337,9 +1337,8 @@ void memory_region_ref(MemoryRegion *mr); * memory_region_unref: Remove 1 to a memory region's reference count * * Whenever memory regions are accessed outside the BQL, they need to be - * preserved against hot-unplug. MemoryRegions actually do not have their - * own reference count; they piggyback on a QOM object, their "owner". - * This function removes a reference to the owner and possibly destroys it. + * preserved against hot-unplug. This function removes a reference to + * the memory and possibly destroys it. * * @mr: the #MemoryRegion */ @@ -1352,7 +1351,7 @@ void memory_region_unref(MemoryRegion *mr); * if @size is nonzero, subregions will be clipped to @size. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @ops: a structure containing read and write callbacks to be used when * I/O is performed on the region. * @opaque: passed to the read and write callbacks of the @ops structure. @@ -1372,7 +1371,7 @@ void memory_region_init_io(MemoryRegion *mr, * directly. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: size of the region. @@ -1395,7 +1394,7 @@ bool memory_region_init_ram_nomigrate(MemoryRegion *m= r, * modify memory directly. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: size of the region. @@ -1425,7 +1424,7 @@ bool memory_region_init_ram_flags_nomigrate(MemoryReg= ion *mr, * canceled. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: used size of the region. @@ -1454,7 +1453,7 @@ bool memory_region_init_resizeable_ram(MemoryRegion *= mr, * mmap-ed backend. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: size of the region. @@ -1487,7 +1486,7 @@ bool memory_region_init_ram_from_file(MemoryRegion *m= r, * mmap-ed backend. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: the name of the region. * @size: size of the region. * @ram_flags: RamBlock flags. Supported flags: RAM_SHARED, RAM_PMEM, @@ -1518,7 +1517,7 @@ bool memory_region_init_ram_from_fd(MemoryRegion *mr, * region will modify memory directly. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: size of the region. @@ -1546,7 +1545,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr, * skip_dump flag. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: the name of the region. * @size: size of the region. * @ptr: memory to be mapped; must contain at least @size bytes. @@ -1566,7 +1565,7 @@ void memory_region_init_ram_device_ptr(MemoryRegion *= mr, * part of another memory region. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: used for debugging; not visible to the user or ABI * @orig: the region to be referenced; @mr will be equivalent to * @orig between @offset and @offset + @size - 1. @@ -1592,7 +1591,7 @@ void memory_region_init_alias(MemoryRegion *mr, * of the caller. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: size of the region. @@ -1615,7 +1614,7 @@ bool memory_region_init_rom_nomigrate(MemoryRegion *m= r, * of the caller. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @ops: callbacks for write access handling (must not be NULL). * @opaque: passed to the read and write callbacks of the @ops structure. * @name: Region name, becomes part of RAMBlock name used in migration str= eam @@ -1651,7 +1650,7 @@ bool memory_region_init_rom_device_nomigrate(MemoryRe= gion *mr, * @_iommu_mr: the #IOMMUMemoryRegion to be initialized * @instance_size: the IOMMUMemoryRegion subclass instance size * @mrtypename: the type name of the #IOMMUMemoryRegion - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: used for debugging; not visible to the user or ABI * @size: size of the region. */ @@ -1667,7 +1666,7 @@ void memory_region_init_iommu(void *_iommu_mr, * region will modify memory directly. * * @mr: the #MemoryRegion to be initialized - * @owner: the object that tracks the region's reference count (must be + * @owner: the object that provides the region's storage (must be * TYPE_DEVICE or a subclass of TYPE_DEVICE, or NULL) * @name: name of the memory region * @size: size of the region in bytes @@ -1713,7 +1712,7 @@ bool memory_region_init_ram_guest_memfd(MemoryRegion = *mr, * If you pass a non-NULL non-device @owner then we will assert. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: size of the region. @@ -1744,7 +1743,7 @@ bool memory_region_init_rom(MemoryRegion *mr, * If you pass a non-NULL non-device @owner then we will assert. * * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count + * @owner: the object that provides the region's storage * @ops: callbacks for write access handling (must not be NULL). * @opaque: passed to the read and write callbacks of the @ops structure. * @name: Region name, becomes part of RAMBlock name used in migration str= eam diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 8fdf6774f87ec8424348e8c9652dc4c99a2faeb5..3b1a01cdeec5b6823217fbc2d61= 1ec94ac1ccf51 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -451,17 +451,32 @@ static bool check_only_migratable(Object *obj, Error = **errp) return true; } =20 -static int del_memory_region(Object *child, void *opaque) +static int collect_memory_region(Object *child, void *opaque) { MemoryRegion *mr =3D (MemoryRegion *)object_dynamic_cast(child, TYPE_M= EMORY_REGION); =20 - if (mr && mr->container) { - memory_region_del_subregion(mr->container, mr); + if (mr) { + if (mr->container) { + memory_region_del_subregion(mr->container, mr); + } + + g_array_append_val(opaque, child); } =20 return 0; } =20 +static void del_memory_regions(DeviceState *dev) +{ + g_autoptr(GArray) array =3D g_array_new(FALSE, FALSE, sizeof(Object *)= ); + + object_child_foreach(OBJECT(dev), collect_memory_region, array); + + for (gsize i =3D 0; i < array->len; i++) { + object_unparent(g_array_index(array, Object *, i)); + } +} + static void device_set_realized(Object *obj, bool value, Error **errp) { DeviceState *dev =3D DEVICE(obj); @@ -593,7 +608,7 @@ static void device_set_realized(Object *obj, bool value= , Error **errp) if (dc->unrealize) { dc->unrealize(dev); } - object_child_foreach(OBJECT(dev), del_memory_region, NULL); + del_memory_regions(dev); dev->pending_deleted_event =3D true; DEVICE_LISTENER_CALL(unrealize, Reverse, dev); } @@ -618,7 +633,7 @@ post_realize_fail: } =20 fail: - object_child_foreach(OBJECT(dev), del_memory_region, NULL); + del_memory_regions(dev); =20 error_propagate(errp, local_err); if (unattached_parent) { diff --git a/stubs/memory.c b/stubs/memory.c new file mode 100644 index 0000000000000000000000000000000000000000..9c36531ae542d804dc19ed2a3c6= 57005881a2bca --- /dev/null +++ b/stubs/memory.c @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "system/memory.h" + +void memory_region_del_subregion(MemoryRegion *mr, + MemoryRegion *subregion) +{ +} diff --git a/system/memory.c b/system/memory.c index 56465479406f4a264bfe13e6a2bc7d9b6565410f..f81c634bcca4c4f32dea6796e5f= 98f6e2baaa94c 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1222,7 +1222,7 @@ static void memory_region_do_init(MemoryRegion *mr, mr->size =3D int128_2_64(); } mr->name =3D g_strdup(name); - mr->owner =3D owner; + mr->owner =3D object_ref(owner); mr->dev =3D (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE= ); mr->ram_block =3D NULL; =20 @@ -1816,6 +1816,7 @@ static void memory_region_finalize(Object *obj) memory_region_clear_coalescing(mr); g_free((char *)mr->name); g_free(mr->ioeventfds); + object_unref(mr->owner); } =20 Object *memory_region_owner(MemoryRegion *mr) @@ -1826,13 +1827,7 @@ Object *memory_region_owner(MemoryRegion *mr) =20 void memory_region_ref(MemoryRegion *mr) { - /* MMIO callbacks most likely will access data that belongs - * to the owner, hence the need to ref/unref the owner whenever - * the memory region is in use. - * - * The memory region is a child of its owner. As long as the - * owner doesn't call unparent itself on the memory region, - * ref-ing the owner will also keep the memory region alive. + /* * Memory regions without an owner are supposed to never go away; * we do not ref/unref them because it slows down DMA sensibly. */ diff --git a/stubs/meson.build b/stubs/meson.build index cef046e6854ddaa9f12714c317a541ea75b8d412..b4df4e60a1af89c9354d5b92449= ce5409095b9f1 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -95,5 +95,6 @@ if have_system or have_user =20 # Also included in have_system for tests/unit/test-qdev-global-props stub_ss.add(files('hotplug-stubs.c')) + stub_ss.add(files('memory.c')) stub_ss.add(files('sysbus.c')) endif --=20 2.51.0