1caab277bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2cd1aebf5SMark Rutland /* 3cd1aebf5SMark Rutland * Copyright (C) 2013 ARM Ltd. 4cd1aebf5SMark Rutland */ 5cd1aebf5SMark Rutland #ifndef __ASM_CPU_OPS_H 6cd1aebf5SMark Rutland #define __ASM_CPU_OPS_H 7cd1aebf5SMark Rutland 8cd1aebf5SMark Rutland #include <linux/init.h> 9cd1aebf5SMark Rutland #include <linux/threads.h> 10cd1aebf5SMark Rutland 11652af899SMark Rutland /** 12652af899SMark Rutland * struct cpu_operations - Callback operations for hotplugging CPUs. 13652af899SMark Rutland * 14652af899SMark Rutland * @name: Name of the property as appears in a devicetree cpu node's 15819a8826SLorenzo Pieralisi * enable-method property. On systems booting with ACPI, @name 16819a8826SLorenzo Pieralisi * identifies the struct cpu_operations entry corresponding to 17819a8826SLorenzo Pieralisi * the boot protocol specified in the ACPI MADT table. 18819a8826SLorenzo Pieralisi * @cpu_init: Reads any data necessary for a specific enable-method for a 19819a8826SLorenzo Pieralisi * proposed logical id. 20652af899SMark Rutland * @cpu_prepare: Early one-time preparation step for a cpu. If there is a 21652af899SMark Rutland * mechanism for doing so, tests whether it is possible to boot 22652af899SMark Rutland * the given CPU. 23652af899SMark Rutland * @cpu_boot: Boots a cpu into the kernel. 24*ad14c192SXiaoming Ni * @cpu_postboot: Optionally, perform any post-boot cleanup or necessary 25652af899SMark Rutland * synchronisation. Called from the cpu being booted. 26d55c5f28SSudeep Holla * @cpu_can_disable: Determines whether a CPU can be disabled based on 27d55c5f28SSudeep Holla * mechanism-specific information. 289327e2c6SMark Rutland * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific 299327e2c6SMark Rutland * reason, which will cause the hot unplug to be aborted. Called 309327e2c6SMark Rutland * from the cpu to be killed. 319327e2c6SMark Rutland * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the 329327e2c6SMark Rutland * cpu being killed. 33c814ca02SAshwin Chaugule * @cpu_kill: Ensures a cpu has left the kernel. Called from another cpu. 34652af899SMark Rutland */ 35cd1aebf5SMark Rutland struct cpu_operations { 36cd1aebf5SMark Rutland const char *name; 37819a8826SLorenzo Pieralisi int (*cpu_init)(unsigned int); 38cd1aebf5SMark Rutland int (*cpu_prepare)(unsigned int); 39652af899SMark Rutland int (*cpu_boot)(unsigned int); 40652af899SMark Rutland void (*cpu_postboot)(void); 419327e2c6SMark Rutland #ifdef CONFIG_HOTPLUG_CPU 42d55c5f28SSudeep Holla bool (*cpu_can_disable)(unsigned int cpu); 439327e2c6SMark Rutland int (*cpu_disable)(unsigned int cpu); 449327e2c6SMark Rutland void (*cpu_die)(unsigned int cpu); 45c814ca02SAshwin Chaugule int (*cpu_kill)(unsigned int cpu); 469327e2c6SMark Rutland #endif 47cd1aebf5SMark Rutland }; 48cd1aebf5SMark Rutland 496885fb12SGavin Shan int __init init_cpu_ops(int cpu); 50de58ed5eSGavin Shan extern const struct cpu_operations *get_cpu_ops(int cpu); 51cd1aebf5SMark Rutland init_bootcpu_ops(void)526885fb12SGavin Shanstatic inline void __init init_bootcpu_ops(void) 53819a8826SLorenzo Pieralisi { 546885fb12SGavin Shan init_cpu_ops(0); 55819a8826SLorenzo Pieralisi } 56819a8826SLorenzo Pieralisi 57cd1aebf5SMark Rutland #endif /* ifndef __ASM_CPU_OPS_H */ 58