Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] arm64: rename stext to primary_entry
@ 2020-03-26 17:14 Ard Biesheuvel
  2020-03-27 13:31 ` Mark Brown
  2020-03-27 14:15 ` Mark Rutland
  0 siblings, 2 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2020-03-26 17:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: mark.rutland, catalin.marinas, broonie, will, Ard Biesheuvel

For historical reasons, the primary entry routine living somewhere in
the inittext section is called stext(), which is confusing, given that
there is also a section marker called _stext which lives at a fixed
offset in the image (either 64 or 4096 bytes, depending on whether
CONFIG_EFI is enabled)

Let's rename stext to primary_entry(), which is a better description
and reflects the secondary_entry() routine that already exists for
SMP boot.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
Note: this applies to linux-next currently, so this is v5.8 material

 arch/arm64/kernel/efi-entry.S   |  2 +-
 arch/arm64/kernel/head.S        | 19 +++++++++----------
 arch/arm64/kernel/image-vars.h  |  2 +-
 arch/arm64/kernel/vmlinux.lds.S |  4 ++--
 4 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S
index 1a03618df0df..303642975a93 100644
--- a/arch/arm64/kernel/efi-entry.S
+++ b/arch/arm64/kernel/efi-entry.S
@@ -19,7 +19,7 @@ SYM_CODE_START(efi_enter_kernel)
 	 * point stored in x0. Save those values in registers which are
 	 * callee preserved.
 	 */
-	ldr	w2, =stext_offset
+	ldr	w2, =primary_entry_offset
 	add	x19, x0, x2		// relocated Image entrypoint
 	mov	x20, x1			// DTB address
 
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 57a91032b4c2..01aa238c7b10 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -70,9 +70,9 @@ _head:
 	 * its opcode forms the magic "MZ" signature required by UEFI.
 	 */
 	add	x13, x18, #0x16
-	b	stext
+	b	primary_entry
 #else
-	b	stext				// branch to kernel start, magic
+	b	primary_entry			// branch to kernel start, magic
 	.long	0				// reserved
 #endif
 	le64sym	_kernel_offset_le		// Image load offset from start of RAM, little-endian
@@ -98,14 +98,13 @@ pe_header:
 	 * primary lowlevel boot path:
 	 *
 	 *  Register   Scope                      Purpose
-	 *  x21        stext() .. start_kernel()  FDT pointer passed at boot in x0
-	 *  x23        stext() .. start_kernel()  physical misalignment/KASLR offset
-	 *  x28        __create_page_tables()     callee preserved temp register
-	 *  x19/x20    __primary_switch()         callee preserved temp registers
-	 *  x24        __primary_switch() .. relocate_kernel()
-	 *                                        current RELR displacement
+	 *  x21        primary_entry() .. start_kernel()        FDT pointer passed at boot in x0
+	 *  x23        primary_entry() .. start_kernel()        physical misalignment/KASLR offset
+	 *  x28        __create_page_tables()                   callee preserved temp register
+	 *  x19/x20    __primary_switch()                       callee preserved temp registers
+	 *  x24        __primary_switch() .. relocate_kernel()  current RELR displacement
 	 */
-SYM_CODE_START(stext)
+SYM_CODE_START(primary_entry)
 	bl	preserve_boot_args
 	bl	el2_setup			// Drop to EL1, w0=cpu_boot_mode
 	adrp	x23, __PHYS_OFFSET
@@ -121,7 +120,7 @@ SYM_CODE_START(stext)
 	mov	x0, #ARM64_CPU_BOOT_PRIMARY
 	bl	__cpu_setup			// initialise processor
 	b	__primary_switch
