From nobody Sun Apr 28 05:41:41 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=1555635005; cv=none; d=zoho.com; s=zohoarc; b=bVhN4ABE8XzTTEOmlly/yyJJcF2fLkXvGMAMTnmtaQgNXkZhpqE2cJoxBewTSlP7hItP6JQUI2wQFPA6FOqmuWN9E9PPIzY1Lb3GaCxGcYOA2pTK5+9xT1jK9n2i2eGuFkt4hyTqKaoOwGbubZYFXawjcPHA0xwiuU+oqbdACPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555635005; 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:ARC-Authentication-Results; bh=3JC4fgKACibZW/ukQFjnyh5N/SxEJASsENPhlbKI+Rg=; b=L1veMR57FaaVbKpesctiN1Qh4bKTv6jsBGs6z8QuN2mpZFFX1B+/jihatQbj6xxpJ+qe/ZQW+fttB+CR1f2cTgyaLZ0kDDA0KDxV5e0Q4h7e3ELwRiFPzfgtVMpBtMFj9Ook0F74iOl7CNwBM/Q0/hMtwKvcGZPL+ppDrpdhuTU= 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 1555635005859196.25683559398863; Thu, 18 Apr 2019 17:50:05 -0700 (PDT) Received: from localhost ([127.0.0.1]:49307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHj5-0003tq-Sd for importer@patchew.org; Thu, 18 Apr 2019 20:49:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHcA-0007cN-Bc for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:42:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHHRB-0005ni-Qf for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:31:30 -0400 Received: from mga18.intel.com ([134.134.136.126]:3679) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHHRA-0005kx-EK; Thu, 18 Apr 2019 20:31:28 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Apr 2019 17:31:26 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 18 Apr 2019 17:31:24 -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,367,1549958400"; d="scan'208";a="163163305" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Fri, 19 Apr 2019 08:30:48 +0800 Message-Id: <20190419003053.8260-2-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190419003053.8260-1-richardw.yang@linux.intel.com> References: <20190419003053.8260-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.126 Subject: [Qemu-devel] [PATCH v4 1/6] q35: acpi: do not create dummy MCFG table 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, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Dummy table (with signature "QEMU") creation came from original SeaBIOS codebase. And QEMU would have to keep it around if there were Q35 machine that depended on keeping ACPI tables blob constant size. Luckily there were no versioned Q35 machine types before commit: (since 2.3) a1666142db acpi-build: make ROMs RAM blocks resizeable which obsoleted need to keep ACPI tables blob the same size on source/desti= nation. Considering the 1st versioned machine is pc-q35-2.4, the dummy table is not really necessary and it's safe to drop it without breaking cross version migration in both directions unconditionally. Signed-off-by: Igor Mammedov Signed-off-by: Wei Yang Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/acpi-build.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b17d4a711d..d009176072 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2401,7 +2401,6 @@ static void build_mcfg_q35(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info) { AcpiTableMcfg *mcfg; - const char *sig; int len =3D sizeof(*mcfg) + 1 * sizeof(mcfg->allocation[0]); =20 mcfg =3D acpi_data_push(table_data, len); @@ -2411,19 +2410,7 @@ build_mcfg_q35(GArray *table_data, BIOSLinker *linke= r, AcpiMcfgInfo *info) mcfg->allocation[0].start_bus_number =3D 0; mcfg->allocation[0].end_bus_number =3D PCIE_MMCFG_BUS(info->mcfg_size = - 1); =20 - /* MCFG is used for ECAM which can be enabled or disabled by guest. - * To avoid table size changes (which create migration issues), - * always create the table even if there are no allocations, - * but set the signature to a reserved value in this case. - * ACPI spec requires OSPMs to ignore such tables. - */ - if (info->mcfg_base =3D=3D PCIE_BASE_ADDR_UNMAPPED) { - /* Reserved signature: ignored by OSPM */ - sig =3D "QEMU"; - } else { - sig =3D "MCFG"; - } - build_header(linker, table_data, (void *)mcfg, sig, len, 1, NULL, NULL= ); + build_header(linker, table_data, (void *)mcfg, "MCFG", len, 1, NULL, N= ULL); } =20 /* @@ -2592,6 +2579,9 @@ static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg) } mcfg->mcfg_base =3D qnum_get_uint(qobject_to(QNum, o)); qobject_unref(o); + if (mcfg->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); --=20 2.19.1 From nobody Sun Apr 28 05:41:41 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=1555634935; cv=none; d=zoho.com; s=zohoarc; b=Q3BmPkICs3hT9UrvdHAlIvG5u/3SNoKO97o4QQ2CbPW+nZ7qBeN/uVyz4kScT2qX7jzRlNodTMe6V/n05A7oPjIVB8iZPpMxTFpWsT2ioQD/W+I32npoeNaRGA/vEHQyhb1qphbZCbm1pCn8p3LYVhEo3OsiRWo9OBtUzGdh0FE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555634935; 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:ARC-Authentication-Results; bh=eJ6t9G3eZlWLik/iCt7LMGSzyS4JGJWMYhSFJEHxV94=; b=C64xZECunTDX0/w91Aax+gp6f1Q8QhrmRo5AWIj+DQoZGfuqeY3lVm29rWHI/G9pYtFRxTHu0KvSM0lmEuMi+KvW56rZcRQFZWUXDsgh+53hQnbjfR7yBwCSHPHvLgcOeoVAsNQydxPZSG8DOkHdzr2ykMs0m+gOTG21bgjAIaM= 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 1555634935245310.66719177108973; Thu, 18 Apr 2019 17:48:55 -0700 (PDT) Received: from localhost ([127.0.0.1]:49301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHho-0003Ie-7y for importer@patchew.org; Thu, 18 Apr 2019 20:48:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHc8-0007cN-FG for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:42:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHHRC-0005oA-CX for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:31:31 -0400 Received: from mga18.intel.com ([134.134.136.126]:3679) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHHRA-0005kx-VX; Thu, 18 Apr 2019 20:31:29 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Apr 2019 17:31:28 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 18 Apr 2019 17:31:26 -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,367,1549958400"; d="scan'208";a="163163316" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Fri, 19 Apr 2019 08:30:49 +0800 Message-Id: <20190419003053.8260-3-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190419003053.8260-1-richardw.yang@linux.intel.com> References: <20190419003053.8260-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.126 Subject: [Qemu-devel] [PATCH v4 2/6] 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, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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 Sun Apr 28 05:41:41 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=1555634834; cv=none; d=zoho.com; s=zohoarc; b=iIexXlZl+JkdOqvBiRNXR2C90Hwxg7gtxaNe7beH4sIdF9D0zF3CezJ/GnQmtRTy+UiwmA0J8XnSgIk+530E/8xxHIJowXcE7lrir8VCZAp0+AxxmMRbamarmjO8Uy/MsZlGctlveKJXfnYhHzY8zn8/BizHUS18+0AYQQjBjnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555634834; 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:ARC-Authentication-Results; bh=C76ULdtufwpzeyRev/zXiYOzio4k/KvON12tyQLWJAY=; b=QgZWJ9++4VYY3/GPWaiKXLGY2OJSzWgI/QTDTKVKUcgleaInFZPgVbw77b2382Aq+4l9JrD+4hElJJTzfKRRMwHSIoaSFJrq9FHOhm/Kqiuz+TY3PGkp9HQNGT1Ym0lIUOnl2NhyTHKH6uRlOeeZUP4iV8wyjDhyG03XY8t7+pk= 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 1555634834866537.7941605631077; Thu, 18 Apr 2019 17:47:14 -0700 (PDT) Received: from localhost ([127.0.0.1]:49293 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHgM-0002Tu-W4 for importer@patchew.org; Thu, 18 Apr 2019 20:47:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHc6-0007cN-FI for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:42:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHHRE-0005ry-U5 for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:31:33 -0400 Received: from mga18.intel.com ([134.134.136.126]:3686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHHRD-0005og-L2; Thu, 18 Apr 2019 20:31:31 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Apr 2019 17:31:30 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 18 Apr 2019 17:31:29 -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,367,1549958400"; d="scan'208";a="163163321" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Fri, 19 Apr 2019 08:30:50 +0800 Message-Id: <20190419003053.8260-4-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190419003053.8260-1-richardw.yang@linux.intel.com> References: <20190419003053.8260-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.126 Subject: [Qemu-devel] [PATCH v4 3/6] 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, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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 Sun Apr 28 05:41:41 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=1555634674; cv=none; d=zoho.com; s=zohoarc; b=JZxLnOF5mGXLnGiw7h45nFV68ok9dmjU/j+/iGRtsdmbRa46vOZbBrvpcCO8XTlRA8IJEMopxrh6Y/VsruT2xMXuZITKPWes8LIYuFTIVkJfFwjZT6hjOIkf0baUy7129Aeivy//wm1m6uSnMSEuLYpAcaBLWGJf4QvkFmVJgmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555634674; 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:ARC-Authentication-Results; bh=0Bu2Ct7gV2VQxZ40I0BfxmpikhBN6Sg7MI7msmIsBXE=; b=MKEPOSCcCJN1AINLoD5Y5RVWdHYj5P8XD0x8eJDYzB4fpmuWp/j+uJKw5tVHZYdYHz/ahwHeSoPvTuTaOqVzAPZQc21G5Foja0URRoddEBBGitp+rFqQvNZ5a8OKn7vuFYuYNa3ZvDsZ3mA00hnrPahGQ2a2qOgCLS1aexTOZfY= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555634674179656.3713379132467; Thu, 18 Apr 2019 17:44:34 -0700 (PDT) Received: from localhost ([127.0.0.1]:49237 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHdn-0000X3-4J for importer@patchew.org; Thu, 18 Apr 2019 20:44:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHc3-0007cN-RH for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:42:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHHRI-0005ui-OK for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:31:38 -0400 Received: from mga18.intel.com ([134.134.136.126]:3686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHHRH-0005og-3c; Thu, 18 Apr 2019 20:31:35 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Apr 2019 17:31:32 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 18 Apr 2019 17:31:31 -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,367,1549958400"; d="scan'208";a="163163331" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Fri, 19 Apr 2019 08:30:51 +0800 Message-Id: <20190419003053.8260-5-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190419003053.8260-1-richardw.yang@linux.intel.com> References: <20190419003053.8260-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.126 Subject: [Qemu-devel] [PATCH v4 4/6] 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, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Igor Mammedov --- v3: * move AcpiMcfgInfo to pci.h v2: * for arm platform, construct a AcpiMcfgInfo directly --- hw/arm/virt-acpi-build.c | 18 +++++++++++------- hw/i386/acpi-build.c | 6 +----- include/hw/acpi/pci.h | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 include/hw/acpi/pci.h diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index e09e7eff8d..ebddcde596 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" @@ -546,21 +547,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 +799,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..c2de7f4b01 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" @@ -86,11 +87,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/pci.h b/include/hw/acpi/pci.h new file mode 100644 index 0000000000..124af7d32a --- /dev/null +++ b/include/hw/acpi/pci.h @@ -0,0 +1,33 @@ +/* + * 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 . + */ +#ifndef HW_ACPI_PCI_H +#define HW_ACPI_PCI_H + +typedef struct AcpiMcfgInfo { + uint64_t base; + uint32_t size; +} AcpiMcfgInfo; + +#endif --=20 2.19.1 From nobody Sun Apr 28 05:41:41 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=1555634675; cv=none; d=zoho.com; s=zohoarc; b=GQ9BSm1CwrTBnmouV5eFw20QX7p4RKKBhHUmw7NJdKX2aWjfbc4my4dCocx+mbkLgC9OPiLyFW5wHrxmuiA/bl8U8Ao/oYQOJaLufRpzXjASvP9yvxs6y/G0bg2CaSq/g4qRvAWZaof+DT63LQJk0DWMcP9TeS0r2PsUZlELu88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555634675; 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:ARC-Authentication-Results; bh=UgwGS11n6YeEumsrDuBRIQvnfL4M+nzQrdz5SXEI364=; b=RgVdSGqYWERLo1Tr8fPt4YJ2q4TENwbazc5yMipdb9g0CRqfOGm0xWuAu2V8sYtbdClUEPBgjcAPqQBH5VgNYsc532KVEGptW8nOycdAiKzlw474vE+fqFCNqGMbn7V+5mHlROc46Q5UoipdfHHC2A3xIYM0v5S1tBCjkD44DqU= 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 1555634675792806.4648872385955; Thu, 18 Apr 2019 17:44:35 -0700 (PDT) Received: from localhost ([127.0.0.1]:49235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHdm-0000V5-CD for importer@patchew.org; Thu, 18 Apr 2019 20:44:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHby-0007cN-Ef for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:42:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHHRL-0005wS-2J for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:31:40 -0400 Received: from mga18.intel.com ([134.134.136.126]:3686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHHRJ-0005og-6I; Thu, 18 Apr 2019 20:31:37 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Apr 2019 17:31:35 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 18 Apr 2019 17:31:33 -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,367,1549958400"; d="scan'208";a="163163340" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Fri, 19 Apr 2019 08:30:52 +0800 Message-Id: <20190419003053.8260-6-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190419003053.8260-1-richardw.yang@linux.intel.com> References: <20190419003053.8260-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.126 Subject: [Qemu-devel] [PATCH v4 5/6] hw/acpi: Consolidate 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, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Now we have two identical build_mcfg functions. Consolidate them in acpi/pci.c. Signed-off-by: Wei Yang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Igor Mammedov --- v3: * adjust changelog based on Igor's suggestion --- 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 | 17 ------------ hw/i386/acpi-build.c | 18 +------------ include/hw/acpi/pci.h | 1 + 8 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 hw/acpi/pci.c 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 ebddcde596..e3353de9e4 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -546,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 c2de7f4b01..29980bb3f4 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2393,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) @@ -2678,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 index 124af7d32a..8bbd32cf45 100644 --- a/include/hw/acpi/pci.h +++ b/include/hw/acpi/pci.h @@ -30,4 +30,5 @@ typedef struct AcpiMcfgInfo { uint32_t size; } AcpiMcfgInfo; =20 +void build_mcfg(GArray *table_data, BIOSLinker *linker, AcpiMcfgInfo *info= ); #endif --=20 2.19.1 From nobody Sun Apr 28 05:41:41 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=1555634684; cv=none; d=zoho.com; s=zohoarc; b=lXsTvFY5TgQRzlLQRLGT2UlNnen+CsUC6mPBhtjDRZvlIdFyq2iyGEBYxo9bZBttvNMembwFPbIuSs8dJXK8dlN0iqR2rTm8JSlD5uHpfvQTXgBMb+/TDHoNnexrvTmiDZCKT+f4w8WXuiuFpuPSjChlyO4WIYChdO6lNuM0tKY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555634684; 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:ARC-Authentication-Results; bh=/YpJEgO5pF3blDibwdwzbpyfENFzcXS3GATfet2WXog=; b=mY7CGfL0kZcKbOO2tfxyic3a5nVOOEztSUdLG07m4Ims99oUWQ4FyXPr3lK0bmQQ2paVUd3PjQ0Twq5YLqz9szVQWNELtMzcqY0kZBSKooFQhD/v9vS6kPU/ammzqkDHXj55e4uN8gxoHPlrm8ZtT6zVGFF0oAQJPhe5fqYoqcU= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555634684245960.6936596686274; Thu, 18 Apr 2019 17:44:44 -0700 (PDT) Received: from localhost ([127.0.0.1]:49240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHdy-0000gg-8D for importer@patchew.org; Thu, 18 Apr 2019 20:44:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHHc0-0007cN-20 for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:42:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHHRL-0005wl-Dy for qemu-devel@nongnu.org; Thu, 18 Apr 2019 20:31:40 -0400 Received: from mga18.intel.com ([134.134.136.126]:3686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHHRK-0005og-3w; Thu, 18 Apr 2019 20:31:38 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Apr 2019 17:31:37 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga004.fm.intel.com with ESMTP; 18 Apr 2019 17:31:35 -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,367,1549958400"; d="scan'208";a="163163360" From: Wei Yang To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Fri, 19 Apr 2019 08:30:53 +0800 Message-Id: <20190419003053.8260-7-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190419003053.8260-1-richardw.yang@linux.intel.com> References: <20190419003053.8260-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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.126 Subject: [Qemu-devel] [PATCH v4 6/6] acpi: pci: use build_append_foo() API to construct 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, philmd@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" build_append_foo() API doesn't need explicit endianness conversions which eliminates a source of errors and it makes build_mcfg() look like declarative definition of MCFG table in ACPI spec, which makes it easy to review. Signed-off-by: Wei Yang Suggested-by: Igor Mammedov Reviewed-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/acpi/pci.c | 33 +++++++++++++++++++++------------ include/hw/acpi/acpi-defs.h | 18 ------------------ 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/hw/acpi/pci.c b/hw/acpi/pci.c index fa0fa30bb9..341805e786 100644 --- a/hw/acpi/pci.c +++ b/hw/acpi/pci.c @@ -30,17 +30,26 @@ =20 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); + int mcfg_start =3D table_data->len; + + acpi_data_push(table_data, sizeof(AcpiTableHeader)); + + /* + * PCI Firmware Specification, Revision 3.0 + * 4.1.2 MCFG Table Description. + */ + /* Base address, processor-relative */ + build_append_int_noprefix(table_data, info->base, 8); + /* PCI segment group number */ + build_append_int_noprefix(table_data, 0, 2); + /* Starting PCI Bus number */ + build_append_int_noprefix(table_data, 0, 1); + /* Final PCI Bus number */ + build_append_int_noprefix(table_data, PCIE_MMCFG_BUS(info->size - 1), = 1); + /* Reserved */ + build_append_int_noprefix(table_data, 0, 4); + + build_header(linker, table_data, (void *)(table_data->data + mcfg_star= t), + "MCFG", table_data->len - mcfg_start, 1, NULL, NULL); } =20 diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index f9aa4bd398..57a3f58b0c 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -449,24 +449,6 @@ struct AcpiSratProcessorGiccAffinity { =20 typedef struct AcpiSratProcessorGiccAffinity AcpiSratProcessorGiccAffinity; =20 -/* PCI fw r3.0 MCFG table. */ -/* Subtable */ -struct AcpiMcfgAllocation { - uint64_t address; /* Base address, processor-relative */ - uint16_t pci_segment; /* PCI segment group number */ - uint8_t start_bus_number; /* Starting PCI Bus number */ - uint8_t end_bus_number; /* Final PCI Bus number */ - uint32_t reserved; -} QEMU_PACKED; -typedef struct AcpiMcfgAllocation AcpiMcfgAllocation; - -struct AcpiTableMcfg { - ACPI_TABLE_HEADER_DEF; - uint8_t reserved[8]; - AcpiMcfgAllocation allocation[0]; -} QEMU_PACKED; -typedef struct AcpiTableMcfg AcpiTableMcfg; - /* * TCPA Description Table * --=20 2.19.1