[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] PV drivers for HVM guests



Hi all,

  I found some issue with my old patch.

  + Fix do_exit() faker type
    - can't compile on linux-2.6.10 and 2.6.11
    - do_exit() faker is mismatched with original header.
    - do_exit type changed after linux-2.6.10
      <  asmlinkage NORET_TYPE void do_exit(long code);
      >  fastcall NORET_TYPE void do_exit(long code);
  + Fix compat-include/linun/mutex.h about version checker
    - change reference version from 2.6.16 to 2.6.15

DOI Tsunehisa wrote:
> Hi all,
> 
> DOI Tsunehisa wrote:
>>   I modified Ian's patch for RHEL4.
>>
>>   We've tested compiling and attaching them on RHEL4. In our simple
>> test, PV-on-HVM VBD/VNIF drivers work on RHEL4 original kernel.
> 
>   I checked several version of kernel source, and modified the patch.
> 
>   This patch is modified from Ian's patch:
> 
>   + move compat.c from xenbus to platform-pci
>     - platform-pci needs vmalloc_to_pfn() realized in compat.c
>       * platform-pci is inserted before xenbus insertion.
>   + append schedule_timeout_interruptible() to compat.c
>     - the code was copied from linux/kernel/timer.c
>   + append do_exit() faker to compat.c
>     - the faker was implemented using complete_and_exit()
>   + delete vmalloc_to_page() from compat.c
>     - vmalloc_to_page() already exists in linux-2.6.0 kernel.
>   + conferm version for several features
>     - do conferm version about "TODO: conferm version"
> 
>   We've tested compiling and attaching them on RHEL4. And they
> work on RHEL4 in same test.
> 
> Thanks,
> - Doi Tsunehisa
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID 6e075156ea4603c81d1ebd37bdb2fea00eb9f026
# Parent  f14a67a35becfb8fb9b455a219fd1a7c942bc21d
Modify for backporting PV-on-HVM drivers

Signed-off-by: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@xxxxxxxxxxxxxx>

diff -r f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Oct 12 
17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Thu Oct 12 17:53:51 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Fri Oct 13 09:06:45 
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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/core/features.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/features.c  Thu Oct 12 17:53:51 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/features.c  Fri Oct 13 09:06:45 
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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Thu Oct 12 17:53:51 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Fri Oct 13 09:06:45 
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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Oct 12 
17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Thu Oct 12 
17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Thu Oct 12 
17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Thu Oct 12 
17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Thu Oct 12 
17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
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 Thu Oct 
12 17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h Fri Oct 
13 09:06:45 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 f14a67a35bec -r 6e075156ea46 linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Thu Oct 12 17:53:51 2006 +0100
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Fri Oct 13 09:06:45 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 f14a67a35bec -r 6e075156ea46 unmodified_drivers/linux-2.6/overrides.mk
--- a/unmodified_drivers/linux-2.6/overrides.mk Thu Oct 12 17:53:51 2006 +0100
+++ b/unmodified_drivers/linux-2.6/overrides.mk Fri Oct 13 09:06:45 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 f14a67a35bec -r 6e075156ea46 
unmodified_drivers/linux-2.6/platform-pci/Kbuild
--- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild  Thu Oct 12 17:53:51 
2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild  Fri Oct 13 09:06:45 
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 f14a67a35bec -r 6e075156ea46 
unmodified_drivers/linux-2.6/platform-pci/evtchn.c
--- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c        Thu Oct 12 
17:53:51 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c        Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Thu Oct 12 
17:53:51 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
unmodified_drivers/linux-2.6/platform-pci/xen_support.c
--- a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Thu Oct 12 
17:53:51 2006 +0100
+++ b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
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    Fri Oct 13 09:06:45 
2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r f14a67a35bec -r 6e075156ea46 
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   
Fri Oct 13 09:06:45 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 f14a67a35bec -r 6e075156ea46 
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   
Fri Oct 13 09:06:45 2006 +0900
@@ -0,0 +1,14 @@
+#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_present(pud)        1
+#define PTRS_PER_PUD            1
+
+#endif /* _PGTABLE_NOPUD_H */
diff -r f14a67a35bec -r 6e075156ea46 
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      Fri Oct 13 
09:06:45 2006 +0900
@@ -0,0 +1,52 @@
+#ifndef COMPAT_INCLUDE_COMPAT_H
+#define COMPAT_INCLUDE_COMPAT_H
+
+#include <linux/version.h>
+
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+
+#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.
+ */
+static inline void *kzalloc(size_t size, int flags)
+{
+        void *ret = kmalloc(size, flags);
+        if (ret)
+                memset(ret, 0, size);
+        return ret;
+}
+#endif
+
+#if defined(__LINUX_COMPILER_H) && !defined(__always_inline)
+#define __always_inline inline
+#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_MM_H) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+unsigned long vmalloc_to_pfn(void *addr);
+#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 LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+signed long __sched schedule_timeout_interruptible(signed long timeout);
+#endif
+
+#endif /* !COMPAT_INCLUDE_COMPAT_H */
diff -r f14a67a35bec -r 6e075156ea46 
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    Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
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 Fri Oct 13 
09:06:45 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 f14a67a35bec -r 6e075156ea46 
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    Fri Oct 13 09:06:45 
2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r f14a67a35bec -r 6e075156ea46 
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        Fri Oct 13 
09:06:45 2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r f14a67a35bec -r 6e075156ea46 
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        Fri Oct 13 
09:06:45 2006 +0900
@@ -0,0 +1,52 @@
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/highmem.h>
+#include <linux/module.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,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)
+/*
+ * 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 f14a67a35bec -r 6e075156ea46 
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      Fri Oct 13 09:06:45 
2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.