From patchwork Tue Jul 22 14:42:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leif Lindholm X-Patchwork-Id: 4603241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 99EFAC0514 for ; Tue, 22 Jul 2014 14:45:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0AE120120 for ; Tue, 22 Jul 2014 14:45:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E317D200F0 for ; Tue, 22 Jul 2014 14:45:37 +0000 (UTC) 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 1X9bHi-0006Gf-2t; Tue, 22 Jul 2014 14:43:18 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X9bHf-0006Dh-QX for linux-arm-kernel@lists.infradead.org; Tue, 22 Jul 2014 14:43:16 +0000 Received: by mail-wi0-f179.google.com with SMTP id f8so550982wiw.12 for ; Tue, 22 Jul 2014 07:42:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=y5NsyTIfqAinXZwI0giXmchX7kDyVOx5ViW4mOLQnDU=; b=B4jxZbdnwqmq/WG6pWRPOktZwHkNYCZOwNfpyZ3DBZGlzGSViX6IQbYSNjsYPjmMeK sZF5Uda3sukXG5oKaXpM6+LIBkMMrU4BmLE78K0lF/0Pf7+1cWpKOjS08s2UVHSyQkFn AdgFQWfM8/sg5UdCL69tQK2r1DCi+K0LWy9ikZ/ZDh6BpnJA2ZM64OPRxPIzRxHQjyyN IT6h9jTp3gtDifSH+8KeVhSTsnX6FXviufkNAVSkN6FCiqhfMYxyBAq4lIeqQaQyNEEi fiAdr6I9q8z109rtrV5uL4aZ0tdleZq9WFI2ptdXvYT0K6SZCZ6Shueus012XbNSSYDQ u4gA== X-Gm-Message-State: ALoCoQkpPtFUki4xDAEyDl6W7jPty0x8SzE8GCJRihLWWm3b87jbdTsYEsU98nHKd6qjfr+lEjCz X-Received: by 10.195.18.8 with SMTP id gi8mr33773947wjd.75.1406040170912; Tue, 22 Jul 2014 07:42:50 -0700 (PDT) Received: from bivouac.eciton.net ([2a00:1098:0:86:1000:23:0:2]) by mx.google.com with ESMTPSA id ey16sm54578567wid.14.2014.07.22.07.42.49 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 22 Jul 2014 07:42:49 -0700 (PDT) Date: Tue, 22 Jul 2014 15:42:47 +0100 From: Leif Lindholm To: Ard Biesheuvel , Dave Martin , Catalin Marinas Subject: Re: [RFC] arm: section split in boot/compressed/head.S Message-ID: <20140722144247.GC4179@bivouac.eciton.net> References: <20140721175432.GB4179@bivouac.eciton.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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-20140722_074316_001235_1854AC32 X-CRM114-Status: GOOD ( 17.89 ) X-Spam-Score: -0.7 (/) Cc: "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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Jul 21, 2014 at 08:29:54PM +0200, Ard Biesheuvel wrote: > On 21 July 2014 19:54, Leif Lindholm wrote: > > Reported-by: Roy Franz > > > > The current code in boot/compressed/head.S executes pretty much > > sequentially from "start", all the way until the end of > > "dtb_check_done". However, shortly after the "not_angel" symbol, there > > is a section change, in the form of a ".text" directive. > > > > This means any literal pools in .start end up getting inserted into > > the middle of the instruction stream. > > > > Would something like the below (pardon the semantic silliness) be an > > acceptable fix? > > > > diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S > > index 3a8b32d..8ee05e9 100644 > > --- a/arch/arm/boot/compressed/head.S > > +++ b/arch/arm/boot/compressed/head.S > > @@ -149,6 +149,10 @@ start: > > mov r0, #0x17 @ angel_SWIreason_EnterSVC > > ARM( swi 0x123456 ) @ angel_SWI_ARM > > THUMB( svc 0xab ) @ angel_SWI_THUMB > > + b angel > > > The idea appears to be that code in .start sections from other > platform specific object files gets put there, so it gets executed > extremely early. > Jumping over it kind of defeats the purpose here. Ah, I got the impression something magic was going on, but failed to spot that bit... > Instead, adding an explicit .ltorg and jumping over /that/ should do > the trick, I think, but perhaps it's better just to open code the > literal pool in this case. The current state seems fragile, so: ? / Leif diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 3a8b32d..8fded53 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -149,6 +149,11 @@ start: mov r0, #0x17 @ angel_SWIreason_EnterSVC ARM( swi 0x123456 ) @ angel_SWI_ARM THUMB( svc 0xab ) @ angel_SWI_THUMB + b angel + + .ltorg + +angel: not_angel: safe_svcmode_maskall r0 msr spsr_cxsf, r9 @ Save the CPU boot mode in