From patchwork Wed Aug 6 13:06:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 34973 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1482420523 for ; Wed, 6 Aug 2014 13:06:34 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id q200sf7332617ykb.9 for ; Wed, 06 Aug 2014 06:06:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:in-reply-to:user-agent:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-disposition; bh=A6jNHiOPia/GNF6AFSUj6ruuBQAK0n1x6kuUYWdYpuk=; b=CUM7s+QGjJE7ED52CwQYdER7kefCn5M2Hg8rARF2+8Y2Jh70TpUR9RSUDXUtXUmmzj +NaU0fuGBj6VF6ZlWFEZNlpf4UCZJ1rhsvqYcj2e2QAkcE5Yw+6NmmadHMV/BiYz1yhi SDctOvpczoKzTxHJ4im2ndYeLL7KzB7MUrZqyOOu2B6kTfLioPAXUlHqlzTeR2GYP4DO tlPI27hvWw6SscSqKo5l/qU7dewux2kCfaNfttO7GZGWZ5DAEUoqZEFRdscmDWF2ITZF cLPd431RWvv4iozV2BVl/iifFE8wbRf+WQ8J1k6xbXtsekHkHJiOjDgYpA2wiCiwCt7U kvBw== X-Gm-Message-State: ALoCoQnjm0/+AZGn0rCn/nOJkDV7/e0CCUauIR8kP2zmK+XCwuRtW075BQqHkDb42qhYPchzQlSj X-Received: by 10.236.120.9 with SMTP id o9mr5570697yhh.14.1407330393837; Wed, 06 Aug 2014 06:06:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.51 with SMTP id s48ls146630qgs.64.gmail; Wed, 06 Aug 2014 06:06:33 -0700 (PDT) X-Received: by 10.52.232.200 with SMTP id tq8mr8797180vdc.32.1407330393687; Wed, 06 Aug 2014 06:06:33 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id k11si413092vcy.20.2014.08.06.06.06.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 06 Aug 2014 06:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so3907633vcb.31 for ; Wed, 06 Aug 2014 06:06:33 -0700 (PDT) X-Received: by 10.52.144.14 with SMTP id si14mr296568vdb.95.1407330393525; Wed, 06 Aug 2014 06:06:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp23600vcb; Wed, 6 Aug 2014 06:06:32 -0700 (PDT) X-Received: by 10.66.236.161 with SMTP id uv1mr11283265pac.85.1407330392543; Wed, 06 Aug 2014 06:06:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bl11si434947pdb.116.2014.08.06.06.06.31 for ; Wed, 06 Aug 2014 06:06:32 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754559AbaHFNGa (ORCPT + 26 others); Wed, 6 Aug 2014 09:06:30 -0400 Received: from mail-we0-f171.google.com ([74.125.82.171]:46512 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbaHFNG2 (ORCPT ); Wed, 6 Aug 2014 09:06:28 -0400 Received: by mail-we0-f171.google.com with SMTP id p10so2617805wes.30 for ; Wed, 06 Aug 2014 06:06:27 -0700 (PDT) X-Received: by 10.180.37.241 with SMTP id b17mr49713473wik.70.1407330386784; Wed, 06 Aug 2014 06:06:26 -0700 (PDT) Received: from bivouac.eciton.net ([2a00:1098:0:86:1000:23:0:2]) by mx.google.com with ESMTPSA id t6sm6066372wib.4.2014.08.06.06.06.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 06 Aug 2014 06:06:25 -0700 (PDT) Date: Wed, 6 Aug 2014 14:06:23 +0100 From: Leif Lindholm To: Dave Young Cc: catalin.marinas@arm.com, will.deacon@arm.com, matt.fleming@intel.com, ard.biesheuvel@linaro.org, msalter@redhat.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org Subject: Re: [PATCH 1/2] UEFI arm64: add noefi boot param Message-ID: <20140806130623.GI4179@bivouac.eciton.net> References: <20140806083825.GA31711@dhcp-16-198.nay.redhat.com> MIME-Version: 1.0 In-Reply-To: <20140806083825.GA31711@dhcp-16-198.nay.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: leif.lindholm@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Content-Disposition: inline On Wed, Aug 06, 2014 at 04:38:25PM +0800, Dave Young wrote: > > Adding a noefi boot param like in X86 to disable efi runtime services support. > > This will be useful for debugging uefi problems. Also it will be useful > for later kexec/kdump work. Kexec on uefi support in X86 depends on a fixed vm > area specific for uefi runtime 1:1 mapping, kernel will switch to a different > page table for any uefi runtime callback in virtual mode. In arm64 similar > work probably is necessary. But kexec boot will just works with 'noefi' with > the limitaion of lacking runtime services. The runtime services is not critical > for kdump kernel for now. So as for kexec/kdump just leave the 1:1 mapping a > future work. Since this is really turning an x86-specific feature into a generic one, could it be moved to core code? Maybe an efi.mask, reusing the efi_enabled defines, with an efi_disabled macro? Also, since this patch (and its x86 predecessor) is not really "noefi", could this be integrated with the "efi=" patch (http://permalink.gmane.org/gmane.linux.kernel.efi/4405), as an efi=noruntime option? On x86, due to CSM, "noefi" was a useful fallback for completely broken (U)EFI implementations - but on an arm* UEFI system, there will be no fallback. Could it be wrapped in a kernel hacking config option? Partial code description, not even compile tested: --- --- / Leif > Signed-off-by: Dave Young > --- > arch/arm64/kernel/efi.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > Index: linux-2.6/arch/arm64/kernel/efi.c > =================================================================== > --- linux-2.6.orig/arch/arm64/kernel/efi.c > +++ linux-2.6/arch/arm64/kernel/efi.c > @@ -31,6 +31,14 @@ static efi_runtime_services_t *runtime; > > static u64 efi_system_table; > > +static bool disable_runtime __initdata = false; > +static int __init setup_noefi(char *arg) > +{ > + disable_runtime = true; > + return 0; > +} > +early_param("noefi", setup_noefi); > + > static int uefi_debug __initdata; > static int __init uefi_debug_setup(char *str) > { > @@ -391,11 +399,14 @@ static int __init arm64_enter_virtual_mo > return -1; > } > > - pr_info("Remapping and enabling EFI services.\n"); > - > - /* replace early memmap mapping with permanent mapping */ > mapsize = memmap.map_end - memmap.map; > early_memunmap(memmap.map, mapsize); > + > + if (disable_runtime) > + return -ENODEV; > + > + pr_info("Remapping and enabling EFI services.\n"); > + /* replace early memmap mapping with permanent mapping */ > memmap.map = (__force void *)ioremap_cache((phys_addr_t)memmap.phys_map, > mapsize); > memmap.map_end = memmap.map + mapsize; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 14db1f6..a295a5c 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -386,7 +386,7 @@ static int __init arm64_enter_virtual_mode(void) int count = 0; unsigned long flags; - if (!efi_enabled(EFI_BOOT)) { + if (!efi_enabled(EFI_BOOT) || efi_disabled(EFI_RUNTIME_SERVICES)) { pr_info("EFI services will not be available.\n"); return -1; } diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 87fc96b..b59a7c6 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c @@ -77,14 +77,6 @@ static efi_config_table_type_t arch_tables[] __initdata = { u64 efi_setup; /* efi setup_data physical address */ -static bool disable_runtime __initdata = false; -static int __init setup_noefi(char *arg) -{ - disable_runtime = true; - return 0; -} -early_param("noefi", setup_noefi); - int add_efi_memmap; EXPORT_SYMBOL(add_efi_memmap); @@ -764,7 +756,7 @@ void __init efi_init(void) if (!efi_runtime_supported()) pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n"); else { - if (disable_runtime || efi_runtime_init()) + if (efi_disabled(EFI_RUNTIME_SERVICES) || efi_runtime_init()) return; } if (efi_memmap_init()) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index dc79346..ffc4a45 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -43,6 +43,15 @@ EXPORT_SYMBOL(efi); static struct kobject *efi_kobj; static struct kobject *efivars_kobj; +static int __init setup_noefi(char *arg) +{ +#if defined(CONFIG_X86) || defined(CONFIG_EFI_DEBUG) + set_bit(EFI_RUNTIME_SERVICES, &efi.mask); +#endif + return 0; +} +early_param("noefi", setup_noefi); + /* * Let's not leave out systab information that snuck into * the efivars driver diff --git a/include/linux/efi.h b/include/linux/efi.h index 41bbf8b..9533d0e 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -826,6 +826,7 @@ extern struct efi { efi_set_virtual_address_map_t *set_virtual_address_map; struct efi_memory_map *memmap; unsigned long flags; + unsigned long mask; } efi; static inline int @@ -926,6 +927,10 @@ static inline bool efi_enabled(int feature) { return test_bit(feature, &efi.flags) != 0; } +static inline bool efi_disabled(int feature) +{ + return test_bit(feature, &efi.mask) == 0; +} #else static inline bool efi_enabled(int feature) {