qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] vmbus bridge: machine property or device?


From: Peter Maydell
Subject: Re: [Qemu-devel] vmbus bridge: machine property or device?
Date: Thu, 13 Apr 2017 22:57:13 +0100

On 13 April 2017 at 19:15, Eduardo Habkost <address@hidden> wrote:
> I can't say it's a good idea, but it looks like there are devices
> that do that (probably they are machine-specific, so they know
> which machine they are being connected to?).
>
> I looked for realize functions that call sysbus_mmio_map() or
> get_system_memory() directly, and I've found a few:

Yeah. Ideally these should get cleaned up. The way I think is
the right approach here is that the board code uses the
system memory address space to map its devices, and then
it passes a MemoryRegion to the SoC container device via a
QOM link property. The SoC then maps its devices inside that
MemoryRegion, and hands an MR to the CPU (and the CPU does
its accesses to that MR). You can see some of this with
stm32f205_soc.c and armv7m.c.

I think most of your examples are SoCs which are just
slightly old-style/lazy and using the system memory
address space directly (since the SoC covers the whole
of the address space anyway). The real bad code is devices
which directly map their own memory regions into the
system memory space even though they're just a leaf
device like a UART (common in not-yet-converted-to-QOM code).

> And the ones that call sysbus_connect_irq() directly:

Calling sysbus_connect_irq() is fine because it's
what you use to wire up a sysbus device's input IRQ
line to something else. If you (as an SoC container
object) have created both the IRQ chip and the other
device then it's also your job to wire the two together.

> Isn't "the board code has to wire you up" true for both sysbus
> and bus-less devices?

If you need no wiring up at all then it's ok.
hw/core/generic-loader.c is an example of that.

thanks
-- PMM



reply via email to

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