From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmgxA-0007lD-Ux for qemu-devel@nongnu.org; Wed, 12 Jun 2013 05:02:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Umgx8-0000dt-5k for qemu-devel@nongnu.org; Wed, 12 Jun 2013 05:02:52 -0400 Date: Wed, 12 Jun 2013 12:03:24 +0300 From: "Michael S. Tsirkin" Message-ID: <20130612090324.GB8060@redhat.com> References: <1371017717-5439-1-git-send-email-fred.konrad@greensocs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1371017717-5439-1-git-send-email-fred.konrad@greensocs.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RESEND PATCH] virtio-scsi: forward scsibus for virtio-scsi-pci. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fred.konrad@greensocs.com Cc: kwolf@redhat.com, aliguori@us.ibm.com, aik@ozlabs.ru, mark.burton@greensocs.com, qemu-devel@nongnu.org, qemu-stable@nongnu.org, pbonzini@redhat.com On Wed, Jun 12, 2013 at 08:15:17AM +0200, fred.konrad@greensocs.com wrote= : > From: KONRAD Frederic >=20 > This fix a bug with scsi hotplug on virtio-scsi-pci: >=20 > As virtio-scsi-pci doesn't have any scsi bus, we need to forward scsi-h= ot-add > to the virtio-scsi-device plugged on the virtio-bus. >=20 > Cc: qemu-stable@nongnu.org > Reported-by: Alexey Kardashevskiy > Reviewed-by: Andreas F=E4rber > Signed-off-by: KONRAD Frederic Acked-by: Michael S. Tsirkin Note: we don't seem to have any decent way to add disks to devices: no QMP interface, pci address is required instead of using an id ... Anyone can be bothered to fix this? > --- > hw/pci/pci-hotplug.c | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/pci/pci-hotplug.c b/hw/pci/pci-hotplug.c > index 12287d1..c708752 100644 > --- a/hw/pci/pci-hotplug.c > +++ b/hw/pci/pci-hotplug.c > @@ -30,6 +30,8 @@ > #include "monitor/monitor.h" > #include "hw/scsi/scsi.h" > #include "hw/virtio/virtio-blk.h" > +#include "hw/virtio/virtio-scsi.h" > +#include "hw/virtio/virtio-pci.h" > #include "qemu/config-file.h" > #include "sysemu/blockdev.h" > #include "qapi/error.h" > @@ -79,13 +81,26 @@ static int scsi_hot_add(Monitor *mon, DeviceState *= adapter, > { > SCSIBus *scsibus; > SCSIDevice *scsidev; > + VirtIOPCIProxy *virtio_proxy; > =20 > scsibus =3D (SCSIBus *) > object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)), > TYPE_SCSI_BUS); > if (!scsibus) { > - error_report("Device is not a SCSI adapter"); > - return -1; > + /* > + * Check if the adapter is a virtio-scsi-pci, and forward scsi= _hot_add > + * to the virtio-scsi-device. > + */ > + if (!object_dynamic_cast(OBJECT(adapter), TYPE_VIRTIO_SCSI_PCI= )) { > + error_report("Device is not a SCSI adapter"); > + return -1; > + } > + virtio_proxy =3D VIRTIO_PCI(adapter); > + adapter =3D DEVICE(virtio_proxy->bus.vdev); > + scsibus =3D (SCSIBus *) > + object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->chi= ld_bus)), > + TYPE_SCSI_BUS); > + assert(scsibus); > } > =20 > /* > --=20 > 1.8.1.4