aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-20 23:03:20 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-27 03:43:50 -0400
commit13906db670a128864714c30c244b866dce119494 (patch)
tree3f615ce7648aa6b15cbd8ff8eaf2c51250f57cd9 /arch/powerpc
parentee372bc1c6ab2f411d098337936ebb994af264c4 (diff)
powerpc/powernv: Return secondary CPUs to firmware on kexec
With OPAL v3 we can return secondary CPUs to firmware on kexec. This allows firmware to do various cleanups making things generally more reliable, and will enable the "new" kernel to call OPAL to perform some reconfiguration tasks early on that can only be done while all the CPUs are in firmware. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/include/asm/opal.h2
-rw-r--r--arch/powerpc/platforms/powernv/opal-wrappers.S1
-rw-r--r--arch/powerpc/platforms/powernv/setup.c11
3 files changed, 14 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
index 48ad6780c6d9..c5cd72833d6e 100644
--- a/arch/powerpc/include/asm/opal.h
+++ b/arch/powerpc/include/asm/opal.h
@@ -128,6 +128,7 @@ extern int opal_enter_rtas(struct rtas_args *args,
128#define OPAL_XSCOM_WRITE 66 128#define OPAL_XSCOM_WRITE 66
129#define OPAL_LPC_READ 67 129#define OPAL_LPC_READ 67
130#define OPAL_LPC_WRITE 68 130#define OPAL_LPC_WRITE 68
131#define OPAL_RETURN_CPU 69
131 132
132#ifndef __ASSEMBLY__ 133#ifndef __ASSEMBLY__
133 134
@@ -646,6 +647,7 @@ int64_t opal_set_system_attention_led(uint8_t led_action);
646int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe, 647int64_t opal_pci_next_error(uint64_t phb_id, uint64_t *first_frozen_pe,
647 uint16_t *pci_error_type, uint16_t *severity); 648 uint16_t *pci_error_type, uint16_t *severity);
648int64_t opal_pci_poll(uint64_t phb_id); 649int64_t opal_pci_poll(uint64_t phb_id);
650int64_t opal_return_cpu(void);
649 651
650int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, uint64_t *val); 652int64_t opal_xscom_read(uint32_t gcid, uint32_t pcb_addr, uint64_t *val);
651int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val); 653int64_t opal_xscom_write(uint32_t gcid, uint32_t pcb_addr, uint64_t val);
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 42c06fba3994..8f3844535fbb 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -115,3 +115,4 @@ OPAL_CALL(opal_xscom_read, OPAL_XSCOM_READ);
115OPAL_CALL(opal_xscom_write, OPAL_XSCOM_WRITE); 115OPAL_CALL(opal_xscom_write, OPAL_XSCOM_WRITE);
116OPAL_CALL(opal_lpc_read, OPAL_LPC_READ); 116OPAL_CALL(opal_lpc_read, OPAL_LPC_READ);
117OPAL_CALL(opal_lpc_write, OPAL_LPC_WRITE); 117OPAL_CALL(opal_lpc_write, OPAL_LPC_WRITE);
118OPAL_CALL(opal_return_cpu, OPAL_RETURN_CPU);
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index 4ddb339700b9..e239dcfa224c 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -31,6 +31,7 @@
31#include <asm/xics.h> 31#include <asm/xics.h>
32#include <asm/rtas.h> 32#include <asm/rtas.h>
33#include <asm/opal.h> 33#include <asm/opal.h>
34#include <asm/kexec.h>
34 35
35#include "powernv.h" 36#include "powernv.h"
36 37
@@ -153,6 +154,16 @@ static void pnv_shutdown(void)
153static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) 154static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
154{ 155{
155 xics_kexec_teardown_cpu(secondary); 156 xics_kexec_teardown_cpu(secondary);
157
158 /* Return secondary CPUs to firmware on OPAL v3 */
159 if (firmware_has_feature(FW_FEATURE_OPALv3) && secondary) {
160 mb();
161 get_paca()->kexec_state = KEXEC_STATE_REAL_MODE;
162 mb();
163
164 /* Return the CPU to OPAL */
165 opal_return_cpu();
166 }
156} 167}
157#endif /* CONFIG_KEXEC */ 168#endif /* CONFIG_KEXEC */
158 169