From patchwork Tue Jul 29 10:27:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 374402 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1B4EA1400AA for ; Tue, 29 Jul 2014 20:27:51 +1000 (EST) Received: from localhost ([::1]:44574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC4dJ-0001IN-8W for incoming@patchwork.ozlabs.org; Tue, 29 Jul 2014 06:27:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC4cv-00011m-Mj for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:27:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XC4co-0002tx-0e for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:27:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XC4cn-0002tc-NU for qemu-devel@nongnu.org; Tue, 29 Jul 2014 06:27:17 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6TARHYS031599 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 29 Jul 2014 06:27:17 -0400 Received: from redhat.com (ovpn-116-80.ams2.redhat.com [10.36.116.80]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id s6TARFfp010851; Tue, 29 Jul 2014 06:27:16 -0400 Date: Tue, 29 Jul 2014 12:27:35 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1406629644-13340-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com Subject: [Qemu-devel] [PATCH] acpi-build: minor code cleanup X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fix up and add comments to clarify code, plus a trivial code change for clarity. Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 779160f..ec86f1b 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -825,9 +825,9 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state) bool bus_hotplug_support = false; /* - skip bridge subtree creation if bridge hotplug is disabled - to make it compatible with 1.7 machine type - */ + * Skip bridge subtree creation if bridge hotplug is disabled + * to make acpi tables compatible with legacy machine types. + */ if (!child->pcihp_bridge_en && bus->parent_dev) { return; } @@ -869,6 +869,7 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state) PCIDeviceClass *pc; PCIDevice *pdev = bus->devices[i]; int slot = PCI_SLOT(i); + bool bridge_in_acpi; if (!pdev) { continue; @@ -878,8 +879,13 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state) pc = PCI_DEVICE_GET_CLASS(pdev); dc = DEVICE_GET_CLASS(pdev); - if (pc->class_id == PCI_CLASS_BRIDGE_ISA || - (pc->is_bridge && child->pcihp_bridge_en)) { + /* When hotplug for bridges is enabled, bridges are + * described in ACPI separately (see build_pci_bus_end). + * In this case they aren't themselves hot-pluggable. + */ + bridge_in_acpi = pc->is_bridge && child->pcihp_bridge_en; + + if (pc->class_id == PCI_CLASS_BRIDGE_ISA || bridge_in_acpi) { set_bit(slot, slot_device_system); } @@ -891,7 +897,7 @@ static void build_pci_bus_end(PCIBus *bus, void *bus_state) } } - if (!dc->hotpluggable || (pc->is_bridge && child->pcihp_bridge_en)) { + if (!dc->hotpluggable || bridge_in_acpi) { clear_bit(slot, slot_hotplug_enable); } }