From patchwork Wed Aug 24 14:36:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 74618 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp351599qga; Wed, 24 Aug 2016 07:39:16 -0700 (PDT) X-Received: by 10.98.103.214 with SMTP id t83mr6358234pfj.158.1472049556879; Wed, 24 Aug 2016 07:39:16 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id p4si9894933paz.202.2016.08.24.07.39.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 07:39:16 -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.85_2 #1 (Red Hat Linux)) id 1bcZJi-00068b-TN; Wed, 24 Aug 2016 14:38:10 +0000 Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bcZIL-0005KT-9g for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2016 14:36:49 +0000 Received: by mail-wm0-x22f.google.com with SMTP id f65so203802839wmi.0 for ; Wed, 24 Aug 2016 07:36:24 -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=woGEsXaOWhcs1wkyIMRCEHlFy4rIqnJfWSOoSKq74jM=; b=NI37z0GM0vAslgt/e3xCoHB7U6YHwZYPY8NIvJX1eijMxpXn6rm/8ja0rTJ2GzJhRs QDfcHBxiBilSEOIimdYGmoygDfBUDxHmp3Iz2JMkSd7C5z65S4WP7u3UA7IvYKEv1IzP rurR64buCOaql00U9CxH6VQ/GmnBI0QOdduek= 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=woGEsXaOWhcs1wkyIMRCEHlFy4rIqnJfWSOoSKq74jM=; b=QFd6v7kl9skpnbzLXyZI+FSc2VJ1GnEs9740VkJGHKS5Vu+Jm771d/WNNJoaedi45N H55hO3erTs9qzKI7lkTKg9QPF3AbJO6dj7/crUtIN8IM2y2LQQ2VD9m6cvYMQKRxsVXB nhewsm173mX1ZPsDkkZ2Mxz2Qf73sZoAnC2HM8aEZiEK4y/01m07ae+erNJeT6kDPkz/ JhW2xjxHLQnAkuBMtuPu77WS4JKLuXWiEMRuYm3b1vbwzl7JvFKwE4Sb5wHU49VwWlvY nDlpmFBq23OhihMz6uqFRZcNFWcz/QKaw1L6HLOkYPdKTSk+nBB+zsal9YFIMYYOqlIl wM4g== X-Gm-Message-State: AEkoouuycEOPkTu1mh+5Q3BLc/O2+x1yKgFEsO3QIXHgJQ2lYB/E6Kc2rhIdsBI3n+Mm4ViW X-Received: by 10.194.89.73 with SMTP id bm9mr3319326wjb.76.1472049383527; Wed, 24 Aug 2016 07:36:23 -0700 (PDT) Received: from localhost.localdomain ([213.143.60.123]) by smtp.gmail.com with ESMTPSA id n2sm10365569wjd.1.2016.08.24.07.36.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Aug 2016 07:36:22 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, james.morse@arm.com Subject: [PATCH v2 5/9] arm64: kernel: use x30 for __enable_mmu return address Date: Wed, 24 Aug 2016 16:36:02 +0200 Message-Id: <1472049366-10922-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472049366-10922-1-git-send-email-ard.biesheuvel@linaro.org> References: <1472049366-10922-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160824_073645_738498_76F22E76 X-CRM114-Status: GOOD ( 13.72 ) 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:22f 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_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 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 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: Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Using x27 for passing to __enable_mmu what is essentially the return address makes the code look more complicated than it needs to be. So in preparation of further simplifications, switch to x30/lr. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/head.S | 12 +++++------- arch/arm64/kernel/sleep.S | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) -- 2.7.4 _______________________________________________ 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 d390feb92730..3e08e51578d5 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -664,7 +664,7 @@ secondary_startup: */ bl __cpu_setup // initialise processor - adr_l x27, __secondary_switch // address to jump to after enabling the MMU + adr_l lr, __secondary_switch // address to jump to after enabling the MMU b __enable_mmu ENDPROC(secondary_startup) @@ -710,9 +710,9 @@ ENTRY(__early_cpu_boot_status) * Enable the MMU. * * x0 = SCTLR_EL1 value for turning on the MMU. - * x27 = *virtual* address to jump to upon completion * - * Other registers depend on the function called upon completion. + * Returns to the caller via x30/lr. This requires the caller to be covered + * by the .idmap.text section. * * Checks if the selected granule size is supported by the CPU. * If it isn't, park the CPU @@ -739,7 +739,7 @@ ENTRY(__enable_mmu) ic iallu dsb nsh isb - br x27 + ret ENDPROC(__enable_mmu) __no_granule_support: @@ -784,9 +784,7 @@ __primary_switch: mrs x20, sctlr_el1 // preserve old SCTLR_EL1 value #endif - adr x27, 0f - b __enable_mmu -0: + bl __enable_mmu #ifdef CONFIG_RELOCATABLE bl __relocate_kernel #ifdef CONFIG_RANDOMIZE_BASE diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S index bbc63099223b..4bce95cd656a 100644 --- a/arch/arm64/kernel/sleep.S +++ b/arch/arm64/kernel/sleep.S @@ -99,7 +99,7 @@ ENTRY(cpu_resume) bl el2_setup // if in EL2 drop to EL1 cleanly bl __cpu_setup /* enable the MMU early - so we can access sleep_save_stash by va */ - adr_l x27, _resume_switched /* __enable_mmu will branch here */ + adr_l lr, _resume_switched /* __enable_mmu will branch here */ b __enable_mmu ENDPROC(cpu_resume)