All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RESEND] PV drivers for HVM guests
@ 2006-10-18 13:51 Ky Srinivasan
  2006-10-18 23:56 ` Doi.Tsunehisa
  0 siblings, 1 reply; 22+ messages in thread
From: Ky Srinivasan @ 2006-10-18 13:51 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

I am enclosing the patch I have been working on. I have tested this on sles9 (2.6.5) and RHEL 4 (2.6.9). The patch applies cleanly on ChangeSet 11635. This patch was cleaned up based on Ian's and DOI's work.

Signed-off-by: K. Y. Srinivasan (ksrinivasan@novell.com)



[-- Attachment #2: pv_compat.patch --]
[-- Type: text/plain, Size: 19998 bytes --]

diff -Nur unmodified_drivers/linux-2.6/blkfront/blkfront.c unmodified_drivers_new/linux-2.6/blkfront/blkfront.c
--- unmodified_drivers/linux-2.6/blkfront/blkfront.c	2006-10-04 00:38:41.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/blkfront/blkfront.c	2006-10-13 11:11:43.000000000 -0400
@@ -47,6 +47,7 @@
 #include <xen/gnttab.h>
 #include <asm/hypervisor.h>
 #include <asm/maddr.h>
+#include <xen/platform_compat.h>
 
 #define BLKIF_STATE_DISCONNECTED 0
 #define BLKIF_STATE_CONNECTED    1
@@ -466,6 +467,27 @@
 		      command, (long)argument, inode->i_rdev);
 
 	switch (command) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+	case HDIO_GETGEO: {
+		struct block_device *bd = inode->i_bdev;
+		struct hd_geometry geo;
+		int ret;
+
+                if (!argument)
+                        return -EINVAL;
+
+		geo.start = get_start_sect(bd);
+		ret = blkif_getgeo(bd, &geo);
+		if (ret)
+			return ret;
+
+		if (copy_to_user((struct hd_geometry __user *)argument, &geo,
+				 sizeof(geo)))
+                        return -EFAULT;
+
+                return 0;
+	}
+#endif
 	case CDROMMULTISESSION:
 		DPRINTK("FIXME: support multisession CDs later\n");
 		for (i = 0; i < sizeof(struct cdrom_multisession); i++)
@@ -678,8 +700,12 @@
 				req, (bret->status == BLKIF_RSP_OKAY),
 				req->hard_nr_sectors);
 			BUG_ON(ret);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+			end_that_request_last(req);
+#else
 			end_that_request_last(
 				req, (bret->status == BLKIF_RSP_OKAY));
+#endif
 			break;
 		default:
 			BUG();
diff -Nur unmodified_drivers/linux-2.6/blkfront/Makefile unmodified_drivers_new/linux-2.6/blkfront/Makefile
--- unmodified_drivers/linux-2.6/blkfront/Makefile	2006-10-04 00:38:41.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/blkfront/Makefile	2006-10-13 11:11:43.000000000 -0400
@@ -1,5 +1,5 @@
+include $(M)/overrides.mk
 
-obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	:= xenblk.o
-
-xenblk-objs := blkfront.o vbd.o
+obj-m += xen-vbd.o
 
+xen-vbd-objs := blkfront.o vbd.o
diff -Nur unmodified_drivers/linux-2.6/blkfront/vbd.c unmodified_drivers_new/linux-2.6/blkfront/vbd.c
--- unmodified_drivers/linux-2.6/blkfront/vbd.c	2006-10-04 00:38:41.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/blkfront/vbd.c	2006-10-13 11:11:43.000000000 -0400
@@ -35,6 +35,7 @@
 #include "block.h"
 #include <linux/blkdev.h>
 #include <linux/list.h>
+#include <xen/platform_compat.h>
 
 #define BLKIF_MAJOR(dev) ((dev)>>8)
 #define BLKIF_MINOR(dev) ((dev) & 0xff)
@@ -91,7 +92,9 @@
 	.open = blkif_open,
 	.release = blkif_release,
 	.ioctl  = blkif_ioctl,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 	.getgeo = blkif_getgeo
+#endif
 };
 
 DEFINE_SPINLOCK(blkif_io_lock);
@@ -186,7 +189,11 @@
 	if (rq == NULL)
 		return -1;
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
 	elevator_init(rq, "noop");
+#else
+	elevator_init(rq, &elevator_noop);
+#endif
 
 	/* Hard sector size and max sectors impersonate the equiv. hardware. */
 	blk_queue_hardsect_size(rq, sector_size);
diff -Nur unmodified_drivers/linux-2.6/include/asm/hypervisor.h unmodified_drivers_new/linux-2.6/include/asm/hypervisor.h
--- unmodified_drivers/linux-2.6/include/asm/hypervisor.h	2006-10-04 00:38:45.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/include/asm/hypervisor.h	2006-10-13 11:11:43.000000000 -0400
@@ -47,10 +47,14 @@
 #include <asm/ptrace.h>
 #include <asm/page.h>
 #if defined(__i386__)
-#  ifdef CONFIG_X86_PAE
-#   include <asm-generic/pgtable-nopud.h>
+#  if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
+#  	ifdef CONFIG_X86_PAE
+#   		include <asm-generic/pgtable-nopud.h>
+#	else
+#   		include <asm-generic/pgtable-nopmd.h>
+#	endif
 #  else
-#   include <asm-generic/pgtable-nopmd.h>
+typedef struct { pgd_t pgd; } pud_t;
 #  endif
 #endif
 
diff -Nur unmodified_drivers/linux-2.6/include/asm/synch_bitops.h unmodified_drivers_new/linux-2.6/include/asm/synch_bitops.h
--- unmodified_drivers/linux-2.6/include/asm/synch_bitops.h	2006-10-04 00:38:45.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/include/asm/synch_bitops.h	2006-10-13 11:11:43.000000000 -0400
@@ -8,6 +8,7 @@
  */
 
 #include <linux/config.h>
+#include <xen/platform_compat.h>
 
 #define ADDR (*(volatile long *) addr)
 
diff -Nur unmodified_drivers/linux-2.6/include/xen/platform_compat.h unmodified_drivers_new/linux-2.6/include/xen/platform_compat.h
--- unmodified_drivers/linux-2.6/include/xen/platform_compat.h	1969-12-31 19:00:00.000000000 -0500
+++ unmodified_drivers_new/linux-2.6/include/xen/platform_compat.h	2006-10-13 11:11:43.000000000 -0400
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * platform_compat.h
+ * Bridge the gap between legacy linux versions of interest and the current 
+ * Linux kernel to support PV front-end drivers in the unmodified legacy
+ * kernels.
+ */
+
+#ifndef __PLATFORM_COMPAT_H
+#define __PLATFORM_COMPAT_H
+#include <linux/types.h>
+#include <linux/version.h>
+#include <asm/semaphore.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+
+
+#if defined(__LINUX_COMPILER_H) && !defined(__always_inline)
+#define __always_inline inline
+#endif
+
+#if defined(__LINUX_CACHE_H) && !defined(__read_mostly)
+#define __read_mostly
+#endif
+
+
+#if defined(__LINUX_SPINLOCK_H) && !defined(DEFINE_SPINLOCK)
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
+#endif
+
+
+/*
+ * Mutex support
+ */
+#define mutex semaphore
+#define DEFINE_MUTEX(foo) DECLARE_MUTEX(foo)
+#define mutex_init(foo) init_MUTEX(foo)
+#define mutex_lock(foo) down(foo)
+#define mutex_unlock(foo) up(foo)
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
+#define nonseekable_open(a,b)
+extern int system_state;
+size_t strcspn(const char *s, const char *reject);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+unsigned long vmalloc_to_pfn(void *addr);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+signed long schedule_timeout_interruptible(signed long timeout);
+void *kzalloc(size_t size, int flags);
+#endif
+
+#endif
+#endif
diff -Nur unmodified_drivers/linux-2.6/include/xen/xenbus.h unmodified_drivers_new/linux-2.6/include/xen/xenbus.h
--- unmodified_drivers/linux-2.6/include/xen/xenbus.h	2006-10-04 00:38:49.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/include/xen/xenbus.h	2006-10-13 11:11:43.000000000 -0400
@@ -35,13 +35,18 @@
 #define _XEN_XENBUS_H
 
 #include <linux/device.h>
+#include <linux/init.h>
 #include <linux/notifier.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 #include <linux/mutex.h>
+#endif
 #include <linux/completion.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/grant_table.h>
 #include <xen/interface/io/xenbus.h>
 #include <xen/interface/io/xs_wire.h>
+#include <xen/platform_compat.h>
 
 /* Register callback to watch this node. */
 struct xenbus_watch
diff -Nur unmodified_drivers/linux-2.6/netfront/Makefile unmodified_drivers_new/linux-2.6/netfront/Makefile
--- unmodified_drivers/linux-2.6/netfront/Makefile	2006-10-04 00:38:42.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/netfront/Makefile	2006-10-13 11:11:43.000000000 -0400
@@ -1,4 +1,4 @@
+include $(M)/overrides.mk
 
-obj-$(CONFIG_XEN_NETDEV_FRONTEND)	:= xennet.o
-
-xennet-objs := netfront.o
+obj-m  = xen-vnif.o
+xen-vnif-objs	:= netfront.o
diff -Nur unmodified_drivers/linux-2.6/netfront/netfront.c unmodified_drivers_new/linux-2.6/netfront/netfront.c
--- unmodified_drivers/linux-2.6/netfront/netfront.c	2006-10-04 00:38:42.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/netfront/netfront.c	2006-10-13 11:11:43.000000000 -0400
@@ -46,7 +46,6 @@
 #include <linux/ethtool.h>
 #include <linux/in.h>
 #include <linux/if_ether.h>
-#include <linux/io.h>
 #include <net/sock.h>
 #include <net/pkt_sched.h>
 #include <net/arp.h>
diff -Nur unmodified_drivers/linux-2.6/platform-pci/features.c unmodified_drivers_new/linux-2.6/platform-pci/features.c
--- unmodified_drivers/linux-2.6/platform-pci/features.c	2006-10-04 00:38:41.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/platform-pci/features.c	2006-10-13 11:11:43.000000000 -0400
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <asm/hypervisor.h>
 #include <xen/features.h>
+#include <xen/platform_compat.h>
 
 u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
 /* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
diff -Nur unmodified_drivers/linux-2.6/platform-pci/Kbuild unmodified_drivers_new/linux-2.6/platform-pci/Kbuild
--- unmodified_drivers/linux-2.6/platform-pci/Kbuild	2006-10-04 00:39:42.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/platform-pci/Kbuild	2006-10-13 11:11:43.000000000 -0400
@@ -4,4 +4,4 @@
 
 EXTRA_CFLAGS += -I$(M)/platform-pci
 
-xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o
+xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o platform_compat.o
diff -Nur unmodified_drivers/linux-2.6/platform-pci/Makefile unmodified_drivers_new/linux-2.6/platform-pci/Makefile
--- unmodified_drivers/linux-2.6/platform-pci/Makefile	1969-12-31 19:00:00.000000000 -0500
+++ unmodified_drivers_new/linux-2.6/platform-pci/Makefile	2006-10-13 11:11:43.000000000 -0400
@@ -0,0 +1,7 @@
+include $(M)/overrides.mk
+
+obj-m := xen-platform-pci.o
+
+EXTRA_CFLAGS += -I$(M)/platform-pci
+
+xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o platform_compat.o
diff -Nur unmodified_drivers/linux-2.6/platform-pci/platform_compat.c unmodified_drivers_new/linux-2.6/platform-pci/platform_compat.c
--- unmodified_drivers/linux-2.6/platform-pci/platform_compat.c	1969-12-31 19:00:00.000000000 -0500
+++ unmodified_drivers_new/linux-2.6/platform-pci/platform_compat.c	2006-10-13 11:11:43.000000000 -0400
@@ -0,0 +1,93 @@
+/*
+ * Compatibility shim for hosting Xen PV drivers in unmodified 
+ * 2.6.5 and 2.6.9 based kernels.
+ */
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <xen/platform_compat.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
+int system_state=1;
+EXPORT_SYMBOL(system_state);
+
+/**
+ * strcspn - Calculate the length of the initial substring of @s which does
+ * 	not contain letters in @reject
+ * @s: The string to be searched
+ * @reject: The string to avoid
+ */
+size_t strcspn(const char *s, const char *reject)
+{
+	const char *p;
+	const char *r;
+	size_t count = 0;
+
+	for (p = s; *p != '\0'; ++p) {
+		for (r = reject; *r != '\0'; ++r) {
+			if (*p == *r)
+				return count;
+		}
+		++count;
+	}
+
+	return count;
+}	
+
+EXPORT_SYMBOL(strcspn);
+
+#endif
+
+#if  LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+/*
+ * Map a vmalloc()-space virtual address to the physical page frame number.
+ */
+unsigned long vmalloc_to_pfn(void * vmalloc_addr)
+{
+	return page_to_pfn(vmalloc_to_page(vmalloc_addr));
+}
+
+EXPORT_SYMBOL(vmalloc_to_pfn);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+/**
+ * kzalloc - allocate memory. The memory is set to zero.
+ * @size: how many bytes of memory are required.
+ * @flags: the type of memory to allocate.
+ */
+void *kzalloc(size_t size, int flags)
+{
+	void *ret = kmalloc(size, flags);
+	if (ret)
+		memset(ret, 0, size);
+	return ret;
+}
+EXPORT_SYMBOL(kzalloc);
+
+signed long schedule_timeout_interruptible(signed long timeout)
+{
+	__set_current_state(TASK_INTERRUPTIBLE);
+	return schedule_timeout(timeout);
+}
+EXPORT_SYMBOL(schedule_timeout_interruptible);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+asmlinkage NORET_TYPE void do_exit(long code)
+#else
+fastcall NORET_TYPE void do_exit(long code)
+#endif
+{
+	complete_and_exit(NULL, code);
+}
+EXPORT_SYMBOL(do_exit);
+#endif
+
+
+#endif
diff -Nur unmodified_drivers/linux-2.6/platform-pci/platform-pci.c unmodified_drivers_new/linux-2.6/platform-pci/platform-pci.c
--- unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	2006-10-04 00:39:42.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/platform-pci/platform-pci.c	2006-10-13 11:11:43.000000000 -0400
@@ -35,6 +35,7 @@
 #include <asm/hypervisor.h>
 #include <xen/interface/memory.h>
 #include <xen/features.h>
+#include <xen/platform_compat.h>
 
 #include "platform-pci.h"
 
diff -Nur unmodified_drivers/linux-2.6/xenbus/Makefile unmodified_drivers_new/linux-2.6/xenbus/Makefile
--- unmodified_drivers/linux-2.6/xenbus/Makefile	2006-10-04 00:38:44.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/xenbus/Makefile	2006-10-13 11:11:43.000000000 -0400
@@ -1,12 +1,10 @@
-obj-y	+= xenbus.o
-obj-$(CONFIG_XEN_BACKEND) += xenbus_be.o
-
-xenbus_be-objs =
-xenbus_be-objs += xenbus_backend_client.o
+include $(M)/overrides.mk
 
+obj-m	+= xenbus.o
 xenbus-objs =
-xenbus-objs += xenbus_client.o
 xenbus-objs += xenbus_comms.o
 xenbus-objs += xenbus_xs.o
-xenbus-objs += xenbus_probe.o
-obj-$(CONFIG_XEN_XENBUS_DEV) += xenbus_dev.o
+xenbus-objs += xenbus_probe.o 
+xenbus-objs += xenbus_dev.o 
+xenbus-objs += xenbus_client.o 
+xenbus-objs += xen_proc.o
diff -Nur unmodified_drivers/linux-2.6/xenbus/xenbus_probe.c unmodified_drivers_new/linux-2.6/xenbus/xenbus_probe.c
--- unmodified_drivers/linux-2.6/xenbus/xenbus_probe.c	2006-10-04 00:38:45.000000000 -0400
+++ unmodified_drivers_new/linux-2.6/xenbus/xenbus_probe.c	2006-10-13 19:00:04.000000000 -0400
@@ -67,13 +67,15 @@
 static void wait_for_devices(struct xenbus_driver *xendrv);
 
 static int xenbus_probe_frontend(const char *type, const char *name);
+#ifdef CONFIG_XEN_BACKEND
 static int xenbus_uevent_backend(struct device *dev, char **envp,
 				 int num_envp, char *buffer, int buffer_size);
 static int xenbus_probe_backend(const char *type, const char *domid);
+static void xenbus_dev_shutdown(struct device *_dev);
+#endif
 
 static int xenbus_dev_probe(struct device *_dev);
 static int xenbus_dev_remove(struct device *_dev);
-static void xenbus_dev_shutdown(struct device *_dev);
 
 /* If something in array of ids matches this device, return it. */
 static const struct xenbus_device_id *
@@ -176,11 +178,6 @@
 }
 
 
-static int read_frontend_details(struct xenbus_device *xendev)
-{
-	return read_otherend_details(xendev, "frontend-id", "frontend");
-}
-
 
 /* Bus type for frontend drivers. */
 static struct xen_bus_type xenbus_frontend = {
@@ -191,15 +188,24 @@
 	.bus = {
 		.name     = "xen",
 		.match    = xenbus_match,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 		.probe    = xenbus_dev_probe,
 		.remove   = xenbus_dev_remove,
+#ifdef CONFIG_XEN_BACKEND
 		.shutdown = xenbus_dev_shutdown,
+#endif
+#endif
 	},
 	.dev = {
 		.bus_id = "xen",
 	},
 };
 
+#ifdef CONFIG_XEN_BACKEND
+static int read_frontend_details(struct xenbus_device *xendev)
+{
+	return read_otherend_details(xendev, "frontend-id", "frontend");
+}
 /* backend/<type>/<fe-uuid>/<id> => <type>-<fe-domid>-<id> */
 static int backend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
 {
@@ -300,6 +306,8 @@
 	return 0;
 }
 
+#endif
+
 static void otherend_changed(struct xenbus_watch *watch,
 			     const char **vec, unsigned int len)
 {
@@ -409,6 +417,7 @@
 	return 0;
 }
 
+#ifdef CONFIG_XEN_BACKEND
 static void xenbus_dev_shutdown(struct device *_dev)
 {
 	struct xenbus_device *dev = to_xenbus_device(_dev);
@@ -429,6 +438,7 @@
  out:
 	put_device(&dev->dev);
 }
+#endif
 
 static int xenbus_register_driver_common(struct xenbus_driver *drv,
 					 struct xen_bus_type *bus)
@@ -437,7 +447,11 @@
 
 	drv->driver.name = drv->name;
 	drv->driver.bus = &bus->bus;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
 	drv->driver.owner = drv->owner;
+#endif
+	drv->driver.probe = xenbus_dev_probe;
+	drv->driver.remove = xenbus_dev_remove;
 
 	mutex_lock(&xenwatch_mutex);
 	ret = driver_register(&drv->driver);
@@ -462,6 +476,7 @@
 }
 EXPORT_SYMBOL_GPL(xenbus_register_frontend);
 
+#ifdef CONFIG_XEN_BACKEND
 int xenbus_register_backend(struct xenbus_driver *drv)
 {
 	drv->read_otherend_details = read_frontend_details;
@@ -469,6 +484,7 @@
 	return xenbus_register_driver_common(drv, &xenbus_backend);
 }
 EXPORT_SYMBOL_GPL(xenbus_register_backend);
+#endif
 
 void xenbus_unregister_driver(struct xenbus_driver *drv)
 {
@@ -566,15 +582,26 @@
 	return p;
 }
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
 static ssize_t xendev_show_nodename(struct device *dev,
 				    struct device_attribute *attr, char *buf)
+#else
+static ssize_t xendev_show_nodename(struct device *dev,
+				    char *buf)
+#endif
 {
 	return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
 }
 DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
 static ssize_t xendev_show_devtype(struct device *dev,
 				   struct device_attribute *attr, char *buf)
+#else
+static ssize_t xendev_show_devtype(struct device *dev,
+				   char *buf)
+#endif
+
 {
 	return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
 }
@@ -653,6 +680,7 @@
 	return err;
 }
 
+#ifdef CONFIG_XEN_BACKEND
 /* backend/<typename>/<frontend-uuid>/<name> */
 static int xenbus_probe_backend_unit(const char *dir,
 				     const char *type,
@@ -702,6 +730,7 @@
 	return err;
 }
 
+#endif
 static int xenbus_probe_device_type(struct xen_bus_type *bus, const char *type)
 {
 	int err = 0;
@@ -809,6 +838,7 @@
 	dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
 }
 
+#ifdef CONFIG_XEN_BACKEND
 static void backend_changed(struct xenbus_watch *watch,
 			    const char **vec, unsigned int len)
 {
@@ -817,17 +847,18 @@
 	dev_changed(vec[XS_WATCH_PATH], &xenbus_backend);
 }
 
+static struct xenbus_watch be_watch = {
+	.node = "backend",
+	.callback = backend_changed,
+};
+#endif
+
 /* We watch for devices appearing and vanishing. */
 static struct xenbus_watch fe_watch = {
 	.node = "device",
 	.callback = frontend_changed,
 };
 
-static struct xenbus_watch be_watch = {
-	.node = "backend",
-	.callback = backend_changed,
-};
-
 static int suspend_dev(struct device *dev, void *data)
 {
 	int err = 0;
@@ -898,7 +929,9 @@
 	DPRINTK("");
 
 	bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, suspend_dev);
+#ifdef CONFIG_XEN_BACKEND
 	bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, suspend_dev);
+#endif
 	xs_suspend();
 }
 EXPORT_SYMBOL_GPL(xenbus_suspend);
@@ -908,7 +941,9 @@
 	xb_init_comms();
 	xs_resume();
 	bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev);
+#ifdef CONFIG_XEN_BACKEND
 	bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, resume_dev);
+#endif
 }
 EXPORT_SYMBOL_GPL(xenbus_resume);
 
@@ -943,11 +978,15 @@
 
 	/* Enumerate devices in xenstore. */
 	xenbus_probe_devices(&xenbus_frontend);
+#ifdef CONFIG_XEN_BACKEND
 	xenbus_probe_devices(&xenbus_backend);
+#endif
 
 	/* Watch for changes. */
 	register_xenbus_watch(&fe_watch);
+#ifdef CONFIG_XEN_BACKEND
 	register_xenbus_watch(&be_watch);
+#endif
 
 	/* Notify others that xenstore is up */
 	notifier_call_chain(&xenstore_chain, 0, NULL);
@@ -959,6 +998,7 @@
 static struct proc_dir_entry *xsd_kva_intf;
 static struct proc_dir_entry *xsd_port_intf;
 
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	size_t size = vma->vm_end - vma->vm_start;
@@ -972,6 +1012,9 @@
 
 	return 0;
 }
+#else
+#define xsd_kva_mmap NULL
+#endif
 
 static int xsd_kva_read(char *page, char **start, off_t off,
 			int count, int *eof, void *data)
@@ -1006,7 +1049,9 @@
 
 	/* Register ourselves with the kernel bus subsystem */
 	bus_register(&xenbus_frontend.bus);
+#ifdef CONFIG_XEN_BACKEND
 	bus_register(&xenbus_backend.bus);
+#endif
 
 	/*
 	 * Domain0 doesn't have a store_evtchn or store_mfn yet.
@@ -1077,7 +1122,9 @@
 
 	/* Register ourselves with the kernel device subsystem */
 	device_register(&xenbus_frontend.dev);
+#ifdef CONFIG_XEN_BACKEND
 	device_register(&xenbus_backend.dev);
+#endif
 
 	if (!is_initial_xendomain())
 		xenbus_probe(NULL);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-18 13:51 [PATCH][RESEND] PV drivers for HVM guests Ky Srinivasan
@ 2006-10-18 23:56 ` Doi.Tsunehisa
  2006-10-19 13:53   ` Ky Srinivasan
  0 siblings, 1 reply; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-18 23:56 UTC (permalink / raw)
  To: Ky Srinivasan; +Cc: xen-devel

Hi,

You (ksrinivasan) said:
> I am enclosing the patch I have been working on. I have tested this on
> sles9 (2.6.5) and RHEL 4 (2.6.9). The patch applies cleanly on ChangeSet
> 11635. This patch was cleaned up based on Ian's and DOI's work.
> 
> Signed-off-by: K. Y. Srinivasan (ksrinivasan@novell.com)

 The patch seems that the source files of unmodified_drivers are split
from linux-2.6-xen-sparse, I think.

  I think it because ...

> diff -Nur unmodified_drivers/linux-2.6/blkfront/blkfront.c unmodified_drivers_new/linux-2.6/blkfront/blkfront.c
> --- unmodified_drivers/linux-2.6/blkfront/blkfront.c	2006-10-04 00:38:41.000000000 -0400
> +++ unmodified_drivers_new/linux-2.6/blkfront/blkfront.c	2006-10-13 11:11:43.000000000 -0400

and

> @@ -47,6 +47,7 @@
>  #include <xen/gnttab.h>
>  #include <asm/hypervisor.h>
>  #include <asm/maddr.h>
> +#include <xen/platform_compat.h>
>  
>  #define BLKIF_STATE_DISCONNECTED 0
>  #define BLKIF_STATE_CONNECTED    1

  xen/platform_compat.h is introduced, but it exists in unmodified_drviers
except linux-2.6-xen-sparse.

  Am I true ?

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-18 23:56 ` Doi.Tsunehisa
@ 2006-10-19 13:53   ` Ky Srinivasan
  2006-10-20 10:12     ` Doi.Tsunehisa
  0 siblings, 1 reply; 22+ messages in thread
