diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index f0eff3dac58d4db1b7d3d1da6e927cb2135ba795..80502dc6ed668dbee5bc388520e1a819d8449959 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -38,3 +38,7 @@ config DEBUG_DRIVER If you are unsure about this, say N here. endmenu + +config SYS_HYPERVISOR + bool + default n diff --git a/drivers/base/Makefile b/drivers/base/Makefile index e99471d3232bb6d3fc70a33263986e2908d8751d..659cde6c2fb9ec9592df7a3a311698d5f7496011 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_FW_LOADER) += firmware_class.o obj-$(CONFIG_NUMA) += node.o obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o obj-$(CONFIG_SMP) += topology.o +obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o ifeq ($(CONFIG_DEBUG_DRIVER),y) EXTRA_CFLAGS += -DDEBUG diff --git a/drivers/base/base.h b/drivers/base/base.h index 122498aef50ba6743c4c6da825ec500d0a0fa0f4..79115eff6e9485892182c2380159f82e41dd13e9 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -5,6 +5,11 @@ extern int devices_init(void); extern int buses_init(void); extern int classes_init(void); extern int firmware_init(void); +#ifdef CONFIG_SYS_HYPERVISOR +extern int hypervisor_init(void); +#else +static inline int hypervisor_init(void) { return 0; } +#endif extern int platform_bus_init(void); extern int system_bus_init(void); extern int cpu_dev_init(void); diff --git a/drivers/base/hypervisor.c b/drivers/base/hypervisor.c new file mode 100644 index 0000000000000000000000000000000000000000..0c85e9d6a4485834e7110c9a54dbb47444ac110e --- /dev/null +++ b/drivers/base/hypervisor.c @@ -0,0 +1,19 @@ +/* + * hypervisor.c - /sys/hypervisor subsystem. + * + * This file is released under the GPLv2 + * + */ + +#include +#include + +#include "base.h" + +decl_subsys(hypervisor, NULL, NULL); +EXPORT_SYMBOL_GPL(hypervisor_subsys); + +int __init hypervisor_init(void) +{ + return subsystem_register(&hypervisor_subsys); +} diff --git a/drivers/base/init.c b/drivers/base/init.c index c648914b9cde8b37be242c46f3c85429941fdc8f..37138154f9e824b353f322022ba8c41017ae3c3e 100644 --- a/drivers/base/init.c +++ b/drivers/base/init.c @@ -27,6 +27,7 @@ void __init driver_init(void) buses_init(); classes_init(); firmware_init(); + hypervisor_init(); /* These are also core pieces, but must come after the * core core pieces. diff --git a/include/linux/kobject.h b/include/linux/kobject.h index c187c53cecd0f94dd15bf3340b87c9a3652ea6d3..2d229327959ed9809042af03c8fdb917913e000e 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -190,6 +190,8 @@ struct subsystem _varname##_subsys = { \ /* The global /sys/kernel/ subsystem for people to chain off of */ extern struct subsystem kernel_subsys; +/* The global /sys/hypervisor/ subsystem */ +extern struct subsystem hypervisor_subsys; /** * Helpers for setting the kset of registered objects.