hotplug-cpu.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * pseries CPU Hotplug infrastructure.
  3. *
  4. * Split out from arch/powerpc/kernel/rtas.c
  5. *
  6. * Peter Bergner, IBM March 2001.
  7. * Copyright (C) 2001 IBM.
  8. *
  9. * Copyright (C) 2006 Michael Ellerman, IBM Corporation
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version
  14. * 2 of the License, or (at your option) any later version.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/delay.h>
  18. #include <linux/cpu.h>
  19. #include <asm/system.h>
  20. #include <asm/prom.h>
  21. #include <asm/rtas.h>
  22. #include <asm/firmware.h>
  23. #include <asm/machdep.h>
  24. #include <asm/vdso_datapage.h>
  25. #include <asm/pSeries_reconfig.h>
  26. #include "xics.h"
  27. /* This version can't take the spinlock, because it never returns */
  28. static struct rtas_args rtas_stop_self_args = {
  29. .token = RTAS_UNKNOWN_SERVICE,
  30. .nargs = 0,
  31. .nret = 1,
  32. .rets = &rtas_stop_self_args.args[0],
  33. };
  34. void rtas_stop_self(void)
  35. {
  36. struct rtas_args *args = &rtas_stop_self_args;
  37. local_irq_disable();
  38. BUG_ON(args->token == RTAS_UNKNOWN_SERVICE);
  39. printk("cpu %u (hwid %u) Ready to die...\n",
  40. smp_processor_id(), hard_smp_processor_id());
  41. enter_rtas(__pa(args));
  42. panic("Alas, I survived.\n");
  43. }
  44. static int __init pseries_cpu_hotplug_init(void)
  45. {
  46. rtas_stop_self_args.token = rtas_token("stop-self");
  47. return 0;
  48. }
  49. arch_initcall(pseries_cpu_hotplug_init);