From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R86Pi-0005Gq-83 for qemu-devel@nongnu.org; Mon, 26 Sep 2011 04:19:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R86Ph-0007WQ-65 for qemu-devel@nongnu.org; Mon, 26 Sep 2011 04:19:46 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:37616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R86Ph-0007WM-0p for qemu-devel@nongnu.org; Mon, 26 Sep 2011 04:19:45 -0400 Received: by wwg14 with SMTP id 14so5302853wwg.10 for ; Mon, 26 Sep 2011 01:19:43 -0700 (PDT) Date: Mon, 26 Sep 2011 08:51:59 +0100 From: Stefan Hajnoczi Message-ID: <20110926075159.GA6455@stefanha-thinkpad.localdomain> References: <87litcs1ly.fsf@ginnungagap.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87litcs1ly.fsf@ginnungagap.bsc.es> Subject: Re: [Qemu-devel] Help writing a trivial device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Llu=EDs?= Vilanova Cc: qemu-devel@nongnu.org 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