From patchwork Thu May 14 09:19:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48493 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7D2D82121F for ; Thu, 14 May 2015 09:29:12 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf17272288wgt.1 for ; Thu, 14 May 2015 02:29:11 -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:cc: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=LI8K5MHazC8gMnmsrND8/5eRyym3hceJJTEo86uLtms=; b=iayd/Uf4TlTs121+fSB1H3Z5kRfUFK6ClZABE/bKuZoXpsLNgW9yPjtxNfc7fjXqR1 9js6HQ2yr4jxdhmFqYMr2m/wP44qkNQu8cYmerZNI4+nCSmo33uYokNlF8l14GhfYS18 UCGPnzgXI0NALj/MkgW2oACc33uiU4HA/yoWnFkawLsfXhz7ZIiQzvM34HV+NwVje+Vf kKk24dSj6sRW4CyvnBSI26TyCZ+ptH4031K8t8fxBufno1I/grLxvrtx1h/vc0Fxsnbf GTzroQ2El2cFvDYxCgkR9PMKYAy2bG01Ze/bmjdpJbzXJQPmF4LZjFgy5u1G6evcjjgC ORBg== X-Gm-Message-State: ALoCoQlhYqmLtAJyyqcLt0TwB2appjdPiLftBOY58JGtB8/ApRUPn3J62bq8E4SQM9hifIcg3YNi X-Received: by 10.152.206.36 with SMTP id ll4mr2452473lac.6.1431595751736; Thu, 14 May 2015 02:29:11 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.110 with SMTP id bf14ls353412lab.48.gmail; Thu, 14 May 2015 02:29:11 -0700 (PDT) X-Received: by 10.152.23.38 with SMTP id j6mr2337486laf.47.1431595751560; Thu, 14 May 2015 02:29:11 -0700 (PDT) Received: from mail-la0-f47.google.com (mail-la0-f47.google.com. [209.85.215.47]) by mx.google.com with ESMTPS id t2si14112756lbj.163.2015.05.14.02.29.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 May 2015 02:29:11 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.47 as permitted sender) client-ip=209.85.215.47; Received: by laat2 with SMTP id t2so59136491laa.1 for ; Thu, 14 May 2015 02:29:11 -0700 (PDT) X-Received: by 10.112.13.6 with SMTP id d6mr2360819lbc.117.1431595751410; Thu, 14 May 2015 02:29:11 -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 hn6csp1117196lbb; Thu, 14 May 2015 02:29:10 -0700 (PDT) X-Received: by 10.140.86.146 with SMTP id p18mr4105892qgd.49.1431595750259; Thu, 14 May 2015 02:29:10 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id o8si22467426qcr.4.2015.05.14.02.29.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 14 May 2015 02:29:10 -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]:53316 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspS1-0003lu-D8 for patch@linaro.org; Thu, 14 May 2015 05:29:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48329) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspNc-0005RY-3w for qemu-devel@nongnu.org; Thu, 14 May 2015 05:24:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YspNa-0001Lk-Qe for qemu-devel@nongnu.org; Thu, 14 May 2015 05:24:35 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:32483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YspNa-0001Iz-46 for qemu-devel@nongnu.org; Thu, 14 May 2015 05:24:34 -0400 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CLJ60785; Thu, 14 May 2015 17:21:12 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.158.1; Thu, 14 May 2015 17:20:58 +0800 From: Shannon Zhao To: , , , , , , , , , , Date: Thu, 14 May 2015 17:19:31 +0800 Message-ID: <1431595182-7552-13-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1431595182-7552-1-git-send-email-zhaoshenglong@huawei.com> References: <1431595182-7552-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: hangaohuai@huawei.com, zhaoshenglong@huawei.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org Subject: [Qemu-devel] [PATCH v7 12/23] 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: patch@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.47 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 --- 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);