From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5cZd-0002LS-F3 for qemu-devel@nongnu.org; Tue, 21 Jan 2014 09:45:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W5cZX-0008BC-Bh for qemu-devel@nongnu.org; Tue, 21 Jan 2014 09:45:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W5cZX-0008Av-3V for qemu-devel@nongnu.org; Tue, 21 Jan 2014 09:44:59 -0500 From: Igor Mammedov Date: Tue, 21 Jan 2014 15:40:05 +0100 Message-Id: <1390315206-20903-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1390315206-20903-1-git-send-email-imammedo@redhat.com> References: <1390315206-20903-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] hw:acpi:pcihp: assume root PCI bus if bus has no ACPI_PCIHP_PROP_BSEL property List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@amazon.com, mst@redhat.com when running with machine types older than 1.7 (i.e. without ACPI builtin tables), PCI bus won't have ACPI_PCIHP_PROP_BSEL property set. Taking in account that acpi hotplug handler in 1.7 and older machines is called only for root PCI bus, to make pcihp code compatible with legacy machine types assume that bus without ACPI_PCIHP_PROP_BSEL property has it equal to 0 and bail out if it's not root bus. Signed-off-by: Igor Mammedov --- hw/acpi/pcihp.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 6d34fe9..76dce8d 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -63,14 +63,10 @@ static int acpi_pcihp_get_bsel(PCIBus *bus) { QObject *o = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL); - int64_t bsel = -1; if (o) { - bsel = qint_get_int(qobject_to_qint(o)); + return qint_get_int(qobject_to_qint(o)); } - if (bsel < 0) { - return -1; - } - return bsel; + return 0; } static void acpi_pcihp_test_hotplug_bus(PCIBus *bus, void *opaque) @@ -190,7 +186,7 @@ int acpi_pcihp_device_hotplug(AcpiPciHpState *s, PCIDevice *dev, { int slot = PCI_SLOT(dev->devfn); int bsel = acpi_pcihp_get_bsel(dev->bus); - if (bsel < 0) { + if ((bsel == 0) && (dev->bus != s->root)) { return -1; } -- 1.7.1