From: Ky Srinivasan @ 2006-10-19 13:53 UTC (permalink / raw)
  To: Doi.Tsunehisa; +Cc: xen-devel

We intend  to maintain the source for the unmodified drivers separately in our source tree. The idea is that this will track the official xen source tree; we would apply the patch to target this source for a particular unmodified guest target. This would eliminate the need to carry the compatibility baggage in the pristine unmodified driver code.

Regards,

K. Y 

>>> On Wed, Oct 18, 2006 at  7:56 PM, in message
<200610182356.k9INuAF03840@photon.sky.yk.fujitsu.co.jp>,
<Doi.Tsunehisa@jp.fujitsu.com> wrote: 
> Hi,
> 
> You (ksrinivasan) said:
>> I am enclosing the patch I have been working on. I have tested this on
>> sles9 (2.6.5) and RHEL 4 (2.6.9). The patch applies cleanly on ChangeSet
>> 11635. This patch was cleaned up based on Ian's and DOI's work.
>> 
>> Signed- off- by: K. Y. Srinivasan (ksrinivasan@novell.com)
> 
>  The patch seems that the source files of unmodified_drivers are split
> from linux- 2.6- xen- sparse, I think.
> 
>   I think it because ...
> 
>> diff - Nur unmodified_drivers/linux- 2.6/blkfront/blkfront.c 
> unmodified_drivers_new/linux- 2.6/blkfront/blkfront.c
>> ---  unmodified_drivers/linux- 2.6/blkfront/blkfront.c	2006- 10- 04 00:38:41.000000000 
> - 0400
>> +++ unmodified_drivers_new/linux- 2.6/blkfront/blkfront.c	2006- 10- 13 
> 11:11:43.000000000 - 0400
> 
> and
> 
>> @@ - 47,6 +47,7 @@
>>  #include <xen/gnttab.h>
>>  #include <asm/hypervisor.h>
>>  #include <asm/maddr.h>
>> +#include <xen/platform_compat.h>
>>  
>>  #define BLKIF_STATE_DISCONNECTED 0
>>  #define BLKIF_STATE_CONNECTED    1
> 
>   xen/platform_compat.h is introduced, but it exists in unmodified_drviers
> except linux- 2.6- xen- sparse.
> 
>   Am I true ?
> 
> Thanks,
> -  Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-19 13:53   ` Ky Srinivasan
@ 2006-10-20 10:12     ` Doi.Tsunehisa
  2006-10-20 13:54       ` Ky Srinivasan
  0 siblings, 1 reply; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-20 10:12 UTC (permalink / raw)
  To: Ky Srinivasan; +Cc: xen-devel, Doi.Tsunehisa

Hi,

You (ksrinivasan) said:
> We intend  to maintain the source for the unmodified drivers separately
> in our source tree. The idea is that this will track the official xen
> source tree; we would apply the patch to target this source for a
> particular unmodified guest target. This would eliminate the need to
> carry the compatibility baggage in the pristine unmodified driver code.

  I understand that it has to be separated from xen source tree for
maintenacne as products. But I think that we should avoid to fork the
source tree. Because its code structure is not stable, I think.

  What do you think about ?

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-20 10:12     ` Doi.Tsunehisa
@ 2006-10-20 13:54       ` Ky Srinivasan
  2006-10-23  1:45         ` Doi.Tsunehisa
  0 siblings, 1 reply; 22+ messages in thread