-SYM_CODE_END(stext)
+SYM_CODE_END(primary_entry)
 
 /*
  * Preserve the arguments passed by the bootloader in x0 .. x3
diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h
index 7f06ad93fc95..be0a63ffed23 100644
--- a/arch/arm64/kernel/image-vars.h
+++ b/arch/arm64/kernel/image-vars.h
@@ -13,7 +13,7 @@
 #ifdef CONFIG_EFI
 
 __efistub_kernel_size		= _edata - _text;
-__efistub_stext_offset		= stext - _text;
+__efistub_primary_entry_offset	= primary_entry - _text;
 
 
 /*
diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
index 497f9675071d..8bd825233580 100644
--- a/arch/arm64/kernel/vmlinux.lds.S
+++ b/arch/arm64/kernel/vmlinux.lds.S
@@ -72,8 +72,8 @@ jiffies = jiffies_64;
 
 /*
  * The size of the PE/COFF section that covers the kernel image, which
- * runs from stext to _edata, must be a round multiple of the PE/COFF
- * FileAlignment, which we set to its minimum value of 0x200. 'stext'
+ * runs from _stext to _edata, must be a round multiple of the PE/COFF
+ * FileAlignment, which we set to its minimum value of 0x200. '_stext'
  * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned
  * boundary should be sufficient.
  */
-- 
2.17.1


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: rename stext to primary_entry
  2020-03-26 17:14 [PATCH] arm64: rename stext to primary_entry Ard Biesheuvel
@ 2020-03-27 13:31 ` Mark Brown
  2020-03-27 14:15 ` Mark Rutland
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-03-27 13:31 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: mark.rutland, catalin.marinas, will, linux-arm-kernel

