From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkhaU-00063Q-IJ for qemu-devel@nongnu.org; Mon, 17 Dec 2012 15:47:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkhaR-0006k7-Tr for qemu-devel@nongnu.org; Mon, 17 Dec 2012 15:46:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkhaR-0006k2-Ky for qemu-devel@nongnu.org; Mon, 17 Dec 2012 15:46:55 -0500 Date: Mon, 17 Dec 2012 22:50:00 +0200 From: "Michael S. Tsirkin" Message-ID: <20121217205000.GC30842@redhat.com> References: <20121217154521.GA28674@redhat.com> <50CF5CA2.7060800@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <50CF5CA2.7060800@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] virtio: make bindings typesafe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, Alexander Graf , Christian Borntraeger , Paolo Bonzini , fred.konrad@greensocs.com On Mon, Dec 17, 2012 at 06:55:46PM +0100, Andreas F=E4rber wrote: > Am 17.12.2012 16:45, schrieb Michael S. Tsirkin: > > diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c > > index 3ea4140..63ae888 100644 > > --- a/hw/virtio-pci.c > > +++ b/hw/virtio-pci.c > > @@ -98,34 +98,34 @@ bool virtio_is_big_endian(void); > > =20 > > /* virtio device */ > > =20 > > -static void virtio_pci_notify(void *opaque, uint16_t vector) > > +static void virtio_pci_notify(DeviceState *d, uint16_t vector) > > { > > - VirtIOPCIProxy *proxy =3D opaque; > > + VirtIOPCIProxy *proxy =3D container_of(d, VirtIOPCIProxy, pci_de= v.qdev); >=20 > Nack. This is going the wrong direction QOM-wise and you among all > others know that from PCI host bridges! >=20 > A core issue being addressed here is that virtio devices are modelled > neither in the regular qdev way nor the QOM way. No, the core issue is unsafe void * use. > They don't inherit > correctly and use their own set of common-init functions - one side > effect of Fred's series was to make them first-class QOM citizens. QOM > like qdev doesn't support multi-inheritence, so the discussed approach > Fred is trying to implement is to have both a VirtioDevice as base clas= s > for Virtio{Block,...}Device and PCIDevice/SysBusDevice/... as base clas= s > for a virtio bridge device with a virtio-bus, on which only virtio is > spoken and pure VirtioDevices can sit (which as you say have device IDs > but not all PCI properties). > What remained under discussion AFAIU was how to expose this modelling > construct to the user - Peter aiming to expose this to the user and me > proposing to hide this (for PCI) as an internal implementation detail. >=20 > Whether DeviceState or a new VirtioDevice or something else is being > used in the API is a different issue that I don't really mind. >=20 > Andreas Me neither just get rid of void* > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrn= berg