cpu_ops.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020 Western Digital Corporation or its affiliates.
  4. * Based on arch/arm64/include/asm/cpu_ops.h
  5. */
  6. #ifndef __ASM_CPU_OPS_H
  7. #define __ASM_CPU_OPS_H
  8. #include <linux/init.h>
  9. #include <linux/sched.h>
  10. #include <linux/threads.h>
  11. /**
  12. * struct cpu_operations - Callback operations for hotplugging CPUs.
  13. *
  14. * @name: Name of the boot protocol.
  15. * @cpu_prepare: Early one-time preparation step for a cpu. If there
  16. * is a mechanism for doing so, tests whether it is
  17. * possible to boot the given HART.
  18. * @cpu_start: Boots a cpu into the kernel.
  19. * @cpu_disable: Prepares a cpu to die. May fail for some
  20. * mechanism-specific reason, which will cause the hot
  21. * unplug to be aborted. Called from the cpu to be killed.
  22. * @cpu_stop: Makes a cpu leave the kernel. Must not fail. Called from
  23. * the cpu being stopped.
  24. * @cpu_is_stopped: Ensures a cpu has left the kernel. Called from another
  25. * cpu.
  26. */
  27. struct cpu_operations {
  28. const char *name;
  29. int (*cpu_prepare)(unsigned int cpu);
  30. int (*cpu_start)(unsigned int cpu,
  31. struct task_struct *tidle);
  32. #ifdef CONFIG_HOTPLUG_CPU
  33. int (*cpu_disable)(unsigned int cpu);
  34. void (*cpu_stop)(void);
  35. int (*cpu_is_stopped)(unsigned int cpu);
  36. #endif
  37. };
  38. extern const struct cpu_operations *cpu_ops[NR_CPUS];
  39. void __init cpu_set_ops(int cpu);
  40. void cpu_update_secondary_bootdata(unsigned int cpuid,
  41. struct task_struct *tidle);
  42. #endif /* ifndef __ASM_CPU_OPS_H */