Skip to contentSkip to conversation

Enable Front-end drivers for 2.4 kernels

PATCH In review Ben Guthro 1 participant 1 message Dec 19, 2007 Xen hypervisor interface

lore
Share & tools
lore

Ben Guthro

author
#0 lore raw

PATCH 2/2 Enable Front-end drivers for 2.4 kernels

[PATCH 2/2][PV-on-HVM][linux-2.6.18-xen.hg] Enable Front-end drivers for 2.4 kernels

This patch enables front end drivers to build under Linux 2.4 (RHEL3-U8)

diffstat linux-RHEL3U8-port.patch

b/include/xen/kerncompat.h                   |  216 +++++++++++++++++++++++++++
drivers/xen/balloon/balloon.c                |    4
drivers/xen/balloon/sysfs.c                  |    4
drivers/xen/blkfront/blkfront.c              |  124 +++++++++++++--
drivers/xen/blkfront/block.h                 |    8 +
drivers/xen/blkfront/vbd.c                   |  207 +++++++++++++++++++++++++
drivers/xen/core/features.c                  |    4
drivers/xen/core/gnttab.c                    |    6
drivers/xen/core/reboot.c                    |   16 +-
drivers/xen/netfront/accel.c                 |    4
drivers/xen/netfront/netfront.c              |    2
drivers/xen/xenbus/Makefile                  |   21 ++
drivers/xen/xenbus/xenbus_client.c           |    4
drivers/xen/xenbus/xenbus_comms.c            |    4
drivers/xen/xenbus/xenbus_dev.c              |    6
drivers/xen/xenbus/xenbus_probe.c            |    4
drivers/xen/xenbus/xenbus_probe_backend.c    |    4
drivers/xen/xenbus/xenbus_xs.c               |    4
include/asm-i386/mach-xen/asm/synch_bitops.h |    4
19 files changed, 577 insertions(+), 69 deletions(-)

[PATCH 2/2][PV-on-HVM][linux-2.6.18-xen.hg] Enable Front-end drivers for 2.4 kernels

This patch enables front end drivers to build under Linux 2.4 (RHEL3-U8)

drivers/xen/balloon/balloon.c +1 -3
diff -r fc406f9e9a0a drivers/xen/balloon/balloon.c
@@ -59,9 +59,7 @@
 #include <xen/xenbus.h>
 #include "common.h"
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 #ifdef CONFIG_PROC_FS
 static struct proc_dir_entry *balloon_pde;
drivers/xen/balloon/sysfs.c +1 -3
diff -r fc406f9e9a0a drivers/xen/balloon/sysfs.c
@@ -35,9 +35,7 @@
 #include <linux/sysdev.h>
 #include "common.h"
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 #define BALLOON_CLASS_NAME "memory"
 
drivers/xen/blkfront/blkfront.c +105 -19

227 lines not on this page · raw message

drivers/xen/blkfront/block.h +8 -0
diff -r fc406f9e9a0a drivers/xen/blkfront/block.h
@@ -118,6 +118,11 @@ struct blkfront_info
 	 * hot-unplug unless this is 0.
 	 */
 	int users;
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+	request_queue_t req_queue;
+	int req_queue_busy;
+#endif
 };
 
 extern spinlock_t blkif_io_lock;
@@ -139,5 +144,8 @@ int xlvbd_add(blkif_sector_t capacity, i
 	      u16 vdisk_info, u16 sector_size, struct blkfront_info *info);
 void xlvbd_del(struct blkfront_info *info);
 int xlvbd_barrier(struct blkfront_info *info);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+void xlvbd_register_disk(struct gendisk *gd, dev_t dev);
+#endif
 
 #endif /* __XEN_DRIVERS_BLOCK_H__ */
drivers/xen/blkfront/vbd.c +201 -6

264 lines not on this page · raw message

drivers/xen/core/features.c +1 -3
diff -r fc406f9e9a0a drivers/xen/core/features.c
@@ -11,9 +11,7 @@
 #include <asm/hypervisor.h>
 #include <xen/features.h>
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
 /* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
drivers/xen/core/gnttab.c +2 -4
diff -r fc406f9e9a0a drivers/xen/core/gnttab.c
@@ -45,9 +45,7 @@
 #include <xen/driver_util.h>
 #include <asm/gnttab_dma.h>
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 /* External tools reserve first few grant table entries. */
 #define NR_RESERVED_ENTRIES 8
