From patchwork Mon Sep 14 09:56:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 254226 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFB85C2BC11 for ; Mon, 14 Sep 2020 09:57:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFD7B21D1A for ; Mon, 14 Sep 2020 09:57:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600077465; bh=TKAzFxIirDIxYLKYqD+6+dUlS9CQKVaHrk/5tQYGlrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=RM1pR+usyRDgznATW2biEQnblz57L2bksKvDROJ3HoA9CX/4wFdK9lWe1LmUQXesh u8cO5eW7eMlEOW5YfOmxTFk+ZpG8qF8Wr/RimeaMP2XMpm4O1YzhZfgCDHLWieY/7O Le/VtjU8wDD8Px7kZl6tKYJ2aiT1D1IMIqcdCCzk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726343AbgINJ5o (ORCPT ); Mon, 14 Sep 2020 05:57:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:48914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726308AbgINJ5k (ORCPT ); Mon, 14 Sep 2020 05:57:40 -0400 Received: from e123331-lin.nice.arm.com (unknown [37.6.197.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AC47420731; Mon, 14 Sep 2020 09:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600077460; bh=TKAzFxIirDIxYLKYqD+6+dUlS9CQKVaHrk/5tQYGlrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZkICpSKb6xO0VKoVM+24PwfMqMcyAc5VY534f4aYsk0mlyIwTsDxXXDFqvRY1Pw1q lHjz5BHkDOJL4hp4SrsAYA+ytLIuluK2IygS2mhgQg5FwebZ78krigh987/OJmXYia itPwELzY9tmQ6lTi0U9Sz2uMJ8JqqhzCpD4R05QQ= From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Russell King , Linus Walleij , Nicolas Pitre , Nick Desaulniers , Stefan Agner , Peter Smith , Marc Zyngier , Will Deacon Subject: [PATCH 04/12] ARM: head-common.S: use PC-relative insn sequence for __proc_info Date: Mon, 14 Sep 2020 12:56:58 +0300 Message-Id: <20200914095706.3985-5-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200914095706.3985-1-ardb@kernel.org> References: <20200914095706.3985-1-ardb@kernel.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Replace the open coded PC relative offset calculations with a pair of adr_l invocations. This removes some open coded arithmetic involving virtual addresses, avoids literal pools on v7+, and slightly reduces the footprint of the code. Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/head-common.S | 22 ++++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S index 4a3982812a40..9a5ab6c19568 100644 --- a/arch/arm/kernel/head-common.S +++ b/arch/arm/kernel/head-common.S @@ -170,11 +170,12 @@ ENDPROC(lookup_processor_type) * r9 = cpuid (preserved) */ __lookup_processor_type: - adr r3, __lookup_processor_type_data - ldmia r3, {r4 - r6} - sub r3, r3, r4 @ get offset between virt&phys - add r5, r5, r3 @ convert virt addresses to - add r6, r6, r3 @ physical address space + /* + * Look in for information about the __proc_info + * structure. + */ + adr_l r5, __proc_info_begin + adr_l r6, __proc_info_end 1: ldmia r5, {r3, r4} @ value, mask and r4, r4, r9 @ mask wanted bits teq r3, r4 @@ -186,17 +187,6 @@ __lookup_processor_type: 2: ret lr ENDPROC(__lookup_processor_type) -/* - * Look in for information about the __proc_info structure. - */ - .align 2 - .type __lookup_processor_type_data, %object -__lookup_processor_type_data: - .long . - .long __proc_info_begin - .long __proc_info_end - .size __lookup_processor_type_data, . - __lookup_processor_type_data - __error_lpae: #ifdef CONFIG_DEBUG_LL adr r0, str_lpae