All of lore.kernel.org
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/9] arm64: kernel: use x30 for __enable_mmu return address
Date: Wed, 24 Aug 2016 16:36:02 +0200	[thread overview]
Message-ID: <1472049366-10922-6-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1472049366-10922-1-git-send-email-ard.biesheuvel@linaro.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 <ard.biesheuvel@linaro.org>
---
 arch/arm64/kernel/head.S  | 12 +++++-------
 arch/arm64/kernel/sleep.S |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

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)
 
-- 
2.7.4

  parent reply	other threads:[~2016-08-24 14:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24 14:35 [PATCH v2 0/9] arm64: clean up early boot function calls Ard Biesheuvel
2016-08-24 14:35 ` [PATCH v2 1/9] arm64: kernel: get rid of x25 and x26 with 'global' scope Ard Biesheuvel
2016-08-24 14:35 ` [PATCH v2 2/9] arm64: kernel: fix style issues in sleep.S Ard Biesheuvel
2016-08-24 16:13   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 3/9] arm64: kernel: use ordinary return/argument register for el2_setup() Ard Biesheuvel
2016-08-24 16:20   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 4/9] arm64: head.S: move KASLR processing out of __enable_mmu() Ard Biesheuvel
2016-08-24 20:36   ` Mark Rutland
2016-08-24 20:44     ` Ard Biesheuvel
2016-08-24 20:46     ` Mark Rutland
2016-08-25 13:59       ` Ard Biesheuvel
2016-08-30 10:24         ` Mark Rutland
2016-08-30 13:45   ` Mark Rutland
2016-08-24 14:36 ` Ard Biesheuvel [this message]
2016-08-24 14:36 ` [PATCH v2 6/9] arm64: call __enable_mmu as an ordinary function for secondary/resume Ard Biesheuvel
2016-08-30 14:07   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 7/9] arm64: kernel: drop use of x24 from primary boot path Ard Biesheuvel
2016-08-30 14:26   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 8/9] arm64: head.S: use ordinary stack frame for __primary_switched() Ard Biesheuvel
2016-08-30 14:38   ` Mark Rutland
2016-08-24 14:36 ` [PATCH v2 9/9] arm64: head.S: document the use of callee saved registers Ard Biesheuvel
2016-08-30 14:43   ` Mark Rutland
2016-08-30 14:48 ` [PATCH v2 0/9] arm64: clean up early boot function calls Mark Rutland
2016-08-30 14:50   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472049366-10922-6-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.