WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] Please try PV-on-HVM on IPF

To: xen-ia64-devel <xen-ia64-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-ia64-devel] Please try PV-on-HVM on IPF
From: DOI Tsunehisa <Doi.Tsunehisa@xxxxxxxxxxxxxx>
Date: Mon, 16 Oct 2006 21:31:22 +0900
Delivery-date: Mon, 16 Oct 2006 05:32:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)
Hi all,

  We've ported PV-on-HVM drivers for IPF. But I think that
only few tries it. Thus, I try to describe to use it.

  And I attach several patches about PV-on-HVM.

    + fix-warning.patch
      - warning fix for HVM PV driver
    + notsafe-comment.patch
      - add not-SMP-safe comment about PV-on-HVM
      - to take Isaku's suggestion.
    + pv-backport.patch (preliminary)
      - current HVM PV driver for only 2.6.16 or 2.6.16.* kernel
      - this is preliminary patch for backporting to before 2.6.16
        kernel
      - we tested only compiling on RHEL4.

[Usage of PV-on-HVM]

  1) get xen-ia64-unstable.hg tree (after cs:11805) and built it.

  2) create a guest system image.
     - simply, install guest system on VT-i domain

  3) build linux-2.6.16 kernel for guest system
     - get linux-2.6.16 kernel source and build

  4) change guest kernel in the image to linux-2.6.16 kernel
     - edit config file of boot loader

  5) build PV-on-HVM drivers
     # cd xen-ia64-unstable.hg/unmodified_drivers/linux-2.6
     # sh mkbuildtree
     # make -C /usr/src/linux-2.6.16 M=$PWD modules

  6) copy the drivers to guest system image
     - mount guest system image with lomount command.
     - copy the drivers to guest system image
       # cp -p */*.ko guest_system...

  7) start VT-i domain

  8) attach drivers
    domvti# insmod xen-platform-pci.ko
    domvti# insmod xenbus.ko
    domvti# insmod xen-vbd.ko
    domvti# insmod xen-vnif.ko

  9) attach devices with xm block-attach/network-attach
     - this operation is same for dom-u

Thanks,
- Tsunehisa Doi
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID 199aa46b3aa2bd3e9e684344e000d4ad40177541
# Parent  bf0a6f241c5eb7bea8b178b490ed32178c7b5bff
warning fix for HVM PV driver

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

