kexec.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  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. #include <asm/machdep.h>
  10. #include <asm/page.h>
  11. #include <asm/firmware.h>
  12. #include <asm/kexec.h>
  13. #include <asm/mpic.h>
  14. #include <asm/smp.h>
  15. #include "pseries.h"
  16. #include "xics.h"
  17. #include "plpar_wrappers.h"
  18. static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
  19. {
  20. /* Don't risk a hypervisor call if we're crashing */
  21. if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) {
  22. unsigned long addr;
  23. addr = __pa(get_slb_shadow());
  24. if (unregister_slb_shadow(hard_smp_processor_id(), addr))
  25. printk("SLB shadow buffer deregistration of "
  26. "cpu %u (hw_cpu_id %d) failed\n",
  27. smp_processor_id(),
  28. hard_smp_processor_id());
  29. addr = __pa(get_lppaca());
  30. if (unregister_vpa(hard_smp_processor_id(), addr)) {
  31. printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
  32. "failed\n", smp_processor_id(),
  33. hard_smp_processor_id());
  34. }
  35. }
  36. }
  37. static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary)
  38. {
  39. pseries_kexec_cpu_down(crash_shutdown, secondary);
  40. mpic_teardown_this_cpu(secondary);
  41. }
  42. void __init setup_kexec_cpu_down_mpic(void)
  43. {
  44. ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_mpic;
  45. }
  46. static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary)
  47. {
  48. pseries_kexec_cpu_down(crash_shutdown, secondary);
  49. xics_kexec_teardown_cpu(secondary);
  50. }
  51. void __init setup_kexec_cpu_down_xics(void)
  52. {
  53. ppc_md.kexec_cpu_down = pseries_kexec_cpu_down_xics;
  54. }
  55. static int __init pseries_kexec_setup(void)
  56. {
  57. ppc_md.machine_kexec = default_machine_kexec;
  58. ppc_md.machine_kexec_prepare = default_machine_kexec_prepare;
  59. ppc_md.machine_crash_shutdown = default_machine_crash_shutdown;
  60. return 0;
  61. }
  62. machine_device_initcall(pseries, pseries_kexec_setup);