Lines Matching full:cpu

2  * CPU subsystem support
9 #include <linux/cpu.h>
19 .name = "cpu",
20 .dev_name = "cpu",
31 struct cpu *cpu = container_of(dev, struct cpu, dev); in show_online() local
33 return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id)); in show_online()
40 struct cpu *cpu = container_of(dev, struct cpu, dev); in store_online() local
46 ret = cpu_down(cpu->dev.id); in store_online()
51 ret = cpu_up(cpu->dev.id); in store_online()
66 static void __cpuinit register_cpu_control(struct cpu *cpu) in register_cpu_control() argument
68 device_create_file(&cpu->dev, &dev_attr_online); in register_cpu_control()
70 void unregister_cpu(struct cpu *cpu) in unregister_cpu() argument
72 int logical_cpu = cpu->dev.id; in unregister_cpu()
76 device_remove_file(&cpu->dev, &dev_attr_online); in unregister_cpu()
78 device_unregister(&cpu->dev); in unregister_cpu()
105 static inline void register_cpu_control(struct cpu *cpu) in register_cpu_control() argument
116 struct cpu *cpu = container_of(dev, struct cpu, dev); in show_crash_notes() local
121 cpunum = cpu->dev.id; in show_crash_notes()
124 * Might be reading other cpu's data based on which cpu read thread in show_crash_notes()
125 * has been scheduled. But cpu data (memory) is allocated once during in show_crash_notes()
137 * Print cpu online, possible, present, and system maps
219 * the only way to handle the issue of statically allocated cpu in cpu_device_release()
220 * devices. The different architectures will have their cpu device in cpu_device_release()
223 * by the cpu device. in cpu_device_release()
231 * register_cpu - Setup a sysfs device for a CPU.
232 * @cpu - cpu->hotpluggable field set to 1 will generate a control file in
233 * sysfs for this CPU.
234 * @num - CPU number to use when creating the device.
236 * Initialize and register the CPU device.
238 int __cpuinit register_cpu(struct cpu *cpu, int num) in register_cpu() argument
242 cpu->node_id = cpu_to_node(num); in register_cpu()
243 memset(&cpu->dev, 0x00, sizeof(struct device)); in register_cpu()
244 cpu->dev.id = num; in register_cpu()
245 cpu->dev.bus = &cpu_subsys; in register_cpu()
246 cpu->dev.release = cpu_device_release; in register_cpu()
247 error = device_register(&cpu->dev); in register_cpu()
248 if (!error && cpu->hotpluggable) in register_cpu()
249 register_cpu_control(cpu); in register_cpu()
251 per_cpu(cpu_sys_devices, num) = &cpu->dev; in register_cpu()
257 error = device_create_file(&cpu->dev, &dev_attr_crash_notes); in register_cpu()
262 struct device *get_cpu_device(unsigned cpu) in get_cpu_device() argument
264 if (cpu < nr_cpu_ids && cpu_possible(cpu)) in get_cpu_device()
265 return per_cpu(cpu_sys_devices, cpu); in get_cpu_device()
293 bool cpu_is_hotpluggable(unsigned cpu) in cpu_is_hotpluggable() argument
295 struct device *dev = get_cpu_device(cpu); in cpu_is_hotpluggable()
296 return dev && container_of(dev, struct cpu, dev)->hotpluggable; in cpu_is_hotpluggable()
301 static DEFINE_PER_CPU(struct cpu, cpu_devices);
311 panic("Failed to register CPU device"); in cpu_dev_register_generic()
319 panic("Failed to register CPU subsystem"); in cpu_dev_init()