linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com,
	will@kernel.org
Cc: mark.rutland@arm.com, robin.murphy@arm.com, james.morse@arm.com,
	hch@lst.de
Subject: [PATCHv4 03/17] arm64: head.S: rename el2_setup -> init_kernel_el
Date: Fri, 13 Nov 2020 12:49:23 +0000	[thread overview]
Message-ID: <20201113124937.20574-4-mark.rutland@arm.com> (raw)
In-Reply-To: <20201113124937.20574-1-mark.rutland@arm.com>

For a while now el2_setup has performed some basic initialization of EL1
even when the kernel is booted at EL1, so the name is a little
misleading. Further, some comments are stale as with VHE it doesn't drop
the CPU to EL1.

To clarify things, rename el2_setup to init_kernel_el, and update
comments to be clearer as to the function's purpose.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 arch/arm64/kernel/head.S  | 15 ++++++++-------
 arch/arm64/kernel/sleep.S |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index d8d9caf02834..5a31086e8e85 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -104,7 +104,7 @@ pe_header:
 	 */
 SYM_CODE_START(primary_entry)
 	bl	preserve_boot_args
-	bl	el2_setup			// Drop to EL1, w0=cpu_boot_mode
+	bl	init_kernel_el			// w0=cpu_boot_mode
 	adrp	x23, __PHYS_OFFSET
 	and	x23, x23, MIN_KIMG_ALIGN - 1	// KASLR offset, defaults to 0
 	bl	set_cpu_boot_mode_flag
@@ -482,13 +482,14 @@ EXPORT_SYMBOL(kimage_vaddr)
 	.section ".idmap.text","awx"
 
 /*
- * If we're fortunate enough to boot at EL2, ensure that the world is
- * sane before dropping to EL1.
+ * Starting from EL2 or EL1, configure the CPU to execute at the highest
+ * reachable EL supported by the kernel in a chosen default state. If dropping
+ * from EL2 to EL1, configure EL2 before configuring EL1.
  *
  * Returns either BOOT_CPU_MODE_EL1 or BOOT_CPU_MODE_EL2 in w0 if
  * booted in EL1 or EL2 respectively.
  */
-SYM_FUNC_START(el2_setup)
+SYM_FUNC_START(init_kernel_el)
 	msr	SPsel, #1			// We want to use SP_EL{1,2}
 	mrs	x0, CurrentEL
 	cmp	x0, #CurrentEL_EL2
@@ -649,7 +650,7 @@ SYM_INNER_LABEL(install_el2_stub, SYM_L_LOCAL)
 	msr	elr_el2, lr
 	mov	w0, #BOOT_CPU_MODE_EL2		// This CPU booted in EL2
 	eret
-SYM_FUNC_END(el2_setup)
+SYM_FUNC_END(init_kernel_el)
 
 /*
  * Sets the __boot_cpu_mode flag depending on the CPU boot mode passed
@@ -699,7 +700,7 @@ SYM_DATA_END(__early_cpu_boot_status)
 	 * cores are held until we're ready for them to initialise.
 	 */
 SYM_FUNC_START(secondary_holding_pen)
-	bl	el2_setup			// Drop to EL1, w0=cpu_boot_mode
+	bl	init_kernel_el			// w0=cpu_boot_mode
 	bl	set_cpu_boot_mode_flag
 	mrs	x0, mpidr_el1
 	mov_q	x1, MPIDR_HWID_BITMASK
@@ -717,7 +718,7 @@ SYM_FUNC_END(secondary_holding_pen)
 	 * be used where CPUs are brought online dynamically by the kernel.
 	 */
 SYM_FUNC_START(secondary_entry)
-	bl	el2_setup			// Drop to EL1
+	bl	init_kernel_el			// w0=cpu_boot_mode
 	bl	set_cpu_boot_mode_flag
 	b	secondary_startup
 SYM_FUNC_END(secondary_entry)
diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S
index ba40d57757d6..4be7f7eed875 100644
--- a/arch/arm64/kernel/sleep.S
+++ b/arch/arm64/kernel/sleep.S
@@ -99,7 +99,7 @@ SYM_FUNC_END(__cpu_suspend_enter)
 
 	.pushsection ".idmap.text", "awx"
 SYM_CODE_START(cpu_resume)
-	bl	el2_setup		// if in EL2 drop to EL1 cleanly
+	bl	init_kernel_el
 	bl	__cpu_setup
 	/* enable the MMU early - so we can access sleep_save_stash by va */
 	adrp	x1, swapper_pg_dir
-- 
2.11.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-13 12:51 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 12:49 [PATCHv4 00/17] arm64: remove set_fs() and friends Mark Rutland
2020-11-13 12:49 ` [PATCHv4 01/17] arm64: ensure ERET from kthread is illegal Mark Rutland
2020-11-13 12:49 ` [PATCHv4 02/17] arm64: add C wrappers for SET_PSTATE_*() Mark Rutland
2020-11-13 12:49 ` Mark Rutland [this message]
2020-11-13 12:49 ` [PATCHv4 04/17] arm64: head.S: cleanup SCTLR_ELx initialization Mark Rutland
2020-11-13 12:49 ` [PATCHv4 05/17] arm64: head.S: always initialize PSTATE Mark Rutland
2020-11-13 12:49 ` [PATCHv4 06/17] arm64: sdei: move uaccess logic to arch/arm64/ Mark Rutland
2020-11-16 17:42   ` Catalin Marinas
2020-11-26 18:42   ` James Morse
2020-11-13 12:49 ` [PATCHv4 07/17] arm64: sdei: explicitly simulate PAN/UAO entry Mark Rutland
2020-11-26 18:42   ` James Morse
2020-12-01 12:14     ` Mark Rutland
2020-11-13 12:49 ` [PATCHv4 08/17] arm64: uaccess: move uao_* alternatives to asm-uaccess.h Mark Rutland
2020-11-14  9:22   ` Christoph Hellwig
2020-11-16 12:25     ` Mark Rutland
2020-11-13 12:49 ` [PATCHv4 09/17] arm64: uaccess: rename privileged uaccess routines Mark Rutland
2020-11-13 12:49 ` [PATCHv4 10/17] arm64: uaccess: simplify __copy_user_flushcache() Mark Rutland
2020-11-13 12:49 ` [PATCHv4 11/17] arm64: uaccess: refactor __{get,put}_user Mark Rutland
2020-11-13 12:49 ` [PATCHv4 12/17] arm64: uaccess: split user/kernel routines Mark Rutland
2020-11-26 18:42   ` James Morse
2020-12-01 11:03     ` Mark Rutland
2020-12-02 12:19       ` Mark Rutland
2020-11-13 12:49 ` [PATCHv4 13/17] arm64: uaccess cleanup macro naming Mark Rutland
2020-11-13 12:49 ` [PATCHv4 14/17] arm64: uaccess: remove set_fs() Mark Rutland
2020-11-16 17:40   ` Catalin Marinas
2020-11-17 10:44     ` Mark Rutland
2020-11-17 10:54       ` Catalin Marinas
2020-11-17 10:57         ` Mark Rutland
2020-11-17 11:02           ` Catalin Marinas
2020-11-17 11:07             ` Mark Rutland
2020-11-17 11:10               ` Catalin Marinas
2020-11-26 18:42               ` James Morse
2020-11-26 18:42   ` James Morse
2020-12-01 12:30     ` Mark Rutland
2020-11-13 12:49 ` [PATCHv4 15/17] arm64: uaccess: remove addr_limit_user_check() Mark Rutland
2020-11-13 12:49 ` [PATCHv4 16/17] arm64: uaccess: remove redundant PAN toggling Mark Rutland
2020-11-13 12:49 ` [PATCHv4 17/17] arm64: uaccess: remove vestigal UAO support Mark Rutland
2020-11-25 19:10 ` [PATCHv4 00/17] arm64: remove set_fs() and friends Catalin Marinas

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=20201113124937.20574-4-mark.rutland@arm.com \
    --to=mark.rutland@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=hch@lst.de \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).