summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJinglin Wen <jinglin.wen@shingroup.cn>2024-06-20 05:41:50 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-07-11 13:49:17 +0300
commitc6036baea4ba5ff6f68dcbeee4c1664f32fa479b (patch)
tree6cc5fcd9e118150d69b6e4f43e411bf4eec3d92e
parentd10e3c39001e9194b9a1bfd6979bd3fa19dccdc5 (diff)
downloadlinux-c6036baea4ba5ff6f68dcbeee4c1664f32fa479b.tar.xz
powerpc/64s: Fix unnecessary copy to 0 when kernel is booted at address 0
commit 13fc6c175924eaa953cf597ce28ffa4edc4554a6 upstream. According to the code logic, when the kernel is loaded at 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. Fixes: b270bebd34e3 ("powerpc/64s: Run at the kernel virtual address earlier in boot") Cc: stable@vger.kernel.org # v6.4+ Signed-off-by: Jinglin Wen <jinglin.wen@shingroup.cn> Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240620024150.14857-1-jinglin.wen@shingroup.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/powerpc/kernel/head_64.S5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 4690c219bfa4..63432a33ec49 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -647,8 +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 */
- beq 9f /* have already put us at zero */
+ mr r4,r26 /* Load the virtual source address into r4 */
+ cmpld r3,r4 /* Check if source == dest */
+ beq 9f /* If so skip the copy */
li r6,0x100 /* Start offset, the first 0x100 */
/* bytes were copied earlier. */