Commit 4039483f authored by Michael Holzheu's avatar Michael Holzheu Committed by Greg Kroah-Hartman

[PATCH] Driver Core: Add /sys/hypervisor when needed

To have a home for all hypervisors, this patch creates /sys/hypervisor.
A new config option SYS_HYPERVISOR is introduced, which should to be set
by architecture dependent hypervisors (e.g. s390 or Xen).
Acked-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarMichael Holzheu <holzheu@de.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e3915532
...@@ -38,3 +38,7 @@ config DEBUG_DRIVER ...@@ -38,3 +38,7 @@ config DEBUG_DRIVER
If you are unsure about this, say N here. If you are unsure about this, say N here.
endmenu endmenu
config SYS_HYPERVISOR
bool
default n
...@@ -9,6 +9,7 @@ obj-$(CONFIG_FW_LOADER) += firmware_class.o ...@@ -9,6 +9,7 @@ obj-$(CONFIG_FW_LOADER) += firmware_class.o
obj-$(CONFIG_NUMA) += node.o obj-$(CONFIG_NUMA) += node.o
obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o
obj-$(CONFIG_SMP) += topology.o obj-$(CONFIG_SMP) += topology.o
obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o
ifeq ($(CONFIG_DEBUG_DRIVER),y) ifeq ($(CONFIG_DEBUG_DRIVER),y)
EXTRA_CFLAGS += -DDEBUG EXTRA_CFLAGS += -DDEBUG
......
...@@ -5,6 +5,11 @@ extern int devices_init(void); ...@@ -5,6 +5,11 @@ extern int devices_init(void);
extern int buses_init(void); extern int buses_init(void);
extern int classes_init(void); extern int classes_init(void);
extern int firmware_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 platform_bus_init(void);
extern int system_bus_init(void); extern int system_bus_init(void);
extern int cpu_dev_init(void); extern int cpu_dev_init(void);
......
/*
* hypervisor.c - /sys/hypervisor subsystem.
*
* This file is released under the GPLv2
*
*/
#include <linux/kobject.h>
#include <linux/device.h>
#include "base.h"
decl_subsys(hypervisor, NULL, NULL);
EXPORT_SYMBOL_GPL(hypervisor_subsys);
int __init hypervisor_init(void)
{
return subsystem_register(&hypervisor_subsys);
}
...@@ -27,6 +27,7 @@ void __init driver_init(void) ...@@ -27,6 +27,7 @@ void __init driver_init(void)
buses_init(); buses_init();
classes_init(); classes_init();
firmware_init(); firmware_init();
hypervisor_init();
/* These are also core pieces, but must come after the /* These are also core pieces, but must come after the
* core core pieces. * core core pieces.
......
...@@ -190,6 +190,8 @@ struct subsystem _varname##_subsys = { \ ...@@ -190,6 +190,8 @@ struct subsystem _varname##_subsys = { \
/* The global /sys/kernel/ subsystem for people to chain off of */ /* The global /sys/kernel/ subsystem for people to chain off of */
extern struct subsystem kernel_subsys; extern struct subsystem kernel_subsys;
/* The global /sys/hypervisor/ subsystem */
extern struct subsystem hypervisor_subsys;
/** /**
* Helpers for setting the kset of registered objects. * Helpers for setting the kset of registered objects.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment