From patchwork Tue Aug 16 10:25:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 73998 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1919582qga; Tue, 16 Aug 2016 03:32:08 -0700 (PDT) X-Received: by 10.36.224.143 with SMTP id c137mr5558493ith.1.1471343528107; Tue, 16 Aug 2016 03:32:08 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id p123si21229024itp.35.2016.08.16.03.32.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Aug 2016 03:32:08 -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-0002Xz-BT; Tue, 16 Aug 2016 10:29:53 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bZbd1-0002Wk-Uc for xen-devel@lists.xen.org; Tue, 16 Aug 2016 10:29:52 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 2E/CD-28857-F1BE2B75; Tue, 16 Aug 2016 10:29:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRWlGSWpSXmKPExsVSPpHPSVfu9aZ wg8b5+hZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8a+/7UFC4UrNq+by9rAuIS/i5GLQ0jgFKPE ijtf2SCcPYwSazbtY+5i5ORgE9CV+LhxCjuILSIgK7G6aw47SBGzwHVGiTvvt7GCJIQF7CQWN b5mAbFZBFQlLr5sYgKxeQU8JBbs6wSrkRDQkFjZOwGohoODU8BT4toUNpCwEFDJ6ZkLWSHKBS VOznwCNoZZQELi4IsXzBCtihJt60+yQdiSEgdX3GABuUEC5OqPn1vZQWZKCJhKfNomPIFRcBa SUbOQjFrAyLSKUaM4tagstUjXyFIvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NScxqVgvOT93EyMw PBmAYAfjgUWBhxglOZiURHlnTtwYLsSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mC9+bLTeFCgkWp6 akVaZk5wEiBSUtw8CiJ8K4GSfMWFyTmFmemQ6ROMSpKifMuAEkIgCQySvPg2mDReYlRVkqYlx HoECGegtSi3MwSVPlXjOIcjErCvOtBpvBk5pXATX8FtJgJaLG+9AaQxSWJCCmpBkbW/gcbTCb c0OORjL65Uqv3i8rf23efxD097MxUZDpR6w6/0GH13bfPfr04983bqwFzebLUD0z5d0D9lVvR 6egephaW+kdFDmueck167PK5/EiHy0Hn08k7g2y8Vzur+Ea+Pa70iVlvZ7K8n1Bx4Ytm1w67L Xu5F8XFF6cFlnedZvjVVmKbc1aJpTgj0VCLuag4EQBafSroyQIAAA== X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1471343387!14776875!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 10617 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-2.tower-21.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 CGJ21742; Tue, 16 Aug 2016 18:26:21 +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:37 +0800 From: Shannon Zhao To: Date: Tue, 16 Aug 2016 18:25:04 +0800 Message-ID: <1471343113-10652-8-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.0A020204.57B2EA4E.0089, 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: f3a1edb202f6792dc4e91fac81ae3f9e 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 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 --- 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 8cd1d9b..28fb6fe 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 @@ -175,6 +183,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 = (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); + + 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) @@ -205,6 +233,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;