aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/smp.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/smp.c')
-rw-r--r--arch/s390/kernel/smp.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 7c0143fdf710..2c5de92958dd 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -821,19 +821,57 @@ int setup_profiling_timer(unsigned int multiplier)
821 821
822static DEFINE_PER_CPU(struct cpu, cpu_devices); 822static DEFINE_PER_CPU(struct cpu, cpu_devices);
823 823
824static ssize_t show_capability(struct sys_device *dev, char *buf)
825{
826 unsigned int capability;
827 int rc;
828
829 rc = get_cpu_capability(&capability);
830 if (rc)
831 return rc;
832 return sprintf(buf, "%u\n", capability);
833}
834static SYSDEV_ATTR(capability, 0444, show_capability, NULL);
835
836static int __cpuinit smp_cpu_notify(struct notifier_block *self,
837 unsigned long action, void *hcpu)
838{
839 unsigned int cpu = (unsigned int)(long)hcpu;
840 struct cpu *c = &per_cpu(cpu_devices, cpu);
841 struct sys_device *s = &c->sysdev;
842
843 switch (action) {
844 case CPU_ONLINE:
845 if (sysdev_create_file(s, &attr_capability))
846 return NOTIFY_BAD;
847 break;
848 case CPU_DEAD:
849 sysdev_remove_file(s, &attr_capability);
850 break;
851 }
852 return NOTIFY_OK;
853}
854
855static struct notifier_block __cpuinitdata smp_cpu_nb = {
856 .notifier_call = smp_cpu_notify,
857};
858
824static int __init topology_init(void) 859static int __init topology_init(void)
825{ 860{
826 int cpu; 861 int cpu;
827 int ret; 862
863 register_cpu_notifier(&smp_cpu_nb);
828 864
829 for_each_possible_cpu(cpu) { 865 for_each_possible_cpu(cpu) {
830 struct cpu *c = &per_cpu(cpu_devices, cpu); 866 struct cpu *c = &per_cpu(cpu_devices, cpu);
867 struct sys_device *s = &c->sysdev;
831 868
832 c->hotpluggable = 1; 869 c->hotpluggable = 1;
833 ret = register_cpu(c, cpu); 870 register_cpu(c, cpu);
834 if (ret) 871 if (!cpu_online(cpu))
835 printk(KERN_WARNING "topology_init: register_cpu %d " 872 continue;
836 "failed (%d)\n", cpu, ret); 873 s = &c->sysdev;
874 sysdev_create_file(s, &attr_capability);
837 } 875 }
838 return 0; 876 return 0;
839} 877}