diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-devices-system-cpu | 15 | ||||
-rw-r--r-- | arch/powerpc/Kconfig | 4 | ||||
-rw-r--r-- | arch/powerpc/include/asm/machdep.h | 5 | ||||
-rw-r--r-- | arch/powerpc/kernel/sysfs.c | 19 | ||||
-rw-r--r-- | drivers/base/cpu.c | 32 | ||||
-rw-r--r-- | include/linux/cpu.h | 2 |
6 files changed, 77 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu index a703b9e9aeb9..d868a11c94a5 100644 --- a/Documentation/ABI/testing/sysfs-devices-system-cpu +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu | |||
@@ -62,6 +62,21 @@ Description: CPU topology files that describe kernel limits related to | |||
62 | See Documentation/cputopology.txt for more information. | 62 | See Documentation/cputopology.txt for more information. |
63 | 63 | ||
64 | 64 | ||
65 | What: /sys/devices/system/cpu/probe | ||
66 | /sys/devices/system/cpu/release | ||
67 | Date: November 2009 | ||
68 | Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org> | ||
69 | Description: Dynamic addition and removal of CPU's. This is not hotplug | ||
70 | removal, this is meant complete removal/addition of the CPU | ||
71 | from the system. | ||
72 | |||
73 | probe: writes to this file will dynamically add a CPU to the | ||
74 | system. Information written to the file to add CPU's is | ||
75 | architecture specific. | ||
76 | |||
77 | release: writes to this file dynamically remove a CPU from | ||
78 | the system. Information writtento the file to remove CPU's | ||
79 | is architecture specific. | ||
65 | 80 | ||
66 | What: /sys/devices/system/cpu/cpu#/node | 81 | What: /sys/devices/system/cpu/cpu#/node |
67 | Date: October 2009 | 82 | Date: October 2009 |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 5dbd375a3f2a..0df57466e783 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -320,6 +320,10 @@ config HOTPLUG_CPU | |||
320 | 320 | ||
321 | Say N if you are unsure. | 321 | Say N if you are unsure. |
322 | 322 | ||
323 | config ARCH_CPU_PROBE_RELEASE | ||
324 | def_bool y | ||
325 | depends on HOTPLUG_CPU | ||
326 | |||
323 | config ARCH_ENABLE_MEMORY_HOTPLUG | 327 | config ARCH_ENABLE_MEMORY_HOTPLUG |
324 | def_bool y | 328 | def_bool y |
325 | 329 | ||
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 9efa2be78331..9f0fc9e6ce0d 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h | |||
@@ -266,6 +266,11 @@ struct machdep_calls { | |||
266 | void (*suspend_disable_irqs)(void); | 266 | void (*suspend_disable_irqs)(void); |
267 | void (*suspend_enable_irqs)(void); | 267 | void (*suspend_enable_irqs)(void); |
268 | #endif | 268 | #endif |
269 | |||
270 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
271 | ssize_t (*cpu_probe)(const char *, size_t); | ||
272 | ssize_t (*cpu_release)(const char *, size_t); | ||
273 | #endif | ||
269 | }; | 274 | }; |
270 | 275 | ||
271 | extern void e500_idle(void); | 276 | extern void e500_idle(void); |
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 956ab33fd73f..e235e52dc4fe 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c | |||
@@ -461,6 +461,25 @@ static void unregister_cpu_online(unsigned int cpu) | |||
461 | 461 | ||
462 | cacheinfo_cpu_offline(cpu); | 462 | cacheinfo_cpu_offline(cpu); |
463 | } | 463 | } |
464 | |||
465 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
466 | ssize_t arch_cpu_probe(const char *buf, size_t count) | ||
467 | { | ||
468 | if (ppc_md.cpu_probe) | ||
469 | return ppc_md.cpu_probe(buf, count); | ||
470 | |||
471 | return -EINVAL; | ||
472 | } | ||
473 | |||
474 | ssize_t arch_cpu_release(const char *buf, size_t count) | ||
475 | { | ||
476 | if (ppc_md.cpu_release) | ||
477 | return ppc_md.cpu_release(buf, count); | ||
478 | |||
479 | return -EINVAL; | ||
480 | } | ||
481 | #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ | ||
482 | |||
464 | #endif /* CONFIG_HOTPLUG_CPU */ | 483 | #endif /* CONFIG_HOTPLUG_CPU */ |
465 | 484 | ||
466 | static int __cpuinit sysfs_cpu_notify(struct notifier_block *self, | 485 | static int __cpuinit sysfs_cpu_notify(struct notifier_block *self, |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index e62a4ccea54d..7c03af7b84a9 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -72,6 +72,38 @@ void unregister_cpu(struct cpu *cpu) | |||
72 | per_cpu(cpu_sys_devices, logical_cpu) = NULL; | 72 | per_cpu(cpu_sys_devices, logical_cpu) = NULL; |
73 | return; | 73 | return; |
74 | } | 74 | } |
75 | |||
76 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | ||
77 | static ssize_t cpu_probe_store(struct class *class, const char *buf, | ||
78 | size_t count) | ||
79 | { | ||
80 | return arch_cpu_probe(buf, count); | ||
81 | } | ||
82 | |||
83 | static ssize_t cpu_release_store(struct class *class, const char *buf, | ||
84 | size_t count) | ||
85 | { | ||
86 | return arch_cpu_release(buf, count); | ||
87 | } | ||
88 | |||
89 | static CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); | ||
90 | static CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); | ||
91 | |||
92 | int __init cpu_probe_release_init(void) | ||
93 | { | ||
94 | int rc; | ||
95 | |||
96 | rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | ||
97 | &class_attr_probe.attr); | ||
98 | if (!rc) | ||
99 | rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj, | ||
100 | &class_attr_release.attr); | ||
101 | |||
102 | return rc; | ||
103 | } | ||
104 | device_initcall(cpu_probe_release_init); | ||
105 | #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ | ||
106 | |||
75 | #else /* ... !CONFIG_HOTPLUG_CPU */ | 107 | #else /* ... !CONFIG_HOTPLUG_CPU */ |
76 | static inline void register_cpu_control(struct cpu *cpu) | 108 | static inline void register_cpu_control(struct cpu *cpu) |
77 | { | 109 | { |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 47536197ffdd..c972f7ccb7d3 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -43,6 +43,8 @@ extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); | |||
43 | 43 | ||
44 | #ifdef CONFIG_HOTPLUG_CPU | 44 | #ifdef CONFIG_HOTPLUG_CPU |
45 | extern void unregister_cpu(struct cpu *cpu); | 45 | extern void unregister_cpu(struct cpu *cpu); |
46 | extern ssize_t arch_cpu_probe(const char *, size_t); | ||
47 | extern ssize_t arch_cpu_release(const char *, size_t); | ||
46 | #endif | 48 | #endif |
47 | struct notifier_block; | 49 | struct notifier_block; |
48 | 50 | ||