From patchwork Mon Aug 7 18:36:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 109590 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1952840qge; Mon, 7 Aug 2017 11:38:41 -0700 (PDT) X-Received: by 10.84.177.131 with SMTP id x3mr1633008plb.280.1502131121591; Mon, 07 Aug 2017 11:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502131121; cv=none; d=google.com; s=arc-20160816; b=lFlttdM6P7GB5CqRN4V33BKy1hEb7X1xMSRt/61pa5tOB0MWCd15sOixE5Y2AoPQYT FLXAZQpmclesO/vRJU39slWdDiJaMT4GNw+0tYyaw0RpWM29P2CV1XGBaTtKR1ejjoKL YJhbLlsoQlwAzO1A4dvGdTH7wIDJVMAPETwSxlB/HuvfN2LG6RUEaiG7ExDoabfhrUf6 zn8vKjov1q9VP0b6kcJCcXF+/4wkrJl/WfYDX91XUWGWCyAa5YWV8jFq0bBimrk9uGha GQMf4myqyWuewcMeUf2vW60HRWnqnkanLF0Sd1JXA45tQbm6sT3hYohYTKDE2OevOmp2 JsqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=UAxKEONwm0A/qq0dUNWzKMWxikXjDQNpuPl7WOGGyN4=; b=UpDp97x4rLIZRb8xZFPCt+0U+1md6zjtlogZGN8UhbsmJukhKu8AOVuWI6ssaYnboc +ctrZ/SIgqfbOHTHPL7/7NtUdyGVIG0NH34BU/ZBk7GwyeuU0LVSL/2bDZz6jhXDSKVE HIaADEj4QGtILTOBTBbWvbw3oIr/xnXzawV6WK5w6fq5Vb3th5HY3zCx2TmSGr6YO4DQ zlPTXh19seLlYl0DMRYUq7elkpdvzI5U5wsWhgXDm6vJ5mIUqx6i9CTgx3EkW91oJvI8 weEqNYFon8CqwP9qK+VkEI5B3VsHm+qg7QEpehOvnHrVxS8CyhjKERJpOxrnWbjf0rrQ lxtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si5011114pfj.271.2017.08.07.11.38.41; Mon, 07 Aug 2017 11:38:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752012AbdHGSih (ORCPT + 25 others); Mon, 7 Aug 2017 14:38:37 -0400 Received: from foss.arm.com ([217.140.101.70]:52686 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbdHGSif (ORCPT ); Mon, 7 Aug 2017 14:38:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BDB9C1991; Mon, 7 Aug 2017 11:38:34 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AA67D3F577; Mon, 7 Aug 2017 11:38:32 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: ard.biesheuvel@linaro.org, catalin.marinas@arm.com, james.morse@arm.com, labbott@redhat.com, linux-kernel@vger.kernel.org, luto@amacapital.net, mark.rutland@arm.com, matt@codeblueprint.co.uk, will.deacon@arm.com, kernel-hardening@lists.openwall.com, keescook@chromium.org Subject: [PATCH 10/14] arm64: assembler: allow adr_this_cpu to use the stack pointer Date: Mon, 7 Aug 2017 19:36:01 +0100 Message-Id: <1502130965-18710-11-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502130965-18710-1-git-send-email-mark.rutland@arm.com> References: <1502130965-18710-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel Given that adr_this_cpu already requires a temp register in addition to the destination register, tweak the instruction sequence so that sp may be used as well. This will simplify switching to per-cpu stacks in subsequent patches. While this limits the range of adr_this_cpu, to +/-4GiB, we don't currently use adr_this_cpu in modules, and this is not problematic for the main kernel image. Signed-off-by: Ard Biesheuvel [Mark: add more commit text] Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: James Morse Cc: Laura Abbott Cc: Will Deacon --- arch/arm64/include/asm/assembler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h index 610a420..4775af5 100644 --- a/arch/arm64/include/asm/assembler.h +++ b/arch/arm64/include/asm/assembler.h @@ -235,7 +235,8 @@ * @tmp: scratch register */ .macro adr_this_cpu, dst, sym, tmp - adr_l \dst, \sym + adrp \tmp, \sym + add \dst, \tmp, #:lo12:\sym mrs \tmp, tpidr_el1 add \dst, \dst, \tmp .endm