On Mon, Sep 26, 2011 at 12:23:21AM +0200, Lluís Vilanova wrote: > 1) Cannot start QEMU with KVM when the device is enabled: > kvm_set_phys_mem: error registering slot: Invalid argument > > 2) The driver never gets called on a read/write to its memory
If I add #include "pci.h" at the top of the file, change TARGET_PAGE_SIZE to 4096 (generic device code is not supposed to be target-dependent), and throw foo.o into Makefile.objs it builds here. It launches successfully with -enable-kvm and I can see the device inside a VM. My qemu.git/HEAD is 1ce9ce6a6184f0192015ba9adf1123d89cd47a7b. I only had a few minutes and couldn't test reading from BAR0, but you might want to get 32-bit reads working first before trying 64-bit. Stefan