From patchwork Tue Nov 17 09:57:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 56776 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1831371lbb; Tue, 17 Nov 2015 01:58:43 -0800 (PST) X-Received: by 10.66.119.237 with SMTP id kx13mr3016885pab.158.1447754322992; Tue, 17 Nov 2015 01:58:42 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qo8si56526165pac.117.2015.11.17.01.58.42; Tue, 17 Nov 2015 01:58:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753016AbbKQJ6l (ORCPT + 6 others); Tue, 17 Nov 2015 04:58:41 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:34630 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753518AbbKQJ6j (ORCPT ); Tue, 17 Nov 2015 04:58:39 -0500 Received: by wmvv187 with SMTP id v187so218399216wmv.1 for ; Tue, 17 Nov 2015 01:58:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fNAdpaon8SA3uMqUf/zodTXGZ6Dc8h0akogszlIVatw=; b=yqkPHJflnWYNGAVijIrqHAl7ywAyqgcWLkJBu0PjGvoa4WT5kWaacT7v8tsqj1fj2I FSIrM+fq+CITX9Pp3vRjHPJ3uhEla6B234At3Q3adlqA2hxBoBAHaikmls3UHxGvLk5U 6LPAnmeBd/0kENllb9vVFRCV2jFOkSjXFkxfy5B65IeVHrRl22Xw7UchRhoZn4ZaASf6 NGLc4DTk2DQTQm+uzj78je5BFGAxl01+qjub5Ot7hZKv9b8fVivfgxj2lOlIzSkZJhuz X8mj6h/uiFH8DH6xmxUVotaB5CXcHY96vcCgST3t1HHQrXWL5okfnJdNjXTdbdz7OkiN BXig== 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=fNAdpaon8SA3uMqUf/zodTXGZ6Dc8h0akogszlIVatw=; b=FjoezZZXhjIgcw5p40E1uberHBIFcCtkZfmapBc9v4Py4oj1FI7TTp7UhpZRg9F4Ph Am7BuRPgU/wftWwMslk0MNdLiMf4e1kS7g9arwBAwKT7cZNld583EUUGXOj4Cp+qoRHE 8ftc2pEBq0fuWBEEaWWG7tR4HuLLwEZSpAoAqP5cTVp7VtE5jCJhuXsT7chUmaNC68rP lY0gyTjRnXl1vTyBSyTiXlRu8QFXAp/BfIp+umh7D4UWYlQBQ7NfTVaQiQ33I4rjZ2wS H72gP7SeVJ3jTNVNd2pthtfkKQdpAZbp4KRtNgTkAoB1JondzYKyzSHs/KDYdXXYO7PR anjg== X-Gm-Message-State: ALoCoQljLVRqpa8xHMmOALXNpJDaGtclKby4RMZ2tBbWyNGOw9mJmN5QO72S3lCUwVX2CzWUdH1q X-Received: by 10.194.209.235 with SMTP id mp11mr28387199wjc.53.1447754317903; Tue, 17 Nov 2015 01:58:37 -0800 (PST) Received: from localhost ([78.129.251.54]) by smtp.gmail.com with ESMTPSA id bk2sm39076449wjc.3.2015.11.17.01.58.34 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 17 Nov 2015 01:58:36 -0800 (PST) From: shannon.zhao@linaro.org To: ian.campbell@citrix.com, stefano.stabellini@citrix.com, catalin.marinas@arm.com, will.deacon@arm.com, julien.grall@citrix.com, ard.biesheuvel@linaro.org, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org Cc: xen-devel@lists.xen.org, christoffer.dall@linaro.org, devicetree@vger.kernel.org, linux-efi@vger.kernel.org, peter.huangpeng@huawei.com, shannon.zhao@linaro.org, zhaoshenglong@huawei.com, hangaohuai@huawei.com Subject: [PATCH 09/13] ARM: Xen: Initialize Xen specific UEFI runtime services Date: Tue, 17 Nov 2015 17:57:07 +0800 Message-Id: <1447754231-7772-10-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1447754231-7772-1-git-send-email-shannon.zhao@linaro.org> References: <1447754231-7772-1-git-send-email-shannon.zhao@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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/include/asm/xen/hypercall.h | 1 + arch/arm/xen/enlighten.c | 1 + arch/arm/xen/hypercall.S | 1 + arch/arm64/kernel/efi.c | 20 ++++++++++++++------ arch/arm64/xen/hypercall.S | 1 + drivers/xen/Kconfig | 2 +- drivers/xen/efi.c | 22 ++++++++++++++++++++++ include/xen/xen-ops.h | 10 ++++++++++ 8 files changed, 51 insertions(+), 7 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/include/asm/xen/hypercall.h b/arch/arm/include/asm/xen/hypercall.h index 712b50e..0de6074 100644 --- a/arch/arm/include/asm/xen/hypercall.h +++ b/arch/arm/include/asm/xen/hypercall.h @@ -50,6 +50,7 @@ int HYPERVISOR_physdev_op(int cmd, void *arg); int HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args); int HYPERVISOR_tmem_op(void *arg); int HYPERVISOR_multicall(struct multicall_entry *calls, uint32_t nr); +int HYPERVISOR_dom0_op(void *arg); static inline int HYPERVISOR_suspend(unsigned long start_info_mfn) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 7cb82f7..1373d6d 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -289,3 +289,4 @@ EXPORT_SYMBOL_GPL(HYPERVISOR_vcpu_op); EXPORT_SYMBOL_GPL(HYPERVISOR_tmem_op); EXPORT_SYMBOL_GPL(HYPERVISOR_multicall); EXPORT_SYMBOL_GPL(privcmd_call); +EXPORT_SYMBOL_GPL(HYPERVISOR_dom0_op); diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S index 10fd99c..16fc153 100644 --- a/arch/arm/xen/hypercall.S +++ b/arch/arm/xen/hypercall.S @@ -90,6 +90,7 @@ HYPERCALL2(physdev_op); HYPERCALL3(vcpu_op); HYPERCALL1(tmem_op); HYPERCALL2(multicall); +HYPERCALL1(dom0_op); ENTRY(privcmd_call) stmdb sp!, {r4} diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 13671a9..ab1c9e9 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -34,6 +34,9 @@ #include #include +#include +#include + struct efi_memory_map memmap; static u64 efi_system_table; @@ -308,13 +311,18 @@ static int __init arm64_enable_runtime_services(void) } set_bit(EFI_SYSTEM_TABLES, &efi.flags); - if (!efi_virtmap_init()) { - pr_err("No UEFI virtual mapping was installed -- runtime services will not be available\n"); - return -1; - } + if (!xen_initial_domain()) { + if (!efi_virtmap_init()) { + pr_err("No UEFI virtual mapping was installed -- runtime services will not be available\n"); + return -1; + } - /* Set up runtime services function pointers */ - efi_native_runtime_setup(); + /* Set up runtime services function pointers */ + efi_native_runtime_setup(); + } else { + /* Set up runtime services function pointers for Xen UEFI */ + xen_efi_runtime_setup(); + } set_bit(EFI_RUNTIME_SERVICES, &efi.flags); efi.runtime_version = efi.systab->hdr.revision; diff --git a/arch/arm64/xen/hypercall.S b/arch/arm64/xen/hypercall.S index 8bbe940..f6e15aa 100644 --- a/arch/arm64/xen/hypercall.S +++ b/arch/arm64/xen/hypercall.S @@ -81,6 +81,7 @@ HYPERCALL2(physdev_op); HYPERCALL3(vcpu_op); HYPERCALL1(tmem_op); HYPERCALL2(multicall); +HYPERCALL1(dom0_op); ENTRY(privcmd_call) mov x16, x0 diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 73708ac..59aec8b 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/drivers/xen/efi.c b/drivers/xen/efi.c index f745db2..5246d89 100644 --- a/drivers/xen/efi.c +++ b/drivers/xen/efi.c @@ -33,6 +33,7 @@ #define INIT_EFI_OP(name) \ {.cmd = XENPF_efi_runtime_call, \ + .interface_version = XENPF_INTERFACE_VERSION, \ .u.efi_runtime_call.function = XEN_EFI_##name, \ .u.efi_runtime_call.misc = 0} @@ -261,6 +262,7 @@ static efi_status_t xen_efi_query_capsule_caps(efi_capsule_header_t **capsules, return efi_data(op).status; } +#ifdef CONFIG_x86 static efi_char16_t vendor[100] __initdata; static efi_system_table_t efi_systab_xen __initdata = { @@ -319,7 +321,26 @@ static const struct efi efi_xen __initconst = { .memmap = NULL, /* Not used under Xen. */ .flags = 0 /* Initialized later. */ }; +#endif +#ifdef CONFIG_ARM64 +void 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; +} +#endif + +#ifdef CONFIG_X86 efi_system_table_t __init *xen_efi_probe(void) { struct xen_platform_op op = { @@ -369,3 +390,4 @@ efi_system_table_t __init *xen_efi_probe(void) return &efi_systab_xen; } +#endif diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index e4e214a..a6c26ad 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h @@ -84,13 +84,23 @@ int xen_xlate_unmap_gfn_range(struct vm_area_struct *vma, bool xen_running_on_version_or_later(unsigned int major, unsigned int minor); #ifdef CONFIG_XEN_EFI +#ifdef CONFIG_X86 extern efi_system_table_t *xen_efi_probe(void); +#endif +#ifdef CONFIG_ARM64 +extern void xen_efi_runtime_setup(void); +#endif #else +#ifdef CONFIG_X86 static inline efi_system_table_t __init *xen_efi_probe(void) { return NULL; } #endif +#ifdef CONFIG_ARM64 +static inline void xen_efi_runtime_setup(void) { } +#endif +#endif #ifdef CONFIG_PREEMPT