From patchwork Fri Sep 2 02:55:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 75267 Delivered-To: patch@linaro.org Received: by 10.140.29.8 with SMTP id a8csp623776qga; Thu, 1 Sep 2016 19:58:51 -0700 (PDT) X-Received: by 10.36.65.198 with SMTP id b67mr1510812itd.53.1472785131488; Thu, 01 Sep 2016 19:58:51 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u187si1942309itg.86.2016.09.01.19.58.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Sep 2016 19:58:51 -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 1bfees-0006sY-57; Fri, 02 Sep 2016 02:56:46 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfeer-0006rN-8O for xen-devel@lists.xen.org; Fri, 02 Sep 2016 02:56:45 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 86/27-17152-C6AE8C75; Fri, 02 Sep 2016 02:56:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVi9XuGg272qxP hBlvmWVks+biYxYHR4+ju30wBjFGsmXlJ+RUJrBnbOp8xFbwSqWi5fIe9gfGyQBcjF4eQwClG iSsfnjB1MXICObsZJea3u4HYbAK6Eh83TmEHsUUEZCVWd81hB2lgFrjOKHHn/TZWkISwgJ3E5 aX7GLsYOThYBFQkLvVzg4R5BTwkTqy7zghiSwhoSKzsncACYnMKeEq8XfWJHWKXh8TjV4+YIO oFJU7OfAJWwywgIXHwxQtmiF5Fibb1J9kgbEmJgytusIDcIAFy9IeOS+wgeyUETCX2TZOewCg 4C8moWUhGLWBkWsWoUZxaVJZapGtkoJdUlJmeUZKbmJmja2hgrJebWlycmJ6ak5hUrJecn7uJ ERie9QwMjDsYm0/4HWKU5GBSEuXNf3IiXIgvKT+lMiOxOCO+qDQntfgQowwHh5IEr9FLoJxgU Wp6akVaZg4wUmDSEhw8SiK8ZiBp3uKCxNzizHSI1ClGRSlx3hcvgBICIImM0jy4Nlh0XmKUlR LmZWRgYBDiKUgtys0sQZV/xSjOwagkzBsAMp4nM68EbvoroMVMQItLrh0HWVySiJCSamBcrJQ uveB7u8thW+N17qzrdiao5Vebl3S1R1iuq9rE+s1fOmWtqx5jR/rhWUJPpNLunnj95a1o09Id 9z9OS+MWfRiuxaDlOK9LIELzzuMlHPuMdm99/SSxrXlKiaDGET7N5XHfqxSPSC58x69f981gb qntJb283OJJ3d8s9LlkJAX/SDydvl2JpTgj0VCLuag4EQB/v9rcyQIAAA== X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-5.tower-31.messagelabs.com!1472784999!55354499!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 4002 invoked from network); 2 Sep 2016 02:56:43 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-5.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 2 Sep 2016 02:56:43 -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 DQM36315; Fri, 02 Sep 2016 10:56:18 +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:04 +0800 From: Shannon Zhao To: Date: Fri, 2 Sep 2016 10:55:30 +0800 Message-ID: <1472784939-14404-8-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.57C8EA53.006D, 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: 3e97a79327d5385fb31c8fb3a116f3e2 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 07/16] 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 Acked-by: Julien Grall --- tools/libxl/libxl_arm_acpi.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c index 93ba2d1..ab49d57 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -25,10 +25,24 @@ typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; +typedef int64_t s64; #include #include +#ifndef BITS_PER_LONG +#ifdef _LP64 +#define BITS_PER_LONG 64 +#else +#define BITS_PER_LONG 32 +#endif +#endif +#define ACPI_MACHINE_WIDTH __BITS_PER_LONG +#define COMPILER_DEPENDENT_INT64 int64_t +#define COMPILER_DEPENDENT_UINT64 uint64_t + +#include + _hidden extern const unsigned char dsdt_anycpu_arm[]; _hidden @@ -190,6 +204,29 @@ static void make_acpi_xsdt(libxl__gc *gc, struct xc_dom_image *dom, acpitables[XSDT].size); } +static void make_acpi_gtdt(libxl__gc *gc, struct xc_dom_image *dom, + struct acpitable acpitables[]) +{ + uint64_t offset = acpitables[GTDT].addr - GUEST_ACPI_BASE; + struct acpi_table_gtdt *gtdt = (void *)dom->acpi_modules[0].data + offset; + + 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); + + gtdt->counter_block_addresss = 0xFFFFFFFFFFFFFFFF; + gtdt->counter_read_block_address = 0xFFFFFFFFFFFFFFFF; + + make_acpi_header(>dt->header, "GTDT", acpitables[GTDT].size, 2); + calculate_checksum(gtdt, offsetof(struct acpi_table_header, checksum), + acpitables[GTDT].size); +} + int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, libxl__domain_build_state *state, struct xc_dom_image *dom) @@ -220,6 +257,7 @@ int libxl__prepare_acpi(libxl__gc *gc, libxl_domain_build_info *info, make_acpi_rsdp(gc, dom, acpitables); make_acpi_xsdt(gc, dom, acpitables); + make_acpi_gtdt(gc, dom, acpitables); out: return rc;