From patchwork Fri Jan 15 06:55:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 59834 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp356756lbb; Thu, 14 Jan 2016 22:56:57 -0800 (PST) X-Received: by 10.98.72.130 with SMTP id q2mr12706313pfi.154.1452841015927; Thu, 14 Jan 2016 22:56:55 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m68si14541332pfj.133.2016.01.14.22.56.55; Thu, 14 Jan 2016 22:56:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754661AbcAOG4u (ORCPT + 6 others); Fri, 15 Jan 2016 01:56:50 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:13174 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754469AbcAOG4m (ORCPT ); Fri, 15 Jan 2016 01:56:42 -0500 Received: from 172.24.1.51 (EHLO SZXEML429-HUB.china.huawei.com) ([172.24.1.51]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DDB64111; Fri, 15 Jan 2016 14:56:32 +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:25 +0800 From: Shannon Zhao To: , , , CC: , , , , , , , , , Subject: [PATCH v2 13/16] ARM: XEN: Set EFI_PARAVIRT if Xen supports EFI Date: Fri, 15 Jan 2016 14:55:26 +0800 Message-ID: <1452840929-19612-14-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.0A020202.56989822.0064, 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: 7c499ce6c54741980060851c00398894 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Shannon Zhao Check if there is "uefi" node in the DT. If so, set EFI_PARAVIRT flag. Signed-off-by: Shannon Zhao --- arch/arm/xen/enlighten.c | 23 +++++++++++++++++++++++ arch/arm64/kernel/efi.c | 5 +++++ 2 files changed, 28 insertions(+) -- 2.0.4 -- 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/xen/enlighten.c b/arch/arm/xen/enlighten.c index 5d0fe68..485e117 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -248,6 +249,19 @@ static int __init fdt_find_xen_node(unsigned long node, const char *uname, return 0; } +static int __init fdt_find_uefi_node(unsigned long node, const char *uname, + int depth, void *data) +{ + bool *found = data; + + if (depth != 2 || strcmp(uname, "uefi") != 0) + return 0; + + *found = true; + + return 1; +} + /* * see Documentation/devicetree/bindings/arm/xen.txt for the * documentation of the Xen Device Tree format. @@ -255,6 +269,8 @@ static int __init fdt_find_xen_node(unsigned long node, const char *uname, #define GRANT_TABLE_PHYSADDR 0 void __init xen_early_init(void) { + bool uefi_found = false; + of_scan_flat_dt(fdt_find_xen_node, NULL); if (!xen_node.found) { pr_debug("No Xen support\n"); @@ -279,6 +295,13 @@ void __init xen_early_init(void) if (!console_set_on_cmdline && !xen_initial_domain()) add_preferred_console("hvc", 0, NULL); + + if (IS_ENABLED(CONFIG_XEN_EFI)) { + /* Check if Xen support UEFI */ + of_scan_flat_dt(fdt_find_uefi_node, &uefi_found); + if (uefi_found) + set_bit(EFI_PARAVIRT, &efi.flags); + } } static int __init xen_guest_init(void) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 4eeb171..16c6b72 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -288,6 +288,11 @@ static int __init arm64_enable_runtime_services(void) return 0; } + if (efi_enabled(EFI_PARAVIRT)) { + pr_info("EFI runtime services access via paravirt.\n"); + return -1; + } + pr_info("Remapping and enabling EFI services.\n"); mapsize = memmap.map_end - memmap.map;