From nobody Mon Feb 9 02:28:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502795838764315.5912429067613; Tue, 15 Aug 2017 04:17:18 -0700 (PDT) Received: from localhost ([::1]:53737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhZqX-0001V8-Kj for importer@patchew.org; Tue, 15 Aug 2017 07:17:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhZpE-0000f7-Lf for qemu-devel@nongnu.org; Tue, 15 Aug 2017 07:15:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhZpA-0005jx-MB for qemu-devel@nongnu.org; Tue, 15 Aug 2017 07:15:56 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:10037) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dhZpA-0005jb-GY for qemu-devel@nongnu.org; Tue, 15 Aug 2017 07:15:52 -0400 X-IronPort-AV: E=Sophos;i="5.41,377,1498521600"; d="scan'208";a="443827950" From: Anthony PERARD To: Date: Tue, 15 Aug 2017 12:15:48 +0100 Message-ID: <20170815111549.6232-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170815111549.6232-1-anthony.perard@citrix.com> References: <20170815111549.6232-1-anthony.perard@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Subject: [Qemu-devel] [PATCH for-2.10 v2 1/2] hw/acpi: Call acpi_set_pci_info when no ACPI tables needed 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: Stefano Stabellini , Eduardo Habkost , "Michael S. Tsirkin" , Bruce Rogers , Paolo Bonzini , Igor Mammedov , Anthony PERARD , xen-devel@lists.xenproject.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To do PCI passthrough with Xen, the property acpi-pcihp-bsel needs to be set, but this was done only when ACPI tables are built which is not needed for a Xen guest. The need for the property starts with commit "pc: pcihp: avoid adding ACPI_PCIHP_PROP_BSEL twice" (f0c9d64a68b776374ec4732424a3e27753ce37b6). Set pci info before checking for the needs to build ACPI tables. Assign bsel=3D0 property only to the root bus on Xen as there is no support in the Xen ACPI tables for a different value. Reported-by: Sander Eikelenboom Signed-off-by: Anthony PERARD --- Changes in V2: - check for acpi_enabled before calling acpi_set_pci_info. - set the property on the root bus only. This patch would be a canditade to backport to 2.9. CC: Stefano Stabellini CC: Bruce Rogers --- hw/i386/acpi-build.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 98dd424678..c0483b96cf 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -46,6 +46,7 @@ #include "sysemu/tpm_backend.h" #include "hw/timer/mc146818rtc_regs.h" #include "sysemu/numa.h" +#include "hw/xen/xen.h" =20 /* Supported chipsets: */ #include "hw/acpi/piix4.h" @@ -518,8 +519,13 @@ static void acpi_set_pci_info(void) unsigned bsel_alloc =3D ACPI_PCIHP_BSEL_DEFAULT; =20 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= ); + if (xen_enabled()) { + /* Assign BSEL property to root bus only. */ + acpi_set_bsel(bus, &bsel_alloc); + } else { + /* Scan all PCI buses. Set property to enable acpi based hotpl= ug. */ + pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_a= lloc); + } } } =20 @@ -2871,6 +2877,14 @@ void acpi_setup(void) AcpiBuildState *build_state; Object *vmgenid_dev; =20 + if (!acpi_enabled) { + ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); + return; + } + + /* Assign BSEL property on hotpluggable PCI buses. */ + acpi_set_pci_info(); + if (!pcms->fw_cfg) { ACPI_BUILD_DPRINTF("No fw cfg. Bailing out.\n"); return; @@ -2881,15 +2895,8 @@ void acpi_setup(void) return; } =20 - if (!acpi_enabled) { - ACPI_BUILD_DPRINTF("ACPI disabled. Bailing out.\n"); - return; - } - build_state =3D g_malloc0(sizeof *build_state); =20 - acpi_set_pci_info(); - acpi_build_tables_init(&tables); acpi_build(&tables, MACHINE(pcms)); =20 --=20 Anthony PERARD