kexec.c 2.1 KB

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