aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-devices-system-cpu15
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/include/asm/machdep.h5
-rw-r--r--arch/powerpc/kernel/sysfs.c19
-rw-r--r--drivers/base/cpu.c32
-rw-r--r--include/linux/cpu.h2
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
65What: /sys/devices/system/cpu/probe
66 /sys/devices/system/cpu/release
67Date: November 2009
68Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
69Description: 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
66What: /sys/devices/system/cpu/cpu#/node 81What: /sys/devices/system/cpu/cpu#/node
67Date: October 2009 82Date: 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
323config ARCH_CPU_PROBE_RELEASE
324 def_bool y
325 depends on HOTPLUG_CPU
326
323config ARCH_ENABLE_MEMORY_HOTPLUG 327config 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
271extern void e500_idle(void); 276extern 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
466ssize_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
474ssize_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
466static int __cpuinit sysfs_cpu_notify(struct notifier_block *self, 485static 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
77static 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
83static 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
89static CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
90static CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store);
91
92int __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}
104device_initcall(cpu_probe_release_init);
105#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
106
75#else /* ... !CONFIG_HOTPLUG_CPU */ 107#else /* ... !CONFIG_HOTPLUG_CPU */
76static inline void register_cpu_control(struct cpu *cpu) 108static 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
45extern void unregister_cpu(struct cpu *cpu); 45extern void unregister_cpu(struct cpu *cpu);
46extern ssize_t arch_cpu_probe(const char *, size_t);
47extern ssize_t arch_cpu_release(const char *, size_t);
46#endif 48#endif
47struct notifier_block; 49struct notifier_block;
48 50