From patchwork Mon Apr 18 15:09:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 66042 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1340930qge; Mon, 18 Apr 2016 08:12:05 -0700 (PDT) X-Received: by 10.66.41.43 with SMTP id c11mr14747092pal.96.1460992325110; Mon, 18 Apr 2016 08:12:05 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id dy1si4006475pab.117.2016.04.18.08.12.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Apr 2016 08:12:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org 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 1asApT-0006Qz-Fn; Mon, 18 Apr 2016 15:11:11 +0000 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1asAor-0005ex-H6 for linux-arm-kernel@lists.infradead.org; Mon, 18 Apr 2016 15:10:34 +0000 Received: by mail-wm0-x234.google.com with SMTP id n3so129521386wmn.0 for ; Mon, 18 Apr 2016 08:10:13 -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=7Ccsa1F4ipJo+yZIviDTie/zoS0qC7N5xCUdNtuQIRM=; b=i5WS8+j02mZBKueNVN750bGOtoyqRtj9hVDu/3YVGPzGdsJNNyuhWPw/OD5TJ1xsyQ cZSZwxPVz0ytgi0xximXtKKR5qUg2ejPEcr0niKMHRjC374ytIctof8ozVY/naNBeIMP Kbs9ZAGtcjINZuaqml9w5l0+2ZHPBB4R5p97I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7Ccsa1F4ipJo+yZIviDTie/zoS0qC7N5xCUdNtuQIRM=; b=QseEcVlqZLM1aiTm5Ams4+xcwzt6NorhKiZhOUmdnC4NBQuonLv8+D6wW5EE8L72li LhFo/y4j4WP4/xlCY829uK9uNJzrWwyY1420mKQ1CB6oiT2zEKMB3D+8P8LoT3YfLUmL qvGWV7dFzKr1gAW2SBQrqIAS8L47AMZIzi9fS0QD+vXC/GTCd2+A4t5mD/g1238DaAC/ syRcbIwJklaKtInWkQEpByVMRt2sqGxUPjHdmtBd6HEFnRdZjPhXTKwOtM65sY2OIk8k ydC/2L5hsh1X7AZwUqhCH5/TdCEpxupSqMunEAfejIkWpNEocrlcBTA5PcTBW/RFLCGA fffA== X-Gm-Message-State: AOPr4FXb2DVFJLMtnrgBbTK44xOkh+9gKygoDTaKEOvm+Ih449OuYAEapYnq4yeLrs7c7/Ep X-Received: by 10.194.5.36 with SMTP id p4mr36131913wjp.167.1460992211936; Mon, 18 Apr 2016 08:10:11 -0700 (PDT) Received: from localhost.localdomain ([195.55.142.58]) by smtp.gmail.com with ESMTPSA id b135sm54232075wmb.10.2016.04.18.08.10.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Apr 2016 08:10:11 -0700 (PDT) From: Ard Biesheuvel To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, will.deacon@arm.com, mark.rutland@arm.com, james.morse@arm.com Subject: [PATCH 5/8] arm64: kernel: replace early 64-bit literal loads with move-immediates Date: Mon, 18 Apr 2016 17:09:45 +0200 Message-Id: <1460992188-23295-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460992188-23295-1-git-send-email-ard.biesheuvel@linaro.org> References: <1460992188-23295-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160418_081033_761712_CBA6DB49 X-CRM114-Status: GOOD ( 11.23 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:234 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: catalin.marinas@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org When building a relocatable kernel, we currently rely on the fact that early 64-bit literal loads need to be deferred to after the relocation has been performed only if they involve symbol references, and not if they involve assemble time constants. While this is not an unreasonable assumption to make, it is better to switch to movk/movz sequences, since these are guaranteed to be resolved at link time, simply because there are no dynamic relocation types to describe them. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/head.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.5.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 0d487d90d221..dae9cabaadf5 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -337,7 +337,7 @@ __create_page_tables: cmp x0, x6 b.lo 1b - ldr x7, =SWAPPER_MM_MMUFLAGS + mov x7, SWAPPER_MM_MMUFLAGS /* * Create the identity mapping. @@ -393,7 +393,7 @@ __create_page_tables: * Map the kernel image (starting with PHYS_OFFSET). */ mov x0, x26 // swapper_pg_dir - ldr x5, =KIMAGE_VADDR + mov_q x5, KIMAGE_VADDR add x5, x5, x23 // add KASLR displacement create_pgd_entry x0, x5, x3, x6 ldr w6, =kernel_img_size @@ -631,7 +631,7 @@ ENTRY(secondary_holding_pen) bl el2_setup // Drop to EL1, w20=cpu_boot_mode bl set_cpu_boot_mode_flag mrs x0, mpidr_el1 - ldr x1, =MPIDR_HWID_BITMASK + mov_q x1, MPIDR_HWID_BITMASK and x0, x0, x1 adr_l x3, secondary_holding_pen_release pen: ldr x4, [x3] @@ -773,7 +773,7 @@ __primary_switch: ldr w9, =__rela_offset // offset to reloc table ldr w10, =__rela_size // size of reloc table - ldr x11, =KIMAGE_VADDR // default virtual offset + mov_q x11, KIMAGE_VADDR // default virtual offset add x11, x11, x23 // actual virtual offset add x8, x8, x11 // __va(.dynsym) add x9, x9, x11 // __va(.rela)