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: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 06/17] sysbus: add sysbus_pass_mmio
Date: Tue, 04 Jun 2013 14:31:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

Il 04/06/2013 14:24, Peter Maydell ha scritto:
> 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.

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



reply via email to

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