Skip to contentSkip to conversation

s390: Hypervisor File System

PATCH Michael Holzheu 2 participants 2 messages May 8, 2006 – May 9, 2006 Driver core

lore
Share & tools
lore
#0 lore raw

Hi Greg,

Greg KH <[email protected]> wrote on 05/05/2006 11:14:47 PM:

Quoted 5 lines
Quoted 5 lines

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?

Ok, I modified the patch according to your input. So hopefully that's the final one... ok?

---

drivers/base/Kconfig +4 -0
diff -urpN linux-2.6.16/drivers/base/Kconfig linux-2.6.16-hypervisor/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
drivers/base/Makefile +1 -0
diff -urpN linux-2.6.16/drivers/base/Makefile linux-2.6.16-hypervisor/drivers/base/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_FW_LOADER)	+= firmware_clas
 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
drivers/base/base.h +5 -0
diff -urpN linux-2.6.16/drivers/base/base.h linux-2.6.16-hypervisor/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
+#define hypervisor_init() do { } while(0)
+#endif
 extern int platform_bus_init(void);
 extern int system_bus_init(void);
 extern int cpu_dev_init(void);
drivers/base/hypervisor.c +19 -0
diff -urpN linux-2.6.16/drivers/base/hypervisor.c linux-2.6.16-hypervisor/drivers/base/hypervisor.c
@@ -0,0 +1,19 @@
+/*
+ * 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);
+}
drivers/base/init.c +1 -0
diff -urpN linux-2.6.16/drivers/base/init.c linux-2.6.16-hypervisor/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.
include/linux/kobject.h +2 -0
diff -urpN linux-2.6.16/include/linux/kobject.h linux-2.6.16-hypervisor/include/linux/kobject.h
@@ -186,6 +186,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.
#1 lore raw
Quoted 11 lines · Michael Holzheu

Hi Greg,

Greg KH <[email protected]> wrote on 05/05/2006 11:14:47 PM:

Quoted 5 lines
Quoted 5 lines

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?

Ok, I modified the patch according to your input. So hopefully that's the final one... ok?

It is so close...

drivers/base/base.h extern int devices_init(void); · line 12

Quoted 12 lines

diff -urpN linux-2.6.16/drivers/base/base.h linux-2.6.16-hypervisor/drivers/base/base.h

drivers/base/base.h +5 -0
@@ -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
+#define hypervisor_init() do { } while(0)
+#endif

Hm, that second case there doesn't return anything incase we actually try to check the return value of hypervisor_init()...

Other than that, looks good. Care to fix this and send it again with a real changelog and Signed-off-by: line, and I'll be glad to add it to my tree.

thanks,

greg k-h