cpu_ops.h 971 B

1234567891011121314151617181920212223242526272829303132333435
  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. * @cpu_start: Boots a cpu into the kernel.
  15. * @cpu_stop: Makes a cpu leave the kernel. Must not fail. Called from
  16. * the cpu being stopped.
  17. * @cpu_is_stopped: Ensures a cpu has left the kernel. Called from another
  18. * cpu.
  19. */
  20. struct cpu_operations {
  21. int (*cpu_start)(unsigned int cpu,
  22. struct task_struct *tidle);
  23. #ifdef CONFIG_HOTPLUG_CPU
  24. void (*cpu_stop)(void);
  25. int (*cpu_is_stopped)(unsigned int cpu);
  26. #endif
  27. };
  28. extern const struct cpu_operations cpu_ops_spinwait;
  29. extern const struct cpu_operations *cpu_ops;
  30. void __init cpu_set_ops(void);
  31. #endif /* ifndef __ASM_CPU_OPS_H */