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: 8038641 Return-Path: X-Original-To: patchwork-xen-devel@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 D302D9F32E for ; Fri, 15 Jan 2016 06:59:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E891A20458 for ; Fri, 15 Jan 2016 06:59:49 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AF4A20430 for ; Fri, 15 Jan 2016 06:59:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aJyJY-0002q0-Ob; Fri, 15 Jan 2016 06:56:52 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aJyJW-0002op-Pk for xen-devel@lists.xen.org; Fri, 15 Jan 2016 06:56:51 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id 69/DE-31069-23898965; Fri, 15 Jan 2016 06:56:50 +0000 X-Env-Sender: zhaoshenglong@huawei.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1452841003!16013316!1 X-Originating-IP: [58.251.152.64] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 55928 invoked from network); 15 Jan 2016 06:56:48 -0000 Received: from szxga01-in.huawei.com (HELO szxga01-in.huawei.com) (58.251.152.64) by server-3.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 15 Jan 2016 06:56:48 -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: , , , 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 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 Subject: [Xen-devel] [PATCH v2 16/16] ARM64: XEN: Initialize Xen specific UEFI runtime services 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: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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