@@ -120,7 +118,7 @@ static void do_free_callbacks(void)
 
 static inline void check_free_callbacks(void)
 {
-	if (unlikely(gnttab_free_callback_list))
+	if (unlikely(gnttab_free_callback_list != NULL))
 		do_free_callbacks();
 }
 
drivers/xen/core/reboot.c +8 -8
diff -r fc406f9e9a0a drivers/xen/core/reboot.c
@@ -9,11 +9,11 @@
 #include <xen/xenbus.h>
 #include <linux/kmod.h>
 #include <linux/slab.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #include <linux/workqueue.h>
-
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
 #endif
+
+#include <xen/kerncompat.h>
 
 MODULE_LICENSE("Dual BSD/GPL");
 
@@ -49,8 +49,8 @@ static int shutdown_process(void *__unus
 
 	if ((shutting_down == SHUTDOWN_POWEROFF) ||
 	    (shutting_down == SHUTDOWN_HALT)) {
-		if (call_usermodehelper("/sbin/poweroff", poweroff_argv,
-					envp, 0) < 0) {
+		if (compat_call_usermodehelper("/sbin/poweroff", poweroff_argv,
+						envp, 0) < 0) {
 #ifdef CONFIG_XEN
 			sys_reboot(LINUX_REBOOT_MAGIC1,
 				   LINUX_REBOOT_MAGIC2,
@@ -69,8 +69,8 @@ static int xen_suspend(void *__unused)
 {
 	int err;
 
-	daemonize("suspend");
-	err = set_cpus_allowed(current, cpumask_of_cpu(0));
+	compat_daemonize("suspend");
+	err = compat_set_cpus_allowed(current, cpumask_of_cpu(0));
 	if (err) {
 		printk(KERN_ERR "Xen suspend can't run on CPU0 (%d)\n", err);
 		goto out;
@@ -177,7 +177,7 @@ static void sysrq_handler(struct xenbus_
 
 #ifdef CONFIG_MAGIC_SYSRQ
 	if (sysrq_key != '\0')
-		handle_sysrq(sysrq_key, NULL, NULL);
+		compat_handle_sysrq(sysrq_key, NULL, NULL);
 #endif
 }
 
drivers/xen/netfront/accel.c +3 -1
diff -r fc406f9e9a0a drivers/xen/netfront/accel.c
@@ -37,6 +37,8 @@
 
 #include "netfront.h"
 
+#include <xen/kerncompat.h>
+
 #define DPRINTK(fmt, args...)				\
 	pr_debug("netfront/accel (%s:%d) " fmt,		\
 	       __FUNCTION__, __LINE__, ##args)
@@ -272,7 +274,7 @@ int netfront_load_accelerator(struct net
 	DPRINTK("requesting module %s\n", frontend);
 
 	/* load module */
-	request_module("%s", frontend);
+	compat_request_module("%s", frontend);
 
 	/*
 	 * Module should now call netfront_accelerator_loaded() once
drivers/xen/netfront/netfront.c +2 -0
diff -r fc406f9e9a0a drivers/xen/netfront/netfront.c
@@ -1862,6 +1862,7 @@ static struct ethtool_ops network_ethtoo
 {
 	.get_tx_csum = ethtool_op_get_tx_csum,
 	.set_tx_csum = ethtool_op_set_tx_csum,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	.get_sg = ethtool_op_get_sg,
 	.set_sg = xennet_set_sg,
 #if HAVE_TSO
@@ -1869,6 +1870,7 @@ static struct ethtool_ops network_ethtoo
 	.set_tso = xennet_set_tso,
 #endif
 	.get_link = ethtool_op_get_link,
+#endif
 };
 
 #ifdef CONFIG_SYSFS
drivers/xen/xenbus/Makefile +21 -0
diff -r fc406f9e9a0a drivers/xen/xenbus/Makefile
@@ -1,3 +1,4 @@ obj-y += xenbus_client.o xenbus_comms.o 
+ifeq ($(VERSION).$(PATCHLEVEL),2.6)
 obj-y += xenbus_client.o xenbus_comms.o xenbus_xs.o xenbus_probe.o
 obj-$(CONFIG_XEN_BACKEND) += xenbus_be.o
 
@@ -7,3 +8,23 @@ xenbus-$(CONFIG_XEN_BACKEND) += xenbus_p
 xenbus-$(CONFIG_XEN_BACKEND) += xenbus_probe_backend.o
 obj-y += $(xenbus-y) $(xenbus-m)
 obj-$(CONFIG_XEN_XENBUS_DEV) += xenbus_dev.o
+endif
+
+ifeq ($(VERSION).$(PATCHLEVEL),2.4)
+O_TARGET := xenbus_be.o
+
+export-objs := xenbus_client.o xenbus_probe.o xenbus_xs.o xenbus_backend_client.o
+
+obj-y := xenbus_client.o xenbus_comms.o xenbus_xs.o xenbus_probe.o xenbus_backend_client.o
+obj-$(CONFIG_XEN_BACKEND) += $(O_TARGET)
+
+
+O_TARGET := xenbus_dev.o
+
+export-objs := xenbus_probe_backend.o
+
+obj-y := xenbus_probe_backend.o
+obj-$(CONFIG_XEN_XENBUS_DEV) += $(O_TARGET)
+
+include $(TOPDIR)/Rules.make
+endif
drivers/xen/xenbus/xenbus_client.c +1 -3
diff -r fc406f9e9a0a drivers/xen/xenbus/xenbus_client.c
@@ -36,9 +36,7 @@
 #include <xen/xenbus.h>
 #include <xen/driver_util.h>
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 #define DPRINTK(fmt, args...) \
     pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
drivers/xen/xenbus/xenbus_comms.c +1 -3
diff -r fc406f9e9a0a drivers/xen/xenbus/xenbus_comms.c
@@ -43,9 +43,7 @@
 
 #include "xenbus_comms.h"
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 static int xenbus_irq;
 
drivers/xen/xenbus/xenbus_dev.c +2 -4
diff -r fc406f9e9a0a drivers/xen/xenbus/xenbus_dev.c
@@ -49,9 +49,7 @@
 #include <xen/xen_proc.h>
 #include <asm/hypervisor.h>
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 struct xenbus_dev_transaction {
 	struct list_head list;
@@ -398,7 +396,7 @@ int xenbus_dev_init(void)
 {
 	xenbus_dev_intf = create_xen_proc_entry("xenbus", 0400);
 	if (xenbus_dev_intf)
-		xenbus_dev_intf->proc_fops = &xenbus_dev_file_ops;
+		xenbus_dev_intf->proc_fops = (struct file_operations *) &xenbus_dev_file_ops;
 
 	return 0;
 }
drivers/xen/xenbus/xenbus_probe.c +1 -3
diff -r fc406f9e9a0a drivers/xen/xenbus/xenbus_probe.c
@@ -59,9 +59,7 @@
 #include "xenbus_comms.h"
 #include "xenbus_probe.h"
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 int xen_store_evtchn;
 struct xenstore_domain_interface *xen_store_interface;
drivers/xen/xenbus/xenbus_probe_backend.c +1 -3
diff -r fc406f9e9a0a drivers/xen/xenbus/xenbus_probe_backend.c
@@ -57,9 +57,7 @@
 #include "xenbus_comms.h"
 #include "xenbus_probe.h"
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 static int xenbus_uevent_backend(struct device *dev, char **envp,
 				 int num_envp, char *buffer, int buffer_size);
drivers/xen/xenbus/xenbus_xs.c +1 -3
diff -r fc406f9e9a0a drivers/xen/xenbus/xenbus_xs.c
@@ -47,9 +47,7 @@
 #include <xen/xenbus.h>
 #include "xenbus_comms.h"
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 #ifndef PF_NOFREEZE /* Old kernel (pre-2.6.6). */
 #define PF_NOFREEZE	0
include/asm-i386/mach-xen/asm/synch_bitops.h +1 -3
diff -r fc406f9e9a0a include/asm-i386/mach-xen/asm/synch_bitops.h
@@ -7,9 +7,7 @@
  * when communicating with Xen or other guest OSes running on other CPUs.
  */
 
-#ifdef HAVE_XEN_PLATFORM_COMPAT_H
-#include <xen/platform-compat.h>
-#endif
+#include <xen/kerncompat.h>
 
 #define ADDR (*(volatile long *) addr)
 
include/xen/kerncompat.h new file +216 -0

216 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel