From nobody Wed Oct 29 22:40:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526395101902816.0159598896206; Tue, 15 May 2018 07:38:21 -0700 (PDT) Received: from localhost ([::1]:41223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIb5o-0003rF-OL for importer@patchew.org; Tue, 15 May 2018 10:38:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIb3Y-0002Rq-5r for qemu-devel@nongnu.org; Tue, 15 May 2018 10:36:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIb3O-0008NN-AG for qemu-devel@nongnu.org; Tue, 15 May 2018 10:36:00 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59340 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fIb3O-0008N9-4N for qemu-devel@nongnu.org; Tue, 15 May 2018 10:35:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65AB5401DE87; Tue, 15 May 2018 14:35:49 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-117-239.ams2.redhat.com [10.36.117.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB77263F45; Tue, 15 May 2018 14:35:48 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 15 May 2018 16:35:48 +0200 Message-Id: <20180515143548.29841-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 15 May 2018 14:35:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 15 May 2018 14:35:49 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] memory: get rid of memory_region_init_reservation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The function has been deprecated for 2.5 years, and there are just a handful of users. Convert them to memory_region_init_io with NULL callbacks, and while at it pass the right device as the owner. Signed-off-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi --- docs/devel/memory.txt | 5 ++--- hw/i386/kvm/i8254.c | 2 +- hw/i386/kvm/i8259.c | 4 ++-- hw/i386/kvm/ioapic.c | 2 +- include/exec/memory.h | 23 ----------------------- 5 files changed, 6 insertions(+), 30 deletions(-) diff --git a/docs/devel/memory.txt b/docs/devel/memory.txt index 8ed810f8b9..c1dee1252c 100644 --- a/docs/devel/memory.txt +++ b/docs/devel/memory.txt @@ -77,9 +77,8 @@ MemoryRegion): - reservation region: a reservation region is primarily for debugging. It claims I/O space that is not supposed to be handled by QEMU itself. The typical use is to track parts of the address space which will be - handled by the host kernel when KVM is enabled. - You initialize these with memory_region_init_reservation(), or by - passing a NULL callback parameter to memory_region_init_io(). + handled by the host kernel when KVM is enabled. You initialize these + by passing a NULL callback parameter to memory_region_init_io(). =20 It is valid to add subregions to a region which is not a pure container (that is, to an MMIO, RAM or ROM region). This means that the region diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c index 13f20f47d9..b11c5cf9b8 100644 --- a/hw/i386/kvm/i8254.c +++ b/hw/i386/kvm/i8254.c @@ -293,7 +293,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error *= *errp) return; } =20 - memory_region_init_reservation(&pit->ioports, NULL, "kvm-pit", 4); + memory_region_init_io(&pit->ioports, OBJECT(dev), NULL, "kvm-pit", 4); =20 qdev_init_gpio_in(dev, kvm_pit_irq_control, 1); =20 diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index 05394cdb7b..73e005dd98 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -121,8 +121,8 @@ static void kvm_pic_realize(DeviceState *dev, Error **e= rrp) PICCommonState *s =3D PIC_COMMON(dev); KVMPICClass *kpc =3D KVM_PIC_GET_CLASS(dev); =20 - memory_region_init_reservation(&s->base_io, NULL, "kvm-pic", 2); - memory_region_init_reservation(&s->elcr_io, NULL, "kvm-elcr", 1); + memory_region_init_io(&s->base_io, OBJECT(dev), NULL, "kvm-pic", 2); + memory_region_init_io(&s->elcr_io, OBJECT(dev), NULL, "kvm-elcr", 1); =20 kpc->parent_realize(dev, errp); } diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c index 98ca480792..ee68553444 100644 --- a/hw/i386/kvm/ioapic.c +++ b/hw/i386/kvm/ioapic.c @@ -142,7 +142,7 @@ static void kvm_ioapic_realize(DeviceState *dev, Error = **errp) { IOAPICCommonState *s =3D IOAPIC_COMMON(dev); =20 - memory_region_init_reservation(&s->io_memory, NULL, "kvm-ioapic", 0x10= 00); + memory_region_init_io(&s->io_memory, OBJECT(dev), NULL, "kvm-ioapic", = 0x1000); /* * KVM ioapic only supports 0x11 now. This will only be used when * we want to dump ioapic version. diff --git a/include/exec/memory.h b/include/exec/memory.h index 4fa1227f13..a116d936fc 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -675,29 +675,6 @@ void memory_region_init_rom_device_nomigrate(MemoryReg= ion *mr, uint64_t size, Error **errp); =20 -/** - * memory_region_init_reservation: Initialize a memory region that reserves - * I/O space. - * - * A reservation region primarily serves debugging purposes. It claims I/O - * space that is not supposed to be handled by QEMU itself. Any access via - * the memory API will cause an abort(). - * This function is deprecated. Use memory_region_init_io() with NULL - * callbacks instead. - * - * @mr: the #MemoryRegion to be initialized - * @owner: the object that tracks the region's reference count - * @name: used for debugging; not visible to the user or ABI - * @size: size of the region. - */ -static inline void memory_region_init_reservation(MemoryRegion *mr, - Object *owner, - const char *name, - uint64_t size) -{ - memory_region_init_io(mr, owner, NULL, mr, name, size); -} - /** * memory_region_init_iommu: Initialize a memory region of a custom type * that translates addresses --=20 2.17.0