From patchwork Sat Aug 5 20:52:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9883331 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 C590160392 for ; Sat, 5 Aug 2017 20:53:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8377286CC for ; Sat, 5 Aug 2017 20:53:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACFD7287B9; Sat, 5 Aug 2017 20:53:37 +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 6A6BB286CC for ; Sat, 5 Aug 2017 20:53:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752764AbdHEUxf (ORCPT ); Sat, 5 Aug 2017 16:53:35 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:36844 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761AbdHEUxb (ORCPT ); Sat, 5 Aug 2017 16:53:31 -0400 Received: by mail-wm0-f51.google.com with SMTP id t201so42448285wmt.1 for ; Sat, 05 Aug 2017 13:53:31 -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=weVne3m08tFNCU5/+ujdM2q3KUTNoztTJxW2gBd+82c=; b=e74EGa8Yfo3zqHXt3YF3lm/MrRzKychI8mImFS/i6am5L8Gy5I0twZ1b6SvsLXCHLA 70zDvjmqiSK3/0f3nRmOkHaGaZsu4hp3ENv/p5QNobGQRHkTCYE697E9McNNHwYDQGp1 UKZBVc/ORPQLQvOcT1LDxrtVtc66Uuocwzruk= 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=weVne3m08tFNCU5/+ujdM2q3KUTNoztTJxW2gBd+82c=; b=LcdtPHEdXlFDF89+UvGcUPgDXfcj18OZO6nu/5BxFpFlUbLwhL/QzWDqNqpuHY4QSQ +t2oKD+ClowXyQ2YkyWU6BJ8lTdlhyvyLG71XcguAeAKEmwxcmiBMi0kmUAJ8vui1w5y m6rkvhz5D0wYjeNYUJDx4PY89ztHwhDbpG6aU2bygjOn7eaxE3Qs5o4rIvrNWXJFyVbD 5ob9ACEUCQq5ZrXJT5at/ENTwZRota2E4CbwO0hIBjt0J+89OC5jmRif8pCit4YdcvxH O67KVIRppwpdnj6N1YDhAvW2d8W9NsM9lGVkMPSEeAANvbOfI9nF5xRcLq5xgm3R8W2i 5pcQ== X-Gm-Message-State: AHYfb5iVovap1mp5rCC9lqvCtdnzEevJiQsIFw8seiSY+3IoJ5ELYdyS 2kxtc+3K4+f0XlSi X-Received: by 10.28.191.157 with SMTP id o29mr4381364wmi.121.1501966410692; Sat, 05 Aug 2017 13:53:30 -0700 (PDT) Received: from localhost.localdomain ([160.77.147.147]) by smtp.gmail.com with ESMTPSA id v62sm2601775wmd.2.2017.08.05.13.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Aug 2017 13:53:29 -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 07/15] ARM: head.S: use PC-relative insn sequences for __fixup_pv_table Date: Sat, 5 Aug 2017 21:52:14 +0100 Message-Id: <20170805205222.19868-8-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 PC relative offset calculations with adr_l and mov_l invocations. Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/head.S | 27 ++++++-------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index aed341e0f530..939543e73874 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -578,14 +578,11 @@ ENDPROC(fixup_smp) */ __HEAD __fixup_pv_table: - adr r0, 1f - ldmia r0, {r3-r7} + adr_l r6, __pv_phys_pfn_offset + adr_l r7, __pv_offset @ __pa(__pv_offset) + mov_l r3, __pv_offset @ __va(__pv_offset) mvn ip, #0 - subs r3, r0, r3 @ PHYS_OFFSET - PAGE_OFFSET - add r4, r4, r3 @ adjust table start address - add r5, r5, r3 @ adjust table end address - add r6, r6, r3 @ adjust __pv_phys_pfn_offset address - add r7, r7, r3 @ adjust __pv_offset address + subs r3, r7, r3 @ PHYS_OFFSET - PAGE_OFFSET mov r0, r8, lsr #PAGE_SHIFT @ convert to PFN str r0, [r6] @ save computed PHYS_OFFSET to __pv_phys_pfn_offset strcc ip, [r7, #HIGH_OFFSET] @ save to __pv_offset high bits @@ -594,20 +591,15 @@ __fixup_pv_table: THUMB( it ne @ cross section branch ) bne __error str r3, [r7, #LOW_OFFSET] @ save to __pv_offset low bits + adr_l r4, __pv_table_begin + adr_l r5, __pv_table_end b __fixup_a_pv_table ENDPROC(__fixup_pv_table) - - .align -1: .long . - .long __pv_table_begin - .long __pv_table_end -2: .long __pv_phys_pfn_offset - .long __pv_offset + .ltorg .text __fixup_a_pv_table: - adr r0, 3f - ldr r6, [r0] + mov_l r6, __pv_offset add r6, r6, r3 ldr r0, [r6, #HIGH_OFFSET] @ pv_offset high word ldr r6, [r6, #LOW_OFFSET] @ pv_offset low word @@ -676,9 +668,6 @@ ARM_BE8(rev16 ip, ip) #endif ENDPROC(__fixup_a_pv_table) - .align -3: .long __pv_offset - ENTRY(fixup_pv_table) stmfd sp!, {r4 - r7, lr} mov r3, #0 @ no offset