Received: from eggs.gnu.org ([140.186.70.92]:41232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcCgH-0003LI-Px for qemu-devel@nongnu.org; Thu, 30 Jun 2011 04:33:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcCgE-0005UG-Jy for qemu-devel@nongnu.org; Thu, 30 Jun 2011 04:33:01 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56541 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcCgE-0005U4-8l for qemu-devel@nongnu.org; Thu, 30 Jun 2011 04:32:58 -0400 References: In-Reply-To: Mime-Version: 1.0 (iPhone Mail 8G4) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Message-Id: From: Alexander Graf Date: Thu, 30 Jun 2011 10:31:30 +0200 Subject: Re: [Qemu-devel] Questions on DeviceState and Virtio infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wei Liu Cc: Anthony Perard , Stefano Stabellini , "qemu-devel@nongnu.org" On 29.06.2011, at 15:59, Wei Liu wrote: > Hi, QEMU folks >=20 > I know that I might have a bad title for this post, but I just don't > have better idea for the title. >=20 > I'm developing virtio support for Xen pv guest, hoping to reuse the > virtio infrastructure in qemu, i.e. I'm planning to use qemu as > "virtio backend" for Xen pv. And qemu can be run as pv backend if > proper "machine" option is given. >=20 > Maybe you've known that Xen pv guest utilizes Xenbus/Xenstore to > configure its paravirt devices. So I'm to configure virtio devices > with Xenbus/Xenstore as well. But in nowdays XenDevice in qemu does > not include a DeviceState. To my understanding, it is not connected to > qemu's internal buses or whatever (correct me if I'm wrong, I'm > relatively new to qemu). I'm not a huge fan of adding multiple different transports for virtio if we d= on't have to. IIRC Xen PV guests can do PCI device assignment, right? That m= eans there is a PCI bus for them which we could reuse to run virtio-pci on. By then, you'd get all the virtio code for free and don't have to worry abou= t maintaining yet another transport (which _is_ cumbersome) Alex >=20 > Here is the problem, say I'm to implement virtio nic for Xen pv guest, > I use Xenbus to probe and initialize the device. When doing > initialization, I am to reuse virtio_net_init, which takes DeviceState > as the first argument -- but I just don't have one in XenDevice. All I > need is to use qemu's virtio infrastructure. >=20 > What's the purpose of this DeviceState argument? >=20 > If I just construct my own DeviceState and pass it to virtio_net_init, > what will happen? Will qemu emulates virtio nic as usual? >=20 > Thanks. >=20 > Wei. >=20