1*caab277bSThomas 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. 24652af899SMark Rutland * @cpu_postboot: Optionally, perform any post-boot cleanup or necesary 25652af899SMark Rutland * synchronisation. Called from the cpu being booted. 269327e2c6SMark Rutland * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific 279327e2c6SMark Rutland * reason, which will cause the hot unplug to be aborted. Called 289327e2c6SMark Rutland * from the cpu to be killed. 299327e2c6SMark Rutland * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the 309327e2c6SMark Rutland * cpu being killed. 31c814ca02SAshwin Chaugule * @cpu_kill: Ensures a cpu has left the kernel. Called from another cpu. 32819a8826SLorenzo Pieralisi * @cpu_init_idle: Reads any data necessary to initialize CPU idle states for 33819a8826SLorenzo Pieralisi * a proposed logical id. 3495322526SLorenzo Pieralisi * @cpu_suspend: Suspends a cpu and saves the required context. May fail owing 3595322526SLorenzo Pieralisi * to wrong parameters or error conditions. Called from the 3695322526SLorenzo Pieralisi * CPU being suspended. Must be called with IRQs disabled. 37652af899SMark Rutland */ 38cd1aebf5SMark Rutland struct cpu_operations { 39cd1aebf5SMark Rutland const char *name; 40819a8826SLorenzo Pieralisi int (*cpu_init)(unsigned int); 41cd1aebf5SMark Rutland int (*cpu_prepare)(unsigned int); 42652af899SMark Rutland int (*cpu_boot)(unsigned int); 43652af899SMark Rutland void (*cpu_postboot)(void); 449327e2c6SMark Rutland #ifdef CONFIG_HOTPLUG_CPU 459327e2c6SMark Rutland int (*cpu_disable)(unsigned int cpu); 469327e2c6SMark Rutland void (*cpu_die)(unsigned int cpu); 47c814ca02SAshwin Chaugule int (*cpu_kill)(unsigned int cpu); 489327e2c6SMark Rutland #endif 49af3cfdbfSLorenzo Pieralisi #ifdef CONFIG_CPU_IDLE 50819a8826SLorenzo Pieralisi int (*cpu_init_idle)(unsigned int); 5195322526SLorenzo Pieralisi int (*cpu_suspend)(unsigned long); 5295322526SLorenzo Pieralisi #endif 53cd1aebf5SMark Rutland }; 54cd1aebf5SMark Rutland 55cd1aebf5SMark Rutland extern const struct cpu_operations *cpu_ops[NR_CPUS]; 56819a8826SLorenzo Pieralisi int __init cpu_read_ops(int cpu); 57cd1aebf5SMark Rutland 58819a8826SLorenzo Pieralisi static inline void __init cpu_read_bootcpu_ops(void) 59819a8826SLorenzo Pieralisi { 60819a8826SLorenzo Pieralisi cpu_read_ops(0); 61819a8826SLorenzo Pieralisi } 62819a8826SLorenzo Pieralisi 63cd1aebf5SMark Rutland #endif /* ifndef __ASM_CPU_OPS_H */ 64