From patchwork Tue Aug 16 10:25:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 73997 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1919577qga; Tue, 16 Aug 2016 03:32:07 -0700 (PDT) X-Received: by 10.36.107.82 with SMTP id v79mr15868134itc.52.1471343527676; Tue, 16 Aug 2016 03:32:07 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id i16si5328239ioe.141.2016.08.16.03.32.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2016 03:32:07 -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 1bZbd3-0002Xb-4V; Tue, 16 Aug 2016 10:29:53 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZbd1-0002Wi-Fr for xen-devel@lists.xen.org; Tue, 16 Aug 2016 10:29:51 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id D8/EC-19922-E1BE2B75; Tue, 16 Aug 2016 10:29:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVSPpHPSVfu9aZ wgwW7pSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ozuh3/ZCh7yVny51sXYwNjK3cXIySEkcIpR 4sZu0S5GLiB7D6PE+/fnmUESbAK6Eh83TmEHsUUEZCVWd81hByliFrjOKHHn/TZWkISwgJ3Eq Y7DYDaLgKrE9Hu72UBsXgFPiR/rvjOB2BICGhIreyewdDFycHACxa9NYYNY7CFxeuZCVohyQY mTM5+wgNjMAhISB1+8YIZoVZRoW3+SDcKWlDi44gYLyA0SIEf/33uEFSJhKvHk5zfWCYyCs5D MmoVk1gJGplWMGsWpRWWpRbpGhnpJRZnpGSW5iZk5uoYGpnq5qcXFiempOYlJxXrJ+bmbGIEB Ws/AwLiD8e5kv0OMkhxMSqK8MyduDBfiS8pPqcxILM6ILyrNSS0+xCjDwaEkwXvz5aZwIcGi1 PTUirTMHGCswKQlOHiURHjfgKR5iwsSc4sz0yFSpxgVpcR5F4AkBEASGaV5cG2w+LzEKCslzM vIwMAgxFOQWpSbWYIq/4pRnINRSRhiPE9mXgnc9FdAi5mAFutLbwBZXJKIkJJqYJxWzpEV5Vu 7wu5p2aQAgcfm9m8rC461fDjuv9zb63KZ9McAy2kuEmERAQ/6mGQz+mVmNx36F9J9NTjqX9PM +pMd5X5GbeJfOC8fuPbs/b+eOvVG250lCVetPVbPWtIUmalwt3rrtqPzs6Ri/d6d7VitezGsR 8Jp1cYHDoyK023CAg/M/vSyRYmlOCPRUIu5qDgRAPARg7TKAgAA X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1471343387!54553638!1 X-Originating-IP: [119.145.14.66] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NiA9PiA4NTI3\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24553 invoked from network); 16 Aug 2016 10:29:50 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-8.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 16 Aug 2016 10:29:50 -0000 Received: from 172.24.1.47 (EHLO szxeml434-hub.china.huawei.com) ([172.24.1.47]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CGJ21739; Tue, 16 Aug 2016 18:26:20 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by szxeml434-hub.china.huawei.com (10.82.67.225) with Microsoft SMTP Server id 14.3.235.1; Tue, 16 Aug 2016 18:25:39 +0800 From: Shannon Zhao To: Date: Tue, 16 Aug 2016 18:25:07 +0800 Message-ID: <1471343113-10652-11-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1471343113-10652-1-git-send-email-zhaoshenglong@huawei.com> References: <1471343113-10652-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.0A020206.57B2EA4D.00F2, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d78c8d684de84db5fb15be21e251aaef 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 v4 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 --- 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 75dfcc2..cb1c9df 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -286,6 +286,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) @@ -318,6 +337,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;