From: Scott Wood <scottwood@freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>
Cc: Tiejun Chen <tiejun.chen@intel.com>, <kexec@lists.infradead.org>,
"Tiejun Chen" <tiejun.chen@windriver.com>,
Scott Wood <scottwood@freescale.com>
Subject: [RFC PATCH 10/17] powerpc/book3e: support CONFIG_RELOCATABLE
Date: Sat, 18 Jul 2015 15:08:47 -0500 [thread overview]
Message-ID: <1437250134-307-11-git-send-email-scottwood@freescale.com> (raw)
In-Reply-To: <1437250134-307-1-git-send-email-scottwood@freescale.com>
From: Tiejun Chen <tiejun.chen@windriver.com>
book3e is different with book3s since 3s includes the exception
vectors code in head_64.S as it relies on absolute addressing
which is only possible within this compilation unit. So we have
to get that label address with got.
And when boot a relocated kernel, we should reset ipvr properly again
after .relocate.
Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
[scottwood: cleanup and ifdef removal]
Signed-off-by: Scott Wood <scottwood@freescale.com>
---
arch/powerpc/include/asm/exception-64e.h | 4 ++--
arch/powerpc/kernel/exceptions-64e.S | 9 +++++++--
arch/powerpc/kernel/head_64.S | 22 +++++++++++++++++++---
3 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64e.h b/arch/powerpc/include/asm/exception-64e.h
index a8b52b6..344fc43 100644
--- a/arch/powerpc/include/asm/exception-64e.h
+++ b/arch/powerpc/include/asm/exception-64e.h
@@ -204,8 +204,8 @@ exc_##label##_book3e:
#endif
#define SET_IVOR(vector_number, vector_offset) \
- li r3,vector_offset@l; \
- ori r3,r3,interrupt_base_book3e@l; \
+ LOAD_REG_ADDR(r3,interrupt_base_book3e);\
+ ori r3,r3,vector_offset@l; \
mtspr SPRN_IVOR##vector_number,r3;
#endif /* _ASM_POWERPC_EXCEPTION_64E_H */
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 9d4a006..488e631 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -1351,7 +1351,10 @@ skpinv: addi r6,r6,1 /* Increment */
* r4 = MAS0 w/TLBSEL & ESEL for the temp mapping
*/
/* Now we branch the new virtual address mapped by this entry */
- LOAD_REG_IMMEDIATE(r6,2f)
+ bl 1f /* Find our address */
+1: mflr r6
+ addi r6,r6,(2f - 1b)
+ tovirt(r6,r6)
lis r7,MSR_KERNEL@h
ori r7,r7,MSR_KERNEL@l
mtspr SPRN_SRR0,r6
@@ -1583,9 +1586,11 @@ _GLOBAL(book3e_secondary_thread_init)
mflr r28
b 3b
+ .globl init_core_book3e
init_core_book3e:
/* Establish the interrupt vector base */
- LOAD_REG_IMMEDIATE(r3, interrupt_base_book3e)
+ tovirt(r2,r2)
+ LOAD_REG_ADDR(r3, interrupt_base_book3e)
mtspr SPRN_IVPR,r3
sync
blr
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index a1e85ca..1b77956 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -457,12 +457,22 @@ __after_prom_start:
/* process relocations for the final address of the kernel */
lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */
sldi r25,r25,32
+#if defined(CONFIG_PPC_BOOK3E)
+ tovirt(r26,r26) /* on booke, we already run at PAGE_OFFSET */
+#endif
lwz r7,__run_at_load-_stext(r26)
+#if defined(CONFIG_PPC_BOOK3E)
+ tophys(r26,r26)
+#endif
cmplwi cr0,r7,1 /* flagged to stay where we are ? */
bne 1f
add r25,r25,r26
1: mr r3,r25
bl relocate
+#if defined(CONFIG_PPC_BOOK3E)
+ /* IVPR needs to be set after relocation. */
+ bl init_core_book3e
+#endif
#endif
/*
@@ -490,12 +500,21 @@ __after_prom_start:
* variable __run_at_load, if it is set the kernel is treated as relocatable
* kernel, otherwise it will be moved to PHYSICAL_START
*/
+#if defined(CONFIG_PPC_BOOK3E)
+ tovirt(r26,r26) /* on booke, we already run at PAGE_OFFSET */
+#endif
lwz r7,__run_at_load-_stext(r26)
cmplwi cr0,r7,1
bne 3f
+#ifdef CONFIG_PPC_BOOK3E
+ LOAD_REG_ADDR(r5, __end_interrupts)
+ LOAD_REG_ADDR(r11, _stext)
+ sub r5,r5,r11
+#else
/* just copy interrupts */
LOAD_REG_IMMEDIATE(r5, __end_interrupts - _stext)
+#endif
b 5f
3:
#endif
@@ -514,9 +533,6 @@ __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 */
--
2.1.4
next prev parent reply other threads:[~2015-07-18 20:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-18 20:08 [RFC PATCH 00/17] powerpc/fsl-book3e-64: kexec/kdump support Scott Wood
2015-07-18 20:08 ` [RFC PATCH 01/17] powerpc/85xx: Load all early TLB entries at once Scott Wood
2015-07-18 20:08 ` [RFC PATCH 02/17] powerpc/85xx: Don't use generic timebase sync on 64-bit Scott Wood
2015-07-18 20:08 ` [RFC PATCH 03/17] crypto: caam: Blacklist CAAM when kexec is enabled Scott Wood
2015-07-18 20:08 ` [RFC PATCH 04/17] powerpc/fsl-corenet: Disable coreint if " Scott Wood
2015-07-18 20:08 ` [RFC PATCH 05/17] powerpc/fsl-booke-64: Don't limit ppc64_rma_size to one TLB entry Scott Wood
2015-07-18 20:08 ` [RFC PATCH 06/17] powerpc/85xx: Implement 64-bit kexec support Scott Wood
2015-07-18 20:08 ` [RFC PATCH 07/17] powerpc/e6500: kexec: Handle hardware threads Scott Wood
2015-07-18 20:08 ` [RFC PATCH 08/17] powerpc/book3e-64: rename interrupt_end_book3e with __end_interrupts Scott Wood
2015-07-18 20:08 ` [RFC PATCH 09/17] powerpc/booke64: Fix args to copy_and_flush Scott Wood
2015-07-18 20:08 ` Scott Wood [this message]
2015-07-18 20:08 ` [RFC PATCH 11/17] powerpc/book3e/kdump: Enable crash_kexec_wait_realmode Scott Wood
2015-07-18 20:08 ` [RFC PATCH 12/17] powerpc/book3e-64: Don't limit paca to 256 MiB Scott Wood
2015-07-18 20:08 ` [RFC PATCH 13/17] powerpc/book3e-64/kexec: create an identity TLB mapping Scott Wood
2015-07-18 20:08 ` [RFC PATCH 14/17] powerpc/book3e-64/kexec: Enable SMP release Scott Wood
2015-08-18 4:51 ` [RFC,14/17] " Michael Ellerman
2015-08-18 5:09 ` Scott Wood
2015-08-20 4:54 ` [RFC PATCH 14/17] " Michael Ellerman
2015-08-24 20:25 ` Scott Wood
2015-08-25 1:57 ` Michael Ellerman
2015-08-25 23:40 ` Scott Wood
2015-08-26 1:13 ` Michael Ellerman
2015-07-18 20:08 ` [RFC PATCH 15/17] powerpc/booke: Only use VIRT_PHYS_OFFSET on booke32 Scott Wood
2015-07-18 20:08 ` [RFC PATCH 16/17] powerpc/book3e-64/kexec: Set "r4 = 0" when entering spinloop Scott Wood
2015-07-18 20:08 ` [RFC PATCH 17/17] powerpc/book3e-64: Enable kexec Scott Wood
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=1437250134-307-11-git-send-email-scottwood@freescale.com \
--to=scottwood@freescale.com \
--cc=kexec@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=tiejun.chen@intel.com \
--cc=tiejun.chen@windriver.com \
/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).