[PATCH 11/12] ppc64: Move fwnmi vectors into trampoline area

Michael Ellerman michael at ellerman.id.au
Fri Aug 26 12:53:32 EST 2005


The fwnmi vectors can be anywhere < 32 MB, so we need to use a trampoline
for them too. We've got plenty of room below 0x3000, so just plonk them in
there and the existing trampoline code will do what we want. If we ever
run out of space below 0x3000 we can change the code to patch the fwnmi
vectors explictly.

Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---

 arch/ppc64/kernel/head.S          |   37 ++++++++++++++++++++-----------------
 arch/ppc64/kernel/pSeries_setup.c |   14 +++++++++-----
 2 files changed, 29 insertions(+), 22 deletions(-)

Index: work/arch/ppc64/kernel/head.S
===================================================================
--- work.orig/arch/ppc64/kernel/head.S
+++ work/arch/ppc64/kernel/head.S
@@ -494,6 +494,26 @@ system_call_pSeries:
 	STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint)
 	STD_EXCEPTION_PSERIES(0x1700, altivec_assist)
 
+	/*
+	 * Vectors for the FWNMI option.  Share common code.
+	 * For kdump's sake these must be < 0x3000 and 8-byte aligned.
+	 */
+	.align 7
+	.globl system_reset_fwnmi
+system_reset_fwnmi:
+	HMT_MEDIUM
+	mtspr   SPRG1,r13               /* save r13 */
+	RUNLATCH_ON(r13)
+	EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
+
+	.align 7
+	.globl machine_check_fwnmi
+machine_check_fwnmi:
+	HMT_MEDIUM
+	mtspr   SPRG1,r13               /* save r13 */
+	RUNLATCH_ON(r13)
+	EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
+
 	. = 0x3000
 
 /*** pSeries interrupt support ***/
@@ -507,23 +527,6 @@ _GLOBAL(do_stab_bolted_pSeries)
 	mfspr	r12,SPRG2
 	EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted)
 
-/*
- * Vectors for the FWNMI option.  Share common code.
- */
-      .globl system_reset_fwnmi
-system_reset_fwnmi:
-      HMT_MEDIUM
-      mtspr   SPRG1,r13               /* save r13 */
-      RUNLATCH_ON(r13)
-      EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
-
-      .globl machine_check_fwnmi
-machine_check_fwnmi:
-      HMT_MEDIUM
-      mtspr   SPRG1,r13               /* save r13 */
-      RUNLATCH_ON(r13)
-      EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
-
 #ifdef CONFIG_PPC_ISERIES
 /***  ISeries-LPAR interrupt handlers ***/
 
Index: work/arch/ppc64/kernel/pSeries_setup.c
===================================================================
--- work.orig/arch/ppc64/kernel/pSeries_setup.c
+++ work/arch/ppc64/kernel/pSeries_setup.c
@@ -108,14 +108,18 @@ void pSeries_get_cpuinfo(struct seq_file
  */
 static void __init fwnmi_init(void)
 {
-	int ret;
+	unsigned long v1, v2;
+
 	int ibm_nmi_register = rtas_token("ibm,nmi-register");
 	if (ibm_nmi_register == RTAS_UNKNOWN_SERVICE)
 		return;
-	ret = rtas_call(ibm_nmi_register, 2, 1, NULL,
-			__pa((unsigned long)system_reset_fwnmi),
-			__pa((unsigned long)machine_check_fwnmi));
-	if (ret == 0)
+
+	/* We point the firmware at low addresses, and use a trampoline to
+	 * get up to the real code at KERNELBASE. */
+	v1 = (unsigned long)system_reset_fwnmi - KERNELBASE;
+	v2 = (unsigned long)machine_check_fwnmi - KERNELBASE;
+
+	if (0 == rtas_call(ibm_nmi_register, 2, 1, NULL, v1, v2))
 		fwnmi_active = 1;
 }
 



More information about the Linuxppc64-dev mailing list