On Thu, Jun 12, 2014 at 12:16:18PM +0200, Paolo Bonzini wrote: > Il 11/06/2014 16:01, Andrew Jones ha scritto: > >virtio-testdev is a communication channel to qemu through virtio that > >can be used by test code to send commands. The only command currently > >implemented is EXIT, which allows the test code to exit with a given > >status code. > > > >Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> > >Reviewed-by: Christoffer Dall <christoffer.dall@xxxxxxxxxx> > > Hi Drew, > > quite a few months ago I had promised to help with an alternative > implementation that does not require a new virtio device (which would > in turn need registration of the device ID and so on. Does it? I assumed we'd be fine just using 0xffff (which I understood from the spec to be reserved for development purposes). I guess a potential problem would be if this device is also used at the same time as an experimental device that is also making that assumption, but that'd be easily fixed by the developer who's doing the experimenting. > > Since the return values are hardly used in your test device, I removed > them and made a simple write-only backend for virtio-serial. With this > simplification, virtio-serial is almost as simple as your test device, > you just use the transmit queue (queue 1). Receiving data would be a > bit more complicated, basically you would first put a buffer in queue > 0, then issue the command, then wait for an interrupt on queue 0. > > There is a single command implemented, "q". It takes a (prefix) > argument for the exit code, so an error exit is implemented by writing > "1q" to the virtio-serial port. > > Right now I'm using ASCII (because I tested it from a Linux guest with > just "echo 1q > /dev/vport0p1"), but of course you could just as well > encode arguments in binary format. > > The QEMU implementation follows, it can be used as: > > qemu-system-arm ... \ > -chardev testdev,id=ctl \ > -device virtio-serial -device virtserialport,chardev=ctl ... > > If you are okay with it, feel free to pick it up and send it to qemu-devel, > and just send v6 of this one patch. Unfortunately I cannot merge > kvm-unit-tests until there is QEMU support for either virtio-testdev or > chardev-testdev, but it should not take much time. Thanks for this! I'll experiment with it, and let you know how it goes. drew -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html