From patchwork Fri May 29 13:10:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 49182 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 91214218E7 for ; Fri, 29 May 2015 13:17:42 +0000 (UTC) Received: by laat2 with SMTP id t2sf20573245laa.2 for ; Fri, 29 May 2015 06:17:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding :subject:precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=sL0UdUz2Ht/xNeM2RjgLIQrgHGWr4C+EiL+28QfjJX4=; b=IiAbg6j1ABKl8U9hptlarWRJNGHmmoYfgu329DoO9nyRfIrlqooImU2gOQO39j6NSD +PAqLZGuiyLV7oQlw4iL4bePoKblBg8tlP/sOalcIW94NeNNq6mg3Q3FHOgzHr1NIcdb nKs9jk0gCbX0MR1z1MPmud0eEbUtM+xcZjSne9DFGAAN8J768/AoSr0sBWS2pVZde+hE AmQS6VbInYJL+jApxx00AP4YMG/u/zvJ7v+dhb7vdbd158uJlvT/LdAa56us3FSQjLdR l7O8C7TB/O1h7IoMzs99T6KyGtqpIezEKncbkgE2IN4pc4NYEn6EeUkY2enFS9+vWVSw 0qOA== X-Gm-Message-State: ALoCoQmPMIBmA8NOLPiG0FAV9UG1fDpQNe5vtnADmw63uiGSQlPTZ0tlrW5Cqso8tBZUGhnWXdda X-Received: by 10.112.13.200 with SMTP id j8mr7308077lbc.14.1432905461453; Fri, 29 May 2015 06:17:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.138 with SMTP id am10ls187666lac.67.gmail; Fri, 29 May 2015 06:17:41 -0700 (PDT) X-Received: by 10.112.210.137 with SMTP id mu9mr7632760lbc.95.1432905461302; Fri, 29 May 2015 06:17:41 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id l7si4664710lbp.115.2015.05.29.06.17.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 06:17:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by laat2 with SMTP id t2so55505657laa.1 for ; Fri, 29 May 2015 06:17:41 -0700 (PDT) X-Received: by 10.153.6.36 with SMTP id cr4mr8093182lad.56.1432905461157; Fri, 29 May 2015 06:17:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp325498lbb; Fri, 29 May 2015 06:17:40 -0700 (PDT) X-Received: by 10.140.81.39 with SMTP id e36mr9520602qgd.10.1432905459802; Fri, 29 May 2015 06:17:39 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 11si5567439qkr.34.2015.05.29.06.17.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 29 May 2015 06:17:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyKAM-0006Wu-P3 for patch@linaro.org; Fri, 29 May 2015 09:17:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyK3y-0003uE-C1 for qemu-devel@nongnu.org; Fri, 29 May 2015 09:11:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YyK3s-0003Xn-Ca for qemu-devel@nongnu.org; Fri, 29 May 2015 09:11:02 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YyK3s-0003US-5X for qemu-devel@nongnu.org; Fri, 29 May 2015 09:10:56 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1YyK3i-0005nh-Ld for qemu-devel@nongnu.org; Fri, 29 May 2015 14:10:46 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 29 May 2015 14:10:33 +0100 Message-Id: <1432905045-22138-28-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1432905045-22138-1-git-send-email-peter.maydell@linaro.org> References: <1432905045-22138-1-git-send-email-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 27/39] hw/arm/virt-acpi-build: Generate MCFG table X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Generate MCFG table for PCIe controller. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao Reviewed-by: Alex Bennée Message-id: 1432522520-8068-14-git-send-email-zhaoshenglong@huawei.com Signed-off-by: Peter Maydell --- 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 f8c1dd8..95c83ee 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" #define ARM_SPI_BASE 32 @@ -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) @@ -350,6 +370,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);