From patchwork Tue Nov 17 09:40:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 56742 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1827260lbb; Tue, 17 Nov 2015 01:48:26 -0800 (PST) X-Received: by 10.31.154.203 with SMTP id c194mr2483115vke.57.1447753703864; Tue, 17 Nov 2015 01:48:23 -0800 (PST) Return-Path: Received: from lists.xen.org (lists.xenproject.org. [50.57.142.19]) by mx.google.com with ESMTPS id q189si2026227vkq.12.2015.11.17.01.48.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Nov 2015 01:48:23 -0800 (PST) Received-SPF: neutral (google.com: 50.57.142.19 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=50.57.142.19; Authentication-Results: mx.google.com; spf=neutral (google.com: 50.57.142.19 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; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZycrB-0006he-EW; Tue, 17 Nov 2015 09:47:21 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Zycr9-0006fm-S5 for xen-devel@lists.xen.org; Tue, 17 Nov 2015 09:47:20 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id F2/87-23747-7A7FA465; Tue, 17 Nov 2015 09:47:19 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-2.tower-31.messagelabs.com!1447753637!4202100!1 X-Originating-IP: [74.125.82.46] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.19.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15754 invoked from network); 17 Nov 2015 09:47:17 -0000 Received: from mail-wm0-f46.google.com (HELO mail-wm0-f46.google.com) (74.125.82.46) by server-2.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Nov 2015 09:47:17 -0000 Received: by wmvv187 with SMTP id v187so217927127wmv.1 for ; Tue, 17 Nov 2015 01:47:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qyGFSAU+8Y/JGL67l3zseFylsC238XkRUUje8V8X4fI=; b=D99FZl3qa6bJc9vq1aGTJhWmr1Zk3j6vPhres6c0dEdIf8ytrGlH1WU1yZ2eBn0nVU WubKaEAGX+ym2ga/Ogy+fBZ2Az026V4O36A6MrljDxHiLUAyMRrqUtIQu85nFi9i8TGQ Vi5R16uPpkvlHbE7N8wHJn66RsduEgrSgr237BbjTlTMPUfEQG0O0F8AylD3mCr1/srl YUfhvx7uBr0lK3xhzvG4UuaxJOj+cebaxkeSEofplmRDo+hhZCrygNWsf0VYhc+ZQPJR a9BHgVfXFpkeHCYdyDnVGRkoUSkuiNNhy2LxkuWHMcR8qayYL0ZrzsJTByoQ6pMP7yiH YFIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qyGFSAU+8Y/JGL67l3zseFylsC238XkRUUje8V8X4fI=; b=bt8wBeYtK+ZsbbJUBI1oriw7C4M1SYq8ZbtBYZzbyeE8dBI8/bE+UKBl0+CVblG0TG mZQw8FSzpsiIcNCI1BxLr5/J1ouHLG/05F/BiSbi+Z7ZIw2dNPDOPUmm4MpcKxh6KVAT r3SOJ6fCBX4KyH+SNCSYxB4PeNVzJV5EJ0QUnoRvRPB978i+Lfop/rQk5A1nGixwTBAi h1zvjHiFMKGAxQW4EnnwGyAf6NQHOJJFqmqdB+z8ya51k8paHG4Hu4hTJ6Q5svi6riWu vpbsvG/WGcDmU0ysw81o2ROPgc4SLjDudyB2aaLwlVtCqpqVhB6gy/CfXMYk/Yx2OIwt ZjEw== X-Gm-Message-State: ALoCoQm9Sg8Gkp7zDh7d9DApAPRWjboHa+XK+Zl2r2086wYk2wV7FWb0++eghZGhzmiz1I8eUWND X-Received: by 10.28.7.8 with SMTP id 8mr1390829wmh.45.1447753637180; Tue, 17 Nov 2015 01:47:17 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id jh4sm38925400wjb.33.2015.11.17.01.47.15 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:47:16 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, keir@xen.org, jbeulich@suse.com, andrew.cooper3@citrix.com, julien.grall@citrix.com, xen-devel@lists.xen.org Date: Tue, 17 Nov 2015 17:40:41 +0800 Message-Id: <1447753261-7552-43-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> References: <1447753261-7552-1-git-send-email-shannon.zhao@linaro.org> Cc: mark.rutland@arm.com, hangaohuai@huawei.com, ard.biesheuvel@linaro.org, shannon.zhao@linaro.org, christoffer.dall@linaro.org, peter.huangpeng@huawei.com, david.vrabel@citrix.com, zhaoshenglong@huawei.com, linux-arm-kernel@lists.infradead.org, roger.pau@citrix.com Subject: [Xen-devel] [PATCH v3 42/62] arm/acpi: Prepare FADT table for Dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org From: Shannon Zhao Copy and modify FADT table before passing it to Dom0. Set PSCI_COMPLIANT and PSCI_USE_HVC. Signed-off-by: Shannon Zhao --- xen/arch/arm/domain_build.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) -- 2.1.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index b5ed44c..5d03dc0 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1357,6 +1357,46 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) } #ifdef CONFIG_ACPI +#define XEN_HYPERVISOR_ID 0x000058656E564D4D /* "XenVMM" */ + +static int acpi_create_fadt(struct domain *d, struct membank tbl_add[]) +{ + struct acpi_table_header *table = NULL; + struct acpi_table_fadt *fadt = NULL; + u64 table_size; + acpi_status status; + u8 *base_ptr; + u8 checksum; + + status = acpi_get_table(ACPI_SIG_FADT, 0, &table); + + if ( ACPI_FAILURE(status) ) + { + const char *msg = acpi_format_exception(status); + + printk("Failed to get FADT table, %s\n", msg); + return -EINVAL; + } + + table_size = table->length; + base_ptr = d->arch.efi_acpi_table + + acpi_get_table_offset(tbl_add, TBL_FADT); + ACPI_MEMCPY(base_ptr, table, table_size); + fadt = (struct acpi_table_fadt *)base_ptr; + + /* Set PSCI_COMPLIANT and PSCI_USE_HVC */ + fadt->arm_boot_flags |= (ACPI_FADT_PSCI_COMPLIANT | ACPI_FADT_PSCI_USE_HVC); + fadt->hypervisor_id = XEN_HYPERVISOR_ID; + checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, fadt), table_size); + fadt->header.checksum -= checksum; + + tbl_add[TBL_FADT].start = d->arch.efi_acpi_gpa + + acpi_get_table_offset(tbl_add, TBL_FADT); + tbl_add[TBL_FADT].size = table_size; + + return 0; +} + static int estimate_acpi_efi_size(struct domain *d, struct kernel_info *kinfo) { u64 efi_size, acpi_size = 0, addr; @@ -1400,6 +1440,7 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) { int rc = 0; int order; + struct membank tbl_add[TBL_MMAX] = {}; rc = estimate_acpi_efi_size(d, kinfo); if ( rc != 0 ) @@ -1418,6 +1459,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) * region. So we use it as the ACPI table mapped address. */ d->arch.efi_acpi_gpa = kinfo->gnttab_start; + rc = acpi_create_fadt(d, tbl_add); + if ( rc != 0 ) + return rc; + return 0; } #else