From patchwork Tue Jul 5 03:12:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 71374 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp91327qgy; Mon, 4 Jul 2016 20:17:16 -0700 (PDT) X-Received: by 10.36.95.146 with SMTP id r140mr6070531itb.49.1467688632802; Mon, 04 Jul 2016 20:17:12 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id l201si3897835itl.2.2016.07.04.20.17.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2016 20:17:12 -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 1bKGp7-0000C7-MC; Tue, 05 Jul 2016 03:14:57 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKGp6-0000AY-EB for xen-devel@lists.xen.org; Tue, 05 Jul 2016 03:14:56 +0000 Received: from [85.158.139.211] by server-7.bemta-5.messagelabs.com id 1B/56-10476-F262B775; Tue, 05 Jul 2016 03:14:55 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsVSPpHPUVdfrTr cYOpXfoslHxezODB6HN39mymAMYo1My8pvyKBNeN/0ySWgn7hiteffrA1ME7m72Lk4hASOMUo cf5JEyuEs5tR4sPuzexdjJwcbAK6Eh83TgGzRQRkJVZ3zQGzmQU+MEqcmi0BYgsL2ElMuLCHD cRmEVCR+LT4FksXIwcHr4CnxO1TBSBhCQENiZW9E1hAbE6g8NebELaQgIdE/4H1rCA2r4CgxM mZT1ggxktIHHzxghmiV1Gibf1JNghbUuLgihssIHdKgBz96sMaJoiEqcTCRwvZJzAKzkIyaxa SWQsYmVYxahSnFpWlFukaWuglFWWmZ5TkJmbm6BoamOrlphYXJ6an5iQmFesl5+duYgQGKAMQ 7GBs2u55iFGSg0lJlPfVv6pwIb6k/JTKjMTijPii0pzU4kOMMhwcShK8a1Wqw4UEi1LTUyvSM nOAsQKTluDgURLhfQaS5i0uSMwtzkyHSJ1iVJQS510AkhAASWSU5sG1weLzEqOslDAvI9AhQj wFqUW5mSWo8q8YxTkYlYR5X4BM4cnMK4Gb/gpoMRPQYtbYcpDFJYkIKakGRkPl7cq2TE13lpm sMtf0FjzhuL4s+abhTMWM7+n/+upbH98r/vY5NO0qb/vdTBbpHTKREYIWCfNWzegPMqux2LT3 xlebPTL3jOa7z9P4MPdwjwa7L9PqryYePBpdj3g5og6GrXPrCF42Z7eXvEt60037a2kJoTn+T LnGdsJPAn46HVuYNVdZiaU4I9FQi7moOBEApa6dpcoCAAA= X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1467688492!48266843!1 X-Originating-IP: [119.145.14.65] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTE5LjE0NS4xNC42NSA9PiA3NzQ2Mw==\n X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 43471 invoked from network); 5 Jul 2016 03:14:54 -0000 Received: from unknown (HELO szxga02-in.huawei.com) (119.145.14.65) by server-8.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 5 Jul 2016 03:14:54 -0000 Received: from 172.24.1.47 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.47]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DJT71996; Tue, 05 Jul 2016 11:14:08 +0800 (CST) Received: from HGHY1Z002260041.china.huawei.com (10.177.16.142) by SZXEML429-HUB.china.huawei.com (10.82.67.184) with Microsoft SMTP Server id 14.3.235.1; Tue, 5 Jul 2016 11:14:01 +0800 From: Shannon Zhao To: Date: Tue, 5 Jul 2016 11:12:39 +0800 Message-ID: <1467688367-17320-10-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1467688367-17320-1-git-send-email-zhaoshenglong@huawei.com> References: <1467688367-17320-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.0A020203.577B2601.0027, 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: 432fc142d3db33883fca7a9bb32e8254 Cc: hangaohuai@huawei.com, 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 v3 09/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 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c index 1989050..c2599b7 100644 --- a/tools/libxl/libxl_arm_acpi.c +++ b/tools/libxl/libxl_arm_acpi.c @@ -24,10 +24,18 @@ typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; +typedef int64_t s64; #include #include +#include +#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 @@ -171,6 +179,26 @@ 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 = dom->acpitable_blob + 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); + + 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) @@ -198,6 +226,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); return 0; }