Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2013 ARM Ltd.
0004  */
0005 #ifndef __ASM_CPU_OPS_H
0006 #define __ASM_CPU_OPS_H
0007 
0008 #include <linux/init.h>
0009 #include <linux/threads.h>
0010 
0011 /**
0012  * struct cpu_operations - Callback operations for hotplugging CPUs.
0013  *
0014  * @name:   Name of the property as appears in a devicetree cpu node's
0015  *      enable-method property. On systems booting with ACPI, @name
0016  *      identifies the struct cpu_operations entry corresponding to
0017  *      the boot protocol specified in the ACPI MADT table.
0018  * @cpu_init:   Reads any data necessary for a specific enable-method for a
0019  *      proposed logical id.
0020  * @cpu_prepare: Early one-time preparation step for a cpu. If there is a
0021  *      mechanism for doing so, tests whether it is possible to boot
0022  *      the given CPU.
0023  * @cpu_boot:   Boots a cpu into the kernel.
0024  * @cpu_postboot: Optionally, perform any post-boot cleanup or necessary
0025  *      synchronisation. Called from the cpu being booted.
0026  * @cpu_can_disable: Determines whether a CPU can be disabled based on
0027  *      mechanism-specific information.
0028  * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific
0029  *      reason, which will cause the hot unplug to be aborted. Called
0030  *      from the cpu to be killed.
0031  * @cpu_die:    Makes a cpu leave the kernel. Must not fail. Called from the
0032  *      cpu being killed.
0033  * @cpu_kill:  Ensures a cpu has left the kernel. Called from another cpu.
0034  */
0035 struct cpu_operations {
0036     const char  *name;
0037     int     (*cpu_init)(unsigned int);
0038     int     (*cpu_prepare)(unsigned int);
0039     int     (*cpu_boot)(unsigned int);
0040     void        (*cpu_postboot)(void);
0041 #ifdef CONFIG_HOTPLUG_CPU
0042     bool        (*cpu_can_disable)(unsigned int cpu);
0043     int     (*cpu_disable)(unsigned int cpu);
0044     void        (*cpu_die)(unsigned int cpu);
0045     int     (*cpu_kill)(unsigned int cpu);
0046 #endif
0047 };
0048 
0049 int __init init_cpu_ops(int cpu);
0050 extern const struct cpu_operations *get_cpu_ops(int cpu);
0051 
0052 static inline void __init init_bootcpu_ops(void)
0053 {
0054     init_cpu_ops(0);
0055 }
0056 
0057 #endif /* ifndef __ASM_CPU_OPS_H */