qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 17/24] arm11mpcore: use sysbus_init_mmio_cb2


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 17/24] arm11mpcore: use sysbus_init_mmio_cb2
Date: Sun, 14 Aug 2011 11:45:00 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

On 08/12/2011 06:23 AM, Peter Maydell wrote:
>    static int realview_mpcore_init(SysBusDevice *dev)
>    {
>       mpcore_rirq_state *s = FROM_SYSBUS(mpcore_rirq_state, dev);
>  @@ -79,7 +84,7 @@ static int realview_mpcore_init(SysBusDevice *dev)
>           }
>       }
>       qdev_init_gpio_in(&dev->qdev, mpcore_rirq_set_irq, 64);
>  -    sysbus_init_mmio_cb(dev, 0x2000, mpcore_rirq_map);
>  +    sysbus_init_mmio_cb2(dev, mpcore_rirq_map, mpcore_rirq_unmap);
>       return 0;
>    }

Since the mpcore code here is only using sysbus mmio callbacks as
a way to pass things through to a sysbus mmio provided by another
device, I think it would be cleaner to just have a way to say "my
mmio is actually provided by this other device".

For instance you could have
MemoryRegion* sysbus_mmio_get_region(SysBusDevice *dev, int n))
{
     return dev->mmio[n].memory;
}

and then realview_mpcore_init() can just
   sysbus_init_mmio_region(dev, sysbus_mmio_get_region(s->priv, 0));

Or you could have a sysbus_pass_mmio() which worked like
sysbus_pass_irq() and just said "my mmios are all this other
device's mmios"; that's less flexible though.



Yes. Yet another option is to create a container MemoryRegion and pass it upwards, then allow the device that actually implements that mmio to register its regions with the container.

I'll leave this to the device maintainer though.

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.




reply via email to

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