[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/56] virtio-scsi: forward scsibus for virtio-scsi-
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 05/56] virtio-scsi: forward scsibus for virtio-scsi-pci. |
Date: |
Tue, 13 Aug 2013 10:10:29 -0500 |
From: KONRAD Frederic <address@hidden>
This fix a bug with scsi hotplug on virtio-scsi-pci:
As virtio-scsi-pci doesn't have any scsi bus, we need to forward scsi-hot-add
to the virtio-scsi-device plugged on the virtio-bus.
Cc: address@hidden
Reported-by: Alexey Kardashevskiy <address@hidden>
Reviewed-by: Andreas Färber <address@hidden>
Signed-off-by: KONRAD Frederic <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
---
hw/pci/pci-hotplug.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
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;
scsibus = (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 = VIRTIO_PCI(adapter);
+ adapter = DEVICE(virtio_proxy->bus.vdev);
+ scsibus = (SCSIBus *)
+ object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)),
+ TYPE_SCSI_BUS);
+ assert(scsibus);
}
/*
--
1.7.9.5
- [Qemu-devel] Patch Round-up for stable 1.5.3, freeze on 2013-08-16, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 02/56] arm/boot: Free dtb blob memory after use, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 03/56] ppc: do not register IABR SPR twice for 603e, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 01/56] s390/virtio-ccw: Fix virtio reset, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 04/56] qxl: Fix QXLRam initialisation., Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 05/56] virtio-scsi: forward scsibus for virtio-scsi-pci.,
Michael Roth <=
- [Qemu-devel] [PATCH 06/56] acl: acl_add can't insert before last list element, fix, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 07/56] usb-host-libusb: set USB_DEV_FLAG_IS_HOST, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 08/56] s390/ipl: Fix boot order, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 09/56] Fix iSCSI crash on SG_IO with an iovector, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 10/56] block/ssh: Set bdrv_has_zero_init according to the file type., Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 13/56] Revert "migration: do not sent zero pages in bulk stage", Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 11/56] gluster: Return bdrv_has_zero_init = 0, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 12/56] vmdk: remove wrong calculation of relative path, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 14/56] migration: do not overwrite zero pages, Michael Roth, 2013/08/13
- [Qemu-devel] [PATCH 15/56] raw-posix: Fix /dev/cdrom magic on OS X, Michael Roth, 2013/08/13