linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Fixed duplicate copying in the early boot.
@ 2024-06-17  2:35 Jinglin Wen
  2024-06-17 11:28 ` Michael Ellerman
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jinglin Wen @ 2024-06-17  2:35 UTC (permalink / raw)
  To: npiggin
  Cc: masahiroy, linux-kernel, christophe.leroy, naveen.n.rao,
	linuxppc-dev, jinglin.wen

According to the code logic, when the kernel is loaded to address 0,
no copying operation should be performed, but it is currently being
done.

This patch fixes the issue where the kernel code was incorrectly
duplicated to address 0 when booting from address 0.

Signed-off-by: Jinglin Wen <jinglin.wen@shingroup.cn>
---
 arch/powerpc/kernel/head_64.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 4690c219bfa4..6c73551bdc50 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -647,7 +647,9 @@ __after_prom_start:
  * Note: This process overwrites the OF exception vectors.
  */
 	LOAD_REG_IMMEDIATE(r3, PAGE_OFFSET)
-	mr.	r4,r26			/* In some cases the loader may  */
+	tophys(r4,r26)
+	cmplwi	cr0,r4,0	/* runtime base addr is zero */
+	mr	r4,r26			/* In some cases the loader may */
 	beq	9f			/* have already put us at zero */
 	li	r6,0x100		/* Start offset, the first 0x100 */
 					/* bytes were copied earlier.	 */
-- 
2.25.1


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

end of thread, other threads:[~2024-06-24 12:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17  2:35 [PATCH] powerpc: Fixed duplicate copying in the early boot Jinglin Wen
2024-06-17 11:28 ` Michael Ellerman
2024-06-18  9:34   ` Jinglin Wen
2024-06-17 16:13 ` Segher Boessenkool
2024-06-18  9:40   ` Jinglin Wen
2024-06-18 12:12   ` Michael Ellerman
2024-06-18 13:27     ` Segher Boessenkool
2024-06-20  2:41 ` [PATCH v2] powerpc: Fix unnecessary copy to 0 when kernel is booted at address 0 Jinglin Wen
2024-06-24 12:30   ` Michael Ellerman

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