From patchwork Fri Sep 2 02:55:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 75265 Delivered-To: patch@linaro.org Received: by 10.140.29.8 with SMTP id a8csp623762qga; Thu, 1 Sep 2016 19:58:48 -0700 (PDT) X-Received: by 10.36.60.10 with SMTP id m10mr1659880ita.95.1472785128300; Thu, 01 Sep 2016 19:58:48 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h207si1999847ita.0.2016.09.01.19.58.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Sep 2016 19:58:48 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfeem-0006pN-Kq; Fri, 02 Sep 2016 02:56:40 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfeek-0006oz-TR for xen-devel@lists.xen.org; Fri, 02 Sep 2016 02:56:38 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id E5/95-27438-66AE8C75; Fri, 02 Sep 2016 02:56:38 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVi9XuGg27qqxP hBkf2m1os+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnvbx5jLLjPW/Hpa3YDYzN3FyMXh5DAKUaJ P7d3MncxcgI5uxklnn+WBrHZBHQlPm6cwg5iiwjISqzumsMO0sAscJ1R4s77bawgCWEBO4n9E 26ygdgsAioS814/YgKxeQU8JR5NXwsWlxDQkFjZO4EFxOYEir9d9YkdYpmHxONXMPWCEidnPg GrYRaQkDj44gUzRK+iRNv6k1BzJCUOrrjBAnKEBMjVv1oXQBWZSjRPamKcwCg4C8msWUhmLWB kWsWoUZxaVJZapGtkrJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERigDECwg/HP /MBDjJIcTEqivPlPToQL8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuDd8RIoJ1iUmp5akZaZA4wVm LQEB4+SCO8KkDRvcUFibnFmOkTqFKOilDhvDkhCACSRUZoH1waLz0uMslLCvIxAhwjxFKQW5W aWoMq/YhTnYFQS5j0BMoUnM68EbvoroMVMQItLrh0HWVySiJCSamD0ss3c/rXPY7vGcZXJ/70 XXtuxK95w80159zob4RVH7k2z8dHjdW9qTl4jw/Am6LrLtBUfp34vFzGY43/NNSjj2d3+hvrX UacjXkyeKRJjee+xYKv7rN2bTJ+7shZsOxt/4IjpnYlLEw5LX34o8uvf1ytPNzY/em1S+3Kjq pWtyG2G1Sty1HdEK7EUZyQaajEXFScCAD7qIyjKAgAA X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1472784993!26798705!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4309 invoked from network); 2 Sep 2016 02:56:37 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-16.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 2 Sep 2016 02:56:37 -0000 Received: from 172.24.1.60 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.60]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DQM36314; Fri, 02 Sep 2016 10:56:17 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Fri, 2 Sep 2016 10:56:07 +0800 From: Shannon Zhao To: Date: Fri, 2 Sep 2016 10:55:33 +0800 Message-ID: <1472784939-14404-11-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1472784939-14404-1-git-send-email-zhaoshenglong@huawei.com> References: <1472784939-14404-1-git-send-email-zhaoshenglong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0203.57C8EA52.0084, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 2ae5db6554b489900d85de08e9a81054 Cc: sstabellini@kernel.org, wei.liu2@citrix.com, ian.jackson@eu.citrix.com, peter.huangpeng@huawei.com, julien.grall@arm.com, shannon.zhao@linaro.org, boris.ostrovsky@oracle.com Subject: [Xen-devel] [PATCH v5 10/16] libxl/arm: Construct ACPI FADT table X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" From: Shannon Zhao Signed-off-by: Shannon Zhao Acked-by: Julien Grall --- tools/libxl/libxl_arm_acpi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c index d3358b3..407f9d5 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -310,6 +310,25 @@ out: return rc; } +static void make_acpi_fadt(libxl__gc *gc, struct xc_dom_image *dom, + struct acpitable acpitables[]) +{ + uint64_t offset = acpitables[FADT].addr - GUEST_ACPI_BASE; + struct acpi_table_fadt *fadt = (void *)dom->acpi_modules[0].data + offset; + + /* Hardware Reduced = 1 and use PSCI 0.2+ and with HVC */ + fadt->flags = ACPI_FADT_HW_REDUCED; + fadt->arm_boot_flags = ACPI_FADT_PSCI_COMPLIANT | ACPI_FADT_PSCI_USE_HVC; + + /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */ + fadt->minor_revision = 0x1; + fadt->dsdt = acpitables[DSDT].addr; + + make_acpi_header(&fadt->header, "FACP", acpitables[FADT].size, 5); + calculate_checksum(fadt, offsetof(struct acpi_table_header, checksum), + acpitables[FADT].size); +} + int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, libxl__domain_build_state *state, struct xc_dom_image *dom) @@ -342,6 +361,10 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, make_acpi_xsdt(gc, dom, acpitables); make_acpi_gtdt(gc, dom, acpitables); rc = make_acpi_madt(gc, dom, info->max_vcpus, xc_config, acpitables); + if (rc) + goto out; + + make_acpi_fadt(gc, dom, acpitables); out: return rc;