From nobody Mon Feb 9 12:29:29 2026 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=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769703689229324.5871141714475; Thu, 29 Jan 2026 08:21:29 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vlUku-0004uy-5a; Thu, 29 Jan 2026 11:20:28 -0500 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 1vlUko-0004sh-TJ for qemu-devel@nongnu.org; Thu, 29 Jan 2026 11:20:24 -0500 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vlUkk-0000e1-Lm for qemu-devel@nongnu.org; Thu, 29 Jan 2026 11:20:22 -0500 Received: from localhost (localhost [127.0.0.1]) by zero.eik.bme.hu (Postfix) with ESMTP id 6DFDE596AE1; Thu, 29 Jan 2026 17:20:15 +0100 (CET) Received: from zero.eik.bme.hu ([127.0.0.1]) by localhost (zero.eik.bme.hu [127.0.0.1]) (amavis, port 10028) with ESMTP id W-2937ki1alH; Thu, 29 Jan 2026 17:20:13 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 54489596A38; Thu, 29 Jan 2026 17:20:13 +0100 (CET) X-Virus-Scanned: amavis at eik.bme.hu Message-ID: <87d6eafa7c7f7f62de0e82dd5c70cd0d0a4f59b8.1769703287.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH 1/4] memory: Remove memory_region_init_rom_device_nomigrate() MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org Cc: Peter Xu , Akihiko Odaki , Paolo Bonzini , Mark Cave-Ayland , Gerd Hoffmann , Max Filippov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 29 Jan 2026 17:20:13 +0100 (CET) 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=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1769703692992158500 Content-Type: text/plain; charset="utf-8" This function is never used, remove it. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- docs/devel/memory.rst | 1 - include/system/memory.h | 27 ------------ .../memory-region-housekeeping.cocci | 8 ---- system/memory.c | 41 ++++++------------- 4 files changed, 13 insertions(+), 64 deletions(-) diff --git a/docs/devel/memory.rst b/docs/devel/memory.rst index f22146e56c..8558f70a42 100644 --- a/docs/devel/memory.rst +++ b/docs/devel/memory.rst @@ -114,7 +114,6 @@ the backing memory yourself, you can call the functions: =20 - memory_region_init_ram_nomigrate() - memory_region_init_rom_nomigrate() -- memory_region_init_rom_device_nomigrate() =20 which only initialize the MemoryRegion and leave handling migration to the caller. diff --git a/include/system/memory.h b/include/system/memory.h index 8f8725ea2d..0562af3136 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -1614,33 +1614,6 @@ bool memory_region_init_rom_nomigrate(MemoryRegion *= mr, uint64_t size, Error **errp); =20 -/** - * memory_region_init_rom_device_nomigrate: Initialize a ROM memory regio= n. - * Writes are handled via callbacks. - * - * Note that this function does not do anything to cause the data in the - * RAM side of the memory region to be migrated; that is the responsibility - * of the caller. - * - * @mr: the #MemoryRegion to be initialized. - * @owner: the object that tracks the region's reference count - * @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 - * must be unique within any device - * @size: size of the region. - * @errp: pointer to Error*, to store an error if it happens. - * - * Return: true on success, else false setting @errp with error. - */ -bool memory_region_init_rom_device_nomigrate(MemoryRegion *mr, - Object *owner, - const MemoryRegionOps *ops, - void *opaque, - const char *name, - uint64_t size, - Error **errp); - /** * memory_region_init_iommu: Initialize a memory region of a custom type * that translates addresses diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 29651ebde9..7f89e9712e 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -97,14 +97,6 @@ expression NAME; expression SIZE; expression ERRP; @@ --memory_region_init_rom_device_nomigrate(MR, NULL, OPS, OPAQUE, NAME, SIZE= , ERRP); -+memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP); - ... --vmstate_register_ram_global(MR); - - -// Device is owner -@@ typedef DeviceState; identifier device_fn, dev, obj; expression E1, E2, E3, E4, E5; diff --git a/system/memory.c b/system/memory.c index 4bf00d82bc..a9032fb2cf 100644 --- a/system/memory.c +++ b/system/memory.c @@ -1748,32 +1748,6 @@ bool memory_region_init_rom_nomigrate(MemoryRegion *= mr, return true; } =20 -bool memory_region_init_rom_device_nomigrate(MemoryRegion *mr, - Object *owner, - const MemoryRegionOps *ops, - void *opaque, - const char *name, - uint64_t size, - Error **errp) -{ - Error *err =3D NULL; - assert(ops); - memory_region_init(mr, owner, name, size); - mr->ops =3D ops; - mr->opaque =3D opaque; - mr->terminates =3D true; - mr->rom_device =3D true; - mr->destructor =3D memory_region_destructor_ram; - mr->ram_block =3D qemu_ram_alloc(size, 0, mr, &err); - if (err) { - mr->size =3D int128_zero(); - object_unparent(OBJECT(mr)); - error_propagate(errp, err); - return false; - } - return true; -} - void memory_region_init_iommu(void *_iommu_mr, size_t instance_size, const char *mrtypename, @@ -3802,9 +3776,20 @@ bool memory_region_init_rom_device(MemoryRegion *mr, Error **errp) { DeviceState *owner_dev; + Error *err =3D NULL; =20 - if (!memory_region_init_rom_device_nomigrate(mr, owner, ops, opaque, - name, size, errp)) { + assert(ops); + memory_region_init(mr, owner, name, size); + mr->ops =3D ops; + mr->opaque =3D opaque; + mr->terminates =3D true; + mr->rom_device =3D true; + mr->destructor =3D memory_region_destructor_ram; + mr->ram_block =3D qemu_ram_alloc(size, 0, mr, &err); + if (err) { + mr->size =3D int128_zero(); + object_unparent(OBJECT(mr)); + error_propagate(errp, err); return false; } /* This will assert if owner is neither NULL nor a DeviceState. --=20 2.41.3