From: Ky Srinivasan @ 2006-10-20 13:54 UTC (permalink / raw)
  To: Doi.Tsunehisa; +Cc: xen-devel



>>> On Fri, Oct 20, 2006 at  6:12 AM, in message
<200610201012.k9KACIF29714@photon.sky.yk.fujitsu.co.jp>,
<Doi.Tsunehisa@jp.fujitsu.com> wrote: 
> Hi,
> 
> You (ksrinivasan) said:
>> We intend  to maintain the source for the unmodified drivers separately
>> in our source tree. The idea is that this will track the official xen
>> source tree; we would apply the patch to target this source for a
>> particular unmodified guest target. This would eliminate the need to
>> carry the compatibility baggage in the pristine unmodified driver code.
> 
>   I understand that it has to be separated from xen source tree for
> maintenacne as products. But I think that we should avoid to fork the
> source tree. Because its code structure is not stable, I think.
> 
>   What do you think about ?

We are not forking tree. The pristine PV driver code will always be the exact code in the xen source tree. 

Regards,

K. Y
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-20 13:54       ` Ky Srinivasan
@ 2006-10-23  1:45         ` Doi.Tsunehisa
  2006-10-24  2:54           ` DOI Tsunehisa
  0 siblings, 1 reply; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-23  1:45 UTC (permalink / raw)
  To: Ky Srinivasan; +Cc: xen-devel, Doi.Tsunehisa

  Hi,

You (ksrinivasan) said:
>>   I understand that it has to be separated from xen source tree for
>> maintenacne as products. But I think that we should avoid to fork the
>> source tree. Because its code structure is not stable, I think.
>> 
>>   What do you think about ?
> 
> We are not forking tree. The pristine PV driver code will always be the
> exact code in the xen source tree. 

  Sorry, My explaining seems to be bad.

  My opinion is that unmodified_drivers tree should not be forked from
linux-sparse tree. Because its code structure will be changed from now
on, so we will have to follow.

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-23  1:45         ` Doi.Tsunehisa
@ 2006-10-24  2:54           ` DOI Tsunehisa
  2006-10-24 15:26             ` Ian Campbell
  0 siblings, 1 reply; 22+ messages in thread
