cpu_ops.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2013 ARM Ltd.
  4. */
  5. #ifndef __ASM_CPU_OPS_H
  6. #define __ASM_CPU_OPS_H
  7. #include <linux/init.h>
  8. #include <linux/threads.h>
  9. /**
  10. * struct cpu_operations - Callback operations for hotplugging CPUs.
  11. *
  12. * @name: Name of the property as appears in a devicetree cpu node's
  13. * enable-method property. On systems booting with ACPI, @name
  14. * identifies the struct cpu_operations entry corresponding to
  15. * the boot protocol specified in the ACPI MADT table.
  16. * @cpu_init: Reads any data necessary for a specific enable-method for a
  17. * proposed logical id.
  18. * @cpu_prepare: Early one-time preparation step for a cpu. If there is a
  19. * mechanism for doing so, tests whether it is possible to boot
  20. * the given CPU.
  21. * @cpu_boot: Boots a cpu into the kernel.
  22. * @cpu_postboot: Optionally, perform any post-boot cleanup or necessary
  23. * synchronisation. Called from the cpu being booted.
  24. * @cpu_can_disable: Determines whether a CPU can be disabled based on
  25. * mechanism-specific information.
  26. * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific
  27. * reason, which will cause the hot unplug to be aborted. Called
  28. * from the cpu to be killed.
  29. * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the
  30. * cpu being killed.
  31. * @cpu_kill: Ensures a cpu has left the kernel. Called from another cpu.
  32. */
  33. struct cpu_operations {
  34. const char *name;
  35. int (*cpu_init)(unsigned int);
  36. int (*cpu_prepare)(unsigned int);
  37. int (*cpu_boot)(unsigned int);
  38. void (*cpu_postboot)(void);
  39. #ifdef CONFIG_HOTPLUG_CPU
  40. bool (*cpu_can_disable)(unsigned int cpu);
  41. int (*cpu_disable)(unsigned int cpu);
  42. void (*cpu_die)(unsigned int cpu);
  43. int (*cpu_kill)(unsigned int cpu);
  44. #endif
  45. };
  46. int __init init_cpu_ops(int cpu);
  47. extern const struct cpu_operations *get_cpu_ops(int cpu);
  48. static inline void __init init_bootcpu_ops(void)
  49. {
  50. init_cpu_ops(0);
  51. }
  52. #endif /* ifndef __ASM_CPU_OPS_H */