powerpc/booke64: Fix args to copy_and_flush
authorTiejun Chen <tiejun.chen@windriver.com>
Wed, 7 Oct 2015 03:48:14 +0000 (22:48 -0500)
committerScott Wood <scottwood@freescale.com>
Tue, 27 Oct 2015 23:13:26 +0000 (18:13 -0500)
Convert r4/r5, not r6, to a virtual address when calling
copy_and_flush.  Otherwise, r3 is already virtual, and copy_to_flush
tries to access r3+r6, PAGE_OFFSET gets added twice.

This isn't normally seen because on book3e we normally enter with
the kernel at zero and thus skip copy_to_flush -- but it will be
needed for kexec support.

Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
[scottwood: split patch and rewrote changelog]
Signed-off-by: Scott Wood <scottwood@freescale.com>
arch/powerpc/kernel/head_64.S

index 8b2bf0d3b7d1bc4d5fbb342172b0cd63bbdee6fd..a1e85ca9864d173c575c3dad454020614580b8c6 100644 (file)
@@ -474,15 +474,15 @@ __after_prom_start:
  */
        li      r3,0                    /* target addr */
 #ifdef CONFIG_PPC_BOOK3E
-       tovirt(r3,r3)                   /* on booke, we already run at PAGE_OFFSET */
+       tovirt(r3,r3)           /* on booke, we already run at PAGE_OFFSET */
 #endif
        mr.     r4,r26                  /* In some cases the loader may  */
+#if defined(CONFIG_PPC_BOOK3E)
+       tovirt(r4,r4)
+#endif
        beq     9f                      /* have already put us at zero */
        li      r6,0x100                /* Start offset, the first 0x100 */
                                        /* bytes were copied earlier.    */
-#ifdef CONFIG_PPC_BOOK3E
-       tovirt(r6,r6)                   /* on booke, we already run at PAGE_OFFSET */
-#endif
 
 #ifdef CONFIG_RELOCATABLE
 /*
@@ -514,6 +514,9 @@ __after_prom_start:
 p_end: .llong  _end - _stext
 
 4:     /* Now copy the rest of the kernel up to _end */
+#if defined(CONFIG_PPC_BOOK3E)
+       tovirt(r26,r26)
+#endif
        addis   r5,r26,(p_end - _stext)@ha
        ld      r5,(p_end - _stext)@l(r5)       /* get _end */
 5:     bl      copy_and_flush          /* copy the rest */