5 #include <linux/kernel.h>
6 #include <linux/module.h>
8 #include <linux/sched.h>
11 #include <linux/device.h>
14 #include <linux/slab.h>
27 #ifdef CONFIG_HOTPLUG_CPU
39 const char *buf,
size_t count)
44 cpu_hotplug_driver_lock();
47 ret = cpu_down(cpu->
dev.id);
52 ret = cpu_up(cpu->
dev.id);
59 cpu_hotplug_driver_unlock();
67 static void __cpuinit register_cpu_control(
struct cpu *cpu)
71 void unregister_cpu(
struct cpu *cpu)
73 int logical_cpu = cpu->
dev.id;
84 #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
90 return arch_cpu_probe(buf, count);
98 return arch_cpu_release(buf, count);
106 static inline void register_cpu_control(
struct cpu *cpu)
112 #include <linux/kexec.h>
119 unsigned long long addr;
122 cpunum = cpu->
dev.id;
131 rc =
sprintf(buf,
"%Lx\n", addr);
158 #define _CPU_ATTR(name, map) \
159 { __ATTR(name, 0444, show_cpus_attr, NULL), map }
162 static struct cpu_attr cpu_attrs[] = {
192 n = cpulist_scnprintf(buf,
len, offline);
193 free_cpumask_var(offline);
212 static void cpu_device_release(
struct device *dev)
247 cpu->
dev.release = cpu_device_release;
248 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
253 register_cpu_control(cpu);
269 return per_cpu(cpu_sys_devices, cpu);
275 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
279 static struct attribute *cpu_root_attrs[] = {
280 #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
281 &dev_attr_probe.attr,
282 &dev_attr_release.attr,
284 &cpu_attrs[0].
attr.attr,
285 &cpu_attrs[1].
attr.attr,
286 &cpu_attrs[2].
attr.attr,
287 &dev_attr_kernel_max.attr,
288 &dev_attr_offline.attr,
289 #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
290 &dev_attr_modalias.attr,
296 .attrs = cpu_root_attrs,
300 &cpu_root_attr_group,
307 return dev &&
container_of(dev,
struct cpu, dev)->hotpluggable;
311 #ifdef CONFIG_GENERIC_CPU_DEVICES
315 static void __init cpu_dev_register_generic(
void)
317 #ifdef CONFIG_GENERIC_CPU_DEVICES
322 panic(
"Failed to register CPU device");
330 panic(
"Failed to register CPU subsystem");
332 cpu_dev_register_generic();