[-- Attachment #1.1: Type: text/plain, Size: 418 bytes --]

On Thu, Mar 26, 2020 at 06:14:23PM +0100, Ard Biesheuvel wrote:
> For historical reasons, the primary entry routine living somewhere in
> the inittext section is called stext(), which is confusing, given that
> there is also a section marker called _stext which lives at a fixed
> offset in the image (either 64 or 4096 bytes, depending on whether
> CONFIG_EFI is enabled)

Reviwed-by: Mark Brown <broonie@kernel.org>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: rename stext to primary_entry
  2020-03-26 17:14 [PATCH] arm64: rename stext to primary_entry Ard Biesheuvel
  2020-03-27 13:31 ` Mark Brown
@ 2020-03-27 14:15 ` Mark Rutland
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Rutland @ 2020-03-27 14:15 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: catalin.marinas, broonie, will, linux-arm-kernel

On Thu, Mar 26, 2020 at 06:14:23PM +0100, Ard Biesheuvel wrote:
> For historical reasons, the primary entry routine living somewhere in
> the inittext section is called stext(), which is confusing, given that
> there is also a section marker called _stext which lives at a fixed
> offset in the image (either 64 or 4096 bytes, depending on whether
> CONFIG_EFI is enabled)
> 
> Let's rename stext to primary_entry(), which is a better description
> and reflects the secondary_entry() routine that already exists for
> SMP boot.
> 
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

Makes sense to me.

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> ---
> Note: this applies to linux-next currently, so this is v5.8 material
> 
>  arch/arm64/kernel/efi-entry.S   |  2 +-
>  arch/arm64/kernel/head.S        | 19 +++++++++----------
>  arch/arm64/kernel/image-vars.h  |  2 +-
>  arch/arm64/kernel/vmlinux.lds.S |  4 ++--
>  4 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S
> index 1a03618df0df..303642975a93 100644
> --- a/arch/arm64/kernel/efi-entry.S
> +++ b/arch/arm64/kernel/efi-entry.S
> @@ -19,7 +19,7 @@ SYM_CODE_START(efi_enter_kernel)
>  	 * point stored in x0. Save those values in registers which are
>  	 * callee preserved.
>  	 */
> -	ldr	w2, =stext_offset
> +	ldr	w2, =primary_entry_offset
>  	add	x19, x0, x2		// relocated Image entrypoint
>  	mov	x20, x1			// DTB address
>  
> diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
> index 57a91032b4c2..01aa238c7b10 100644
> --- a/arch/arm64/kernel/head.S
> +++ b/arch/arm64/kernel/head.S
> @@ -70,9 +70,9 @@ _head:
>  	 * its opcode forms the magic "MZ" signature required by UEFI.
>  	 */
>  	add	x13, x18, #0x16
> -	b	stext
> +	b	primary_entry
>  #else
> -	b	stext				// branch to kernel start, magic
> +	b	primary_entry			// branch to kernel start, magic
>  	.long	0				// reserved
>  #endif
>  	le64sym	_kernel_offset_le		// Image load offset from start of RAM, little-endian
> @@ -98,14 +98,13 @@ pe_header:
>  	 * primary lowlevel boot path:
>  	 *
>  	 *  Register   Scope                      Purpose
> -	 *  x21        stext() .. start_kernel()  FDT pointer passed at boot in x0
> -	 *  x23        stext() .. start_kernel()  physical misalignment/KASLR offset
> -	 *  x28        __create_page_tables()     callee preserved temp register
> -	 *  x19/x20    __primary_switch()         callee preserved temp registers
> -	 *  x24        __primary_switch() .. relocate_kernel()
> -	 *                                        current RELR displacement
> +	 *  x21        primary_entry() .. start_kernel()        FDT pointer passed at boot in x0
> +	 *  x23        primary_entry() .. start_kernel()        physical misalignment/KASLR offset
> +	 *  x28        __create_page_tables()                   callee preserved temp register
> +	 *  x19/x20    __primary_switch()                       callee preserved temp registers
> +	 *  x24        __primary_switch() .. relocate_kernel()  current RELR displacement
>  	 */
> -SYM_CODE_START(stext)
> +SYM_CODE_START(primary_entry)
>  	bl	preserve_boot_args
>  	bl	el2_setup			// Drop to EL1, w0=cpu_boot_mode
>  	adrp	x23, __PHYS_OFFSET
> @@ -121,7 +120,7 @@ SYM_CODE_START(stext)
>  	mov	x0, #ARM64_CPU_BOOT_PRIMARY
>  	bl	__cpu_setup			// initialise processor
>  	b	__primary_switch
> -SYM_CODE_END(stext)
> +SYM_CODE_END(primary_entry)
>  
>  /*
>   * Preserve the arguments passed by the bootloader in x0 .. x3
> diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h
> index 7f06ad93fc95..be0a63ffed23 100644
> --- a/arch/arm64/kernel/image-vars.h
> +++ b/arch/arm64/kernel/image-vars.h
> @@ -13,7 +13,7 @@
>  #ifdef CONFIG_EFI
>  
>  __efistub_kernel_size		= _edata - _text;
> -__efistub_stext_offset		= stext - _text;
> +__efistub_primary_entry_offset	= primary_entry - _text;
>  
>  
>  /*
> diff --git a/arch/arm64/kernel/vmlinux.lds.S b/arch/arm64/kernel/vmlinux.lds.S
> index 497f9675071d..8bd825233580 100644
> --- a/arch/arm64/kernel/vmlinux.lds.S
> +++ b/arch/arm64/kernel/vmlinux.lds.S
> @@ -72,8 +72,8 @@ jiffies = jiffies_64;
>  
>  /*
>   * The size of the PE/COFF section that covers the kernel image, which
> - * runs from stext to _edata, must be a round multiple of the PE/COFF
> - * FileAlignment, which we set to its minimum value of 0x200. 'stext'
> + * runs from _stext to _edata, must be a round multiple of the PE/COFF
> + * FileAlignment, which we set to its minimum value of 0x200. '_stext'
>   * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned
>   * boundary should be sufficient.
>   */
> -- 
> 2.17.1
> 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 17:14 [PATCH] arm64: rename stext to primary_entry Ard Biesheuvel
2020-03-27 13:31 ` Mark Brown
2020-03-27 14:15 ` Mark Rutland

Linux-ARM-Kernel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git
	git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \
		linux-arm-kernel@lists.infradead.org
	public-inbox-index linux-arm-kernel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git