linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>, Alan Modra <amodra@gmail.com>
Subject: [RFC PATCH 4/9] powerpc/64: Move initial base and TOC pointer calculation
Date: Tue, 27 Dec 2022 19:26:04 +1000	[thread overview]
Message-ID: <20221227092609.2078908-5-npiggin@gmail.com> (raw)
In-Reply-To: <20221227092609.2078908-1-npiggin@gmail.com>

A later change moves the non-prom case to run at the virtual address
earlier, which calls for virtual TOC and kernel base. Split these two
calculations for prom and non-prom to make that change simpler.

Signed: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/head_64.S | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 3a7266fa8a18..63f3b9b3cf7e 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -514,15 +514,6 @@ __start_initialization_multiplatform:
 	/* Zero r13 (paca) so early program check / mce don't use it */
 	li	r13,0
 
-	/* Get TOC pointer (current runtime address) */
-	bl	relative_toc
-
-	/* find out where we are now */
-	bcl	20,31,$+4
-0:	mflr	r26			/* r26 = runtime addr here */
-	addis	r26,r26,(_stext - 0b)@ha
-	addi	r26,r26,(_stext - 0b)@l	/* current runtime base addr */
-
 	/*
 	 * Are we booted from a PROM Of-type client-interface ?
 	 */
@@ -544,11 +535,30 @@ __start_initialization_multiplatform:
 #else
 	bl	start_initialization_book3s
 #endif /* CONFIG_PPC_BOOK3E_64 */
+
+	/* Get TOC pointer */
+	bl	relative_toc
+
+	/* find out where we are now */
+	bcl	20,31,$+4
+0:	mflr	r26			/* r26 = runtime addr here */
+	addis	r26,r26,(_stext - 0b)@ha
+	addi	r26,r26,(_stext - 0b)@l	/* current runtime base addr */
+
 	b	__after_prom_start
 
 __REF
 __boot_from_prom:
 #ifdef CONFIG_PPC_OF_BOOT_TRAMPOLINE
+	/* Get TOC pointer */
+	bl	relative_toc
+
+	/* find out where we are now */
+	bcl	20,31,$+4
+0:	mflr	r26			/* r26 = runtime addr here */
+	addis	r26,r26,(_stext - 0b)@ha
+	addi	r26,r26,(_stext - 0b)@l	/* current runtime base addr */
+
 	/* Save parameters */
 	mr	r31,r3
 	mr	r30,r4
-- 
2.37.2


  parent reply	other threads:[~2022-12-27  9:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27  9:26 [RFC PATCH 0/9] powerpc/64: Build with PC-Relative addressing Nicholas Piggin
2022-12-27  9:26 ` [RFC PATCH 1/9] crypto: powerpc - Use address generation helper for asm Nicholas Piggin
2022-12-27  9:26 ` [RFC PATCH 2/9] powerpc/64s: Refactor initialisation after prom Nicholas Piggin
2022-12-27  9:26 ` [RFC PATCH 3/9] powerpc/64e: Simplify address calculation in secondary hold loop Nicholas Piggin
2022-12-27  9:26 ` Nicholas Piggin [this message]
2022-12-27  9:26 ` [RFC PATCH 5/9] powerpc/64s: Run at the kernel virtual address earlier in boot Nicholas Piggin
2022-12-27  9:26 ` [RFC PATCH 6/9] powerpc: add CFUNC assembly label annotation Nicholas Piggin
2022-12-27  9:26 ` [RFC PATCH 7/9] powerpc/64: Add support to build with prefixed instructions Nicholas Piggin
2022-12-27  9:26 ` [RFC PATCH 8/9] powerpc/64: vmlinux support building with PCREL addresing Nicholas Piggin
2022-12-27  9:26 ` [RFC PATCH 9/9] powerpc/64: modules " Nicholas Piggin

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=20221227092609.2078908-5-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=amodra@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.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).