From patchwork Tue Nov 17 09:40:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 7635131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A58409F1D3 for ; Tue, 17 Nov 2015 10:17:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C37C9204E0 for ; Tue, 17 Nov 2015 10:17:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7948203C0 for ; Tue, 17 Nov 2015 10:17:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZydIU-0002bT-Am; Tue, 17 Nov 2015 10:15:34 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zycrq-0002pI-2T for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 09:48:06 +0000 Received: by wmww144 with SMTP id w144so145723294wmw.1 for ; Tue, 17 Nov 2015 01:47:40 -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=lPjKI6nRhP1/vOQU6mKT/lKBl0ybQ3f9rkk7ACHYvkY=; b=kBWgVKEPlaMxm6TJJxTBrC1q9T5xQRsa2ZvCyHFTcoVGKA3e0rdGhnShTLftJBZmGe pgx4SvnUCvU0qM9+abCxXr4PgqVY1lAsNNmjwLHj5NguRThiJjn9O6lDn9ZXcIk3e3WY xS8pRCGOxHX86EqcmAQnrVDdLD6wzDLGvmRby0MjT6OUwSoP26TaeDd6QcymwKinbuiM s4GpQbsSNKxtMbvMphppVF2/CUEkytYDO+ruKrvgZeN5f0rvzqGhmyYO32R2YWZlq/58 ZulJn+RLVk0nMYncJJACLLY7ESebez/25K4WrVsDEtaqnY8OtLZ83VqxiClc51eL3oMs kGnQ== 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=lPjKI6nRhP1/vOQU6mKT/lKBl0ybQ3f9rkk7ACHYvkY=; b=aau4d6HyCjwWPctHAWBJoE2Qcsrb2NZJCKMuJlbZCE/oGHyXM9QWWERi+hw6fIr6x9 ebMnDwO/qBP3I5fl1ezqWcnMf1DcL27bD8uC2gL+bkZVnY6zt37OBaJEYZnOyW/EoNln J1BPYjUqzFIczDo9KX084GqBKHnvEYoRlHeM5zUCortMi/UvqIY3IzhmSEox68RWXojL /TUDI9pUW0Q3K6fEGiLAmH8lcPJrD+YeCVrs4Rti59GoQkbGGuxdREgLwED02kz8ST1b M2xw6QnjnefOYxpUSWm1aILv18ZtaEKO44M5anp/2OeioT9DbZiDBNqvqcdtb7RYvD9w pxgg== X-Gm-Message-State: ALoCoQnwFf+XkRMVX2PW+Pz2IWJphPmXtZJ0cEwb32IhmFFhFv7SX4WhvuuozD/wgCI3eudsFkjC X-Received: by 10.28.139.18 with SMTP id n18mr1538044wmd.63.1447753660558; Tue, 17 Nov 2015 01:47:40 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id ft4sm38918365wjb.37.2015.11.17.01.47.38 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:47:39 -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 Subject: [PATCH v3 45/62] arm/acpi: Prepare STAO table for Dom0 Date: Tue, 17 Nov 2015 17:40:44 +0800 Message-Id: <1447753261-7552-46-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_014802_754367_E6C80827 X-CRM114-Status: GOOD ( 12.18 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shannon Zhao Create STAO table for Dom0. This table is used to tell Dom0 whether it should ignore UART defined in SPCR table or the ACPI namespace names. Look at below url for details: http://wiki.xenproject.org/mediawiki/images/0/02/Status-override-table.pdf Signed-off-by: Parth Dixit Signed-off-by: Shannon Zhao --- xen/arch/arm/domain_build.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 4591955..fb3f150 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1359,6 +1359,45 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) #ifdef CONFIG_ACPI #define XEN_HYPERVISOR_ID 0x000058656E564D4D /* "XenVMM" */ +static int acpi_create_stao(struct domain *d, struct membank tbl_add[]) +{ + struct acpi_table_header *table = NULL; + struct acpi_table_stao *stao = NULL; + u64 table_size = sizeof(struct acpi_table_stao); + acpi_status status; + u8 *base_ptr; + u8 checksum; + + status = acpi_get_table(ACPI_SIG_MADT, 0, &table); + + if ( ACPI_FAILURE(status) ) + { + const char *msg = acpi_format_exception(status); + + printk("Failed to get MADT table, %s\n", msg); + return -EINVAL; + } + + base_ptr = d->arch.efi_acpi_table + + acpi_get_table_offset(tbl_add, TBL_STAO); + /* Copy header of one table, here use MADT */ + ACPI_MEMCPY(base_ptr, table, sizeof(struct acpi_table_header)); + stao = (struct acpi_table_stao *)base_ptr; + + ACPI_MEMCPY(stao->header.signature, ACPI_SIG_STAO, 4); + stao->header.revision = 1; + stao->header.length = table_size; + stao->ignore_uart = 1; + checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, stao), table_size); + stao->header.checksum = stao->header.checksum - checksum; + + tbl_add[TBL_STAO].start = d->arch.efi_acpi_gpa + + acpi_get_table_offset(tbl_add, TBL_STAO); + tbl_add[TBL_STAO].size = table_size; + + return 0; +} + static int acpi_create_madt(struct domain *d, struct membank tbl_add[]) { struct acpi_table_header *table = NULL; @@ -1561,6 +1600,10 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo) if ( rc != 0 ) return rc; + rc = acpi_create_stao(d, tbl_add); + if ( rc != 0 ) + return rc; + return 0; } #else