From patchwork Sat Aug 5 20:52:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9883345 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2EB160392 for ; Sat, 5 Aug 2017 20:53:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D63B2286CC for ; Sat, 5 Aug 2017 20:53:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAC63287B9; Sat, 5 Aug 2017 20:53:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92C1D286CC for ; Sat, 5 Aug 2017 20:53:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752756AbdHEUxs (ORCPT ); Sat, 5 Aug 2017 16:53:48 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:36854 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752778AbdHEUxf (ORCPT ); Sat, 5 Aug 2017 16:53:35 -0400 Received: by mail-wm0-f42.google.com with SMTP id t201so42448843wmt.1 for ; Sat, 05 Aug 2017 13:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5WQyT0WG5y7rV9xMOfN/zzzm++0D2SfRBebqJRnq+2g=; b=AzNI/lXkhN3bBVYoUgoq6xCjWG7+uhNT4iuVu3dHqOm6FrxYoP+/ndrWwt4l4CclLQ +GHkB98NdzgRtUiJChGRPsfklH/+6nCt3S3ZeCuV2C8U2bc/eJpkaBP71kLcX/WrgAhU 3jrlh4rVaO4jBs53gIebS/FBKNqK0U10sqjWQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5WQyT0WG5y7rV9xMOfN/zzzm++0D2SfRBebqJRnq+2g=; b=jWLxiwp22WxGvUmk3UFU9TCuJy1G/nEcExZOVGaj1Ww2qC0kz4f+jFp8ALaQ58VFlA liUXMj1WBN1BbhFGHHf644Z+heABjO8bDxHToD+qk9lDjmBQZ7STn/4HOocB6fVv40lD bCdhTu2+ZkVz8pV4yYWdECADsrJh3BgZN36LkDO0RiMMY8KNv6farroKsPIHb6Pmxtsl UHHR4RkaUzmcw97560hdwhpmDoLkoSeBOjl9rcwKdpTEvjelWWQfuE8uwAC42cuw4cpl SindA6W3cuR+eIfRteJofwm8ljQOAcv5XVVE1WJwHaUM6g0pmAoUmAQj/2CFoQpHyfpp QowA== X-Gm-Message-State: AHYfb5gpHKmx/qcjlVeKu2Bwn9QVOc0uDmhjVU2AB90v99zgGAwf9dyt VaF0PQUxfpQIaQKo X-Received: by 10.28.180.8 with SMTP id d8mr4167339wmf.161.1501966414539; Sat, 05 Aug 2017 13:53:34 -0700 (PDT) Received: from localhost.localdomain ([160.77.147.147]) by smtp.gmail.com with ESMTPSA id v62sm2601775wmd.2.2017.08.05.13.53.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Aug 2017 13:53:33 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux@armlinux.org.uk, linux-omap@vger.kernel.org, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, krzk@kernel.org, jason@lakedaemon.net, arm@kernel.org, andrew@lunn.ch, gregory.clement@free-electrons.com, sebastian.hesselbarth@gmail.com, tony@atomide.com, baohua@kernel.org, horms@verge.net.au, magnus.damm@gmail.com, vireshk@kernel.org, shiraz.linux.kernel@gmail.com, patrice.chotard@st.com, nico@linaro.org, dave.martin@arm.com, marc.zyngier@arm.com Cc: Ard Biesheuvel Subject: [PATCH 08/15] ARM: head.S: use PC relative insn sequence to calculate PHYS_OFFSET Date: Sat, 5 Aug 2017 21:52:15 +0100 Message-Id: <20170805205222.19868-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170805205222.19868-1-ard.biesheuvel@linaro.org> References: <20170805205222.19868-1-ard.biesheuvel@linaro.org> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace the open coded arithmetic with a simple adr_l/sub pair. Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/head.S | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 939543e73874..e08a4623a980 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -106,10 +106,8 @@ ENTRY(stext) #endif #ifndef CONFIG_XIP_KERNEL - adr r3, 2f - ldmia r3, {r4, r8} - sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET) - add r8, r8, r4 @ PHYS_OFFSET + adr_l r8, _text @ __pa(_text) + sub r8, r8, #TEXT_OFFSET @ PHYS_OFFSET #else ldr r8, =PLAT_PHYS_OFFSET @ always constant in this case #endif @@ -161,10 +159,6 @@ ENTRY(stext) 1: b __enable_mmu ENDPROC(stext) .ltorg -#ifndef CONFIG_XIP_KERNEL -2: .long . - .long PAGE_OFFSET -#endif /* * Setup the initial page tables. We only setup the barest