From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvRcn-0004eQ-2R for qemu-devel@nongnu.org; Thu, 21 May 2015 10:39:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvRcg-0001UH-Sa for qemu-devel@nongnu.org; Thu, 21 May 2015 10:39:05 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:52446 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvRcg-0001UA-LD for qemu-devel@nongnu.org; Thu, 21 May 2015 10:38:58 -0400 References: <1431595182-7552-1-git-send-email-zhaoshenglong@huawei.com> <1431595182-7552-13-git-send-email-zhaoshenglong@huawei.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1431595182-7552-13-git-send-email-zhaoshenglong@huawei.com> Date: Thu, 21 May 2015 15:38:55 +0100 Message-ID: <874mn6hu68.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v7 12/23] hw/arm/virt-acpi-build: Generate MCFG table List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Shannon Zhao Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, mst@redhat.com, a.spyridakis@virtualopensystems.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, peter.huangpeng@huawei.com, hanjun.guo@linaro.org, imammedo@redhat.com, pbonzini@redhat.com, lersek@redhat.com, christoffer.dall@linaro.org, shannon.zhao@linaro.org Shannon Zhao writes: > From: Shannon Zhao > > Generate MCFG table for PCIe controller. > > Signed-off-by: Shannon Zhao > Signed-off-by: Shannon Zhao Reviewed-by: Alex Bennée > --- > hw/arm/virt-acpi-build.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c > index 19ba69e..80d4e64 100644 > --- a/hw/arm/virt-acpi-build.c > +++ b/hw/arm/virt-acpi-build.c > @@ -39,6 +39,7 @@ > #include "hw/loader.h" > #include "hw/hw.h" > #include "hw/acpi/aml-build.h" > +#include "hw/pci/pcie_host.h" > > typedef struct VirtAcpiCpuInfo { > DECLARE_BITMAP(found_cpus, VIRT_ACPI_CPU_ID_LIMIT); > @@ -180,6 +181,25 @@ build_rsdp(GArray *rsdp_table, GArray *linker, unsigned rsdt) > return rsdp_table; > } > > +static void > +build_mcfg(GArray *table_data, GArray *linker, VirtGuestInfo *guest_info) > +{ > + AcpiTableMcfg *mcfg; > + const MemMapEntry *memmap = guest_info->memmap; > + int len = sizeof(*mcfg) + sizeof(mcfg->allocation[0]); > + > + mcfg = acpi_data_push(table_data, len); > + mcfg->allocation[0].address = cpu_to_le64(memmap[VIRT_PCIE_ECAM].base); > + > + /* Only a single allocation so no need to play with segments */ > + mcfg->allocation[0].pci_segment = cpu_to_le16(0); > + mcfg->allocation[0].start_bus_number = 0; > + mcfg->allocation[0].end_bus_number = (memmap[VIRT_PCIE_ECAM].size > + / PCIE_MMCFG_SIZE_MIN) - 1; > + > + build_header(linker, table_data, (void *)mcfg, "MCFG", len, 5); > +} > + > /* GTDT */ > static void > build_gtdt(GArray *table_data, GArray *linker) > @@ -348,6 +368,9 @@ void virt_acpi_build(VirtGuestInfo *guest_info, AcpiBuildTables *tables) > acpi_add_table(table_offsets, tables_blob); > build_gtdt(tables_blob, tables->linker); > > + acpi_add_table(table_offsets, tables_blob); > + build_mcfg(tables_blob, tables->linker, guest_info); > + > /* RSDT is pointed to by RSDP */ > rsdt = tables_blob->len; > build_rsdt(tables_blob, tables->linker, table_offsets); -- Alex Bennée