From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj6TK-0000UE-UG for qemu-devel@nongnu.org; Thu, 13 Dec 2012 05:57:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tj6TF-00060r-U7 for qemu-devel@nongnu.org; Thu, 13 Dec 2012 05:56:58 -0500 Received: from greensocs.com ([87.106.252.221]:45132 helo=s15328186.onlinehome-server.info) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tj6TF-00060l-Mt for qemu-devel@nongnu.org; Thu, 13 Dec 2012 05:56:53 -0500 Message-ID: <50C9B471.4000401@greensocs.com> Date: Thu, 13 Dec 2012 11:56:49 +0100 From: =?UTF-8?B?S09OUkFEIEZyw6lkw6lyaWM=?= MIME-Version: 1.0 References: <1355157952-2321-1-git-send-email-fred.konrad@greensocs.com> <1355157952-2321-8-git-send-email-fred.konrad@greensocs.com> <50C990B6.5050806@greensocs.com> In-Reply-To: <50C990B6.5050806@greensocs.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH v7 7/8] virtio-pci-blk : Switch to new API. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: aliguori@us.ibm.com, e.voevodin@samsung.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, stefanha@redhat.com, cornelia.huck@de.ibm.com, afaerber@suse.de On 13/12/2012 09:24, KONRAD Fr=C3=A9d=C3=A9ric wrote: > On 12/12/2012 15:25, Peter Maydell wrote: >> On 10 December 2012 16:45, wrote: >>> -static void virtio_blk_class_init(ObjectClass *klass, void *data) >>> -{ >>> - DeviceClass *dc =3D DEVICE_CLASS(klass); >>> - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); >>> - >>> - k->init =3D virtio_blk_init_pci; >>> - k->exit =3D virtio_blk_exit_pci; >>> - k->vendor_id =3D PCI_VENDOR_ID_REDHAT_QUMRANET; >>> - k->device_id =3D PCI_DEVICE_ID_VIRTIO_BLOCK; >>> - k->revision =3D VIRTIO_PCI_ABI_VERSION; >>> - k->class_id =3D PCI_CLASS_STORAGE_SCSI; >>> - dc->reset =3D virtio_pci_reset; >>> - dc->props =3D virtio_blk_properties; >>> -} >> This hunk removes the setting of the PCI vendor and device IDs >> but I can't see where they are set in the new code. >> >> How will the PCI transport's PCI vendor/device/class IDs be >> set (a) when a virtio-blk backend is created and separately >> plugged into a virtio-pci transport (b) for the legacy >> virtio-pci-blk? [ideally the answer to (b) should be "in the >> same way as for (a)"] >> >> -- PMM > > It's done in the virtio_pci_device_plugged(), ( step 4 ) > At this time we have the device ID, so we can put the PCI IDs : > > +static void virtio_pci_device_plugged(void *opaque) > +{ > + VirtIOPCIProxy *proxy =3D VIRTIO_PCI(opaque); > + uint8_t *config; > + uint32_t size; > + > + /* Put the PCI IDs */ > + switch (get_virtio_device_id(proxy->bus)) { > + > + case VIRTIO_ID_BLOCK: > + pci_config_set_device_id(proxy->pci_dev.config, > + PCI_DEVICE_ID_VIRTIO_BLOCK); > + pci_config_set_class(proxy->pci_dev.config,=20 > PCI_CLASS_STORAGE_SCSI); > + break; > + default: > + error_report("unknown device id\n"); > + break; > + > + } > > I'll move the "case" to the step 7 as it should be. > I meant step 6* : Add the virtio-blk device. the virtio-blk-pci set the PCI IDs on the same way as for virtio-blk. > Fred > >