From patchwork Wed Apr 29 16:43:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 47734 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 58A6D20553 for ; Wed, 29 Apr 2015 16:45:29 +0000 (UTC) Received: by lamp14 with SMTP id p14sf8255937lam.3 for ; Wed, 29 Apr 2015 09:45:28 -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:in-reply-to :message-id:references:user-agent:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=Eqf8CWEkJY0nPOFwH3l+gICaUSnCYbdhUvvpIFM2pS0=; b=JLL9hwTcNZ9BK9IquJXZ/BJ67CEtam8vEwQ2nIRXRG+KAHGV73Am0P8Q4ju7IIqfqw UHtJQNp4/KXvBaZj2Kj8L6m9lCDtBHCH1GGfAuw5hIQLAsBJpX2gOeR9woLnzAwrCZ80 hgL/c4m3gW1CEZiiHpQVZxSc/S7mugp1WP9nnXT9jSo+URhe1ogfg+aex1jj2hw8AUwX xw2Wcg+YZZ7m1bLTVOwj+gs4UDrbUGQYGsLy7hulRleiONVI4B6t7RLSQdSZ0JEcy1Fr 0GZIHAQoVsurh7gipbQ8FCIDLG7fqGj7S2HSbluncaHD0coks9/ZhHzG6e9D+qNr1ewl 3aaQ== X-Gm-Message-State: ALoCoQlkfTONJ/8mQB5taHQXGDG8FV+boEO8kSJw9czs18frKvWr1XrLid+b0xBf6OgNtGeHQbjz X-Received: by 10.112.14.101 with SMTP id o5mr13716654lbc.3.1430325928295; Wed, 29 Apr 2015 09:45:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.169 with SMTP id l9ls264242lah.52.gmail; Wed, 29 Apr 2015 09:45:28 -0700 (PDT) X-Received: by 10.112.169.42 with SMTP id ab10mr19766802lbc.3.1430325928149; Wed, 29 Apr 2015 09:45:28 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id s7si13991189las.80.2015.04.29.09.45.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 09:45:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbbzk7 with SMTP id zk7so24920090lbb.0 for ; Wed, 29 Apr 2015 09:45:27 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr19439792lbb.112.1430325927652; Wed, 29 Apr 2015 09:45:27 -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.112.67.65 with SMTP id l1csp2619833lbt; Wed, 29 Apr 2015 09:45:26 -0700 (PDT) X-Received: by 10.70.103.200 with SMTP id fy8mr42949711pdb.136.1430325925244; Wed, 29 Apr 2015 09:45:25 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id y1si40215444pdg.253.2015.04.29.09.45.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 09:45:25 -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 1YnV5K-0004Dl-I3; Wed, 29 Apr 2015 16:43:42 +0000 Received: from mail-qc0-f175.google.com ([209.85.216.175]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YnV58-00041i-Hi for linux-arm-kernel@lists.infradead.org; Wed, 29 Apr 2015 16:43:31 +0000 Received: by qcyk17 with SMTP id k17so15951403qcy.1 for ; Wed, 29 Apr 2015 09:43:08 -0700 (PDT) X-Received: by 10.55.20.65 with SMTP id e62mr29516471qkh.90.1430325788021; Wed, 29 Apr 2015 09:43:08 -0700 (PDT) Received: from xanadu.home (modemcable142.180-131-66.mc.videotron.ca. [66.131.180.142]) by mx.google.com with ESMTPSA id n72sm14888887qha.19.2015.04.29.09.43.05 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Apr 2015 09:43:06 -0700 (PDT) Date: Wed, 29 Apr 2015 12:43:04 -0400 (EDT) From: Nicolas Pitre To: Valentin Longchamp Subject: Re: [RFC] arm: pick the r2 passed DTB over the appended one In-Reply-To: <5540FD7A.8040002@keymile.com> Message-ID: References: <1429880030-21473-1-git-send-email-valentin.longchamp@keymile.com> <5540A0DA.9060409@keymile.com> <5540FD7A.8040002@keymile.com> User-Agent: Alpine 2.11 (LFD 23 2013-08-11) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150429_094330_684797_63AAF1E2 X-CRM114-Status: GOOD ( 19.89 ) 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.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.216.175 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.216.175 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: "bones@secretlab.ca" , "linux-arm-kernel@lists.infradead.org" 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: nicolas.pitre@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.217.182 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 On Wed, 29 Apr 2015, Valentin Longchamp wrote: > On 04/29/2015 03:58 PM, Nicolas Pitre wrote: > > Now, to fix your test, you'd simply have to augment it with: > > > > + cmp r6, r8 @ is r8 pointing to the appended DTB? > > + beq 1f > > ldr lr, [r8, #0] @ conventionaly passed dtb ? > > cmp lr, r1 > > beq dtb_check_done @ yes, do not manage it > > +1: > > > > I had thought the same and implemented a similar test as you propose (patch > attached, with some more debug code - please excuse my poor assembler). However > it does not work ! The reason for it is that on the second run, r6 contains > another value. As the output below seems to show, this 2nd run r6 value seems to > point to a DTB since the first jump to dtb_check_done is not performed. However, > since r8 now points to the "initial" appended DTB, the 2nd test jumps to > dtb_check_done. Please see the output below. Right. On the second run, r6 points at the relocated DTB. That's the one that should be used. r8 points at the initial, non relocated and about to be overwritten DTB. By giving priority to r8 with your patch, you're picking the wrong one. The following should fix this issue: Nicolas diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index c41a793b51..bbce6a0f0d 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -399,6 +399,16 @@ dtb_check_done: 1: #endif +#ifdef CONFIG_ARM_APPENDED_DTB + /* + * If r8 refers to an appended DTB, it is no longer valid + * and should be revalidated once relocated. + */ + cmp r8, r5 + cmpcs r6, r8 + movcs r8, #0 +#endif + sub r9, r6, r5 @ size to copy add r9, r9, #31 @ rounded up to a multiple bic r9, r9, #31 @ ... of 32 bytes