From patchwork Thu Jun 23 03:16:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 70709 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp217238qgy; Wed, 22 Jun 2016 20:20:24 -0700 (PDT) X-Received: by 10.107.12.70 with SMTP id w67mr46659513ioi.182.1466652022801; Wed, 22 Jun 2016 20:20:22 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n9si3067219itn.14.2016.06.22.20.20.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jun 2016 20:20:22 -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 1bFv9c-0000C2-5u; Thu, 23 Jun 2016 03:18:08 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFv9b-0000Aw-6B for xen-devel@lists.xen.org; Thu, 23 Jun 2016 03:18:07 +0000 Received: from [85.158.139.211] by server-9.bemta-5.messagelabs.com id 99/67-10998-EE45B675; Thu, 23 Jun 2016 03:18:06 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsVSPpHPSfddSHa 4wd9VHBZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8bMs2uZCr4IVLTu+cncwDiLt4uRi0NI4BSj xI7Gm8wQzh5GiYNNr1i7GDk52AR0JT5unMIOYosIyEqs7prDDlLELHCdUeLO+21gRcICdhKPf 05nBrFZBFQl/v3YCdbAK+AusX3nbTYQW0JAQ2Jl7wQWEJtTwEPi5KwnYPVCQDVz1uxlgagXlD g58wmYzSwgIXHwxQtmiF5Fibb1J6HmSEocXHGDBeQICZCzf59sYoFImEqsmrCZeQKj4Cwks2Y hmbWAkWkVo0ZxalFZapGukbFeUlFmekZJbmJmjq6hgalebmpxcWJ6ak5iUrFecn7uJkZgkNYz MDDuYNzR7neIUZKDSUmU18ohO1yILyk/pTIjsTgjvqg0J7X4EKMMB4eSBO/xIKCcYFFqempFW mYOMF5g0hIcPEoivBLBQGne4oLE3OLMdIjUKUZFKXHeyyB9AiCJjNI8uDZYjF5ilJUS5mVkYG AQ4ilILcrNLEGVf8UozsGoJMz7AWQKT2ZeCdz0V0CLmYAWL+tPB1lckoiQkmpgzN7wgkEkorf Hb7XYWZvnpdy9h/4z1jJZuC/4nrSfoSWktDezdV1aGqN1cXiLuox4hWNr8px7KZO7n7OvmjOn xOrge4FIgQ0rWSqP+pxjvteRfY9lmfLFK5s7P+tO26x46tBi3tcW0oErF/N0SRSu6+TK0FbRc 5v18Sz/uRzD99yJ1xiemBQosRRnJBpqMRcVJwIA2QSIU8wCAAA= X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-14.tower-206.messagelabs.com!1466651883!9871564!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.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29796 invoked from network); 23 Jun 2016 03:18:05 -0000 Received: from szxga03-in.huawei.com (HELO szxga03-in.huawei.com) (119.145.14.66) by server-14.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 23 Jun 2016 03:18:05 -0000 Received: from 172.24.1.36 (EHLO szxeml430-hub.china.huawei.com) ([172.24.1.36]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CDT13167; Thu, 23 Jun 2016 11:17:38 +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.235.1; Thu, 23 Jun 2016 11:17:30 +0800 From: Shannon Zhao To: Date: Thu, 23 Jun 2016 11:16:54 +0800 Message-ID: <1466651824-6964-8-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1466651824-6964-1-git-send-email-zhaoshenglong@huawei.com> References: <1466651824-6964-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.0A090203.576B54D3.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-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ba7dc05bf919d41e4ae5a85fe03b0725 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 v2 07/17] libxl/arm: Construct ACPI GTDT 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 Construct GTDT table with the interrupt information of timers. Signed-off-by: Shannon Zhao --- tools/libxl/libxl_arm_acpi.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c index d5ffedf..de863f4 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -39,6 +39,9 @@ typedef uint64_t u64; #define ACPI_BUILD_APPNAME6 "XenARM" #define ACPI_BUILD_APPNAME4 "Xen " +#define ACPI_LEVEL_SENSITIVE (u8) 0x00 +#define ACPI_ACTIVE_LOW (u8) 0x01 + enum { RSDP, XSDT, @@ -110,6 +113,30 @@ static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom) dom->acpitable_size += ROUNDUP(acpitables[XSDT].size, 3); } +static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom) +{ + struct acpi_table_gtdt *gtdt; + size_t size = sizeof(*gtdt); + + gtdt = libxl__zalloc(gc, size); + + gtdt->non_secure_el1_interrupt = GUEST_TIMER_PHYS_NS_PPI; + gtdt->non_secure_el1_flags = + (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE) + |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY); + gtdt->virtual_timer_interrupt = GUEST_TIMER_VIRT_PPI; + gtdt->virtual_timer_flags = + (ACPI_LEVEL_SENSITIVE << ACPI_GTDT_INTERRUPT_MODE) + |(ACPI_ACTIVE_LOW << ACPI_GTDT_INTERRUPT_POLARITY); + + make_acpi_header(>dt->header, "GTDT", size, 2); + + acpitables[GTDT].table = gtdt; + acpitables[GTDT].size = size; + /* Align to 64bit. */ + dom->acpitable_size += ROUNDUP(acpitables[GTDT].size, 3); +} + int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, libxl__domain_build_state *state, struct xc_dom_image *dom) @@ -132,6 +159,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, make_acpi_rsdp(gc, dom); make_acpi_xsdt(gc, dom); + make_acpi_gtdt(gc, dom); return 0; }