s390: Hypervisor File System
Greg KH <[email protected]> wrote on 05/04/2006 05:34:11 PM:
Quoted 7 lines
Quoted 1 line
So you want a new config option
CONFIG_HYPERVISOR?Sure. But don't make it a user selectable config option, but rather, one your S390 option sets.
That way the Xen and other groups can also set it when they need it.
[snip]
Quoted 3 lines
The Xen people need it too. Now who knows when their code will ever hit mainline...
I added a invisible config option CONFIG_SYS_HYPERVISOR. If this option is enabled, /sys/hypervisor is created. CONFIG_S390_HYPFS enables this option automatically using "select".
This the following patch acceptable for you?
---
drivers/base/Kconfig | 4 ++++ drivers/base/Makefile | 2 +- drivers/base/hypervisor.c | 30 ++++++++++++++++++++++++++++++ drivers/base/init.c | 1 + include/linux/kobject.h | 4 ++++ 5 files changed, 40 insertions(+), 1 deletion(-)
drivers/base/Kconfig +4 -0
@@ -38,3 +38,7 @@ config DEBUG_DRIVER If you are unsure about this, say N here. endmenu + +config SYS_HYPERVISOR + bool + default n
drivers/base/Makefile +1 -1
@@ -3,7 +3,7 @@ obj-y := core.o sys.o bus.o dd.o \ driver.o class.o platform.o \ cpu.o firmware.o init.o map.o dmapool.o \ - attribute_container.o transport_class.o + attribute_container.o transport_class.o hypervisor.o obj-y += power/ obj-$(CONFIG_FW_LOADER) += firmware_class.o obj-$(CONFIG_NUMA) += node.o
drivers/base/hypervisor.c +30 -0
@@ -0,0 +1,30 @@ +/* +* hypervisor.c - /sys/hypervisor subsystem. +* +* This file is released under the GPLv2 +* +*/ + +#include <linux/kobject.h> +#include <linux/device.h> + +#include "base.h" + +#ifdef CONFIG_SYS_HYPERVISOR + +decl_subsys (hypervisor,NULL ,NULL ); +EXPORT_SYMBOL_GPL (hypervisor_subsys); + +int __init hypervisor_init (void ) +{ +return subsystem_register (&hypervisor_subsys); +} + +#else + +int __init hypervisor_init (void ) +{ +return -1 ; +} + +#endif /* CONFIG_SYS_HYPERVISOR */
drivers/base/init.c +1 -0
@@ -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.
include/linux/kobject.h +4 -0
@@ -186,6 +186,10 @@ struct subsystem _varname##_subsys = { \/* The global /sys/kernel/ subsystem for people to chain off of */ extern struct subsystem kernel_subsys; +#ifdef CONFIG_SYS_HYPERVISOR +/* The global /sys/hypervisor/ subsystem */ +extern struct subsystem hypervisor_subsys; +#endif /* CONFIG_SYS_HYPERVISOR */ /** * Helpers for setting the kset of registered objects.
Quoted 44 lines · Michael Holzheu
Greg KH <[email protected]> wrote on 05/04/2006 05:34:11 PM:
Quoted 7 lines
Quoted 1 line
So you want a new config option
CONFIG_HYPERVISOR?Sure. But don't make it a user selectable config option, but rather, one your S390 option sets.
That way the Xen and other groups can also set it when they need it.
[snip]
Quoted 3 lines
The Xen people need it too. Now who knows when their code will ever hit mainline...
I added a invisible config option
CONFIG_SYS_HYPERVISOR. If this option is enabled,/sys/hypervisoris created.CONFIG_S390_HYPFSenables this option automatically using "select".This the following patch acceptable for you?
---
drivers/base/Kconfig | 4 ++++ drivers/base/Makefile | 2 +- drivers/base/hypervisor.c | 30 ++++++++++++++++++++++++++++++ drivers/base/init.c | 1 + include/linux/kobject.h | 4 ++++ 5 files changed, 40 insertions(+), 1 deletion(-)diff -urpN linux-2.6.16/drivers/base/Kconfig linux-2.6.16-hypervisor/drivers/base/Kconfig
drivers/base/Kconfig +4
-0@@ -38,3 +38,7 @@ config DEBUG_DRIVER If you are unsure about this, say N here. endmenu + +config SYS_HYPERVISOR + bool + default ndiff -urpN linux-2.6.16/drivers/base/Makefile linux-2.6.16-hypervisor/drivers/base/Makefile
drivers/base/Makefile line 9
Quoted 8 lines
drivers/base/Makefile +1
-1@@ -3,7 +3,7 @@ obj-y := core.o sys.o bus.o dd.o \ driver.o class.o platform.o \ cpu.o firmware.o init.o map.o dmapool.o \ - attribute_container.o transport_class.o + attribute_container.o transport_class.o hypervisor.o obj-y += power/ obj-$(CONFIG_FW_LOADER) += firmware_class.o obj-$(CONFIG_NUMA) += node.o
This should be:
obj-$(CONFIG_HYPERVISOR) += hypervisor.o
don't always load it in.
Quoted 24 lines
diff -urpN
linux-2.6.16/drivers/base/hypervisor.clinux-2.6.16-hypervisor/drivers/base/hypervisor.cdrivers/base/hypervisor.c +20
-0@@ -0,0 +1,30 @@ +/* +* hypervisor.c - /sys/hypervisor subsystem. +* +* This file is released under the GPLv2 +* +*/ + +#include <linux/kobject.h> +#include <linux/device.h> + +#include "base.h" + +#ifdef CONFIG_SYS_HYPERVISOR + +decl_subsys (hypervisor,NULL ,NULL ); +EXPORT_SYMBOL_GPL (hypervisor_subsys); + +int __init hypervisor_init (void ) +{ +return subsystem_register (&hypervisor_subsys);
drivers/base/hypervisor.c line 30
Quoted 10 lines
drivers/base/hypervisor.c +10
-0+} + +#else + +int __init hypervisor_init (void ) +{ +return -1 ; +} + +#endif /* CONFIG_SYS_HYPERVISOR */
No ifdef needed here then.
drivers/base/init.c void __init driver_init(void) · line 30
Quoted 8 lines
diff -urpN
linux-2.6.16/drivers/base/init.clinux-2.6.16-hypervisor/drivers/base/init.cdrivers/base/init.c +1
-0@@ -27,6 +27,7 @@ void __init driver_init(void)buses_init ();classes_init ();firmware_init (); +hypervisor_init ();
But we need the ifdef in a header file to make this compile properly.
Quoted 7 lines
drivers/base/init.c +0
-0/* These are also core pieces, but must come after the * core core pieces. diff -urpN
linux-2.6.16/include/linux/kobject.hlinux-2.6.16-hypervisor/include/linux/kobject.h
include/linux/kobject.h struct subsystem _varname##_subsys = { \ · line 192
Quoted 7 lines
include/linux/kobject.h +4
-0@@ -186,6 +186,10 @@ struct subsystem _varname##_subsys = { \/* The global /sys/kernel/ subsystem for people to chain off of */ extern struct subsystem kernel_subsys; +#ifdef CONFIG_SYS_HYPERVISOR +/* The global /sys/hypervisor/ subsystem */ +extern struct subsystem hypervisor_subsys; +#endif /* CONFIG_SYS_HYPERVISOR */
No ifdef here should be needed, a link error will happen if you try to access it and it's not linked in properly.
So, it's almost there :)
thanks,
greg k-h