From patchwork Fri Jan 15 06:55:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8038831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D0B73BEEE5 for ; Fri, 15 Jan 2016 07:03:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E495620458 for ; Fri, 15 Jan 2016 07:03:56 +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 09C4020430 for ; Fri, 15 Jan 2016 07:03:56 +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 1aJyOv-0003yt-Be; Fri, 15 Jan 2016 07:02:25 +0000 Received: from szxga01-in.huawei.com ([58.251.152.64]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJyNP-00029b-E1 for linux-arm-kernel@lists.infradead.org; Fri, 15 Jan 2016 07:00:57 +0000 Received: from 172.24.1.50 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.50]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DDB64123; Fri, 15 Jan 2016 14:56:37 +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; Fri, 15 Jan 2016 14:56:29 +0800 From: Shannon Zhao To: , , , Subject: [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI runtime services Date: Fri, 15 Jan 2016 14:55:29 +0800 Message-ID: <1452840929-19612-17-git-send-email-zhaoshenglong@huawei.com> X-Mailer: git-send-email 1.9.0.msysgit.0 In-Reply-To: <1452840929-19612-1-git-send-email-zhaoshenglong@huawei.com> References: <1452840929-19612-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.0A020205.56989825.0120, 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: 6f7c59d3a99a6646ca210cddbecfdbcb X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160114_230052_315649_65DC8FEA X-CRM114-Status: GOOD ( 15.41 ) X-Spam-Score: -4.2 (----) 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, devicetree@vger.kernel.org, linux-efi@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, xen-devel@lists.xen.org, julien.grall@citrix.com, shannon.zhao@linaro.org, peter.huangpeng@huawei.com 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.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 When running on Xen hypervisor, runtime services are supported through hypercall. So call Xen specific function to initialize runtime services. Signed-off-by: Shannon Zhao --- arch/arm/xen/enlighten.c | 5 +++++ arch/arm64/xen/Makefile | 1 + arch/arm64/xen/efi.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/xen/Kconfig | 2 +- include/xen/xen-ops.h | 1 + 5 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/xen/efi.c diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 485e117..84f27ec 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -414,6 +414,11 @@ static int __init xen_guest_init(void) if (xen_initial_domain()) pvclock_gtod_register_notifier(&xen_pvclock_gtod_notifier); + if (IS_ENABLED(CONFIG_XEN_EFI)) { + if (efi_enabled(EFI_PARAVIRT)) + xen_efi_runtime_setup(); + } + return 0; } early_initcall(xen_guest_init); diff --git a/arch/arm64/xen/Makefile b/arch/arm64/xen/Makefile index 74a8d87..62e6fe2 100644 --- a/arch/arm64/xen/Makefile +++ b/arch/arm64/xen/Makefile @@ -1,2 +1,3 @@ xen-arm-y += $(addprefix ../../arm/xen/, enlighten.o grant-table.o p2m.o mm.o) obj-y := xen-arm.o hypercall.o +obj-$(CONFIG_XEN_EFI) += efi.o diff --git a/arch/arm64/xen/efi.c b/arch/arm64/xen/efi.c new file mode 100644 index 0000000..33046b0 --- /dev/null +++ b/arch/arm64/xen/efi.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2015, Linaro Limited, Shannon Zhao + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include +#include + +void __init xen_efi_runtime_setup(void) +{ + efi.get_time = xen_efi_get_time; + efi.set_time = xen_efi_set_time; + efi.get_wakeup_time = xen_efi_get_wakeup_time; + efi.set_wakeup_time = xen_efi_set_wakeup_time; + efi.get_variable = xen_efi_get_variable; + efi.get_next_variable = xen_efi_get_next_variable; + efi.set_variable = xen_efi_set_variable; + efi.query_variable_info = xen_efi_query_variable_info; + efi.update_capsule = xen_efi_update_capsule; + efi.query_capsule_caps = xen_efi_query_capsule_caps; + efi.get_next_high_mono_count = xen_efi_get_next_high_mono_count; + efi.reset_system = NULL; +} +EXPORT_SYMBOL_GPL(xen_efi_runtime_setup); diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 73708ac..27d216a 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -268,7 +268,7 @@ config XEN_HAVE_PVMMU config XEN_EFI def_bool y - depends on X86_64 && EFI + depends on (ARM64 || X86_64) && EFI config XEN_AUTO_XLATE def_bool y diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index c83a338..36ff8e4 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h @@ -107,6 +107,7 @@ efi_status_t xen_efi_update_capsule(efi_capsule_header_t **capsules, efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, unsigned long count, u64 *max_size, int *reset_type); +void xen_efi_runtime_setup(void); #ifdef CONFIG_PREEMPT