From patchwork Mon Mar 12 18:33:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey G X-Patchwork-Id: 10277005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94DD560211 for ; Mon, 12 Mar 2018 18:38:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85F1B28DD8 for ; Mon, 12 Mar 2018 18:38:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A84928DF2; Mon, 12 Mar 2018 18:38:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1CDBE28DD8 for ; Mon, 12 Mar 2018 18:38:51 +0000 (UTC) Received: from localhost ([::1]:33878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evSLS-0004RV-Md for patchwork-qemu-devel@patchwork.kernel.org; Mon, 12 Mar 2018 14:38:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evSIC-0007wX-AU for qemu-devel@nongnu.org; Mon, 12 Mar 2018 14:35:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evSIB-0005F6-B9 for qemu-devel@nongnu.org; Mon, 12 Mar 2018 14:35:28 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:43995) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evSIB-0005Ec-0F for qemu-devel@nongnu.org; Mon, 12 Mar 2018 14:35:27 -0400 Received: by mail-pl0-x241.google.com with SMTP id f23-v6so9824183plr.10 for ; Mon, 12 Mar 2018 11:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=y7qdy0z2OLXt8ZV7cIca/hXmMWJ5HVRW53zHpVjIVWQ=; b=Nq7JCOXWg1mYn21obaGI3YB7y7O8KwE0wCXDGeAf/hEXunaU138BAEY4OKICNJ+GY6 7dCMeg/4ACOW2iHlo3RPhxSiBJonCiOX0A1PUkalqQCHEmkAZ7JBmYqmajVgTTg1HgtR rXAaNe8FqhqVkSaYW/j5Rh7NJUJBjHU89hpD6GREK0mbj4VqcZ2lOCQ0mlu6vNLpoQsB ys6bf4Auhvbu5JBeOgsn3ujKyoBd7tBjEtzCwqd36l3NHvr/Li79roN3Ugo/9r2lS2Jr MC4yR2gcdckK9QOg6FYvKfemy7hQy8aX6qYEsTNyjO9CP+mnMi8lnaxkytPSN6qy8s1G ceIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=y7qdy0z2OLXt8ZV7cIca/hXmMWJ5HVRW53zHpVjIVWQ=; b=O32Kb5Tujh4fcStsyOayXaDFvsTlrK+CYfBo5nPFwRTyPX38NIncnntdETbP7u8h3d uw9gpeEeyRcmDLODNdyjFHoBatCVTerE78Mea3cFDjDYrpBrcMJv7FHb8jsqys4uoxfn 7UlBLum8MNastYjNGZJEBbtT1otCmmOTdkJSb0iIvcmLajIbW2OCYWLUHBvYpqzvnxzZ UPzSPolTBjqQd5X6Dc5JB2/Ob9WEVFOjyYmYTPuTkORqrYECX5BJWR9Vqubd/nZ4SwtF uQcXnlsQkSIjFIeJEie8rYMeXq8I1SXd6e0+a5EOKilueN6VxlfUVBCLgAS3H0IvogZw ul7w== X-Gm-Message-State: AElRT7HqUDjtEtzH6xsSl1sTj+PblRecN5TkU7DYEaMiQzIW5Xb6SgVp S0ZsP6+8S7a3Dw5Adm++f7o2gA== X-Google-Smtp-Source: AG47ELt4Y7CERup/dkbVD6Bo/+ji/ni3i/wVcByGh8y7gGKAaz1SiI0Fwzxz5rAb4CbVBwsWjzMchA== X-Received: by 2002:a17:902:f24:: with SMTP id 33-v6mr5819476ply.242.1520879726195; Mon, 12 Mar 2018 11:35:26 -0700 (PDT) Received: from localhost.localdomain ([217.150.73.25]) by smtp.gmail.com with ESMTPSA id w10sm14468666pgr.57.2018.03.12.11.35.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 11:35:25 -0700 (PDT) From: Alexey Gerasimenko To: xen-devel@lists.xenproject.org Date: Tue, 13 Mar 2018 04:33:59 +1000 Message-Id: <4d4ea2e1b6632474660bf4e46126984256b8db3f.1520867956.git.x1917x@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [RFC PATCH 14/30] pc/q35: Apply PCI bus BSEL property for Xen PCI device hotplug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcel Apfelbaum , Igor Mammedov , "Michael S. Tsirkin" , Alexey Gerasimenko , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Q35 we still need to assign BSEL property to bus(es) for PCI device add/hotplug to work. Extend acpi_set_pci_info() function to support Q35 as well. Previously it was limited to find_i440fx() call, this patch adds new (trivial) function find_q35() which returns root PCIBus object on Q35, in a way similar to what find_i440fx does. Signed-off-by: Alexey Gerasimenko --- hw/acpi/pcihp.c | 6 +++++- hw/pci-host/q35.c | 8 ++++++++ include/hw/i386/pc.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 91c82fdc7a..f70d8620d7 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -105,7 +105,11 @@ static void acpi_set_pci_info(void) } bsel_is_set = true; - bus = find_i440fx(); /* TODO: Q35 support */ + bus = find_i440fx(); + if (!bus) { + bus = find_q35(); + } + if (bus) { /* Scan all PCI buses. Set property to enable acpi based hotplug. */ pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc); diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index a36a1195e4..8c1603fce9 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -258,6 +258,14 @@ static void q35_host_initfn(Object *obj) IO_APIC_DEFAULT_ADDRESS - 1); } +PCIBus *find_q35(void) +{ + PCIHostState *s = OBJECT_CHECK(PCIHostState, + object_resolve_path("/machine/q35", NULL), + TYPE_PCI_HOST_BRIDGE); + return s ? s->bus : NULL; +} + static const TypeInfo q35_host_info = { .name = TYPE_Q35_HOST_DEVICE, .parent = TYPE_PCIE_HOST_BRIDGE, diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index bb49165fe0..96d74b35bd 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -302,6 +302,9 @@ PCIBus *find_i440fx(void); extern PCIDevice *piix4_dev; int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); +/* q35.c */ +PCIBus *find_q35(void); + /* pc_sysfw.c */ void pc_system_firmware_init(MemoryRegion *rom_memory, bool isapc_ram_fw);