2 * Copyright IBM Corp. 2007
3 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
6 #define KMSG_COMPONENT "sclp_config"
7 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
9 #include <linux/init.h>
10 #include <linux/errno.h>
11 #include <linux/cpu.h>
12 #include <linux/device.h>
13 #include <linux/workqueue.h>
18 struct conf_mgm_data
{
21 } __attribute__((packed
));
23 #define EV_QUAL_CPU_CHANGE 1
24 #define EV_QUAL_CAP_CHANGE 3
26 static struct work_struct sclp_cpu_capability_work
;
27 static struct work_struct sclp_cpu_change_work
;
29 static void sclp_cpu_capability_notify(struct work_struct
*work
)
34 s390_adjust_jiffies();
35 pr_info("CPU capability may have changed\n");
37 for_each_online_cpu(cpu
) {
38 dev
= get_cpu_device(cpu
);
39 kobject_uevent(&dev
->kobj
, KOBJ_CHANGE
);
44 static void __ref
sclp_cpu_change_notify(struct work_struct
*work
)
49 static void sclp_conf_receiver_fn(struct evbuf_header
*evbuf
)
51 struct conf_mgm_data
*cdata
;
53 cdata
= (struct conf_mgm_data
*)(evbuf
+ 1);
54 switch (cdata
->ev_qualifier
) {
55 case EV_QUAL_CPU_CHANGE
:
56 schedule_work(&sclp_cpu_change_work
);
58 case EV_QUAL_CAP_CHANGE
:
59 schedule_work(&sclp_cpu_capability_work
);
64 static struct sclp_register sclp_conf_register
=
66 .receive_mask
= EVTYP_CONFMGMDATA_MASK
,
67 .receiver_fn
= sclp_conf_receiver_fn
,
70 static int __init
sclp_conf_init(void)
72 INIT_WORK(&sclp_cpu_capability_work
, sclp_cpu_capability_notify
);
73 INIT_WORK(&sclp_cpu_change_work
, sclp_cpu_change_notify
);
74 return sclp_register(&sclp_conf_register
);
77 __initcall(sclp_conf_init
);