From nobody Fri Apr 26 18:18:33 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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=1555311981; cv=none; d=zoho.com; s=zohoarc; b=Wdee3NkbXFZzU96b+XOfIErWHjtEKQowPEunR7yjIna81B0Rm0OBVYyfyrTkHWTmolMfSdI4fSL+ZtPY+GgmQrl2KnKw7yTlxnOc0ICqL4gs0d1VUQy7IBeYGEw6A57DxllyMdi7PY8qF1I+rEP2L/RC1GVU+wtgBtHF3w80Of4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555311981; 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=EdbZ39bFyMGW6ekJ7QC1YV5/o/FSh66nQkgr0wD1jdg=; b=dVi/iWHINNnz92CliaQqt/Z/UAXJw8tiWZqU8CzMvX2A9/VRUL+hUW3w5yU3gHcbi56KaXLxhoVynukJXcdnp7T7xz4WzPNduLBYJE+9WZvgHAf+xsDu8Evr8xizAUKqwKLFOBaRs7Pow74es1v9AboKUNLRHVJ81s7fu1TDwiE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155531198126699.51828112386647; Mon, 15 Apr 2019 00:06:21 -0700 (PDT) Received: from localhost ([127.0.0.1]:45868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFvgr-0000yT-Ty for importer@patchew.org; Mon, 15 Apr 2019 03:06:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFveu-0008EK-1x 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-0004H8-TL for qemu-devel@nongnu.org; Mon, 15 Apr 2019 03:04:03 -0400 Received: from mga06.intel.com ([134.134.136.31]:30995) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hFvek-00048B-6D; 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:45 -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:43 -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="164783097" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Mon, 15 Apr 2019 15:03:04 +0800 Message-Id: <20190415070307.13668-2-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 1/4] hw/arm/virt-acpi-build: remove unnecessary variable mcfg_start 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" mcfg_start points to the start of MCFG table and is used in build_header. While this information could be derived from mcfg. This patch removes the unnecessary variable mcfg_start. Signed-off-by: Wei Yang Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/virt-acpi-build.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 857989362a..e09e7eff8d 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -552,7 +552,6 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) 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]); - int mcfg_start =3D table_data->len; =20 mcfg =3D acpi_data_push(table_data, len); mcfg->allocation[0].address =3D cpu_to_le64(memmap[ecam_id].base); @@ -563,8 +562,7 @@ build_mcfg(GArray *table_data, BIOSLinker *linker, Virt= MachineState *vms) mcfg->allocation[0].end_bus_number =3D PCIE_MMCFG_BUS(memmap[ecam_id].size - 1); =20 - build_header(linker, table_data, (void *)(table_data->data + mcfg_star= t), - "MCFG", table_data->len - mcfg_start, 1, NULL, NULL); + build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1, NULL, N= ULL); } =20 /* GTDT */ --=20 2.19.1 From nobody Fri Apr 26 18:18:33 2024 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=1555312079; cv=none; d=zoho.com; s=zohoarc; b=YVY5tLT6y3jU7pY/eJNi0nohsFspVDVu5UxVKCo/AGbQ1XmJZ8/gx0H7ZsjNBuCh6kDcIPOhBbVSeY+5r4SUsHAbBgVwjjaaUVChoXCLAb4dOA7zIY+0Yfc5Pl4nIo2SA/o0r554h6gqU97HkSa8rMIN3FrcnkPT+X4ri4Hgy/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555312079; 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=3zGVcLe8sWkgDbbEOSgHAkUiuqUbiOt37FWo3A/U0Lc=; b=fMZM01TwJGqgbJpeqT8Da2S7+KaZtdFYI6/0laiN0a9tZ8U2MWivwu89aVO3sShg+x+n02mFe0te6eInQJVQu0GI1VBakNitE8hl3nZraPB1fqcEwGbEvzWntfzmkTwD8dJV8f+pC94xApBhZyC7VeQNn0luLjP/jofTR8SNhc0= 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 1555312079634648.8082520895865; Mon, 15 Apr 2019 00:07:59 -0700 (PDT) Received: from localhost ([127.0.0.1]:45884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFvig-0002aF-MK for importer@patchew.org; Mon, 15 Apr 2019 03:07:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFveu-0008EJ-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-0004H7-TN for qemu-devel@nongnu.org; Mon, 15 Apr 2019 03:04:03 -0400 Received: from mga06.intel.com ([134.134.136.31]:30997) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hFvek-00048h-6D; 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:47 -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:45 -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="164783103" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Mon, 15 Apr 2019 15:03:05 +0800 Message-Id: <20190415070307.13668-3-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 2/4] i386, acpi: remove mcfg_ prefix in AcpiMcfgInfo members 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" This is obvious the member in AcpiMcfgInfo describe MCFG's property. Remove the mcfg_ prefix. Signed-off-by: Wei Yang Suggested-by: Igor Mammedov Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/acpi-build.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d009176072..f0d27bffd6 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -87,8 +87,8 @@ #define ACPI_BUILD_IOAPIC_ID 0x0 =20 typedef struct AcpiMcfgInfo { - uint64_t mcfg_base; - uint32_t mcfg_size; + uint64_t base; + uint32_t size; } AcpiMcfgInfo; =20 typedef struct AcpiPmInfo { @@ -2404,11 +2404,11 @@ build_mcfg_q35(GArray *table_data, BIOSLinker *link= er, AcpiMcfgInfo *info) int len =3D sizeof(*mcfg) + 1 * sizeof(mcfg->allocation[0]); =20 mcfg =3D acpi_data_push(table_data, len); - mcfg->allocation[0].address =3D cpu_to_le64(info->mcfg_base); + mcfg->allocation[0].address =3D cpu_to_le64(info->base); /* 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(info->mcfg_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); } @@ -2577,15 +2577,15 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) if (!o) { return false; } - mcfg->mcfg_base =3D qnum_get_uint(qobject_to(QNum, o)); + mcfg->base =3D qnum_get_uint(qobject_to(QNum, o)); qobject_unref(o); - if (mcfg->mcfg_base =3D=3D PCIE_BASE_ADDR_UNMAPPED) { + if (mcfg->base =3D=3D PCIE_BASE_ADDR_UNMAPPED) { return false; } =20 o =3D object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL); assert(o); - mcfg->mcfg_size =3D qnum_get_uint(qobject_to(QNum, o)); + mcfg->size =3D qnum_get_uint(qobject_to(QNum, o)); qobject_unref(o); return true; } --=20 2.19.1 From nobody Fri Apr 26 18:18:33 2024 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 From nobody Fri Apr 26 18:18:33 2024 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=1555311978; cv=none; d=zoho.com; s=zohoarc; b=irWmvLvnRpdNTaudSfJMd9bLF8AAtnRDkcHfSpG/duGRdegcBm74SDjhcBtkhB8ico/xJa/0ZJiHBs8G+bD8Du8HFsVDLQMpaOfBfxMa4GTEpGKFoQKYHV4EwEGtkjbkcxCePA9SdTrLYm+Hye+R1Vl/ZOSc+4ym6oEz0eVuUg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555311978; 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=Az5GCeha1MgIwDTgr76sj8azYqPbF6UubpwDzuUh0vg=; b=Bb99z7yFZQQV4tPRkdl1P6ViN7qEtIKWDFDWk1v1zgt6kYW3mBymQyAnM6nq1IPvc2bOZXYZ/E+flsYkhUSYXLd5FHuQ22rdbEFLSGKMcETWO7XVHKZbCX+AUVpHFGFxuMJCmaJEVrRCOxBrAUh86Lnpsh71OsiMFLJWBJUXdTE= 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155531197864388.23750622253817; Mon, 15 Apr 2019 00:06:18 -0700 (PDT) Received: from localhost ([127.0.0.1]:45870 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFvgv-000110-KO for importer@patchew.org; Mon, 15 Apr 2019 03:06:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFvez-0008I0-MZ for qemu-devel@nongnu.org; Mon, 15 Apr 2019 03:04:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFvey-0004JU-21 for qemu-devel@nongnu.org; Mon, 15 Apr 2019 03:04:09 -0400 Received: from mga06.intel.com ([134.134.136.31]:30995) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hFveo-00048B-AQ; Mon, 15 Apr 2019 03:03:59 -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:52 -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:50 -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="164783133" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Mon, 15 Apr 2019 15:03:07 +0800 Message-Id: <20190415070307.13668-5-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 4/4] hw/acpi: Extract build_mcfg to pci.c 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" Now we have two identical build_mcfg function. Extract them to pci.c. Signed-off-by: Wei Yang Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- v2: * put it to dedicated file pci.c --- default-configs/arm-softmmu.mak | 1 + default-configs/i386-softmmu.mak | 1 + hw/acpi/Kconfig | 4 +++ hw/acpi/Makefile.objs | 1 + hw/acpi/pci.c | 46 ++++++++++++++++++++++++++++++++ hw/arm/virt-acpi-build.c | 18 +------------ hw/i386/acpi-build.c | 19 ++----------- include/hw/acpi/pci.h | 5 ++++ 8 files changed, 61 insertions(+), 34 deletions(-) create mode 100644 hw/acpi/pci.c create mode 100644 include/hw/acpi/pci.h diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.= mak index 613d19a06d..8f2796e195 100644 --- a/default-configs/arm-softmmu.mak +++ b/default-configs/arm-softmmu.mak @@ -144,6 +144,7 @@ CONFIG_XIO3130=3Dy CONFIG_IOH3420=3Dy CONFIG_I82801B11=3Dy CONFIG_ACPI=3Dy +CONFIG_ACPI_PCI=3Dy CONFIG_ARM_VIRT=3Dy CONFIG_SMBIOS=3Dy CONFIG_ASPEED_SOC=3Dy diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmm= u.mak index ba3fb3ff50..cd5ea391e8 100644 --- a/default-configs/i386-softmmu.mak +++ b/default-configs/i386-softmmu.mak @@ -25,3 +25,4 @@ CONFIG_ISAPC=3Dy CONFIG_I440FX=3Dy CONFIG_Q35=3Dy +CONFIG_ACPI_PCI=3Dy diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig index eca3beed75..7265843cc3 100644 --- a/hw/acpi/Kconfig +++ b/hw/acpi/Kconfig @@ -23,6 +23,10 @@ config ACPI_NVDIMM bool depends on ACPI =20 +config ACPI_PCI + bool + depends on ACPI + config ACPI_VMGENID bool default y diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index ba93c5b64a..9bb2101e3b 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -11,6 +11,7 @@ common-obj-$(call lnot,$(CONFIG_ACPI_X86)) +=3D acpi-stub= .o common-obj-y +=3D acpi_interface.o common-obj-y +=3D bios-linker-loader.o common-obj-y +=3D aml-build.o utils.o +common-obj-$(CONFIG_ACPI_PCI) +=3D pci.o common-obj-$(CONFIG_TPM) +=3D tpm.o =20 common-obj-$(CONFIG_IPMI) +=3D ipmi.o diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c new file mode 100644 index 0000000000..fa0fa30bb9 --- /dev/null +++ b/hw/acpi/pci.c @@ -0,0 +1,46 @@ +/* + * Support for generating PCI related ACPI tables and passing them to Gues= ts + * + * Copyright (C) 2006 Fabrice Bellard + * Copyright (C) 2008-2010 Kevin O'Connor + * Copyright (C) 2013-2019 Red Hat Inc + * Copyright (C) 2019 Intel Corporation + * + * Author: Wei Yang + * Author: Michael S. Tsirkin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/acpi/aml-build.h" +#include "hw/acpi/pci.h" +#include "hw/pci/pcie_host.h" + +void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info) +{ + AcpiTableMcfg *mcfg; + int len =3D sizeof(*mcfg) + sizeof(mcfg->allocation[0]); + + mcfg =3D acpi_data_push(table_data, len); + mcfg->allocation[0].address =3D cpu_to_le64(info->base); + + /* 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(info->size - 1); + + build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1, NULL, N= ULL); +} + diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 7350f207b5..e3353de9e4 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -40,6 +40,7 @@ #include "hw/hw.h" #include "hw/acpi/aml-build.h" #include "hw/acpi/utils.h" +#include "hw/acpi/pci.h" #include "hw/pci/pcie_host.h" #include "hw/pci/pci.h" #include "hw/arm/virt.h" @@ -545,23 +546,6 @@ build_srat(GArray *table_data, BIOSLinker *linker, Vir= tMachineState *vms) "SRAT", table_data->len - srat_start, 3, NULL, NULL); } =20 -static void -build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info) -{ - AcpiTableMcfg *mcfg; - int len =3D sizeof(*mcfg) + sizeof(mcfg->allocation[0]); - - mcfg =3D acpi_data_push(table_data, len); - mcfg->allocation[0].address =3D cpu_to_le64(info->base); - - /* 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(info->size - 1); - - build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1, NULL, N= ULL); -} - /* GTDT */ static void build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 7613b245cf..29980bb3f4 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -58,6 +58,7 @@ =20 #include "hw/acpi/aml-build.h" #include "hw/acpi/utils.h" +#include "hw/acpi/pci.h" =20 #include "qom/qom-qobject.h" #include "hw/i386/amd_iommu.h" @@ -2392,22 +2393,6 @@ build_srat(GArray *table_data, BIOSLinker *linker, M= achineState *machine) table_data->len - srat_start, 1, NULL, NULL); } =20 -static void -build_mcfg_q35(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info) -{ - AcpiTableMcfg *mcfg; - int len =3D sizeof(*mcfg) + 1 * sizeof(mcfg->allocation[0]); - - mcfg =3D acpi_data_push(table_data, len); - mcfg->allocation[0].address =3D cpu_to_le64(info->base); - /* 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(info->size - 1); - - build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1, NULL, N= ULL); -} - /* * VT-d spec 8.1 DMA Remapping Reporting Structure * (version Oct. 2014 or later) @@ -2677,7 +2662,7 @@ void acpi_build(AcpiBuildTables *tables, MachineState= *machine) } if (acpi_get_mcfg(&mcfg)) { acpi_add_table(table_offsets, tables_blob); - build_mcfg_q35(tables_blob, tables->linker, &mcfg); + build_mcfg(tables_blob, tables->linker, &mcfg); } if (x86_iommu_get_default()) { IommuType IOMMUType =3D x86_iommu_get_type(); diff --git a/include/hw/acpi/pci.h b/include/hw/acpi/pci.h new file mode 100644 index 0000000000..6f94ac4926 --- /dev/null +++ b/include/hw/acpi/pci.h @@ -0,0 +1,5 @@ +#ifndef HW_ACPI_PCI_H +#define HW_ACPI_PCI_H + +void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info= ); +#endif --=20 2.19.1