From nobody Tue Feb 10 06:43:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1586350799; cv=none; d=zohomail.com; s=zohoarc; b=lCAF8D5wQiLnrg5AHct7lcfTRMzCH6Csl46J/ZS5DNbUKez5ruX0pP58RUrw9U9WUoXoYGjyrK/wsobb+lz7Y9AdSNlvsSfwu+Hi1stb1DddhLXlxWAgihvPMmRkUwtT908NQSOAO73TJ5U39d3g2wQu0cV1EH5DSycLa9nmGxI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586350799; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7PvThwaBePpwSM5AXFpW6zkwSfIlxIj26ZgycGq9hX8=; b=hZNPkGyX72SxL8mFhwaHVg7pq0aYqcxetT+oYk596DgJAzj0iKWkYwY/1dmZF0wSheWIkliIulj4J16TwHJIFwAgXncrlkunGg5sBhORdJX0K8hBQ9fij6gqmWnZr2MZkOdrbZnCmRgu7GCzW9Xj5VYbsynkyr+XYkuYOkIntiQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586350799475265.88226170478174; Wed, 8 Apr 2020 05:59:59 -0700 (PDT) Received: from localhost ([::1]:35706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMAJC-0001jz-AW for importer@patchew.org; Wed, 08 Apr 2020 08:59:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39719) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jMAI6-0008VE-6t for qemu-devel@nongnu.org; Wed, 08 Apr 2020 08:58:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jMAI4-000578-D5 for qemu-devel@nongnu.org; Wed, 08 Apr 2020 08:58:49 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:3735 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jMAI4-00054k-1T for qemu-devel@nongnu.org; Wed, 08 Apr 2020 08:58:48 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id DB99FAAF32453AD37B68; Wed, 8 Apr 2020 20:58:39 +0800 (CST) Received: from DESKTOP-D7EVK5B.china.huawei.com (10.173.221.29) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Wed, 8 Apr 2020 20:58:32 +0800 From: Yubo Miao To: , , Subject: [PATCH v6 2/8] fw_cfg: Write the extra roots into the fw_cfg Date: Wed, 8 Apr 2020 20:58:10 +0800 Message-ID: <20200408125816.955-3-miaoyubo@huawei.com> X-Mailer: git-send-email 2.24.1.windows.2 In-Reply-To: <20200408125816.955-1-miaoyubo@huawei.com> References: <20200408125816.955-1-miaoyubo@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.173.221.29] X-CFilter-Loop: Reflected Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 45.249.212.191 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: berrange@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, xiexiangyou@huawei.com, miaoyubo@huawei.com, imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: miaoyubo Write the extra roots into the fw_cfg therefore the uefi could get the extra roots. Only if the uefi know there are extra roots, the config space of devices behind the root could be obtained. Signed-off-by: miaoyubo --- hw/arm/virt.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 7dc96abf72..0fdfe4129c 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -77,6 +77,7 @@ #include "hw/acpi/generic_event_device.h" #include "hw/virtio/virtio-iommu.h" #include "hw/char/pl011.h" +#include "hw/pci/pci_bus.h" =20 #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \ static void virt_##major##_##minor##_class_init(ObjectClass *oc, \ @@ -1435,6 +1436,12 @@ void virt_machine_done(Notifier *notifier, void *dat= a) ARMCPU *cpu =3D ARM_CPU(first_cpu); struct arm_boot_info *info =3D &vms->bootinfo; AddressSpace *as =3D arm_boot_address_space(cpu, info); + PCIHostState *s =3D OBJECT_CHECK(PCIHostState, + object_resolve_path_type("", + "pcie-host-bridge", NULL), + TYPE_PCI_HOST_BRIDGE); + + PCIBus *bus =3D s->bus; =20 /* * If the user provided a dtb, we assume the dynamic sysbus nodes @@ -1453,6 +1460,22 @@ void virt_machine_done(Notifier *notifier, void *dat= a) exit(1); } =20 + if (bus) { + int extra_hosts =3D 0; + QLIST_FOREACH(bus, &bus->child, sibling) { + /* look for expander root buses */ + if (pci_bus_is_root(bus)) { + extra_hosts++; + } + } + if (extra_hosts && vms->fw_cfg) { + uint64_t *val =3D g_malloc(sizeof(*val)); + *val =3D cpu_to_le64(extra_hosts); + fw_cfg_add_file(vms->fw_cfg, + "etc/extra-pci-roots", val, sizeof(*val)); + } + } + virt_acpi_setup(vms); virt_build_smbios(vms); } --=20 2.19.1