From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjqOo-0000J8-5I for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:31:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjqOm-0000so-3Z for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:31:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjqOl-0000sE-Nd for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:31:35 -0400 Message-ID: <51ADDE1A.4030709@redhat.com> Date: Tue, 04 Jun 2013 14:31:22 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1370348041-6768-1-git-send-email-pbonzini@redhat.com> <1370348041-6768-7-git-send-email-pbonzini@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 06/17] sysbus: add sysbus_pass_mmio List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org Il 04/06/2013 14:24, Peter Maydell ha scritto: > On 4 June 2013 13:13, Paolo Bonzini wrote: >> This matches sysbus_pass_irq in cases where a device is a thin wrapper >> of another. MMIO regions will keep the subdevice as the owner. >> >> Signed-off-by: Paolo Bonzini >> --- >> hw/core/sysbus.c | 12 ++++++++++++ >> hw/cpu/arm11mpcore.c | 2 +- >> include/hw/sysbus.h | 1 + >> 3 files changed, 14 insertions(+), 1 deletion(-) >> >> diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c >> index 9004d8c..6dbd1f8 100644 >> --- a/hw/core/sysbus.c >> +++ b/hw/core/sysbus.c >> @@ -117,6 +117,18 @@ void sysbus_init_mmio(SysBusDevice *dev, MemoryRegion *memory) >> dev->mmio[n].memory = memory; >> } >> >> +/* Pass MMIOs from a target device. */ >> +void sysbus_pass_mmio(SysBusDevice *dev, SysBusDevice *target) >> +{ >> + int i; >> + assert(dev->num_mmio == 0); >> + dev->num_mmio = target->num_mmio; >> + for (i = 0; i < dev->num_mmio; i++) { >> + assert(target->mmio[i].addr == -1); >> + dev->mmio[i] = target->mmio[i]; >> + } >> +} > > This is much less flexible than just using sysbus_mmio_get_region(), > because it only lets you pass the whole set of MMIOs from the > other device through, not just the ones you want. How is this different from sysbus_pass_irq? > Please just make reference counting work properly with passing > MemoryRegion*s around. Do you have any idea that doesn't require touch 800 invocation of the region creation functions? This looks like a solution in search of a problem to me. Paolo