From: DOI Tsunehisa @ 2006-10-24  2:54 UTC (permalink / raw)
  To: xen-devel; +Cc: Ky Srinivasan, Ian Campbell

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

Hi all,

"Ky Srinivasan" <ksrinivasan@novell.com> wrote:
> I am enclosing the patch I have been working on. I have tested this on
> sles9 (2.6.5) and RHEL 4 (2.6.9). The patch applies cleanly on
> ChangeSet 11635. This patch was cleaned up based on Ian's and DOI's
> work.

  I merged Srinivasan's work and a part of modification for IA64
platform.

  I tested only compiling on RHEL4 Update 2.

Thanks,
- Tsunehisa Doi


[-- Attachment #2: pv-backport4.patch --]
[-- Type: text/plain, Size: 25824 bytes --]

# HG changeset patch
# User Doi.Tsunehisa@jp.fujitsu.com
# Node ID e08cd46b951535a7d21beb1d476dc9c895c4d4ef
# Parent  29b02d929b7e4df6016c16ebba71d6d73462882e
Modify for backporting PV-on-HVM drivers

Signed-off-by: Ian Campbell <Ian.Campbell@XenSource.com>
Signed-off-by: K. Y. Srinivasan (ksrinivasan@novell.com)
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>

diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Tue Oct 24 11:00:08 2006 +0900
@@ -48,6 +48,10 @@
 #include <asm/hypervisor.h>
 #include <asm/maddr.h>
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 #define BLKIF_STATE_DISCONNECTED 0
 #define BLKIF_STATE_CONNECTED    1
 #define BLKIF_STATE_SUSPENDED    2
@@ -468,6 +472,27 @@ int blkif_ioctl(struct inode *inode, str
 		      command, (long)argument, inode->i_rdev);
 
 	switch (command) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+	case HDIO_GETGEO: {
+		struct block_device *bd = inode->i_bdev;
+		struct hd_geometry geo;
+		int ret;
+
+                if (!argument)
+                        return -EINVAL;
+
+		geo.start = get_start_sect(bd);
+		ret = blkif_getgeo(bd, &geo);
+		if (ret)
+			return ret;
+
+		if (copy_to_user((struct hd_geometry __user *)argument, &geo,
+				 sizeof(geo)))
+                        return -EFAULT;
+
+                return 0;
+	}
+#endif
 	case CDROMMULTISESSION:
 		DPRINTK("FIXME: support multisession CDs later\n");
 		for (i = 0; i < sizeof(struct cdrom_multisession); i++)
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Tue Oct 24 11:00:08 2006 +0900
@@ -36,6 +36,10 @@
 #include <linux/blkdev.h>
 #include <linux/list.h>
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 #define BLKIF_MAJOR(dev) ((dev)>>8)
 #define BLKIF_MINOR(dev) ((dev) & 0xff)
 
@@ -91,7 +95,9 @@ static struct block_device_operations xl
 	.open = blkif_open,
 	.release = blkif_release,
 	.ioctl  = blkif_ioctl,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 	.getgeo = blkif_getgeo
+#endif
 };
 
 DEFINE_SPINLOCK(blkif_io_lock);
@@ -186,7 +192,11 @@ xlvbd_init_blk_queue(struct gendisk *gd,
 	if (rq == NULL)
 		return -1;
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
 	elevator_init(rq, "noop");
+#else
+	elevator_init(rq, &elevator_noop);
+#endif
 
 	/* Hard sector size and max sectors impersonate the equiv. hardware. */
 	blk_queue_hardsect_size(rq, sector_size);
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/core/features.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/features.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/features.c	Tue Oct 24 11:00:08 2006 +0900
@@ -10,6 +10,10 @@
 #include <linux/module.h>
 #include <asm/hypervisor.h>
 #include <xen/features.h>
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly;
 /* Not a GPL symbol: used in ubiquitous macros, so too restrictive. */
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Tue Oct 24 11:00:08 2006 +0900
@@ -44,6 +44,10 @@
 #include <asm/io.h>
 #include <xen/interface/memory.h>
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 /* External tools reserve first few grant table entries. */
 #define NR_RESERVED_ENTRIES 8
 
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Tue Oct 24 11:00:08 2006 +0900
@@ -64,6 +64,10 @@
 #include <xen/interface/grant_table.h>
 #include <xen/gnttab.h>
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 /*
  * Mutually-exclusive module options to select receive data path:
  *  rx_copy : Packets are copied by network backend into local memory
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c	Tue Oct 24 11:00:08 2006 +0900
@@ -34,6 +34,10 @@
 #include <xen/gnttab.h>
 #include <xen/xenbus.h>
 #include <xen/driver_util.h>
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 /* xenbus_probe.c */
 extern char *kasprintf(const char *fmt, ...);
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c	Tue Oct 24 11:00:08 2006 +0900
@@ -39,6 +39,10 @@
 #include <xen/xenbus.h>
 #include "xenbus_comms.h"
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 static int xenbus_irq;
 
 extern void xenbus_probe(void *);
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Tue Oct 24 11:00:08 2006 +0900
@@ -56,6 +56,10 @@
 
 #include "xenbus_comms.h"
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 int xen_store_evtchn;
 struct xenstore_domain_interface *xen_store_interface;
 static unsigned long xen_store_mfn;
@@ -67,13 +71,17 @@ static void wait_for_devices(struct xenb
 static void wait_for_devices(struct xenbus_driver *xendrv);
 
 static int xenbus_probe_frontend(const char *type, const char *name);
+#ifdef CONFIG_XEN_BACKEND
 static int xenbus_uevent_backend(struct device *dev, char **envp,
 				 int num_envp, char *buffer, int buffer_size);
 static int xenbus_probe_backend(const char *type, const char *domid);
+#endif
 
 static int xenbus_dev_probe(struct device *_dev);
 static int xenbus_dev_remove(struct device *_dev);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 static void xenbus_dev_shutdown(struct device *_dev);
+#endif
 
 /* If something in array of ids matches this device, return it. */
 static const struct xenbus_device_id *
@@ -176,10 +184,12 @@ static int read_backend_details(struct x
 }
 
 
+#ifdef CONFIG_XEN_BACKEND
 static int read_frontend_details(struct xenbus_device *xendev)
 {
 	return read_otherend_details(xendev, "frontend-id", "frontend");
 }
+#endif
 
 
 /* Bus type for frontend drivers. */
@@ -191,15 +201,18 @@ static struct xen_bus_type xenbus_fronte
 	.bus = {
 		.name     = "xen",
 		.match    = xenbus_match,
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 		.probe    = xenbus_dev_probe,
 		.remove   = xenbus_dev_remove,
 		.shutdown = xenbus_dev_shutdown,
+#endif
 	},
 	.dev = {
 		.bus_id = "xen",
 	},
 };
 
+#ifdef CONFIG_XEN_BACKEND
 /* backend/<type>/<fe-uuid>/<id> => <type>-<fe-domid>-<id> */
 static int backend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
 {
@@ -299,6 +312,7 @@ static int xenbus_uevent_backend(struct 
 
 	return 0;
 }
+#endif
 
 static void otherend_changed(struct xenbus_watch *watch,
 			     const char **vec, unsigned int len)
@@ -423,6 +437,7 @@ static int xenbus_dev_remove(struct devi
 	return 0;
 }
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
 static void xenbus_dev_shutdown(struct device *_dev)
 {
 	struct xenbus_device *dev = to_xenbus_device(_dev);
@@ -443,6 +458,7 @@ static void xenbus_dev_shutdown(struct d
  out:
 	put_device(&dev->dev);
 }
+#endif
 
 static int xenbus_register_driver_common(struct xenbus_driver *drv,
 					 struct xen_bus_type *bus)
@@ -451,7 +467,13 @@ static int xenbus_register_driver_common
 
 	drv->driver.name = drv->name;
 	drv->driver.bus = &bus->bus;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
 	drv->driver.owner = drv->owner;
+#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+	drv->driver.probe = xenbus_dev_probe;
+	drv->driver.remove = xenbus_dev_remove;
+#endif
 
 	mutex_lock(&xenwatch_mutex);
 	ret = driver_register(&drv->driver);
@@ -476,6 +498,7 @@ int xenbus_register_frontend(struct xenb
 }
 EXPORT_SYMBOL_GPL(xenbus_register_frontend);
 
+#ifdef CONFIG_XEN_BACKEND
 int xenbus_register_backend(struct xenbus_driver *drv)
 {
 	drv->read_otherend_details = read_frontend_details;
@@ -483,6 +506,7 @@ int xenbus_register_backend(struct xenbu
 	return xenbus_register_driver_common(drv, &xenbus_backend);
 }
 EXPORT_SYMBOL_GPL(xenbus_register_backend);
+#endif
 
 void xenbus_unregister_driver(struct xenbus_driver *drv)
 {
@@ -581,14 +605,20 @@ char *kasprintf(const char *fmt, ...)
 }
 
 static ssize_t xendev_show_nodename(struct device *dev,
-				    struct device_attribute *attr, char *buf)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
+				    struct device_attribute *attr,
+#endif
+				    char *buf)
 {
 	return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
 }
 DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
 
 static ssize_t xendev_show_devtype(struct device *dev,
-				   struct device_attribute *attr, char *buf)
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,12)
+				   struct device_attribute *attr,
+#endif
+				   char *buf)
 {
 	return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
 }
@@ -667,6 +697,7 @@ static int xenbus_probe_frontend(const c
 	return err;
 }
 
+#ifdef CONFIG_XEN_BACKEND
 /* backend/<typename>/<frontend-uuid>/<name> */
 static int xenbus_probe_backend_unit(const char *dir,
 				     const char *type,
@@ -715,6 +746,7 @@ static int xenbus_probe_backend(const ch
 	kfree(nodename);
 	return err;
 }
+#endif
 
 static int xenbus_probe_device_type(struct xen_bus_type *bus, const char *type)
 {
@@ -823,6 +855,7 @@ static void frontend_changed(struct xenb
 	dev_changed(vec[XS_WATCH_PATH], &xenbus_frontend);
 }
 
+#ifdef CONFIG_XEN_BACKEND
 static void backend_changed(struct xenbus_watch *watch,
 			    const char **vec, unsigned int len)
 {
@@ -830,6 +863,7 @@ static void backend_changed(struct xenbu
 
 	dev_changed(vec[XS_WATCH_PATH], &xenbus_backend);
 }
+#endif
 
 /* We watch for devices appearing and vanishing. */
 static struct xenbus_watch fe_watch = {
@@ -837,10 +871,12 @@ static struct xenbus_watch fe_watch = {
 	.callback = frontend_changed,
 };
 
+#ifdef CONFIG_XEN_BACKEND
 static struct xenbus_watch be_watch = {
 	.node = "backend",
 	.callback = backend_changed,
 };
+#endif
 
 static int suspend_dev(struct device *dev, void *data)
 {
@@ -912,7 +948,9 @@ void xenbus_suspend(void)
 	DPRINTK("");
 
 	bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, suspend_dev);
+#ifdef CONFIG_XEN_BACKEND
 	bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, suspend_dev);
+#endif
 	xs_suspend();
 }
 EXPORT_SYMBOL_GPL(xenbus_suspend);
@@ -922,7 +960,9 @@ void xenbus_resume(void)
 	xb_init_comms();
 	xs_resume();
 	bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev);
+#ifdef CONFIG_XEN_BACKEND
 	bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, resume_dev);
+#endif
 }
 EXPORT_SYMBOL_GPL(xenbus_resume);
 
