From nobody Mon Feb 9 10:28:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1555312090; cv=none; d=zoho.com; s=zohoarc; b=SGclXkREqoyhPgdbqnC85RpHU4KjHGODtMo8q/qAJrHj7uPEnVUolr08Gcwrbcfbw5LjqwlxZ5mvZD1rUs1n20Hzl2R1hrZl9r1xIlU7o18Mn24UVSRUpXIGQo6qA2HCZUUeocsVQya9M+LtgIQBF2l2+KnFAZY2yIaIYG/3mcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555312090; h=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:ARC-Authentication-Results; bh=EaNRxyxe/T81bSdHItuVksGAA9zAKEkmw8QGM/6nfhg=; b=OvPzfdQlQ8kIQrKx33wMYZ16HVWdnRqXtlXsZ4opFYW6/LzfT0OzRKDbp8S4+xJMtxKqfrcD6PO4ktoB2qmi286SNk3HVChlQ4OjCMbuPaB3UZL+Kbv7e9hoNTSYeJwtEnsnYpGjARo8kv11nEi408FkSzlx7mgGJQdStW4yuGE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555312090472747.4335970788362; Mon, 15 Apr 2019 00:08:10 -0700 (PDT) Received: from localhost ([127.0.0.1]:45887 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFvir-0002i9-HF for importer@patchew.org; Mon, 15 Apr 2019 03:08:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFveu-0008EL-1w for qemu-devel@nongnu.org; Mon, 15 Apr 2019 03:04:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFver-0004HD-TR for qemu-devel@nongnu.org; Mon, 15 Apr 2019 03:04:03 -0400 Received: from mga06.intel.com ([134.134.136.31]:30998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hFvek-0004AN-69; Mon, 15 Apr 2019 03:03:56 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 00:03:49 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga001.fm.intel.com with ESMTP; 15 Apr 2019 00:03:48 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,352,1549958400"; d="scan'208";a="164783117" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Mon, 15 Apr 2019 15:03:06 +0800 Message-Id: <20190415070307.13668-4-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190415070307.13668-1-richardw.yang@linux.intel.com> References: <20190415070307.13668-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 134.134.136.31 Subject: [Qemu-devel] [PATCH v2 3/4] hw/arm/virt-acpi-build: pass AcpiMcfgInfo to build_mcfg() 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: yang.zhong@intel.com, peter.maydell@linaro.org, mst@redhat.com, shannon.zhaosl@gmail.com, Wei Yang , imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" To build MCFG, two information is necessary: * bus number * base address Abstract these two information to AcpiMcfgInfo so that build_mcfg and build_mcfg_q35 will have the same declaration. Signed-off-by: Wei Yang Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- v2: * for arm platform, construct a AcpiMcfgInfo directly --- hw/arm/virt-acpi-build.c | 17 ++++++++++------- hw/i386/acpi-build.c | 5 ----- include/hw/acpi/aml-build.h | 5 +++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index e09e7eff8d..7350f207b5 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -546,21 +546,18 @@ build_srat(GArray *table_data, BIOSLinker *linker, Vi= rtMachineState *vms) } =20 static void -build_mcfg(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) +build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info) { AcpiTableMcfg *mcfg; - const MemMapEntry *memmap =3D vms->memmap; - int ecam_id =3D VIRT_ECAM_ID(vms->highmem_ecam); int len =3D sizeof(*mcfg) + sizeof(mcfg->allocation[0]); =20 mcfg =3D acpi_data_push(table_data, len); - mcfg->allocation[0].address =3D cpu_to_le64(memmap[ecam_id].base); + mcfg->allocation[0].address =3D cpu_to_le64(info->base); =20 /* Only a single allocation so no need to play with segments */ mcfg->allocation[0].pci_segment =3D cpu_to_le16(0); mcfg->allocation[0].start_bus_number =3D 0; - mcfg->allocation[0].end_bus_number =3D - PCIE_MMCFG_BUS(memmap[ecam_id].size - 1); + mcfg->allocation[0].end_bus_number =3D PCIE_MMCFG_BUS(info->size - 1); =20 build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1, NULL, N= ULL); } @@ -801,7 +798,13 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildT= ables *tables) build_gtdt(tables_blob, tables->linker, vms); =20 acpi_add_table(table_offsets, tables_blob); - build_mcfg(tables_blob, tables->linker, vms); + { + AcpiMcfgInfo mcfg =3D { + .base =3D vms->memmap[VIRT_ECAM_ID(vms->highmem_ecam)].base, + .size =3D vms->memmap[VIRT_ECAM_ID(vms->highmem_ecam)].size, + }; + build_mcfg(tables_blob, tables->linker, &mcfg); + } =20 acpi_add_table(table_offsets, tables_blob); build_spcr(tables_blob, tables->linker, vms); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index f0d27bffd6..7613b245cf 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -86,11 +86,6 @@ /* Default IOAPIC ID */ #define ACPI_BUILD_IOAPIC_ID 0x0 =20 -typedef struct AcpiMcfgInfo { - uint64_t base; - uint32_t size; -} AcpiMcfgInfo; - typedef struct AcpiPmInfo { bool s3_disabled; bool s4_disabled; diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 1a563ad756..22dd593068 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -223,6 +223,11 @@ struct AcpiBuildTables { BIOSLinker *linker; } AcpiBuildTables; =20 +typedef struct AcpiMcfgInfo { + uint64_t base; + uint32_t size; +} AcpiMcfgInfo; + /** * init_aml_allocator: * --=20 2.19.1