blob: 53cbd53d8740537d86b7fe5ab13e19dfcdcecd75 [file] [log] [blame]
Michael Ellermandce623e2007-02-08 18:33:55 +11001/*
2 * Copyright 2006 Michael Ellerman, IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#include <asm/machdep.h>
11#include <asm/page.h>
12#include <asm/firmware.h>
13#include <asm/kexec.h>
14#include <asm/mpic.h>
Paul Mackerrasf6407122007-05-10 22:17:18 +100015#include <asm/smp.h>
Michael Ellermandce623e2007-02-08 18:33:55 +110016
17#include "pseries.h"
18#include "xics.h"
19#include "plpar_wrappers.h"
20
21static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
22{
23 /* Don't risk a hypervisor call if we're crashing */
24 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
25 unsigned long addr;
26
27 addr = __pa(get_slb_shadow());
28 if (unregister_slb_shadow(hard_smp_processor_id(), addr))
29 printk("SLB shadow buffer deregistration of "
30 "cpu %u (hw_cpu_id %d) failed\n",
31 smp_processor_id(),
32 hard_smp_processor_id());
33
34 addr = __pa(get_lppaca());
35 if (unregister_vpa(hard_smp_processor_id(), addr)) {
36 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
37 "failed\n", smp_processor_id(),
38 hard_smp_processor_id());
39 }
40 }
41}
42
43static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary)
44{
45 pseries_kexec_cpu_down(crash_shutdown, secondary);
46 mpic_teardown_this_cpu(secondary);
47}
48
49void __init setup_kexec_cpu_down_mpic(void)
50{
51 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_mpic;
52}
53
54static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
55{
56 pseries_kexec_cpu_down(crash_shutdown, secondary);
Nathan Fontenotc3e85062008-02-07 07:37:31 +110057 xics_kexec_teardown_cpu(secondary);
Michael Ellermandce623e2007-02-08 18:33:55 +110058}
59
60void __init setup_kexec_cpu_down_xics(void)
61{
62 ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics;
63}
64
65static int __init pseries_kexec_setup(void)
66{
67 ppc_md.machine_kexec = default_machine_kexec;
68 ppc_md.machine_kexec_prepare = default_machine_kexec_prepare;
69 ppc_md.machine_crash_shutdown = default_machine_crash_shutdown;
70
71 return 0;
72}
Arnd Bergmanncf207602008-06-12 19:14:35 +100073machine_device_initcall(pseries, pseries_kexec_setup);