[PATCH 4/12] powerpc: Create a trampoline for the fwnmi vectors

Michael Ellerman michael at ellerman.id.au
Tue Nov 8 00:06:55 EST 2005


The fwnmi vectors can be anywhere < 32 MB, so we need to use a trampoline
for them. The kdump kernel will register the trampoline addresses, which will
then jump up to the real code above 32 MB.

 arch/powerpc/kernel/head_64.S          |    2 ++
 arch/powerpc/platforms/pseries/ras.c   |    6 ++----
 arch/powerpc/platforms/pseries/setup.c |   17 +++++++++--------
 include/asm-powerpc/firmware.h         |    6 ++++++
 4 files changed, 19 insertions(+), 12 deletions(-)

Index: kexec/arch/powerpc/kernel/head_64.S
===================================================================
--- kexec.orig/arch/powerpc/kernel/head_64.S
+++ kexec/arch/powerpc/kernel/head_64.S
@@ -512,6 +512,7 @@ _GLOBAL(do_stab_bolted_pSeries)
  * Vectors for the FWNMI option.  Share common code.
  */
 	.globl system_reset_fwnmi
+      .align 7
 system_reset_fwnmi:
 	HMT_MEDIUM
 	mtspr	SPRN_SPRG1,r13		/* save r13 */
@@ -519,6 +520,7 @@ system_reset_fwnmi:
 	EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
 
 	.globl machine_check_fwnmi
+      .align 7
 machine_check_fwnmi:
 	HMT_MEDIUM
 	mtspr	SPRN_SPRG1,r13		/* save r13 */
Index: kexec/arch/powerpc/platforms/pseries/setup.c
===================================================================
--- kexec.orig/arch/powerpc/platforms/pseries/setup.c
+++ kexec/arch/powerpc/platforms/pseries/setup.c
@@ -75,8 +75,6 @@
 #endif
 
 extern void find_udbg_vterm(void);
-extern void system_reset_fwnmi(void);	/* from head.S */
-extern void machine_check_fwnmi(void);	/* from head.S */
 extern void generic_find_legacy_serial_ports(u64 *physport,
 		unsigned int *default_speed);
 
@@ -104,18 +102,21 @@ void pSeries_show_cpuinfo(struct seq_fil
 
 /* Initialize firmware assisted non-maskable interrupts if
  * the firmware supports this feature.
- *
  */
 static void __init fwnmi_init(void)
 {
-	int ret;
+	unsigned long a1, a2;
+
 	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)
+
+	/* If the kernel's not linked at zero we point the firmware at low
+	 * addresses anyway, and use a trampoline to get to the real code. */
+	a1 = __pa(system_reset_fwnmi) - PHYSICAL_START;
+	a2 = __pa(machine_check_fwnmi) - PHYSICAL_START;
+
+	if (0 == rtas_call(ibm_nmi_register, 2, 1, NULL, a1, a2))
 		fwnmi_active = 1;
 }
 
Index: kexec/include/asm-powerpc/firmware.h
===================================================================
--- kexec.orig/include/asm-powerpc/firmware.h
+++ kexec/include/asm-powerpc/firmware.h
@@ -92,6 +92,12 @@ typedef struct {
 extern firmware_feature_t firmware_features_table[];
 #endif
 
+extern void system_reset_fwnmi(void);
+extern void machine_check_fwnmi(void);
+
+/* This is true if we are using the firmware NMI handler (typically LPAR) */
+extern int fwnmi_active;
+
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* __ASM_POWERPC_FIRMWARE_H */
Index: kexec/arch/powerpc/platforms/pseries/ras.c
===================================================================
--- kexec.orig/arch/powerpc/platforms/pseries/ras.c
+++ kexec/arch/powerpc/platforms/pseries/ras.c
@@ -49,14 +49,12 @@
 #include <asm/machdep.h>
 #include <asm/rtas.h>
 #include <asm/ppcdebug.h>
+#include <asm/firmware.h>
 
 static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
 static DEFINE_SPINLOCK(ras_log_buf_lock);
 
-char mce_data_buf[RTAS_ERROR_LOG_MAX]
-;
-/* This is true if we are using the firmware NMI handler (typically LPAR) */
-extern int fwnmi_active;
+char mce_data_buf[RTAS_ERROR_LOG_MAX];
 
 static int ras_get_sensor_state_token;
 static int ras_check_exception_token;



More information about the Linuxppc64-dev mailing list