From patchwork Thu Mar 24 14:44:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 8662061 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 BB0759F36E for ; Thu, 24 Mar 2016 14:56:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBC68203A0 for ; Thu, 24 Mar 2016 14:56:37 +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 A6F24202AE for ; Thu, 24 Mar 2016 14:56:36 +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 1aj6f3-0005Gp-0x; Thu, 24 Mar 2016 14:54:57 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aj6Z9-0007Nf-CG for linux-arm-kernel@lists.infradead.org; Thu, 24 Mar 2016 14:49:09 +0000 Received: by mail-pa0-x22d.google.com with SMTP id td3so23749420pab.2 for ; Thu, 24 Mar 2016 07:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Un/WT4xcT7ypW7PxGVqgcjw2jGX6zN/6vEBGIUqF5UA=; b=QuM3/9k2/X36GksgBKT9/9y8xc40utD7Umyf0OESvdpP4mwoQL92xpZIMlSgUFbKkS 7mO7mZpJLWWaUZPljpIzagkUGLy4FjJ8n8X1h16zs6D2rY/Q6CrjEelGqaoFTLOLG4fd bQLqyh1q2c+ENNw/+oWFViIOv9MIUPEind/UA= 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=Un/WT4xcT7ypW7PxGVqgcjw2jGX6zN/6vEBGIUqF5UA=; b=SXwRyavG11jT1zGkajvlQdue4ENFKDLALvQ1HxnxsKY6ogidUHUCrklJsEA67aRXsZ 2roI7yeRIM8jN8eE4BXhZh2AU5990izRjgOYMv0pjZtnZ8FvwJb3XVOeQx4RsxwitW88 MwNuqK2rC4WYpOIllDEfN3yAcu/aUo/wmAq5hJomi1fxr/EunVbXSJkB8D+IDe4Sj6+a xspD7rrLCfq9uG2Fz1jSRwMIls4wBGgbQauQiVcLepwyae0mjGFQsl87lR0McWmHfe2B OFaJ6ZJomTEpcGOV8KtjBLey3ivTDdPfkiIev5nmC6iPwFb9auRar4V46wQkafTcIfzc Y75w== X-Gm-Message-State: AD7BkJKrD1ZOAxJhqK3ydj2OHoFl62EE1FJuZvZCCIjYjwGI76bMhJG3HF0AxQ9rgy7waFom X-Received: by 10.66.102.8 with SMTP id fk8mr13485447pab.12.1458830910374; Thu, 24 Mar 2016 07:48:30 -0700 (PDT) Received: from localhost.localdomain ([104.238.45.135]) by smtp.gmail.com with ESMTPSA id lq10sm10780673pab.36.2016.03.24.07.48.22 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 24 Mar 2016 07:48:29 -0700 (PDT) From: Shannon Zhao To: linux-arm-kernel@lists.infradead.org, stefano.stabellini@citrix.com, david.vrabel@citrix.com Subject: [PATCH v7 15/17] ARM64: XEN: Add a function to initialize Xen specific UEFI runtime services Date: Thu, 24 Mar 2016 22:44:34 +0800 Message-Id: <1458830676-27075-16-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1458830676-27075-1-git-send-email-shannon.zhao@linaro.org> References: <1458830676-27075-1-git-send-email-shannon.zhao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160324_074852_100853_9E952D56 X-CRM114-Status: GOOD ( 16.50 ) X-Spam-Score: -2.7 (--) 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: devicetree@vger.kernel.org, linux-efi@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, peter.huangpeng@huawei.com, julien.grall@arm.com, shannon.zhao@linaro.org, zhaoshenglong@huawei.com, xen-devel@lists.xen.org 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 When running on Xen hypervisor, runtime services are supported through hypercall. Add a Xen specific function to initialize runtime services. Signed-off-by: Shannon Zhao Reviewed-by: Stefano Stabellini --- arch/arm/include/asm/xen/xen-ops.h | 6 ++++++ arch/arm/xen/Makefile | 1 + arch/arm/xen/efi.c | 40 ++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/xen/xen-ops.h | 6 ++++++ arch/arm64/xen/Makefile | 1 + drivers/xen/Kconfig | 2 +- 6 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/xen/xen-ops.h create mode 100644 arch/arm/xen/efi.c create mode 100644 arch/arm64/include/asm/xen/xen-ops.h diff --git a/arch/arm/include/asm/xen/xen-ops.h b/arch/arm/include/asm/xen/xen-ops.h new file mode 100644 index 0000000..ec154e7 --- /dev/null +++ b/arch/arm/include/asm/xen/xen-ops.h @@ -0,0 +1,6 @@ +#ifndef _ASM_XEN_OPS_H +#define _ASM_XEN_OPS_H + +void xen_efi_runtime_setup(void); + +#endif /* _ASM_XEN_OPS_H */ diff --git a/arch/arm/xen/Makefile b/arch/arm/xen/Makefile index 1296952..2279521 100644 --- a/arch/arm/xen/Makefile +++ b/arch/arm/xen/Makefile @@ -1 +1,2 @@ obj-y := enlighten.o hypercall.o grant-table.o p2m.o mm.o +obj-$(CONFIG_XEN_EFI) += efi.o diff --git a/arch/arm/xen/efi.c b/arch/arm/xen/efi.c new file mode 100644 index 0000000..16db419 --- /dev/null +++ b/arch/arm/xen/efi.c @@ -0,0 +1,40 @@ +/* + * 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 +#include + +/* Set XEN EFI runtime services function pointers. Other fields of struct efi, + * e.g. efi.systab, will be set like normal EFI. + */ +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; /* Functionality provided by Xen. */ +} +EXPORT_SYMBOL_GPL(xen_efi_runtime_setup); diff --git a/arch/arm64/include/asm/xen/xen-ops.h b/arch/arm64/include/asm/xen/xen-ops.h new file mode 100644 index 0000000..ec154e7 --- /dev/null +++ b/arch/arm64/include/asm/xen/xen-ops.h @@ -0,0 +1,6 @@ +#ifndef _ASM_XEN_OPS_H +#define _ASM_XEN_OPS_H + +void xen_efi_runtime_setup(void); + +#endif /* _ASM_XEN_OPS_H */ diff --git a/arch/arm64/xen/Makefile b/arch/arm64/xen/Makefile index 74a8d87..8ff8aa9 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) += $(addprefix ../../arm/xen/, efi.o) diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 979a831..f15bb3b 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -275,7 +275,7 @@ config XEN_HAVE_PVMMU config XEN_EFI def_bool y - depends on X86_64 && EFI + depends on (ARM || ARM64 || X86_64) && EFI config XEN_AUTO_XLATE def_bool y