Re: [Qemu-devel] Modular hardware emulation

2017-07-11 Thread Stefan Hajnoczi
On Wed, Jul 05, 2017 at 05:56:51PM +, Tom Cook wrote:
> I'm using qemu to emulate a certain fruit-flavoured single-board computer -
> which is fantastic for testing changes configuration, by the way.
> 
> We have a bit of custom hardware attached to that single-board computer -
> essentially an SPI-slave 8-channel ADC with some analog electronics
> attached.
> 
> I'm trying to get a feel for the level of effort involved in writing an
> emulation of this custom hardware that will work with qemu.  I can see two
> extremes:  At one end of the scale, there might be a nice Python interface
> already in place for writing SPI device emulations and all I need to do is
> point a command-line parameter at a suitable script and away it goes.  At
> the other end, I need to hack around in the qemu source, understand about
> 3/4 of it and create a custom build of the whole emulator.
> 
> Can someone give me some sort of idea what level of effort is involved, and
> perhaps a pointer in the right direction, please?

Emulated devices are part of the QEMU codebase.  They live in hw/.  You
would have to learn about QEMU internals to add a custom device.

I'm not an ARM expert or familiar with SPI, but the starting point would
be looking at the machine type (board) you are using and locating the
SPI controller (BCM2835 SPI0?).  See if that is emulated in QEMU and if
there are any existing devices for you to study.

git grep -i '\' doesn't show much evidence of true SPI support.
There is SSI and I2C support though, so at least those would give you an
idea of how to add SPI.

Stefan


signature.asc
Description: PGP signature


[Qemu-devel] Modular hardware emulation

2017-07-05 Thread Tom Cook
I'm using qemu to emulate a certain fruit-flavoured single-board computer -
which is fantastic for testing changes configuration, by the way.

We have a bit of custom hardware attached to that single-board computer -
essentially an SPI-slave 8-channel ADC with some analog electronics
attached.

I'm trying to get a feel for the level of effort involved in writing an
emulation of this custom hardware that will work with qemu.  I can see two
extremes:  At one end of the scale, there might be a nice Python interface
already in place for writing SPI device emulations and all I need to do is
point a command-line parameter at a suitable script and away it goes.  At
the other end, I need to hack around in the qemu source, understand about
3/4 of it and create a custom build of the whole emulator.

Can someone give me some sort of idea what level of effort is involved, and
perhaps a pointer in the right direction, please?

Regards,
Tom