diff options
-rw-r--r-- | drivers/base/Kconfig | 4 | ||||
-rw-r--r-- | drivers/base/Makefile | 1 | ||||
-rw-r--r-- | drivers/base/base.h | 5 | ||||
-rw-r--r-- | drivers/base/hypervisor.c | 19 | ||||
-rw-r--r-- | drivers/base/init.c | 1 | ||||
-rw-r--r-- | include/linux/kobject.h | 2 |
6 files changed, 32 insertions, 0 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index f0eff3dac58d..80502dc6ed66 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -38,3 +38,7 @@ config DEBUG_DRIVER | |||
38 | If you are unsure about this, say N here. | 38 | If you are unsure about this, say N here. |
39 | 39 | ||
40 | endmenu | 40 | endmenu |
41 | |||
42 | config SYS_HYPERVISOR | ||
43 | bool | ||
44 | default n | ||
diff --git a/drivers/base/Makefile b/drivers/base/Makefile index e99471d3232b..659cde6c2fb9 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile | |||
@@ -9,6 +9,7 @@ obj-$(CONFIG_FW_LOADER) += firmware_class.o | |||
9 | obj-$(CONFIG_NUMA) += node.o | 9 | obj-$(CONFIG_NUMA) += node.o |
10 | obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o | 10 | obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o |
11 | obj-$(CONFIG_SMP) += topology.o | 11 | obj-$(CONFIG_SMP) += topology.o |
12 | obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o | ||
12 | 13 | ||
13 | ifeq ($(CONFIG_DEBUG_DRIVER),y) | 14 | ifeq ($(CONFIG_DEBUG_DRIVER),y) |
14 | EXTRA_CFLAGS += -DDEBUG | 15 | EXTRA_CFLAGS += -DDEBUG |
diff --git a/drivers/base/base.h b/drivers/base/base.h index 122498aef50b..79115eff6e94 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -5,6 +5,11 @@ extern int devices_init(void); | |||
5 | extern int buses_init(void); | 5 | extern int buses_init(void); |
6 | extern int classes_init(void); | 6 | extern int classes_init(void); |
7 | extern int firmware_init(void); | 7 | extern int firmware_init(void); |
8 | #ifdef CONFIG_SYS_HYPERVISOR | ||
9 | extern int hypervisor_init(void); | ||
10 | #else | ||
11 | static inline int hypervisor_init(void) { return 0; } | ||
12 | #endif | ||
8 | extern int platform_bus_init(void); | 13 | extern int platform_bus_init(void); |
9 | extern int system_bus_init(void); | 14 | extern int system_bus_init(void); |
10 | extern int cpu_dev_init(void); | 15 | extern int cpu_dev_init(void); |
diff --git a/drivers/base/hypervisor.c b/drivers/base/hypervisor.c new file mode 100644 index 000000000000..0c85e9d6a448 --- /dev/null +++ b/drivers/base/hypervisor.c | |||
@@ -0,0 +1,19 @@ | |||
1 | /* | ||
2 | * hypervisor.c - /sys/hypervisor subsystem. | ||
3 | * | ||
4 | * This file is released under the GPLv2 | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/kobject.h> | ||
9 | #include <linux/device.h> | ||
10 | |||
11 | #include "base.h" | ||
12 | |||
13 | decl_subsys(hypervisor, NULL, NULL); | ||
14 | EXPORT_SYMBOL_GPL(hypervisor_subsys); | ||
15 | |||
16 | int __init hypervisor_init(void) | ||
17 | { | ||
18 | return subsystem_register(&hypervisor_subsys); | ||
19 | } | ||
diff --git a/drivers/base/init.c b/drivers/base/init.c index c648914b9cde..37138154f9e8 100644 --- a/drivers/base/init.c +++ b/drivers/base/init.c | |||
@@ -27,6 +27,7 @@ void __init driver_init(void) | |||
27 | buses_init(); | 27 | buses_init(); |
28 | classes_init(); | 28 | classes_init(); |
29 | firmware_init(); | 29 | firmware_init(); |
30 | hypervisor_init(); | ||
30 | 31 | ||
31 | /* These are also core pieces, but must come after the | 32 | /* These are also core pieces, but must come after the |
32 | * core core pieces. | 33 | * core core pieces. |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index c187c53cecd0..2d229327959e 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -190,6 +190,8 @@ struct subsystem _varname##_subsys = { \ | |||
190 | 190 | ||
191 | /* The global /sys/kernel/ subsystem for people to chain off of */ | 191 | /* The global /sys/kernel/ subsystem for people to chain off of */ |
192 | extern struct subsystem kernel_subsys; | 192 | extern struct subsystem kernel_subsys; |
193 | /* The global /sys/hypervisor/ subsystem */ | ||
194 | extern struct subsystem hypervisor_subsys; | ||
193 | 195 | ||
194 | /** | 196 | /** |
195 | * Helpers for setting the kset of registered objects. | 197 | * Helpers for setting the kset of registered objects. |