From patchwork Fri Apr 1 15:49:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 64877 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp811753lbc; Fri, 1 Apr 2016 08:52:16 -0700 (PDT) X-Received: by 10.66.160.231 with SMTP id xn7mr32411148pab.134.1459525934043; Fri, 01 Apr 2016 08:52:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qk3si6636708pac.28.2016.04.01.08.52.13; Fri, 01 Apr 2016 08:52:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932671AbcDAPvr (ORCPT + 29 others); Fri, 1 Apr 2016 11:51:47 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35425 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932618AbcDAPvo (ORCPT ); Fri, 1 Apr 2016 11:51:44 -0400 Received: by mail-pa0-f52.google.com with SMTP id td3so93508808pab.2 for ; Fri, 01 Apr 2016 08:51:44 -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=uGvL0sX7d1tro/UR6LvwHZEagV70Uddr2X7Sp5/i4HU=; b=ecur2j0PCd2ji8anSev4DM7AK8F07gHaU8AzgtD0ol7T6lOM9ExfcvDKYaZtVwOriF pSsdwap26SPqoj5LQO5PbCFYBVU923Acmcvncuw7MH4rHtk/kC0PSNNYqaRwjDvboPY/ JIaqUn4663nkmpHo/2F0mKuuBQiev8+/iV3JA= 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=uGvL0sX7d1tro/UR6LvwHZEagV70Uddr2X7Sp5/i4HU=; b=K4yXFceeRPJF47buGq0FVX1FERxw3DVf6NaHBy4dNq3x22jUtK8DDEfbgS1OzKEOhQ KfC9Q8yTlZkZMPP7MQxMkNl9diLYmlCSIFwQR948i4K4gDRIKDFmoTHuVoc9c2rqbTwc Hav+QNUv1DTyZv5KhWGoo3FzkIbNHFC9PK2lBH/M94NTCyolsp7lyf7pN0RC3mBjqXUL gGI46WayGfaZkNF7gq40FpRyVRLzVDAQRW6H0y2lPlV8mSZUHMChPO23A0FeNgsFqXTw WyRoo7+VGgCREqu9lQlJBbqP73Kxj0cUJknoAN8a8Imt6XYCNsS314b1cZ3AlSnpPHJn MUyA== X-Gm-Message-State: AD7BkJJg1ZCmm4boOmkr8I87j5/wk8cJPmQdaivXcaRZJzwycQTESm3VN8WyY72n9nLOqf7Z X-Received: by 10.66.243.35 with SMTP id wv3mr31925696pac.93.1459525904152; Fri, 01 Apr 2016 08:51:44 -0700 (PDT) Received: from localhost.localdomain ([167.160.116.218]) by smtp.gmail.com with ESMTPSA id yj1sm22536791pac.16.2016.04.01.08.51.36 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 01 Apr 2016 08:51:42 -0700 (PDT) From: Shannon Zhao To: linux-arm-kernel@lists.infradead.org, stefano.stabellini@citrix.com Cc: david.vrabel@citrix.com, devicetree@vger.kernel.org, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, julien.grall@arm.com, peter.huangpeng@huawei.com, xen-devel@lists.xen.org, zhaoshenglong@huawei.com, shannon.zhao@linaro.org Subject: [PATCH v10 15/17] ARM64: XEN: Add a function to initialize Xen specific UEFI runtime services Date: Fri, 1 Apr 2016 23:49:13 +0800 Message-Id: <1459525755-36968-16-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> References: <1459525755-36968-1-git-send-email-shannon.zhao@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.1.4 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 979a8317..f15bb3b7 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