From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujq8D-0007uo-GZ for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:14:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ujq8C-0002Xb-96 for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:14:29 -0400 Received: from mail-bk0-x22a.google.com ([2a00:1450:4008:c01::22a]:58450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujq8C-0002XJ-2W for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:14:28 -0400 Received: by mail-bk0-f42.google.com with SMTP id jk13so92444bkc.15 for ; Tue, 04 Jun 2013 05:14:27 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 4 Jun 2013 14:13:54 +0200 Message-Id: <1370348041-6768-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1370348041-6768-1-git-send-email-pbonzini@redhat.com> References: <1370348041-6768-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 10/17] isa/portio: allow setting an owner List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Signed-off-by: Paolo Bonzini --- hw/isa/isa-bus.c | 2 ++ include/exec/ioport.h | 3 +++ ioport.c | 10 ++++++++++ 3 files changed, 15 insertions(+) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 7860b17..d263d0f 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -100,6 +100,7 @@ static inline void isa_init_ioport(ISADevice *dev, uint16_t ioport) void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start) { + memory_region_set_owner(io, OBJECT(dev)); memory_region_add_subregion(isabus->address_space_io, start, io); isa_init_ioport(dev, start); } @@ -116,6 +117,7 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start, isa_init_ioport(dev, start); portio_list_init(piolist, pio_start, opaque, name); + portio_list_set_owner(piolist, OBJECT(dev)); portio_list_add(piolist, isabus->address_space_io, start); } diff --git a/include/exec/ioport.h b/include/exec/ioport.h index fc28350..5fe0d99 100644 --- a/include/exec/ioport.h +++ b/include/exec/ioport.h @@ -62,6 +62,7 @@ typedef struct PortioList { unsigned nr; struct MemoryRegion **regions; struct MemoryRegion **aliases; + struct Object *owner; void *opaque; const char *name; } PortioList; @@ -69,6 +70,8 @@ typedef struct PortioList { void portio_list_init(PortioList *piolist, const struct MemoryRegionPortio *callbacks, void *opaque, const char *name); +void portio_list_set_owner(PortioList *piolist, + struct Object *owner); void portio_list_destroy(PortioList *piolist); void portio_list_add(PortioList *piolist, struct MemoryRegion *address_space, diff --git a/ioport.c b/ioport.c index a0ac2a0..1cccd70 100644 --- a/ioport.c +++ b/ioport.c @@ -347,6 +347,12 @@ void portio_list_init(PortioList *piolist, piolist->address_space = NULL; piolist->opaque = opaque; piolist->name = name; + piolist->owner = NULL; +} + +void portio_list_set_owner(PortioList *piolist, Object *owner) +{ + piolist->owner = owner; } void portio_list_destroy(PortioList *piolist) @@ -386,8 +392,12 @@ static void portio_list_add_1(PortioList *piolist, */ memory_region_init_io(region, ops, piolist->opaque, piolist->name, INT64_MAX); + memory_region_set_owner(region, piolist->owner); + memory_region_init_alias(alias, piolist->name, region, start + off_low, off_high - off_low); + memory_region_set_owner(alias, piolist->owner); + memory_region_add_subregion(piolist->address_space, start + off_low, alias); piolist->regions[piolist->nr] = region; -- 1.8.1.4