From patchwork Tue Dec 15 17:30:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfgang Mauerer X-Patchwork-Id: 41211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 40F9EB6F17 for ; Wed, 16 Dec 2009 04:29:49 +1100 (EST) Received: from localhost ([127.0.0.1]:48735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKbDW-0001q1-Lk for incoming@patchwork.ozlabs.org; Tue, 15 Dec 2009 12:29:46 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NKbBw-000134-Ri for qemu-devel@nongnu.org; Tue, 15 Dec 2009 12:28:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NKbBt-0000yT-1K for qemu-devel@nongnu.org; Tue, 15 Dec 2009 12:28:08 -0500 Received: from [199.232.76.173] (port=38652 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NKbBs-0000xv-7z for qemu-devel@nongnu.org; Tue, 15 Dec 2009 12:28:04 -0500 Received: from gecko.sbs.de ([194.138.37.40]:21167) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NKbBr-0003u4-85 for qemu-devel@nongnu.org; Tue, 15 Dec 2009 12:28:03 -0500 Received: from mail2.sbs.de (localhost [127.0.0.1]) by gecko.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id nBFHRxQm029835; Tue, 15 Dec 2009 18:27:59 +0100 Received: from [139.25.109.82] (mchn315c.mchp.siemens.de [139.25.109.82]) by mail2.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id nBFHRwee027116; Tue, 15 Dec 2009 18:27:59 +0100 Message-ID: <4B27C7B1.9030609@siemens.com> Date: Tue, 15 Dec 2009 18:30:25 +0100 From: Wolfgang Mauerer User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Gerd Hoffmann X-Enigmail-Version: 0.95.7 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 Cc: "qemu-devel@nongnu.org" Subject: [Qemu-devel] [PATCH, RFC] Allow adding empty SCSI controllers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi Gerd, in commit 5b684b5a56e81f6f, you introduced an explicit check to prevent adding SCSI controllers without attached disks to the system. Is there any other method to introduce disk-less controllers into the system? If not, I'd suggest to remove the check (patch is attached) -- there are some situations when you want empty SCSI controllers, for instance for the libvirt hotplug/remove framework currently under development (see http://article.gmane.org/gmane.comp.emulators.libvirt/19043) Thanks, Wolfgang commit c827742224b9a3a0d9dad0ce36c7e59c1a796ec1 Author: Wolfgang Mauerer Date: Tue Dec 15 18:06:19 2009 +0100 Revert "hotplug: fix "pci_add storage if=scsi"" This reverts commit 5b684b5a56e81f6f88234952fe8ed68010c36e19, and also includes some manual adaptions. There are some cases where addding an empty SCSI controller to a system makes sense, so we should not prohibit this option. Signed-off-by: Wolfgang Mauerer diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 8b8a80b..eee206b 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -2103,9 +2103,7 @@ 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); - if (!dev->qdev.hotplugged) { - scsi_bus_legacy_handle_cmdline(&s->bus); - } + scsi_bus_legacy_handle_cmdline(&s->bus); vmstate_register(-1, &vmstate_lsi_scsi, s); return 0; } diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 6e42776..075be31 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -183,14 +183,10 @@ 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) { + if (dev && dinfo) { if (scsi_hot_add(&dev->qdev, dinfo, 0) != 0) { qdev_unplug(&dev->qdev); dev = NULL; @@ -204,12 +200,15 @@ 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) + return NULL; + if (dinfo && qdev_init(&dev->qdev) < 0) + return NULL; + return dev; }