From patchwork Tue Jul 8 09:21:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 33181 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A94B620969 for ; Tue, 8 Jul 2014 09:22:58 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id j17sf33772011oag.0 for ; Tue, 08 Jul 2014 02:22:58 -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:subject:message-id :references:mime-version:in-reply-to:user-agent:cc:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-disposition :content-type:content-transfer-encoding; bh=zStEcNEUVnRW6q+zg4WhmAaiGZf9qKlCEgkPnbo0j/s=; b=nFLwMyG0ufBY/ubU5TsIa5UWJY1o8MSlQ1845o/BdkWUewD6eWQyag6KrRumpSZwVn mkb0kG89i0RpDv4AwRVhWBAV2pufd+ny0OyQUqEsC4RKhBSetgbDhhDFGnvh485Vc5nS lTJBBZgqWooIhwfmEoDMmxppkfJMjQ2Eg1Qm/GvADO+QpAPAMJBIErl7JAPXdsmGgYmn HJRdF/QS3WF+i9RSwA+uyn2Eu+iY6405f3Sbw8/9oFmqteErNXxvXX9yDMC0C1ELJtv8 VaH7hfwsoE992ccSlLwEkAvjbiDxhHG/IyJ0MYvHTaco5Bq5EpMrFbIvCnxoVkqtzSrl ZUHQ== X-Gm-Message-State: ALoCoQnkF7fA8Dimyr6D+hZV95YrgX0q46Gf1DjI/5ZntJYk7B/dPEZXp4uwoidvWa7f1OmUT/rz X-Received: by 10.182.115.133 with SMTP id jo5mr17595563obb.38.1404811378113; Tue, 08 Jul 2014 02:22:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.18.242 with SMTP id 105ls1998546qgf.83.gmail; Tue, 08 Jul 2014 02:22:58 -0700 (PDT) X-Received: by 10.221.56.132 with SMTP id wc4mr109242vcb.38.1404811378020; Tue, 08 Jul 2014 02:22:58 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id tk8si19906862vcb.62.2014.07.08.02.22.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 02:22:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id la4so5298107vcb.0 for ; Tue, 08 Jul 2014 02:22:57 -0700 (PDT) X-Received: by 10.52.27.208 with SMTP id v16mr27842161vdg.21.1404811377889; Tue, 08 Jul 2014 02:22:57 -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 tc5csp754139vcb; Tue, 8 Jul 2014 02:22:57 -0700 (PDT) X-Received: by 10.66.147.99 with SMTP id tj3mr34353495pab.47.1404811376960; Tue, 08 Jul 2014 02:22:56 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id bs8si43044735pad.157.2014.07.08.02.22.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 02:22:56 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4Ral-0007kc-7k; Tue, 08 Jul 2014 09:21:39 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4Rai-0007aT-Uz for linux-arm-kernel@lists.infradead.org; Tue, 08 Jul 2014 09:21:37 +0000 Received: from arm.com (e102109-lin.cambridge.arm.com [10.1.203.182]) by collaborate-mta1.arm.com (Postfix) with ESMTPS id EE01D13F884; Tue, 8 Jul 2014 04:21:11 -0500 (CDT) Date: Tue, 8 Jul 2014 10:21:00 +0100 From: Catalin Marinas To: Leif Lindholm Subject: Re: EFI_STUB fails to boot non-EFI on arm64 Message-ID: <20140708092100.GA21320@arm.com> References: <20140523094513.GC9252@arm.com> <20140523131656.GR4179@bivouac.eciton.net> <20140523134720.GA9256@arm.com> <20140523150331.GS4179@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: <20140523150331.GS4179@bivouac.eciton.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140708_022137_095582_C1903482 X-CRM114-Status: GOOD ( 23.16 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Roy Franz , "linux-efi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "msalter@redhat.com" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: catalin.marinas@arm.com 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.169 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 Content-Disposition: inline I forgot about this thread. I think we need it sorted in some way. On Fri, May 23, 2014 at 04:03:31PM +0100, Leif Lindholm wrote: > On Fri, May 23, 2014 at 02:47:20PM +0100, Catalin Marinas wrote: > > Can we add another of detecting whether it's an EFI application and > > avoid calling efi_init()? I can see x86 sets some efi_loader_signature > > string in exit_boot() and checks against it later when calling > > efi_init(). So, to be in line with 32-bit arm, the only way to tell the uncompressed kernel image that it was started as an EFI application is via FDT. > My view is that this should be fixed in fdt_find_uefi_params(). A > single info message that we can't find evidence of UEFI should be > printed in the non-error case. [...] > diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c > index cd36deb..4bb42e1e 100644 > --- a/drivers/firmware/efi/efi.c > +++ b/drivers/firmware/efi/efi.c > @@ -366,11 +366,8 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, > > for (i = 0; i < ARRAY_SIZE(dt_params); i++) { > prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); > - if (!prop) { > - pr_err("Can't find %s in device tree!\n", > - dt_params[i].name); > - return 0; > - } > + if (!prop) > + goto fail; > dest = info->params + dt_params[i].offset; > > val = of_read_number(prop, len / sizeof(u32)); > @@ -385,6 +382,14 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, > dt_params[i].size * 2, val); > } > return 1; > + > + fail: > + if (i == 0) > + pr_info(" UEFI not found.\n"); > + else > + pr_err("Can't find %s in device tree!\n", dt_params[i].name); > + > + return 0; I'm ok with the idea but I don't particularly like the implementation. Does this look any better (functionally the same as yours)? Acked-by: Leif Lindholm Tested-by: Leif Lindholm diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index eff1a2f22f09..dc79346689e6 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -346,6 +346,7 @@ static __initdata struct { struct param_info { int verbose; + int found; void *params; }; @@ -362,16 +363,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) return 0; - pr_info("Getting parameters from FDT:\n"); - for (i = 0; i < ARRAY_SIZE(dt_params); i++) { prop = of_get_flat_dt_prop(node, dt_params[i].propname, &len); - if (!prop) { - pr_err("Can't find %s in device tree!\n", - dt_params[i].name); + if (!prop) return 0; - } dest = info->params + dt_params[i].offset; + info->found++; val = of_read_number(prop, len / sizeof(u32)); @@ -390,10 +387,21 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname, int __init efi_get_fdt_params(struct efi_fdt_params *params, int verbose) { struct param_info info; + int ret; + + pr_info("Getting EFI parameters from FDT:\n"); info.verbose = verbose; + info.found = 0; info.params = params; - return of_scan_flat_dt(fdt_find_uefi_params, &info); + ret = of_scan_flat_dt(fdt_find_uefi_params, &info); + if (!info.found) + pr_info("UEFI not found.\n"); + else if (!ret) + pr_err("Can't find '%s' in device tree!\n", + dt_params[info.found].name); + + return ret; } #endif /* CONFIG_EFI_PARAMS_FROM_FDT */