qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 06/17] sysbus: add sysbus_pass_mmio


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 06/17] sysbus: add sysbus_pass_mmio
Date: Tue, 4 Jun 2013 13:24:14 +0100

On 4 June 2013 13:13, Paolo Bonzini <address@hidden> 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 <address@hidden>
> ---
>  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. Please
just make reference counting work properly with passing
MemoryRegion*s around.

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]