@@ -957,11 +997,15 @@ void xenbus_probe(void *unused)
 
 	/* Enumerate devices in xenstore. */
 	xenbus_probe_devices(&xenbus_frontend);
+#ifdef CONFIG_XEN_BACKEND
 	xenbus_probe_devices(&xenbus_backend);
+#endif
 
 	/* Watch for changes. */
 	register_xenbus_watch(&fe_watch);
+#ifdef CONFIG_XEN_BACKEND
 	register_xenbus_watch(&be_watch);
+#endif
 
 	/* Notify others that xenstore is up */
 	notifier_call_chain(&xenstore_chain, 0, NULL);
@@ -973,6 +1017,7 @@ static struct proc_dir_entry *xsd_kva_in
 static struct proc_dir_entry *xsd_kva_intf;
 static struct proc_dir_entry *xsd_port_intf;
 
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	size_t size = vma->vm_end - vma->vm_start;
@@ -986,6 +1031,9 @@ static int xsd_kva_mmap(struct file *fil
 
 	return 0;
 }
+#else
+#define xsd_kva_mmap NULL
+#endif
 
 static int xsd_kva_read(char *page, char **start, off_t off,
 			int count, int *eof, void *data)
@@ -1020,7 +1068,9 @@ static int __init xenbus_probe_init(void
 
 	/* Register ourselves with the kernel bus subsystem */
 	bus_register(&xenbus_frontend.bus);
+#ifdef CONFIG_XEN_BACKEND
 	bus_register(&xenbus_backend.bus);
+#endif
 
 	/*
 	 * Domain0 doesn't have a store_evtchn or store_mfn yet.
@@ -1091,7 +1141,9 @@ static int __init xenbus_probe_init(void
 
 	/* Register ourselves with the kernel device subsystem */
 	device_register(&xenbus_frontend.dev);
+#ifdef CONFIG_XEN_BACKEND
 	device_register(&xenbus_backend.dev);
+#endif
 
 	if (!is_initial_xendomain())
 		xenbus_probe(NULL);
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Tue Oct 24 11:00:08 2006 +0900
@@ -42,8 +42,13 @@
 #include <linux/fcntl.h>
 #include <linux/kthread.h>
 #include <linux/rwsem.h>
+#include <linux/module.h>
 #include <xen/xenbus.h>
 #include "xenbus_comms.h"
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 /* xenbus_probe.c */
 extern char *kasprintf(const char *fmt, ...);
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h	Tue Oct 24 11:00:08 2006 +0900
@@ -8,6 +8,10 @@
  */
 
 #include <linux/config.h>
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 #define ADDR (*(volatile long *) addr)
 
diff -r 29b02d929b7e -r e08cd46b9515 linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h	Mon Oct 23 14:42:52 2006 +0100
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h	Tue Oct 24 11:00:08 2006 +0900
@@ -38,10 +38,15 @@
 #include <linux/notifier.h>
 #include <linux/mutex.h>
 #include <linux/completion.h>
+#include <linux/init.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/grant_table.h>
 #include <xen/interface/io/xenbus.h>
 #include <xen/interface/io/xs_wire.h>
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 /* Register callback to watch this node. */
 struct xenbus_watch
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/overrides.mk
--- a/unmodified_drivers/linux-2.6/overrides.mk	Mon Oct 23 14:42:52 2006 +0100
+++ b/unmodified_drivers/linux-2.6/overrides.mk	Tue Oct 24 11:00:08 2006 +0900
@@ -9,4 +9,4 @@ EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRAN
 EXTRA_CFLAGS += -DCONFIG_XEN_BLKDEV_GRANT -DXEN_EVTCHN_MASK_OPS
 EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRANT_RX -DCONFIG_XEN_NETDEV_GRANT_TX
 EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202
-EXTRA_CFLAGS += -I$(M)/include
+EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_COMPAT_H
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/platform-pci/Kbuild
--- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild	Mon Oct 23 14:42:52 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild	Tue Oct 24 11:00:08 2006 +0900
@@ -4,4 +4,10 @@ obj-m := xen-platform-pci.o
 
 EXTRA_CFLAGS += -I$(M)/platform-pci
 
-xen-platform-pci-objs := evtchn.o platform-pci.o gnttab.o xen_support.o features.o
+xen-platform-pci-objs :=
+xen-platform-pci-objs += platform-pci.o
+xen-platform-pci-objs += features.o
+xen-platform-pci-objs += evtchn.o
+xen-platform-pci-objs += gnttab.o
+xen-platform-pci-objs += xen_support.o
+xen-platform-pci-objs += compat.o
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/platform-pci/evtchn.c
--- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c	Tue Oct 24 11:00:08 2006 +0900
@@ -35,6 +35,10 @@
 #include <xen/interface/hvm/ioreq.h>
 #include <xen/features.h>
 #include "platform-pci.h"
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 void *shared_info_area;
 
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c	Tue Oct 24 11:00:08 2006 +0900
@@ -38,6 +38,10 @@
 
 #include "platform-pci.h"
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 #define DRV_NAME    "xen-platform-pci"
 #define DRV_VERSION "0.10"
 #define DRV_RELDATE "03/03/2005"
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/platform-pci/xen_support.c
--- a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c	Mon Oct 23 14:42:52 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c	Tue Oct 24 11:00:08 2006 +0900
@@ -26,6 +26,10 @@
 #include <asm/hypervisor.h>
 #include "platform-pci.h"
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 void xen_machphys_update(unsigned long mfn, unsigned long pfn)
 {
 	BUG();
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/blkfront/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/blkfront/Makefile	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopmd.h	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,14 @@
+#ifndef _PGTABLE_NOPMD_H
+#define _PGTABLE_NOPMD_H
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
+#error "This version of Linux should not need compat pgtable-nopmd.h"
+#endif
+
+#define pud_t pgd_t
+#define pud_offset(d, va)	(d)
+#define pud_none(pud)		0
+#define pud_present(pud)	1
+#define PTRS_PER_PUD		1
+
+#endif /* _PGTABLE_NOPMD_H */
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,15 @@
+#ifndef _PGTABLE_NOPUD_H
+#define _PGTABLE_NOPUD_H
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10)
+#error "This version of Linux should not need compat pgtable-nopud.h"
+#endif
+
+#define pud_t pgd_t
+#define pud_offset(d, va)	(d)
+#define pud_none(pud)		0
+#define pud_bad(pud)		0
+#define pud_present(pud)	1
+#define PTRS_PER_PUD		1
+
+#endif /* _PGTABLE_NOPUD_H */
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/compat-include/compat.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/compat-include/compat.h	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,62 @@
+#ifndef COMPAT_INCLUDE_COMPAT_H
+#define COMPAT_INCLUDE_COMPAT_H
+
+#include <linux/version.h>
+#include <linux/compiler.h>
+
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+
+#if defined(__LINUX_COMPILER_H) && !defined(__always_inline)
+#define __always_inline inline
+#endif
+
+#if defined(__LINUX_COMPILER_H) && !defined(__nocast)
+#define __nocast
+#endif
+
+#if defined(__LINUX_SPINLOCK_H) && !defined(DEFINE_SPINLOCK)
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
+#endif
+
+#if defined(_LINUX_INIT_H) && !defined(__init)
+#define __init
+#endif
+
+#if defined(__LINUX_CACHE_H) && !defined(__read_mostly)
+#define __read_mostly
+#endif
+
+#if defined(_LINUX_SCHED_H) && !defined(__sched)
+#define __sched
+#endif
+
+#if defined(_LINUX_TYPES_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+typedef unsigned __nocast gfp_t;
+#endif
+
+#if defined(_LINUX_MM_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+unsigned long vmalloc_to_pfn(void *addr);
+#endif
+
+#if defined(_LINUX_SLAB_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+void *kzalloc(size_t size, int flags);
+#endif
+
+#if defined(_LINUX_SCHED_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+signed long __sched schedule_timeout_interruptible(signed long timeout);
+#endif
+
+#if defined(_LINUX_ERR_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)
+#endif
+
+#if defined(_LINUX_BLKDEV_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+#define end_that_request_last(req, uptodate) end_that_request_last(req)
+#endif
+
+#if defined(__ia64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
+#include <asm-generic/pgtable-nopud.h>
+#endif
+
+#endif /* !COMPAT_INCLUDE_COMPAT_H */
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/compat-include/linux/io.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/compat-include/linux/io.h	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,10 @@
+#ifndef _LINUX_IO_H
+#define _LINUX_IO_H
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+#error "This version of Linux should not need compat linux/io.h"
+#endif
+
+#include <asm/io.h>
+
+#endif
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/compat-include/linux/mutex.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2006 Cisco Systems.  All rights reserved.
+ *
+ * This file is released under the GPLv2.
+ */
+
+/* mutex compatibility for pre-2.6.16 kernels */
+
+#ifndef __LINUX_MUTEX_H
+#define __LINUX_MUTEX_H
+
+#include <linux/version.h>
+#include <asm/semaphore.h>
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+#error "This version of Linux should not need compat mutex.h"
+#endif
+
+#define mutex semaphore
+#define DEFINE_MUTEX(foo) DECLARE_MUTEX(foo)
+#define mutex_init(foo) init_MUTEX(foo)
+#define mutex_lock(foo) down(foo)
+#define mutex_lock_interruptible(foo) down_interruptible(foo)
+/* this function follows the spin_trylock() convention, so        *
+ * it is negated to the down_trylock() return values! Be careful  */
+#define mutex_trylock(foo) !down_trylock(foo)
+#define mutex_unlock(foo) up(foo)
+
+#endif /* __LINUX_MUTEX_H */
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/netfront/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/netfront/Makefile	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/platform-pci/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/platform-pci/Makefile	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/platform-pci/compat.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/platform-pci/compat.c	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,101 @@
+/*
+ * Compatibility shim for hosting Xen PV drivers in unmodified
+ * 2.6.5 and 2.6.9 based kernels.
+ */
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+#include <linux/highmem.h>
+#include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+
+#include <asm/pgtable.h>
+#include <asm/hypervisor.h>
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
+int system_state = 1;
+EXPORT_SYMBOL(system_state);
+
+/**
+ * strcspn - Calculate the length of the initial substring of @s which does
+ *     not contain letters in @reject
+ * @s: The string to be searched
+ * @reject: The string to avoid
+ */
+size_t strcspn(const char *s, const char *reject)
+{
+	const char *p;
+	const char *r;
+	size_t count = 0;
+
+	for (p = s; *p != '\0'; ++p) {
+		for (r = reject; *r != '\0'; ++r) {
+			if (*p == *r)
+				return count;
+		}
+		++count;
+	}
+	return count;
+}
+EXPORT_SYMBOL(strcspn);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+/*
+ * Map a vmalloc()-space virtual address to the physical page frame number.
+ */
+unsigned long vmalloc_to_pfn(void * vmalloc_addr)
+{
+	return page_to_pfn(vmalloc_to_page(vmalloc_addr));
+}
+
+EXPORT_SYMBOL(vmalloc_to_pfn);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
+/*
+    fake do_exit using complete_and_exit
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+asmlinkage NORET_TYPE void do_exit(long code)
+#else
+fastcall NORET_TYPE void do_exit(long code)
+#endif
+{
+    complete_and_exit(NULL, code);
+}
+EXPORT_SYMBOL(do_exit);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+/**
+ * kzalloc - allocate memory. The memory is set to zero.
+ * @size: how many bytes of memory are required.
+ * @flags: the type of memory to allocate.
+ */
+void *kzalloc(size_t size, int flags)
+{
+	void *ret = kmalloc(size, flags);
+	if (ret)
+		memset(ret, 0, size);
+	return ret;
+}
+EXPORT_SYMBOL(kzalloc);
+
+/*
+ * We can use __set_current_state() here because schedule_timeout() calls
+ * schedule() unconditionally.
+ */
+signed long __sched schedule_timeout_interruptible(signed long timeout)
+{
+	__set_current_state(TASK_INTERRUPTIBLE);
+	return schedule_timeout(timeout);
+}
+EXPORT_SYMBOL(schedule_timeout_interruptible);
+#endif
diff -r 29b02d929b7e -r e08cd46b9515 unmodified_drivers/linux-2.6/xenbus/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unmodified_drivers/linux-2.6/xenbus/Makefile	Tue Oct 24 11:00:08 2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-24  2:54           ` DOI Tsunehisa
@ 2006-10-24 15:26             ` Ian Campbell
  2006-10-24 23:54               ` Doi.Tsunehisa
  0 siblings, 1 reply; 22+ messages in thread
From: Ian Campbell @ 2006-10-24 15:26 UTC (permalink / raw)
  To: DOI Tsunehisa; +Cc: Ky Srinivasan, xen-devel

On Tue, 2006-10-24 at 11:54 +0900, DOI Tsunehisa wrote:
> Hi all,
> 
> "Ky Srinivasan" <ksrinivasan@novell.com> wrote:
> > I am enclosing the patch I have been working on. I have tested this on
> > sles9 (2.6.5) and RHEL 4 (2.6.9). The patch applies cleanly on
> > ChangeSet 11635. This patch was cleaned up based on Ian's and DOI's
> > work.
> 
> I merged Srinivasan's work and a part of modification for IA64
> platform.

Thank you. I am just in the process of cleaning up the patch and
breaking it into manageable chunks. I've incorporated changes from your
patches and added both your signed-off-by's to the bits you've signed
off on.

> I tested only compiling on RHEL4 Update 2.

OK, I'm boot testing on sles9sp3 and rhel4.4. Perhaps that explains some
of the extra bits you seem to have which I don't seem to need? Or
perhaps they are IA64 specific?

I've left the bits that I've quoted below out for now since I didn't
need them for the releases I'm testing. Once I've committed the first
batch we can revisit these as well as anything I've dropped by mistake.

Cheers,
Ian.

> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/unmodified_drivers/linux-2.6/compat-include/compat.h	Tue Oct 24 11:00:08 2006 +0900

> +#if defined(__LINUX_COMPILER_H) && !defined(__nocast)
> +#define __nocast
> +#endif

> +#if defined(_LINUX_SCHED_H) && !defined(__sched)
> +#define __sched
> +#endif

> +#if defined(_LINUX_TYPES_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
> +typedef unsigned __nocast gfp_t;
> +#endif

> +#if defined(_LINUX_ERR_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)
> +#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)
> +#endif

> +#if defined(__ia64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
> +#include <asm-generic/pgtable-nopud.h>
> +#endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-24 15:26             ` Ian Campbell
@ 2006-10-24 23:54               ` Doi.Tsunehisa
  2006-10-25  3:11                 ` Doi.Tsunehisa
  2006-10-25 11:03                 ` [PATCH][RESEND] PV drivers for HVM guests Ian Campbell
  0 siblings, 2 replies; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-24 23:54 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ky Srinivasan, xen-devel, DOI Tsunehisa

Hi Ian,

You (Ian.Campbell) said:
>> I tested only compiling on RHEL4 Update 2.
> 
> OK, I'm boot testing on sles9sp3 and rhel4.4. Perhaps that explains some
> of the extra bits you seem to have which I don't seem to need? Or
> perhaps they are IA64 specific?

  In my patch, IA64 specfic part is below.

>> +#if defined(__ia64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
>> +#include <asm-generic/pgtable-nopud.h>
>> +#endif

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-24 23:54               ` Doi.Tsunehisa
@ 2006-10-25  3:11                 ` Doi.Tsunehisa
  2006-10-25 11:03                   ` Ian Campbell
  2006-10-25 11:03                 ` [PATCH][RESEND] PV drivers for HVM guests Ian Campbell
  1 sibling, 1 reply; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-25  3:11 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ky Srinivasan, xen-devel, Doi.Tsunehisa

Hi Ian,

I (Doi.Tsunehisa) said:
> You (Ian.Campbell) said:
>> OK, I'm boot testing on sles9sp3 and rhel4.4.

  I've met a compile error about gfp_t in rhel4.4. Thus, I avoided to meet
the compile error with preliminary patch like below.

Thanks,
- Tsunehisa Doi

  
diff -r 5b9bf5501157 -r 1b7b292278d0 unmodified_drivers/linux-2.6/compat-include/compat.h
--- a/unmodified_drivers/linux-2.6/compat-include/compat.h      Tue Oct 24 09:25:24 2006 +0900
+++ b/unmodified_drivers/linux-2.6/compat-include/compat.h      Tue Oct 24 17:55:16 2006 +0900
@@ -31,7 +31,8 @@
 #define __sched
 #endif

-#if defined(_LINUX_TYPES_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+#if defined(_LINUX_TYPES_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) \
+    && !defined(HAVE_GFP_T)
 typedef unsigned __nocast gfp_t;
 #endif

diff -r 5b9bf5501157 -r 1b7b292278d0 unmodified_drivers/linux-2.6/overrides.mk
--- a/unmodified_drivers/linux-2.6/overrides.mk Tue Oct 24 09:25:24 2006 +0900
+++ b/unmodified_drivers/linux-2.6/overrides.mk Tue Oct 24 17:55:16 2006 +0900
@@ -10,3 +10,6 @@ EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRAN
 EXTRA_CFLAGS += -DCONFIG_XEN_NETDEV_GRANT_RX -DCONFIG_XEN_NETDEV_GRANT_TX
 EXTRA_CFLAGS += -D__XEN_INTERFACE_VERSION__=0x00030202
 EXTRA_CFLAGS += -I$(M)/include -I$(M)/compat-include -DHAVE_COMPAT_H
+ifeq ($(KERNELRELEASE),2.6.9-42.EL) # for RHEL4 U4
+    EXTRA_CFLAGS += -DHAVE_GFP_T
+endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-25  3:11                 ` Doi.Tsunehisa
@ 2006-10-25 11:03                   ` Ian Campbell
  2006-10-26  0:13                     ` Doi.Tsunehisa
  0 siblings, 1 reply; 22+ messages in thread
From: Ian Campbell @ 2006-10-25 11:03 UTC (permalink / raw)
  To: Doi.Tsunehisa; +Cc: Ky Srinivasan, xen-devel

On Wed, 2006-10-25 at 12:11 +0900, Doi.Tsunehisa@jp.fujitsu.com wrote:
>   I've met a compile error about gfp_t in rhel4.4. Thus, I avoided to meet
> the compile error with preliminary patch like below.

Oh, you mean you were seeing problems because gfp_t is backported to
RHEL 4.4? I thought your patch was adding the typedef but actually you
are conditionally removing it.

I not sure the typedef is needed at all -- nothing in unmodified_drivers
uses gpf_t as far as I can see. My current patchset doesn't define it at
all and builds ok on RHEL4.4. Perhaps it is an arch specific issue?

Cheers,
Ian.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-24 23:54               ` Doi.Tsunehisa
  2006-10-25  3:11                 ` Doi.Tsunehisa
@ 2006-10-25 11:03                 ` Ian Campbell
  2006-10-26  0:16                   ` Doi.Tsunehisa
  1 sibling, 1 reply; 22+ messages in thread
From: Ian Campbell @ 2006-10-25 11:03 UTC (permalink / raw)
  To: Doi.Tsunehisa; +Cc: Ky Srinivasan, xen-devel

On Wed, 2006-10-25 at 08:54 +0900, Doi.Tsunehisa@jp.fujitsu.com wrote:
>   In my patch, IA64 specfic part is below.
> 
> >> +#if defined(__ia64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
> >> +#include <asm-generic/pgtable-nopud.h>
> >> +#endif

Can we come up with a more specific guard? Does something like this work
for you?
	#if defined _ASM_IA64_PGTABLE_H && !defined(_PGTABLE_NOPUD_H)

Cheers,
Ian.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-25 11:03                   ` Ian Campbell
@ 2006-10-26  0:13                     ` Doi.Tsunehisa
  2006-10-26  3:58                       ` Doi.Tsunehisa
  0 siblings, 1 reply; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-26  0:13 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ky Srinivasan, xen-devel, Doi.Tsunehisa

You (Ian.Campbell) said:
>>   I've met a compile error about gfp_t in rhel4.4. Thus, I avoided to meet
>> the compile error with preliminary patch like below.
> 
> Oh, you mean you were seeing problems because gfp_t is backported to
> RHEL 4.4? I thought your patch was adding the typedef but actually you
> are conditionally removing it.
> 
> I not sure the typedef is needed at all -- nothing in unmodified_drivers
> uses gpf_t as far as I can see. My current patchset doesn't define it at
> all and builds ok on RHEL4.4. Perhaps it is an arch specific issue?

  Sorry, I might be confused. I'll check it.

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-25 11:03                 ` [PATCH][RESEND] PV drivers for HVM guests Ian Campbell
@ 2006-10-26  0:16                   ` Doi.Tsunehisa
  0 siblings, 0 replies; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-26  0:16 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ky Srinivasan, xen-devel, Doi.Tsunehisa

Hi Ian,

You (Ian.Campbell) said:
>>   In my patch, IA64 specfic part is below.
>> 
>>>> +#if defined(__ia64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11)
>>>> +#include <asm-generic/pgtable-nopud.h>
>>>> +#endif
> 
> Can we come up with a more specific guard? Does something like this work
> for you?
> 	#if defined _ASM_IA64_PGTABLE_H && !defined(_PGTABLE_NOPUD_H)

  Ok. I'll try it.

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-26  0:13                     ` Doi.Tsunehisa
@ 2006-10-26  3:58                       ` Doi.Tsunehisa
  2006-10-26  6:37                         ` Doi.Tsunehisa
  2006-10-26 14:15                         ` Ian Campbell
  0 siblings, 2 replies; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-26  3:58 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ky Srinivasan, xen-devel, Doi.Tsunehisa

Hi Ian,

I (Doi.Tsunehisa) said:
>> I not sure the typedef is needed at all -- nothing in unmodified_drivers
>> uses gpf_t as far as I can see. My current patchset doesn't define it at
>> all and builds ok on RHEL4.4. Perhaps it is an arch specific issue?
> 
>   Sorry, I might be confused. I'll check it.

  I've checked it. It's an ia64 arch specific issue indeed.

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-26  3:58                       ` Doi.Tsunehisa
@ 2006-10-26  6:37                         ` Doi.Tsunehisa
  2006-10-26 14:15                         ` Ian Campbell
  1 sibling, 0 replies; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-26  6:37 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ky Srinivasan, xen-devel, Doi.Tsunehisa

Hi Ian,

I (Doi.Tsunehisa) said:
>   I've checked it. It's an ia64 arch specific issue indeed.

  BTW, I might find a issue about NET_IP_ALIGN in the compatible shim.
Currentry, its value is 0, but the value should be matched a value of
netback module. Thus, its value should be 2, I think.

  What do you think about the issue ?

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-26  3:58                       ` Doi.Tsunehisa
  2006-10-26  6:37                         ` Doi.Tsunehisa
@ 2006-10-26 14:15                         ` Ian Campbell
  2006-10-27  4:11                           ` [Xen-devel][PATCH][RESEND] " Doi.Tsunehisa
       [not found]                           ` <00a201c6f96a$811feac0$dab2220a@VF03007L>
  1 sibling, 2 replies; 22+ messages in thread
From: Ian Campbell @ 2006-10-26 14:15 UTC (permalink / raw)
  To: Doi.Tsunehisa; +Cc: Ky Srinivasan, xen-devel

On Thu, 2006-10-26 at 12:58 +0900, Doi.Tsunehisa@jp.fujitsu.com wrote:
> I (Doi.Tsunehisa) said:
> >> I not sure the typedef is needed at all -- nothing in unmodified_drivers
> >> uses gpf_t as far as I can see. My current patchset doesn't define it at
> >> all and builds ok on RHEL4.4. Perhaps it is an arch specific issue?
> > 
> >   Sorry, I might be confused. I'll check it.
> 
>   I've checked it. It's an ia64 arch specific issue indeed.

I'd much prefer it if we can find a way to avoid encoding specific RHEL
kernel versions as you had in your patch. I've gone with
	#define gfp_t unsigned
which basically ignores any existing typedef. I think this is OK in this
instance since gfp_t has always been 

On Thu, 2006-10-26 at 15:37 +0900, Doi.Tsunehisa@jp.fujitsu.com wrote: 
>   BTW, I might find a issue about NET_IP_ALIGN in the compatible shim.
> Currentry, its value is 0, but the value should be matched a value of
> netback module. Thus, its value should be 2, I think.
> 
>   What do you think about the issue ?

My thinking was that since those older kernels don't define NET_IP_ALIGN
and don't hardcode the number 2 anywhere they don't expect any extra
alignment. Therefore using 0 seems correct in terms of behaving the same
as native drivers do on those versions. I'm not sure I would want to
backport the addition of the extra padding in our drivers, the distros
haven't seen the need for example...

My current patch is below, it cross-compiles for IA64 without warnings
against RHEL4.4 and SLES9sp3. Could you let me know if it works for you?
If so would you mind submitting the ia64 bits via the ia64 maintainer.
I'll apply the unmodified_drivers bits.

Ian.

Additional PV-on-HVM fixes for IA64.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>

diff -r a0a65da68861 linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c	Thu Oct 26 12:27:51 2006 +0100
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c	Thu Oct 26 15:06:15 2006 +0100
@@ -20,6 +20,11 @@
 #include <linux/mm.h>
 #include <xen/interface/xen.h>
 #include <asm/page.h>
+
+#ifdef HAVE_XEN_PLATFORM_COMPAT_H
+#include <xen/platform-compat.h>
+#endif
+
 #include <asm/xen/xencomm.h>
 
 static int xencomm_debug = 0;
diff -r a0a65da68861 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Thu Oct 26 12:27:51 2006 +0100
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Thu Oct 26 15:06:15 2006 +0100
@@ -283,6 +283,9 @@ static inline void exit_idle(void) {}
 #ifdef CONFIG_XEN
 #include <asm/xen/privop.h>
 #endif /* CONFIG_XEN */
+#ifdef HAVE_XEN_PLATFORM_COMPAT_H
+#include <xen/platform-compat.h>
+#endif
 
 static inline unsigned long
 __HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
diff -r a0a65da68861 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Thu Oct 26 12:27:51 2006 +0100
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Thu Oct 26 15:06:15 2006 +0100
@@ -56,8 +56,8 @@ extern int running_on_xen;
 #include <xen/interface/event_channel.h>
 #include <xen/interface/physdev.h>
 #include <xen/interface/sched.h>
+#include <asm/ptrace.h>
 #include <asm/hypercall.h>
-#include <asm/ptrace.h>
 #include <asm/page.h>
 
 extern shared_info_t *HYPERVISOR_shared_info;
diff -r a0a65da68861 unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h
--- a/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h	Thu Oct 26 12:27:51 2006 +0100
+++ b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h	Thu Oct 26 15:06:15 2006 +0100
@@ -9,6 +9,7 @@
 #define pud_offset(d, va)     d
 #define pud_none(pud)         0
 #define pud_present(pud)      1
+#define pud_bad(pud)          0
 #define PTRS_PER_PUD          1
 
 #endif /* _PGTABLE_NOPUD_H */
diff -r a0a65da68861 unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
--- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Thu Oct 26 12:27:51 2006 +0100
+++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h	Thu Oct 26 15:06:15 2006 +0100
@@ -25,6 +25,21 @@
 #define NET_IP_ALIGN 0
 #endif
 
+#if defined(_LINUX_ERR_H) && !defined(IS_ERR_VALUE)
+#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)
+#endif
+
+#if defined(_ASM_IA64_PGTABLE_H) && !defined(_PGTABLE_NOPUD_H)
+#include <asm-generic/pgtable-nopud.h>
+#endif
+
+/* Some kernels have this typedef backported so we cannot reliably
+ * detect based on version number, hence we forcibly #define it.
+ */
+#if defined(__LINUX_TYPES_H) || defined(__LINUX_GFP_H)
+#define gfp_t unsigned
+#endif
+
 #if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
 #define nonseekable_open(inode, filp) /* Nothing to do */
 #endif
diff -r a0a65da68861 unmodified_drivers/linux-2.6/mkbuildtree

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [Xen-devel][PATCH][RESEND] PV drivers for HVM guests
  2006-10-26 14:15                         ` Ian Campbell
@ 2006-10-27  4:11                           ` Doi.Tsunehisa
  2006-10-27  9:40                             ` [PATCH][RESEND] " Ian Campbell
       [not found]                           ` <00a201c6f96a$811feac0$dab2220a@VF03007L>
  1 sibling, 1 reply; 22+ messages in thread
From: Doi.Tsunehisa @ 2006-10-27  4:11 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel, xen-ia64-devel

Hi Ian,

You (Ian.Campbell) said:
> I'd much prefer it if we can find a way to avoid encoding specific RHEL
> kernel versions as you had in your patch. I've gone with
> 	#define gfp_t unsigned
> which basically ignores any existing typedef. I think this is OK in this
> instance since gfp_t has always been 
   .....
> My current patch is below, it cross-compiles for IA64 without warnings
> against RHEL4.4 and SLES9sp3. Could you let me know if it works for you?
> If so would you mind submitting the ia64 bits via the ia64 maintainer.
> I'll apply the unmodified_drivers bits.

  Takanori (he is my co-worker) checked this patch, but it occures
compile error in linux-xen. We are investigating it.

>>   BTW, I might find a issue about NET_IP_ALIGN in the compatible shim.
>> Currentry, its value is 0, but the value should be matched a value of
>> netback module. Thus, its value should be 2, I think.
>> 
>>   What do you think about the issue ?
>
> My thinking was that since those older kernels don't define NET_IP_ALIGN
> and don't hardcode the number 2 anywhere they don't expect any extra
> alignment. Therefore using 0 seems correct in terms of behaving the same
> as native drivers do on those versions. I'm not sure I would want to
> backport the addition of the extra padding in our drivers, the distros
> haven't seen the need for example...

  Hmm, I thought that NET_IF_ALIGN mismatch between netfront and netback
occures a confusion of VNIF. But I might be imagining if it was used
correctly.

  Is it used on SLES9 guest ? I don't have the environment.

Thanks,
- Tsunehisa Doi

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
  2006-10-27  4:11                           ` [Xen-devel][PATCH][RESEND] " Doi.Tsunehisa
@ 2006-10-27  9:40                             ` Ian Campbell
  0 siblings, 0 replies; 22+ messages in thread
From: Ian Campbell @ 2006-10-27  9:40 UTC (permalink / raw)
  To: Doi.Tsunehisa; +Cc: xen-devel, Kasai Takanori, xen-ia64-devel

On Fri, 2006-10-27 at 13:11 +0900, Doi.Tsunehisa@jp.fujitsu.com wrote:
> Takanori (he is my co-worker) checked this patch, but it occures
> compile error in linux-xen. We are investigating it.

Thanks, I'll reply to him in a moment.

> >>   BTW, I might find a issue about NET_IP_ALIGN in the compatible shim.
> >> Currentry, its value is 0, but the value should be matched a value of
> >> netback module. Thus, its value should be 2, I think.
> >> 
> >>   What do you think about the issue ?
> >
> > My thinking was that since those older kernels don't define NET_IP_ALIGN
> > and don't hardcode the number 2 anywhere they don't expect any extra
> > alignment. Therefore using 0 seems correct in terms of behaving the same
> > as native drivers do on those versions. I'm not sure I would want to
> > backport the addition of the extra padding in our drivers, the distros
> > haven't seen the need for example...
> 
> Hmm, I thought that NET_IF_ALIGN mismatch between netfront and netback
> occures a confusion of VNIF. But I might be imagining if it was used
> correctly.

I'd not heard about or seen that problem. Lets leave things as they are
and if a problem arises we'll revisit it.

> Is it used on SLES9 guest ? I don't have the environment.

Yes, I'm compile testing against SLES9sp3 (2.6.5 based) and RHEL4 update
4 (2.6.9 based) kernels. I don't have an IA64 platform to do anything
more than that.

Ian.

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVM guests
       [not found]                             ` <1161943070.13318.53.camel@localhost.localdomain>
@ 2006-10-27 11:43                               ` Kasai Takanori
       [not found]                               ` <03b301c6fa5a$8cc725a0$dab2220a@VF03007L>
  1 sibling, 0 replies; 22+ messages in thread
From: Kasai Takanori @ 2006-10-27 11:43 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Hi Ian,

>> How do you think of this patch?
> 
> In general we want to avoid adding compatibility bits to generic code
> and confine it to platform-compat.[ch] wherever possible. You have added
> code in xencomm.[ch] and hypercall.h which I think we can avoid.
> 
> I also try to avoid checking version numbers if I can, preferring to
> check for the presence of absence of specific definitions instead. This
> is useful when dealing with kernels with backported bits. Unfortunately
> it doesn't help with the gfp_t typedef :-( but we'll come to that later.
> 
> I've attached my current patch including the ptrace fix from above and
> the comments from below. Can you give it a go?

I'll try it.

Thanks

-
Takanori Kasai

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVMguests
       [not found]                               ` <03b301c6fa5a$8cc725a0$dab2220a@VF03007L>
@ 2006-11-01 23:55                                 ` Kasai Takanori
  2006-11-02 10:01                                   ` Ian Campbell
  0 siblings, 1 reply; 22+ messages in thread
From: Kasai Takanori @ 2006-11-01 23:55 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Hi Ian,

I confirmed this patch.
However, this patch has not been applied yet.

Do you think that this patch has another problem?
If this patch has no problem, could you apply this patch?

Thanks

--
Takanori Kasai


----- Original Message ----- 
From: "Kasai Takanori" <kasai.takanori@jp.fujitsu.com>
To: "Ian Campbell" <Ian.Campbell@xensource.com>
Cc: "xen-ia64-devel" <xen-ia64-devel@lists.xensource.com>
Sent: Saturday, October 28, 2006 3:30 PM
Subject: [Xen-ia64-devel] Re: [Xen-devel][PATCH][RESEND] PV drivers for 
HVMguests


> Hi Ian,
>
>> I've attached my current patch including the ptrace fix from above and
>> the comments from below. Can you give it a go?
>
> I confirmed this patch. (cs:12004)
> I tested compiling it and simple test on RHEL4U2 and RHEL4U4.
>
> Thanks
>
> --
> Takanori Kasai
>
>
> As follows:
> ------------
> diff -r cf05aabe6e65 linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
> --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Wed Oct 25 15:29:00 
> 2006 -0600
> +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Sat Oct 28 13:30:39 
> 2006 +0900
> @@ -39,6 +39,10 @@
>
> #include <asm/xen/xcom_hcall.h>
> struct xencomm_handle;
> +
> +#ifdef HAVE_XEN_PLATFORM_COMPAT_H
> +#include <xen/platform-compat.h>
> +#endif
>
> /*
>  * Assembler stubs for hyper-calls.
> diff -r cf05aabe6e65 linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h
> --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h Wed Oct 25 15:29:00 
> 2006 -0600
> +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h Sat Oct 28 13:42:40 
> 2006 +0900
> @@ -20,6 +20,10 @@
> #define _LINUX_XENCOMM_H_
>
> #include <xen/interface/xencomm.h>
> +
> +#ifdef HAVE_XEN_PLATFORM_COMPAT_H
> +#include <xen/platform-compat.h>
> +#endif
>
> #define XENCOMM_MINI_ADDRS 3
> struct xencomm_mini {
> diff -r cf05aabe6e65 
> unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h
> --- a/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h 
> Wed Oct 25 15:29:00 2006 -0600
> +++ b/unmodified_drivers/linux-2.6/compat-include/asm-generic/pgtable-nopud.h 
> Sat Oct 28 12:50:07 2006 +0900
> @@ -9,6 +9,7 @@
> #define pud_offset(d, va)     d
> #define pud_none(pud)         0
> #define pud_present(pud)      1
> +#define pud_bad(pud)          0
> #define PTRS_PER_PUD          1
>
> #endif /* _PGTABLE_NOPUD_H */
> diff -r cf05aabe6e65 
> unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h
> --- a/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h Wed 
> Oct 25 15:29:00 2006 -0600
> +++ b/unmodified_drivers/linux-2.6/compat-include/xen/platform-compat.h Sat 
> Oct 28 13:16:35 2006 +0900
> @@ -25,6 +25,21 @@
> #define NET_IP_ALIGN 0
> #endif
>
> +#if defined(_LINUX_ERR_H) && !defined(IS_ERR_VALUE)
> +#define IS_ERR_VALUE(x) unlikely((x) > (unsigned long)-1000L)
> +#endif
> +
> +#if defined(_ASM_IA64_PGTABLE_H) && !defined(_PGTABLE_NOPUD_H)
> +#include <asm-generic/pgtable-nopud.h>
> +#endif
> +
> +/* Some kernels have this typedef backported so we cannot reliably
> + * detect based on version number, hence we forcibly #define it.
> + */
> +#if defined(__LINUX_TYPES_H) || defined(__LINUX_GFP_H)
> +#define gfp_t unsigned
> +#endif
> +
> #if defined(_LINUX_FS_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
> #define nonseekable_open(inode, filp) /* Nothing to do */
> #endif
>
>
>
> _______________________________________________
> Xen-ia64-devel mailing list
> Xen-ia64-devel@lists.xensource.com
> http://lists.xensource.com/xen-ia64-devel
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH][RESEND] PV drivers for HVMguests
  2006-11-01 23:55                                 ` [PATCH][RESEND] PV drivers for HVMguests Kasai Takanori
@ 2006-11-02 10:01                                   ` Ian Campbell
  0 siblings, 0 replies; 22+ messages in thread
From: Ian Campbell @ 2006-11-02 10:01 UTC (permalink / raw)
  To: Kasai Takanori; +Cc: xen-devel

On Thu, 2006-11-02 at 08:55 +0900, Kasai Takanori wrote:
> Hi Ian,
> 
> I confirmed this patch.
> However, this patch has not been applied yet.
> 
> Do you think that this patch has another problem?
> If this patch has no problem, could you apply this patch?

Sorry, I simply forgot. I'll get to it today.

Ian.

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2006-11-02 10:01 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-18 13:51 [PATCH][RESEND] PV drivers for HVM guests Ky Srinivasan
2006-10-18 23:56 ` Doi.Tsunehisa
2006-10-19 13:53   ` Ky Srinivasan
2006-10-20 10:12     ` Doi.Tsunehisa
2006-10-20 13:54       ` Ky Srinivasan
2006-10-23  1:45         ` Doi.Tsunehisa
2006-10-24  2:54           ` DOI Tsunehisa
2006-10-24 15:26             ` Ian Campbell
2006-10-24 23:54               ` Doi.Tsunehisa
2006-10-25  3:11                 ` Doi.Tsunehisa
2006-10-25 11:03                   ` Ian Campbell
2006-10-26  0:13                     ` Doi.Tsunehisa
2006-10-26  3:58                       ` Doi.Tsunehisa
2006-10-26  6:37                         ` Doi.Tsunehisa
2006-10-26 14:15                         ` Ian Campbell
2006-10-27  4:11                           ` [Xen-devel][PATCH][RESEND] " Doi.Tsunehisa
2006-10-27  9:40                             ` [PATCH][RESEND] " Ian Campbell
     [not found]                           ` <00a201c6f96a$811feac0$dab2220a@VF03007L>
     [not found]                             ` <1161943070.13318.53.camel@localhost.localdomain>
2006-10-27 11:43                               ` Kasai Takanori
     [not found]                               ` <03b301c6fa5a$8cc725a0$dab2220a@VF03007L>
2006-11-01 23:55                                 ` [PATCH][RESEND] PV drivers for HVMguests Kasai Takanori
2006-11-02 10:01                                   ` Ian Campbell
2006-10-25 11:03                 ` [PATCH][RESEND] PV drivers for HVM guests Ian Campbell
2006-10-26  0:16                   ` Doi.Tsunehisa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.