On Tue, 16 Apr 2019 at 11:09, <[email protected]> wrote: > I am trying to create a new device in QEMU that is supposed to be a memory > mapped device at some physical address and of some size. > The idea is to set up .read and .write functions that get control when the > user application reads from or writes to the MMIO device, similar to other > devices. > It should NOT be PCI!
You want something that is a "sysbus device", which is QEMU's abstraction for "device that is memory mapped and possibly has interrupt lines". hw/misc/mps2-scc.c is an example of a very simple one that's been written fairly recently and is in the currently recommended style. You would then need to modify the board code for whatever machine you're trying to use this with to create the device at whatever physical address you want it to live at. > I was hoping that the configuration values for the MMIO-device could be > provided when starting the QEMU-image, along with other entities you see > when you use the -v option. So there must be a standard way to pass this > information on from the invocation to the actual device they were written > for. You can't conveniently do this. Memory-mapped devices are created by board code, not on the command line, which makes them awkward to configure via the command line. (It is possible to get them to have some device properties which can then be set via the -global option, but you need to know where the device was created in the QOM object tree to know what to pass -global.) thanks -- PMM
