* [Qemu-devel] [PATCH] memory: get rid of memory_region_init_reservation
@ 2018-05-15 14:35 Paolo Bonzini
2018-05-24 13:52 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2018-05-15 14:35 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
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 <pbonzini@redhat.com>
---
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().
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;
}
- memory_region_init_reservation(&pit->ioports, NULL, "kvm-pit", 4);
+ memory_region_init_io(&pit->ioports, OBJECT(dev), NULL, "kvm-pit", 4);
qdev_init_gpio_in(dev, kvm_pit_irq_control, 1);
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 **errp)
PICCommonState *s = PIC_COMMON(dev);
KVMPICClass *kpc = KVM_PIC_GET_CLASS(dev);
- 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);
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 = IOAPIC_COMMON(dev);
- memory_region_init_reservation(&s->io_memory, NULL, "kvm-ioapic", 0x1000);
+ 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(MemoryRegion *mr,
uint64_t size,
Error **errp);
-/**
- * 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
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] memory: get rid of memory_region_init_reservation
2018-05-15 14:35 [Qemu-devel] [PATCH] memory: get rid of memory_region_init_reservation Paolo Bonzini
@ 2018-05-24 13:52 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2018-05-24 13:52 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel, peter.maydell
[-- Attachment #1: Type: text/plain, Size: 641 bytes --]
On Tue, May 15, 2018 at 04:35:48PM +0200, Paolo Bonzini wrote:
> 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 <pbonzini@redhat.com>
> ---
> 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(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-24 13:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-15 14:35 [Qemu-devel] [PATCH] memory: get rid of memory_region_init_reservation Paolo Bonzini
2018-05-24 13:52 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).