From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIfzW-0005Bm-I5 for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIfzQ-00057o-R3 for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:21 -0500 Received: from [199.232.76.173] (port=49966 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIfzQ-00057g-Ly for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37166) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIfzQ-0007nl-6f for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:16 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBAABFh5017999 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Dec 2009 05:11:15 -0500 From: Gerd Hoffmann Date: Thu, 10 Dec 2009 11:11:05 +0100 Message-Id: <1260439868-15061-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1260439868-15061-1-git-send-email-kraxel@redhat.com> References: <1260439868-15061-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [FOR 0.12 PATCH 1/4] pci: don't abort() when trying to hotplug with acpi off. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann The PCI bus on x86 requires ACPI for hotplug support, thus disbling ACPI also disables hotplug for the PCI bus. This patch makes qemu check whenever the PCI bus in question can handle hotplug before trying to add devices. This is needed because qdev will abort() on any attempt to hotplug devices into a non-hotpluggable bus. Signed-off-by: Gerd Hoffmann --- hw/pci-hotplug.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 081d6d1..7e5c51d 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -40,7 +40,18 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, const char *opts_str) { QemuOpts *opts; - int ret; + PCIBus *bus; + int ret, devfn; + + bus = pci_get_bus_devfn(&devfn, devaddr); + if (!bus) { + monitor_printf(mon, "Invalid PCI device address %s\n", devaddr); + return NULL; + } + if (!((BusState*)bus)->allow_hotplug) { + monitor_printf(mon, "PCI bus doesn't support hotplug\n"); + return NULL; + } opts = qemu_opts_parse(&qemu_net_opts, opts_str ? opts_str : "", NULL); if (!opts) { @@ -179,6 +190,10 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon, monitor_printf(mon, "Invalid PCI device address %s\n", devaddr); return NULL; } + if (!((BusState*)bus)->allow_hotplug) { + monitor_printf(mon, "PCI bus doesn't support hotplug\n"); + return NULL; + } switch (type) { case IF_SCSI: -- 1.6.5.2