diff -r bf0a6f241c5e -r 199aa46b3aa2 
linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c      Mon Oct 16 20:00:12 
2006 +0900
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c      Mon Oct 16 20:20:16 
2006 +0900
@@ -36,8 +36,10 @@ unsigned long
 unsigned long
 xencomm_vaddr_to_paddr(unsigned long vaddr)
 {
+#ifndef CONFIG_VMX_GUEST
        struct page *page;
        struct vm_area_struct *vma;
+#endif
 
        if (vaddr == 0)
                return 0;
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID bf0a6f241c5eb7bea8b178b490ed32178c7b5bff
# Parent  fcd746cf4647e06b8e88e620c29610ba43e3ad7c
Add not-SMP-safe comment about PV-on-HVM

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

diff -r fcd746cf4647 -r bf0a6f241c5e xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Sat Oct 14 18:10:08 2006 -0600
+++ b/xen/arch/ia64/xen/mm.c    Mon Oct 16 20:00:12 2006 +0900
@@ -400,6 +400,7 @@ gmfn_to_mfn_foreign(struct domain *d, un
 
        // This function may be called from __gnttab_copy()
        // during destruction of VT-i domain with PV-on-HVM driver.
+       // ** FIXME: This is not SMP-safe yet about p2m table. **
        if (unlikely(d->arch.mm.pgd == NULL)) {
                if (VMX_DOMAIN(d->vcpu[0]))
                        return INVALID_MFN;
diff -r fcd746cf4647 -r bf0a6f241c5e xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c  Sat Oct 14 18:10:08 2006 -0600
+++ b/xen/arch/ia64/xen/vhpt.c  Mon Oct 16 20:00:12 2006 +0900
@@ -216,6 +216,7 @@ void vcpu_flush_vtlb_all(struct vcpu *v)
                   grant_table share page from guest_physmap_remove_page()
                   in arch_memory_op() XENMEM_add_to_physmap to realize
                   PV-on-HVM feature. */
+               /* FIXME: This is not SMP-safe yet about p2m table */
                /* Purge vTLB for VT-i domain */
                thash_purge_all(v);
        }
# HG changeset patch
# User Doi.Tsunehisa@xxxxxxxxxxxxxx
# Node ID 7089d11a9e0b723079c83697c529970d7b3b0750
# Parent  199aa46b3aa2bd3e9e684344e000d4ad40177541
Modify for PV-on-HVM backport

diff -r 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c
--- a/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c      Mon Oct 16 20:20:16 
2006 +0900
+++ b/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c      Mon Oct 16 20:21:40 
2006 +0900
@@ -22,6 +22,10 @@
 #include <asm/page.h>
 #include <asm/xen/xencomm.h>
 
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
+
 static int xencomm_debug = 0;
 
 static unsigned long kernel_start_pa;
diff -r 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Oct 16 
20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Mon Oct 16 20:20:16 
2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Mon Oct 16 20:21:40 
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 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/drivers/xen/core/features.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/features.c  Mon Oct 16 20:20:16 
2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/core/features.c  Mon Oct 16 20:21:40 
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 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Mon Oct 16 20:20:16 
2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c    Mon Oct 16 20:21:40 
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 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Oct 16 
20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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 16 
20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c   Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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 16 
20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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 16 
20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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 16 
20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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 
16 20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/synch_bitops.h Mon Oct 
16 20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Mon Oct 16 20:20:16 
2006 +0900
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Mon Oct 16 20:21:40 
2006 +0900
@@ -37,8 +37,13 @@
 # error "please don't include this file directly"
 #endif
 
+#include <linux/err.h>
 #include <asm/xen/xcom_hcall.h>
 struct xencomm_handle;
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 /*
  * Assembler stubs for hyper-calls.
diff -r 199aa46b3aa2 -r 7089d11a9e0b 
linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h       Mon Oct 16 
20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h       Mon Oct 16 
20:21:40 2006 +0900
@@ -20,6 +20,10 @@
 #define _LINUX_XENCOMM_H_
 
 #include <xen/interface/xencomm.h>
+
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
+#endif
 
 #define XENCOMM_MINI_ADDRS 3
 struct xencomm_mini {
diff -r 199aa46b3aa2 -r 7089d11a9e0b linux-2.6-xen-sparse/include/xen/xenbus.h
--- a/linux-2.6-xen-sparse/include/xen/xenbus.h Mon Oct 16 20:20:16 2006 +0900
+++ b/linux-2.6-xen-sparse/include/xen/xenbus.h Mon Oct 16 20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b unmodified_drivers/linux-2.6/overrides.mk
--- a/unmodified_drivers/linux-2.6/overrides.mk Mon Oct 16 20:20:16 2006 +0900
+++ b/unmodified_drivers/linux-2.6/overrides.mk Mon Oct 16 20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
unmodified_drivers/linux-2.6/platform-pci/Kbuild
--- a/unmodified_drivers/linux-2.6/platform-pci/Kbuild  Mon Oct 16 20:20:16 
2006 +0900
+++ b/unmodified_drivers/linux-2.6/platform-pci/Kbuild  Mon Oct 16 20:21:40 
2006 +0900
@@ -4,7 +4,13 @@ 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
 
 # Can we do better ?
 ifeq ($(ARCH),ia64)
diff -r 199aa46b3aa2 -r 7089d11a9e0b 
unmodified_drivers/linux-2.6/platform-pci/evtchn.c
--- a/unmodified_drivers/linux-2.6/platform-pci/evtchn.c        Mon Oct 16 
20:20:16 2006 +0900
+++ b/unmodified_drivers/linux-2.6/platform-pci/evtchn.c        Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
--- a/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Mon Oct 16 
20:20:16 2006 +0900
+++ b/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c  Mon Oct 16 
20:21:40 2006 +0900
@@ -41,6 +41,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 199aa46b3aa2 -r 7089d11a9e0b 
unmodified_drivers/linux-2.6/platform-pci/xen_support.c
--- a/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Mon Oct 16 
20:20:16 2006 +0900
+++ b/unmodified_drivers/linux-2.6/platform-pci/xen_support.c   Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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    Mon Oct 16 20:21:40 
2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r 199aa46b3aa2 -r 7089d11a9e0b 
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   
Mon Oct 16 20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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   
Mon Oct 16 20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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      Mon Oct 16 
20:21:40 2006 +0900
@@ -0,0 +1,73 @@
+#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 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_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_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 199aa46b3aa2 -r 7089d11a9e0b 
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    Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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 Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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    Mon Oct 16 20:21:40 
2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r 199aa46b3aa2 -r 7089d11a9e0b 
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        Mon Oct 16 
20:21:40 2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
diff -r 199aa46b3aa2 -r 7089d11a9e0b 
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        Mon Oct 16 
20:21:40 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 199aa46b3aa2 -r 7089d11a9e0b 
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      Mon Oct 16 20:21:40 
2006 +0900
@@ -0,0 +1,3 @@
+ifneq ($(KERNELRELEASE),)
+include $(src)/Kbuild
+endif
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel