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: 64384 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp698523lbc; Thu, 24 Mar 2016 07:50:13 -0700 (PDT) X-Received: by 10.55.22.103 with SMTP id g100mr8448336qkh.0.1458830978638; Thu, 24 Mar 2016 07:49:38 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id 47si6804800qgd.35.2016.03.24.07.49.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Mar 2016 07:49:38 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 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 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj6Ys-0003sC-Sq; Thu, 24 Mar 2016 14:48:34 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aj6Yr-0003rK-BO for xen-devel@lists.xen.org; Thu, 24 Mar 2016 14:48:33 +0000 Received: from [193.109.254.147] by server-13.bemta-14.messagelabs.com id B6/EA-02874-04EF3F65; Thu, 24 Mar 2016 14:48:32 +0000 X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-13.tower-27.messagelabs.com!1458830910!33656585!1 X-Originating-IP: [209.85.220.51] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49376 invoked from network); 24 Mar 2016 14:48:31 -0000 Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by server-13.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 Mar 2016 14:48:31 -0000 Received: by mail-pa0-f51.google.com with SMTP id fl4so23864384pad.0 for ; Thu, 24 Mar 2016 07:48:31 -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=LRXBoKMBqCgXDzrgsgfk/L3RgJQll1QhXL0HOLtiej6yqQNwiDOQQSZ7EeymUnvZnI 037Z2Bqu9VpX10n0LlG+qUPoUOzNyjqbOOtmlpKsFUIca6O/PS+s5TNkA6URXF0vOBRV YeGxBQvzz1hcnjMC/bqtePJu6gTEjNzMwNSAX3o24cb9qfZXUGl53AbhxWyzAxGtw6Z0 2FNus4NLTBCXJdgebB171HcnDOMo8zjCOsX/SJB72n8OzI0jSqwJoqy98P8j7AXVOrbV zR+iGCGMoSi/+zgdPjdso/UUGnDq4p/F4PEQvStHJs/5fmy8WjvkMI4W8BFlZDOc1s5x QlYw== X-Gm-Message-State: AD7BkJJmrPmatmNWmY2A7KDoAQmc41TXtghZGfUIqbrlynLE+5kGFAVGdByLwiaeK2YDc1+V 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 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> 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 Subject: [Xen-devel] [PATCH v7 15/17] ARM64: XEN: Add a function to initialize Xen specific UEFI runtime services X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" 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