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

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.