* [Qemu-devel] [PATCH] hotplug: fix "pci_add storage if=scsi"
@ 2009-10-13 11:59 Gerd Hoffmann
2009-10-13 15:53 ` Anthony Liguori
0 siblings, 1 reply; 3+ messages in thread
From: Gerd Hoffmann @ 2009-10-13 11:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Explicitly add the drive to the bus of the newly created scsi adapter
instead of hoping that scsi_bus_legacy_handle_cmdline() picks it up
correctly.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/lsi53c895a.c | 4 +++-
hw/pci-hotplug.c | 15 +++++++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index a4d3a57..012aaf6 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2178,7 +2178,9 @@ static int lsi_scsi_init(PCIDevice *dev)
lsi_soft_reset(s);
scsi_bus_new(&s->bus, &dev->qdev, 1, LSI_MAX_DEVS, lsi_command_complete);
- scsi_bus_legacy_handle_cmdline(&s->bus);
+ if (!dev->qdev.hotplugged) {
+ scsi_bus_legacy_handle_cmdline(&s->bus);
+ }
register_savevm("lsiscsi", -1, 0, lsi_scsi_save, lsi_scsi_load, s);
return 0;
}
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index 08b5826..2a192d3 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -159,7 +159,18 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
switch (type) {
case IF_SCSI:
+ if (!dinfo) {
+ monitor_printf(mon, "scsi requires a backing file/device.\n");
+ return NULL;
+ }
dev = pci_create(bus, devfn, "lsi53c895a");
+ if (qdev_init(&dev->qdev) < 0)
+ dev = NULL;
+ if (dev) {
+ BusState *scsibus = QLIST_FIRST(&dev->qdev.child_bus);
+ scsi_bus_legacy_add_drive(DO_UPCAST(SCSIBus, qbus, scsibus),
+ dinfo, dinfo->unit);
+ }
break;
case IF_VIRTIO:
if (!dinfo) {
@@ -168,12 +179,12 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
}
dev = pci_create(bus, devfn, "virtio-blk-pci");
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
+ if (qdev_init(&dev->qdev) < 0)
+ dev = NULL;
break;
default:
dev = NULL;
}
- if (!dev || qdev_init(&dev->qdev) < 0)
- return NULL;
return dev;
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hotplug: fix "pci_add storage if=scsi"
2009-10-13 11:59 [Qemu-devel] [PATCH] hotplug: fix "pci_add storage if=scsi" Gerd Hoffmann
@ 2009-10-13 15:53 ` Anthony Liguori
2009-10-13 16:01 ` Dustin Kirkland
0 siblings, 1 reply; 3+ messages in thread
From: Anthony Liguori @ 2009-10-13 15:53 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel, Dustin Kirkland
Gerd Hoffmann wrote:
> Explicitly add the drive to the bus of the newly created scsi adapter
> instead of hoping that scsi_bus_legacy_handle_cmdline() picks it up
> correctly.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>
I think that this is also broken in stable-0.11. The backport seems
non-trivial. Could you take a look?
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hotplug: fix "pci_add storage if=scsi"
2009-10-13 15:53 ` Anthony Liguori
@ 2009-10-13 16:01 ` Dustin Kirkland
0 siblings, 0 replies; 3+ messages in thread
From: Dustin Kirkland @ 2009-10-13 16:01 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Gerd Hoffmann, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 767 bytes --]
On Tue, 2009-10-13 at 10:53 -0500, Anthony Liguori wrote:
> Gerd Hoffmann wrote:
> > Explicitly add the drive to the bus of the newly created scsi adapter
> > instead of hoping that scsi_bus_legacy_handle_cmdline() picks it up
> > correctly.
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> >
>
> I think that this is also broken in stable-0.11. The backport seems
> non-trivial. Could you take a look?
Definitely broken in stable-0.11.
I took a look at backporting this patch, but it seems that (at least) in
stable-0.11:
* scsi_bus_legacy_handle_cmdline() doesn't exist
* scsi_bus_new() syntax may have changed (?)
* pci_create() syntax may have changed (?)
I'll gladly test and ack a backport ;-)
Thanks,
:-Dustin
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-13 16:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-13 11:59 [Qemu-devel] [PATCH] hotplug: fix "pci_add storage if=scsi" Gerd Hoffmann
2009-10-13 15:53 ` Anthony Liguori
2009-10-13 16:01 ` Dustin Kirkland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).