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-changelog

[Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] merge with linux-2.6.18-xen.hg
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 07 Sep 2007 09:10:31 -0700
Delivery-date: Fri, 07 Sep 2007 09:12:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1187283526 21600
# Node ID 60d8f0befd1810571b562a5120ced76868c86096
# Parent  41b7a0d7c2adcf6b77602ecf37883c98c5d20acc
# Parent  05c22f28202356d65d4f62692ff7c43bcdb0827a
merge with linux-2.6.18-xen.hg
---
 include/asm-i386/mach-xen/asm/floppy.h      |  147 -------------------
 include/asm-x86_64/mach-xen/asm/floppy.h    |  206 ----------------------------
 arch/i386/kernel/setup-xen.c                |    5 
 arch/powerpc/platforms/xen/hcall.c          |   56 +++----
 arch/powerpc/platforms/xen/setup.h          |    2 
 arch/x86_64/kernel/setup-xen.c              |    4 
 drivers/block/floppy.c                      |   14 +
 drivers/pnp/manager.c                       |   32 +---
 drivers/xen/core/reboot.c                   |    3 
 drivers/xen/core/xencomm.c                  |   20 +-
 drivers/xen/netfront/netfront.c             |   43 ++---
 drivers/xen/xenbus/xenbus_client.c          |    1 
 drivers/xen/xenbus/xenbus_comms.c           |    1 
 drivers/xen/xenbus/xenbus_probe.c           |    1 
 include/asm-i386/mach-xen/asm/hypercall.h   |    3 
 include/asm-i386/mach-xen/asm/io.h          |    2 
 include/asm-x86_64/mach-xen/asm/hypercall.h |    3 
 include/asm-x86_64/mach-xen/asm/io.h        |    2 
 include/xen/cpu_hotplug.h                   |    3 
 include/xen/xencomm.h                       |   42 ++++-
 20 files changed, 139 insertions(+), 451 deletions(-)

diff -r 41b7a0d7c2ad -r 60d8f0befd18 arch/i386/kernel/setup-xen.c
--- a/arch/i386/kernel/setup-xen.c      Sun Aug 12 15:04:04 2007 -0600
+++ b/arch/i386/kernel/setup-xen.c      Thu Aug 16 10:58:46 2007 -0600
@@ -1826,6 +1826,11 @@ void __init setup_arch(char **cmdline_p)
                     virt_to_mfn(pfn_to_mfn_frame_list_list);
        }
 
+       /* Mark all ISA DMA channels in-use - using them wouldn't work. */
+       for (i = 0; i < MAX_DMA_CHANNELS; ++i)
+               if (i != 4 && request_dma(i, "xen") != 0)
+                       BUG();
+
        /*
         * NOTE: at this point the bootmem allocator is fully available.
         */
diff -r 41b7a0d7c2ad -r 60d8f0befd18 arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c        Sun Aug 12 15:04:04 2007 -0600
+++ b/arch/powerpc/platforms/xen/hcall.c        Thu Aug 16 10:58:46 2007 -0600
@@ -56,7 +56,7 @@
 
 int HYPERVISOR_console_io(int cmd, int count, char *str)
 {
-       void *desc;
+       struct xencomm_handle *desc;
        int rc;
 
        desc = xencomm_map_no_alloc(str, count);
@@ -76,7 +76,8 @@ int HYPERVISOR_event_channel_op(int cmd,
 {
        int rc;
 
-       void *desc = xencomm_map_no_alloc(op, sizeof(evtchn_op_t));
+       struct xencomm_handle *desc =
+               xencomm_map_no_alloc(op, sizeof(evtchn_op_t));
        if (desc == NULL)
                return -EINVAL;
 
@@ -92,7 +93,7 @@ EXPORT_SYMBOL(HYPERVISOR_event_channel_o
 
 int HYPERVISOR_xen_version(int cmd, void *arg)
 {
-       void *desc;
+       struct xencomm_handle *desc;
        const unsigned long hcall = __HYPERVISOR_xen_version;
        int argsize;
        int rc;
@@ -144,7 +145,8 @@ EXPORT_SYMBOL(HYPERVISOR_xen_version);
 
 int HYPERVISOR_physdev_op(int cmd, void *op)
 {
-       void *desc = xencomm_map_no_alloc(op, sizeof(physdev_op_t));
+       struct xencomm_handle *desc =
+               xencomm_map_no_alloc(op, sizeof(physdev_op_t));
        int rc;
 
        if (desc == NULL)
@@ -163,8 +165,8 @@ int HYPERVISOR_sched_op(int cmd, void *a
 {
        int argsize = 0;
        int rc = -EINVAL;
-       void *desc;
-       evtchn_port_t *ports = NULL;
+       struct xencomm_handle *desc;
+       struct xencomm_handle *ports = NULL;
 
        switch (cmd) {
        case SCHEDOP_yield:
@@ -187,7 +189,7 @@ int HYPERVISOR_sched_op(int cmd, void *a
                if (ports == NULL)
                        return -ENOMEM;
 
-               set_xen_guest_handle(sched_poll.ports, ports);
+               set_xen_guest_handle(sched_poll.ports, (evtchn_port_t *)ports);
                memcpy(arg, &sched_poll, sizeof(sched_poll));
 
                }
@@ -222,7 +224,7 @@ int HYPERVISOR_suspend(unsigned long sre
        struct sched_shutdown sched_shutdown = {
                .reason = SHUTDOWN_suspend,
        };
-       void *desc;
+       struct xencomm_handle *desc;
 
        desc = xencomm_map_no_alloc(&sched_shutdown, sizeof(struct 
sched_shutdown));
 
@@ -234,7 +236,7 @@ int HYPERVISOR_kexec_op(unsigned long op
 int HYPERVISOR_kexec_op(unsigned long op, void *args)
 {
        unsigned long argsize;
-       void *desc;
+       struct xencomm_handle *desc;
 
        switch (op) {
                case KEXEC_CMD_kexec_get_range:
@@ -316,8 +318,8 @@ static int xenppc_privcmd_domctl(privcmd
 {
        xen_domctl_t kern_op;
        xen_domctl_t __user *user_op = (xen_domctl_t __user *)hypercall->arg[0];
-       void *op_desc;
-       void *desc = NULL;
+       struct xencomm_handle *op_desc;
+       struct xencomm_handle *desc = NULL;
        int ret = 0;
 
        if (copy_from_user(&kern_op, user_op, sizeof(xen_domctl_t)))
@@ -349,7 +351,7 @@ static int xenppc_privcmd_domctl(privcmd
                        ret = -ENOMEM;
 
                set_xen_guest_handle(kern_op.u.getmemlist.buffer,
-                                    desc);
+                                    (void *)desc);
                break;
        case XEN_DOMCTL_getpageframeinfo:
                break;
@@ -362,7 +364,7 @@ static int xenppc_privcmd_domctl(privcmd
                        ret = -ENOMEM;
 
                set_xen_guest_handle(kern_op.u.getpageframeinfo2.array,
-                                    desc);
+                                    (void *)desc);
                break;
        case XEN_DOMCTL_shadow_op:
 
@@ -376,7 +378,7 @@ static int xenppc_privcmd_domctl(privcmd
                                ret = -ENOMEM;
 
                        set_xen_guest_handle(kern_op.u.shadow_op.dirty_bitmap,
-                                        desc);
+                                        (void *)desc);
                }
                break;
        case XEN_DOMCTL_max_mem:
@@ -391,7 +393,7 @@ static int xenppc_privcmd_domctl(privcmd
                        ret = -ENOMEM;
 
                set_xen_guest_handle(kern_op.u.vcpucontext.ctxt,
-                                    desc);
+                                    (void *)desc);
                break;
        case XEN_DOMCTL_getvcpuinfo:
                break;
@@ -405,7 +407,7 @@ static int xenppc_privcmd_domctl(privcmd
                        ret = -ENOMEM;
 
                set_xen_guest_handle(kern_op.u.vcpuaffinity.cpumap.bitmap,
-                                    desc);
+                                    (void *)desc);
                break;
        case XEN_DOMCTL_max_vcpus:
        case XEN_DOMCTL_scheduler_op:
@@ -442,8 +444,8 @@ static int xenppc_privcmd_sysctl(privcmd
 {
        xen_sysctl_t kern_op;
        xen_sysctl_t __user *user_op = (xen_sysctl_t __user *)hypercall->arg[0];
-       struct xencomm_desc *op_desc;
-       void *desc = NULL;
+       struct xencomm_handle *op_desc;
+       struct xencomm_handle *desc = NULL;
        int ret = 0;
 
        if (copy_from_user(&kern_op, user_op, sizeof(xen_sysctl_t)))
@@ -470,7 +472,7 @@ static int xenppc_privcmd_sysctl(privcmd
                        ret = -ENOMEM;
 
                set_xen_guest_handle(kern_op.u.readconsole.buffer,
-                                    desc);
+                                    (void *)desc);
                break;
        case XEN_SYSCTL_tbuf_op:
        case XEN_SYSCTL_physinfo:
@@ -491,7 +493,7 @@ static int xenppc_privcmd_sysctl(privcmd
                        ret = -ENOMEM;
 
                set_xen_guest_handle(kern_op.u.getdomaininfolist.buffer,
-                                    desc);
+                                    (void *)desc);
                break;
        default:
                printk(KERN_ERR "%s: unknown sysctl cmd %d\n", __func__, 
kern_op.cmd);
@@ -517,8 +519,8 @@ static int xenppc_privcmd_platform_op(pr
        xen_platform_op_t kern_op;
        xen_platform_op_t __user *user_op =
                        (xen_platform_op_t __user *)hypercall->arg[0];
-       void *op_desc;
-       void *desc = NULL;
+       struct xencomm_handle *op_desc;
+       struct xencomm_handle *desc = NULL;
        int ret = 0;
 
        if (copy_from_user(&kern_op, user_op, sizeof(xen_platform_op_t)))
@@ -566,7 +568,7 @@ int HYPERVISOR_memory_op(unsigned int cm
 int HYPERVISOR_memory_op(unsigned int cmd, void *arg)
 {
        int ret;
-       void *op_desc;
+       struct xencomm_handle *op_desc;
        xen_memory_reservation_t *mop;
 
 
@@ -581,7 +583,7 @@ int HYPERVISOR_memory_op(unsigned int cm
        case XENMEM_increase_reservation:
        case XENMEM_decrease_reservation:
        case XENMEM_populate_physmap: {
-               void *desc = NULL;
+               struct xencomm_handle *desc = NULL;
 
                if (xen_guest_handle(mop->extent_start)) {
                        desc = xencomm_map(
@@ -595,7 +597,7 @@ int HYPERVISOR_memory_op(unsigned int cm
                        }
 
                        set_xen_guest_handle(mop->extent_start,
-                                            desc);
+                                            (void *)desc);
                }
 
                ret = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_memory_op),
@@ -650,7 +652,7 @@ static int xenppc_privcmd_version(privcm
 
 static int xenppc_privcmd_event_channel_op(privcmd_hypercall_t *hypercall)
 {
-       struct xencomm_desc *desc;
+       struct xencomm_handle *desc;
        unsigned int argsize;
        int ret;
 
@@ -856,7 +858,7 @@ int HYPERVISOR_vcpu_op(int cmd, int vcpu
 {
        int argsize;
        const unsigned long hcall = __HYPERVISOR_vcpu_op;
-       void *desc;
+       struct xencomm_handle *desc;
        int rc;
 
        switch (cmd) {
diff -r 41b7a0d7c2ad -r 60d8f0befd18 arch/powerpc/platforms/xen/setup.h
--- a/arch/powerpc/platforms/xen/setup.h        Sun Aug 12 15:04:04 2007 -0600
+++ b/arch/powerpc/platforms/xen/setup.h        Thu Aug 16 10:58:46 2007 -0600
@@ -40,8 +40,6 @@ static inline u64 jiffies_to_ns(unsigned
        return j * (1000000000UL / HZ);
 }
 
-#define xen_guest_handle(hnd)  ((hnd).p)
-
 extern struct page *alloc_foreign_page(void);
 extern void free_foreign_page(struct page *page);
 
diff -r 41b7a0d7c2ad -r 60d8f0befd18 arch/x86_64/kernel/setup-xen.c
--- a/arch/x86_64/kernel/setup-xen.c    Sun Aug 12 15:04:04 2007 -0600
+++ b/arch/x86_64/kernel/setup-xen.c    Thu Aug 16 10:58:46 2007 -0600
@@ -863,6 +863,10 @@ void __init setup_arch(char **cmdline_p)
                                virt_to_mfn(pfn_to_mfn_frame_list_list);
                }
 
+               /* Mark all ISA DMA channels in-use - using them wouldn't work. 
*/
+               for (i = 0; i < MAX_DMA_CHANNELS; ++i)
+                       if (i != 4 && request_dma(i, "xen") != 0)
+                               BUG();
        }
 
        if (!is_initial_xendomain()) {
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/block/floppy.c
--- a/drivers/block/floppy.c    Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/block/floppy.c    Thu Aug 16 10:58:46 2007 -0600
@@ -4392,11 +4392,15 @@ static int floppy_grab_irq_and_dma(void)
        if (fd_request_dma()) {
                DPRINT("Unable to grab DMA%d for the floppy driver\n",
                       FLOPPY_DMA);
-               fd_free_irq();
-               spin_lock_irqsave(&floppy_usage_lock, flags);
-               usage_count--;
-               spin_unlock_irqrestore(&floppy_usage_lock, flags);
-               return -1;
+               if (can_use_virtual_dma & 2)
+                       use_virtual_dma = can_use_virtual_dma = 1;
+               if (!(can_use_virtual_dma & 1)) {
+                       fd_free_irq();
+                       spin_lock_irqsave(&floppy_usage_lock, flags);
+                       usage_count--;
+                       spin_unlock_irqrestore(&floppy_usage_lock, flags);
+                       return -1;
+               }
        }
 
        for (fdc = 0; fdc < N_FDC; fdc++) {
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/pnp/manager.c
--- a/drivers/pnp/manager.c     Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/pnp/manager.c     Thu Aug 16 10:58:46 2007 -0600
@@ -168,7 +168,7 @@ static int pnp_assign_irq(struct pnp_dev
        return 0;
 }
 
-static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
+static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
 {
        resource_size_t *start, *end;
        unsigned long *flags;
@@ -179,18 +179,14 @@ static int pnp_assign_dma(struct pnp_dev
                1, 3, 5, 6, 7, 0, 2, 4
        };
 
-       if (!dev || !rule)
-               return -EINVAL;
-
        if (idx >= PNP_MAX_DMA) {
                pnp_err("More than 2 dmas is incompatible with pnp 
specifications.");
-               /* pretend we were successful so at least the manager won't try 
again */
-               return 1;
+               return;
        }
 
        /* check if this resource has been manually set, if so skip */
        if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO))
-               return 1;
+               return;
 
        start = &dev->res.dma_resource[idx].start;
        end = &dev->res.dma_resource[idx].end;
@@ -199,20 +195,18 @@ static int pnp_assign_dma(struct pnp_dev
        /* set the initial values */
        *flags |= rule->flags | IORESOURCE_DMA;
        *flags &=  ~IORESOURCE_UNSET;
-
-       if (!rule->map) {
-               *flags |= IORESOURCE_DISABLED;
-               return 1; /* skip disabled resource requests */
-       }
 
        for (i = 0; i < 8; i++) {
                if(rule->map & (1<<xtab[i])) {
                        *start = *end = xtab[i];
                        if(pnp_check_dma(dev, idx))
-                               return 1;
-               }
-       }
-       return 0;
+                               return;
+               }
+       }
+#ifdef MAX_DMA_CHANNELS
+       *start = *end = MAX_DMA_CHANNELS;
+#endif
+       *flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED;
 }
 
 /**
@@ -331,8 +325,7 @@ static int pnp_assign_resources(struct p
                        irq = irq->next;
                }
                while (dma) {
-                       if (!pnp_assign_dma(dev, dma, ndma))
-                               goto fail;
+                       pnp_assign_dma(dev, dma, ndma);
                        ndma++;
                        dma = dma->next;
                }
@@ -367,8 +360,7 @@ static int pnp_assign_resources(struct p
                        irq = irq->next;
                }
                while (dma) {
-                       if (!pnp_assign_dma(dev, dma, ndma))
-                               goto fail;
+                       pnp_assign_dma(dev, dma, ndma);
                        ndma++;
                        dma = dma->next;
                }
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/xen/core/reboot.c
--- a/drivers/xen/core/reboot.c Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/xen/core/reboot.c Thu Aug 16 10:58:46 2007 -0600
@@ -7,7 +7,10 @@
 #include <linux/sysrq.h>
 #include <asm/hypervisor.h>
 #include <xen/xenbus.h>
+#include <linux/kmod.h>
 #include <linux/kthread.h>
+#include <linux/slab.h>
+#include <linux/workqueue.h>
 
 #ifdef HAVE_XEN_PLATFORM_COMPAT_H
 #include <xen/platform-compat.h>
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/xen/core/xencomm.c
--- a/drivers/xen/core/xencomm.c        Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/xen/core/xencomm.c        Thu Aug 16 10:58:46 2007 -0600
@@ -23,6 +23,9 @@
 #include <asm/page.h>
 #include <xen/xencomm.h>
 #include <xen/interface/xen.h>
+#ifdef __ia64__
+#include <asm/xen/xencomm.h>   /* for is_kern_addr() */
+#endif
 
 static int xencomm_init(struct xencomm_desc *desc,
                        void *buffer, unsigned long bytes)
@@ -80,7 +83,7 @@ static struct xencomm_desc *xencomm_allo
        return desc;
 }
 
-void xencomm_free(void *desc)
+void xencomm_free(struct xencomm_handle *desc)
 {
        if (desc && !((ulong)desc & XENCOMM_INLINE_FLAG))
                free_page((unsigned long)__va(desc));
@@ -111,7 +114,7 @@ static int xencomm_create(void *buffer, 
        rc = xencomm_init(desc, buffer, bytes);
        if (rc) {
                printk("%s failure: %d\n", "xencomm_init", rc);
-               xencomm_free(desc);
+               xencomm_free((struct xencomm_handle *)__pa(desc));
                return rc;
        }
 
@@ -128,7 +131,7 @@ static int is_phys_contiguous(unsigned l
        return (addr < VMALLOC_START) || (addr >= VMALLOC_END);
 }
 
-static void *xencomm_create_inline(void *ptr)
+static struct xencomm_handle *xencomm_create_inline(void *ptr)
 {
        unsigned long paddr;
 
@@ -136,7 +139,7 @@ static void *xencomm_create_inline(void 
 
        paddr = (unsigned long)xencomm_pa(ptr);
        BUG_ON(paddr & XENCOMM_INLINE_FLAG);
-       return (void *)(paddr | XENCOMM_INLINE_FLAG);
+       return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG);
 }
 
 /* "mini" routine, for stack-based communications: */
@@ -146,6 +149,7 @@ static int xencomm_create_mini(void *buf
 {
        int rc = 0;
        struct xencomm_desc *desc;
+       BUG_ON(((unsigned long)xc_desc) % sizeof(*xc_desc) != 0);
 
        desc = (void *)xc_desc; 
 
@@ -157,7 +161,7 @@ static int xencomm_create_mini(void *buf
        return rc;
 }
 
-void *xencomm_map(void *ptr, unsigned long bytes)
+struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes)
 {
        int rc;
        struct xencomm_desc *desc;
@@ -170,10 +174,10 @@ void *xencomm_map(void *ptr, unsigned lo
        if (rc || desc == NULL)
                return NULL;
 
-       return (void *)__pa(desc);
+       return xencomm_pa(desc);
 }
 
-void *__xencomm_map_no_alloc(void *ptr, unsigned long bytes, 
+struct xencomm_handle *__xencomm_map_no_alloc(void *ptr, unsigned long bytes, 
                        struct xencomm_mini *xc_desc)
 {
        int rc;
@@ -188,5 +192,5 @@ void *__xencomm_map_no_alloc(void *ptr, 
        if (rc)
                return NULL;
  
-       return (void *)__pa(desc);
+       return xencomm_pa(desc);
 }
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/xen/netfront/netfront.c   Thu Aug 16 10:58:46 2007 -0600
@@ -99,6 +99,7 @@ static const int MODPARM_rx_flip = 0;
 #if defined(NETIF_F_GSO)
 #define HAVE_GSO                       1
 #define HAVE_TSO                       1 /* TSO is a subset of GSO */
+#define HAVE_CSUM_OFFLOAD              1
 static inline void dev_disable_gso_features(struct net_device *dev)
 {
        /* Turn off all GSO bits except ROBUST. */
@@ -106,6 +107,7 @@ static inline void dev_disable_gso_featu
        dev->features |= NETIF_F_GSO_ROBUST;
 }
 #elif defined(NETIF_F_TSO)
+#define HAVE_GSO                      0
 #define HAVE_TSO                       1
 
 /* Some older kernels cannot cope with incorrect checksums,
@@ -113,7 +115,7 @@ static inline void dev_disable_gso_featu
  * with the presence of NETIF_F_TSO but it appears to be a good first
  * approximiation.
  */
-#define HAVE_NO_CSUM_OFFLOAD           1
+#define HAVE_CSUM_OFFLOAD              0
 
 #define gso_size tso_size
 #define gso_segs tso_segs
@@ -138,8 +140,12 @@ static inline int netif_needs_gso(struct
                 unlikely(skb->ip_summed != CHECKSUM_HW));
 }
 #else
+#define HAVE_GSO                       0
+#define HAVE_TSO                       0
+#define HAVE_CSUM_OFFLOAD              0
 #define netif_needs_gso(dev, skb)      0
 #define dev_disable_gso_features(dev)  ((void)0)
+#define ethtool_op_set_tso(dev, data)  (-ENOSYS)
 #endif
 
 #define GRANT_INVALID_REF      0
@@ -412,13 +418,12 @@ again:
                goto abort_transaction;
        }
 
-#ifdef HAVE_NO_CSUM_OFFLOAD
-       err = xenbus_printf(xbt, dev->nodename, "feature-no-csum-offload", 
"%d", 1);
+       err = xenbus_printf(xbt, dev->nodename, "feature-no-csum-offload",
+                           "%d", !HAVE_CSUM_OFFLOAD);
        if (err) {
                message = "writing feature-no-csum-offload";
                goto abort_transaction;
        }
-#endif
 
        err = xenbus_printf(xbt, dev->nodename, "feature-sg", "%d", 1);
        if (err) {
@@ -426,13 +431,12 @@ again:
                goto abort_transaction;
        }
 
-#ifdef HAVE_TSO
-       err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d", 1);
+       err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d",
+                           HAVE_TSO);
        if (err) {
                message = "writing feature-gso-tcpv4";
                goto abort_transaction;
        }
-#endif
 
        err = xenbus_transaction_end(xbt, 0);
        if (err) {
@@ -983,7 +987,7 @@ static int network_start_xmit(struct sk_
                tx->flags |= NETTXF_data_validated;
 #endif
 
-#ifdef HAVE_TSO
+#if HAVE_TSO
        if (skb_shinfo(skb)->gso_size) {
                struct netif_extra_info *gso = (struct netif_extra_info *)
                        RING_GET_REQUEST(&np->tx, ++i);
@@ -1013,15 +1017,16 @@ static int network_start_xmit(struct sk_
        if (notify)
                notify_remote_via_irq(np->irq);
 
+       np->stats.tx_bytes += skb->len;
+       np->stats.tx_packets++;
+
+       /* Note: It is not safe to access skb after network_tx_buf_gc()! */
        network_tx_buf_gc(dev);
 
        if (!netfront_tx_slot_available(np))
                netif_stop_queue(dev);
 
        spin_unlock_irq(&np->tx_lock);
-
-       np->stats.tx_bytes += skb->len;
-       np->stats.tx_packets++;
 
        return 0;
 
@@ -1279,9 +1284,9 @@ static int xennet_set_skb_gso(struct sk_
                return -EINVAL;
        }
 
-#ifdef HAVE_TSO
+#if HAVE_TSO
        skb_shinfo(skb)->gso_size = gso->u.gso.size;
-#ifdef HAVE_GSO
+#if HAVE_GSO
        skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4;
 
        /* Header must be checked, and gso_segs computed. */
@@ -1701,7 +1706,6 @@ static int xennet_set_sg(struct net_devi
 
 static int xennet_set_tso(struct net_device *dev, u32 data)
 {
-#ifdef HAVE_TSO
        if (data) {
                struct netfront_info *np = netdev_priv(dev);
                int val;
@@ -1714,9 +1718,6 @@ static int xennet_set_tso(struct net_dev
        }
 
        return ethtool_op_set_tso(dev, data);
-#else
-       return -ENOSYS;
-#endif
 }
 
 static void xennet_set_features(struct net_device *dev)
@@ -1734,10 +1735,8 @@ static void xennet_set_features(struct n
        /* Before 2.6.9 TSO seems to be unreliable so do not enable it
         * on older kernels.
         */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
-       xennet_set_tso(dev, 1);
-#endif
-
+       if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9))
+               xennet_set_tso(dev, 1);
 }
 
 static int network_connect(struct net_device *dev)
@@ -1865,8 +1864,10 @@ static struct ethtool_ops network_ethtoo
        .set_tx_csum = ethtool_op_set_tx_csum,
        .get_sg = ethtool_op_get_sg,
        .set_sg = xennet_set_sg,
+#if HAVE_TSO
        .get_tso = ethtool_op_get_tso,
        .set_tso = xennet_set_tso,
+#endif
        .get_link = ethtool_op_get_link,
 };
 
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/xen/xenbus/xenbus_client.c
--- a/drivers/xen/xenbus/xenbus_client.c        Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/xen/xenbus/xenbus_client.c        Thu Aug 16 10:58:46 2007 -0600
@@ -30,6 +30,7 @@
  * IN THE SOFTWARE.
  */
 
+#include <linux/slab.h>
 #include <xen/evtchn.h>
 #include <xen/gnttab.h>
 #include <xen/xenbus.h>
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/xen/xenbus/xenbus_comms.c
--- a/drivers/xen/xenbus/xenbus_comms.c Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/xen/xenbus/xenbus_comms.c Thu Aug 16 10:58:46 2007 -0600
@@ -35,6 +35,7 @@
 #include <linux/sched.h>
 #include <linux/err.h>
 #include <linux/ptrace.h>
+#include <linux/workqueue.h>
 #include <xen/evtchn.h>
 #include <xen/xenbus.h>
 
diff -r 41b7a0d7c2ad -r 60d8f0befd18 drivers/xen/xenbus/xenbus_probe.c
--- a/drivers/xen/xenbus/xenbus_probe.c Sun Aug 12 15:04:04 2007 -0600
+++ b/drivers/xen/xenbus/xenbus_probe.c Thu Aug 16 10:58:46 2007 -0600
@@ -43,6 +43,7 @@
 #include <linux/mm.h>
 #include <linux/notifier.h>
 #include <linux/mutex.h>
+#include <linux/module.h>
 
 #include <asm/io.h>
 #include <asm/page.h>
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/asm-i386/mach-xen/asm/floppy.h
--- a/include/asm-i386/mach-xen/asm/floppy.h    Sun Aug 12 15:04:04 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Architecture specific parts of the Floppy driver
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995
- *
- * Modifications for Xen are Copyright (c) 2004, Keir Fraser.
- */
-#ifndef __ASM_XEN_I386_FLOPPY_H
-#define __ASM_XEN_I386_FLOPPY_H
-
-#include <linux/vmalloc.h>
-
-/* XEN: Hit DMA paths on the head. This trick from asm-m68k/floppy.h. */
-#include <asm/dma.h>
-#undef MAX_DMA_ADDRESS
-#define MAX_DMA_ADDRESS 0
-#define CROSS_64KB(a,s) (0)
-
-#define fd_inb(port)                   inb_p(port)
-#define fd_outb(value,port)            outb_p(value,port)
-
-#define fd_request_dma()        (0)
-#define fd_free_dma()           ((void)0)
-#define fd_enable_irq()         enable_irq(FLOPPY_IRQ)
-#define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
-#define fd_free_irq()          free_irq(FLOPPY_IRQ, NULL)
-#define fd_get_dma_residue()    (virtual_dma_count + virtual_dma_residue)
-#define fd_dma_setup(addr, size, mode, io) vdma_dma_setup(addr, size, mode, io)
-/*
- * Do not use vmalloc/vfree: floppy_release_irq_and_dma() gets called from
- * softirq context via motor_off_callback. A generic bug we happen to trigger.
- */
-#define fd_dma_mem_alloc(size) __get_free_pages(GFP_KERNEL, get_order(size))
-#define fd_dma_mem_free(addr, size) free_pages(addr, get_order(size))
-
-static int virtual_dma_count;
-static int virtual_dma_residue;
-static char *virtual_dma_addr;
-static int virtual_dma_mode;
-static int doing_pdma;
-
-static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
-{
-       register unsigned char st;
-       register int lcount;
-       register char *lptr;
-
-       if (!doing_pdma)
-               return floppy_interrupt(irq, dev_id, regs);
-
-       st = 1;
-       for(lcount=virtual_dma_count, lptr=virtual_dma_addr; 
-           lcount; lcount--, lptr++) {
-               st=inb(virtual_dma_port+4) & 0xa0 ;
-               if(st != 0xa0) 
-                       break;
-               if(virtual_dma_mode)
-                       outb_p(*lptr, virtual_dma_port+5);
-               else
-                       *lptr = inb_p(virtual_dma_port+5);
-       }
-       virtual_dma_count = lcount;
-       virtual_dma_addr = lptr;
-       st = inb(virtual_dma_port+4);
-
-       if(st == 0x20)
-               return IRQ_HANDLED;
-       if(!(st & 0x20)) {
-               virtual_dma_residue += virtual_dma_count;
-               virtual_dma_count=0;
-               doing_pdma = 0;
-               floppy_interrupt(irq, dev_id, regs);
-               return IRQ_HANDLED;
-       }
-       return IRQ_HANDLED;
-}
-
-static void fd_disable_dma(void)
-{
-       doing_pdma = 0;
-       virtual_dma_residue += virtual_dma_count;
-       virtual_dma_count=0;
-}
-
-static int fd_request_irq(void)
-{
-       return request_irq(FLOPPY_IRQ, floppy_hardint,
-                          IRQF_DISABLED, "floppy", NULL);
-}
-
-static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
-{
-       doing_pdma = 1;
-       virtual_dma_port = io;
-       virtual_dma_mode = (mode  == DMA_MODE_WRITE);
-       virtual_dma_addr = addr;
-       virtual_dma_count = size;
-       virtual_dma_residue = 0;
-       return 0;
-}
-
-/* XEN: This trick to force 'virtual DMA' is from include/asm-m68k/floppy.h. */
-#define FDC1 xen_floppy_init()
-static int FDC2 = -1;
-
-static int xen_floppy_init(void)
-{
-       use_virtual_dma = 1;
-       can_use_virtual_dma = 1;
-       return 0x3f0;
-}
-
-/*
- * Floppy types are stored in the rtc's CMOS RAM and so rtc_lock
- * is needed to prevent corrupted CMOS RAM in case "insmod floppy"
- * coincides with another rtc CMOS user.               Paul G.
- */
-#define FLOPPY0_TYPE   ({                              \
-       unsigned long flags;                            \
-       unsigned char val;                              \
-       spin_lock_irqsave(&rtc_lock, flags);            \
-       val = (CMOS_READ(0x10) >> 4) & 15;              \
-       spin_unlock_irqrestore(&rtc_lock, flags);       \
-       val;                                            \
-})
-
-#define FLOPPY1_TYPE   ({                              \
-       unsigned long flags;                            \
-       unsigned char val;                              \
-       spin_lock_irqsave(&rtc_lock, flags);            \
-       val = CMOS_READ(0x10) & 15;                     \
-       spin_unlock_irqrestore(&rtc_lock, flags);       \
-       val;                                            \
-})
-
-#define N_FDC 2
-#define N_DRIVE 8
-
-#define FLOPPY_MOTOR_MASK 0xf0
-
-#define EXTRA_FLOPPY_PARAMS
-
-#endif /* __ASM_XEN_I386_FLOPPY_H */
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/asm-i386/mach-xen/asm/hypercall.h
--- a/include/asm-i386/mach-xen/asm/hypercall.h Sun Aug 12 15:04:04 2007 -0600
+++ b/include/asm-i386/mach-xen/asm/hypercall.h Thu Aug 16 10:58:46 2007 -0600
@@ -34,6 +34,7 @@
 #define __HYPERCALL_H__
 
 #include <linux/string.h> /* memcpy() */
+#include <linux/stringify.h>
 
 #ifndef __HYPERVISOR_H__
 # error "please don't include this file directly"
@@ -47,7 +48,7 @@
        "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
 #else
 #define HYPERCALL_STR(name)                                    \
-       "mov hypercall_stubs,%%eax; "                           \
+       "mov "__stringify(hypercall_stubs)",%%eax; "            \
        "add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "        \
        "call *%%eax"
 #endif
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/asm-i386/mach-xen/asm/io.h
--- a/include/asm-i386/mach-xen/asm/io.h        Sun Aug 12 15:04:04 2007 -0600
+++ b/include/asm-i386/mach-xen/asm/io.h        Thu Aug 16 10:58:46 2007 -0600
@@ -151,7 +151,7 @@ extern void bt_iounmap(void *addr, unsig
 /*
  * ISA I/O bus memory addresses are 1:1 with the physical address.
  */
-#define isa_virt_to_bus(_x) isa_virt_to_bus_is_UNSUPPORTED->x
+#define isa_virt_to_bus(_x) ({ BUG(); virt_to_bus(_x); })
 #define isa_page_to_bus(_x) isa_page_to_bus_is_UNSUPPORTED->x
 #define isa_bus_to_virt(_x) (void *)(__fix_to_virt(FIX_ISAMAP_BEGIN) + (_x))
 
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/asm-x86_64/mach-xen/asm/floppy.h
--- a/include/asm-x86_64/mach-xen/asm/floppy.h  Sun Aug 12 15:04:04 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,206 +0,0 @@
-/*
- * Architecture specific parts of the Floppy driver
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1995
- *
- * Modifications for Xen are Copyright (c) 2004, Keir Fraser.
- */
-#ifndef __ASM_XEN_X86_64_FLOPPY_H
-#define __ASM_XEN_X86_64_FLOPPY_H
-
-#include <linux/vmalloc.h>
-
-/*
- * The DMA channel used by the floppy controller cannot access data at
- * addresses >= 16MB
- *
- * Went back to the 1MB limit, as some people had problems with the floppy
- * driver otherwise. It doesn't matter much for performance anyway, as most
- * floppy accesses go through the track buffer.
- */
-#define _CROSS_64KB(a,s,vdma) \
-(!(vdma) && ((unsigned long)(a)/K_64 != ((unsigned long)(a) + (s) - 1) / K_64))
-
-/* XEN: Hit DMA paths on the head. This trick from asm-m68k/floppy.h. */
-#include <asm/dma.h>
-#undef MAX_DMA_ADDRESS
-#define MAX_DMA_ADDRESS 0
-#define CROSS_64KB(a,s) (0)
-
-#define fd_inb(port)                   inb_p(port)
-#define fd_outb(value,port)            outb_p(value,port)
-
-#define fd_request_dma()        (0)
-#define fd_free_dma()           ((void)0)
-#define fd_enable_irq()         enable_irq(FLOPPY_IRQ)
-#define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
-#define fd_free_irq()          free_irq(FLOPPY_IRQ, NULL)
-#define fd_get_dma_residue()    vdma_get_dma_residue(FLOPPY_DMA)
-/*
- * Do not use vmalloc/vfree: floppy_release_irq_and_dma() gets called from
- * softirq context via motor_off_callback. A generic bug we happen to trigger.
- */
-#define fd_dma_mem_alloc(size) __get_free_pages(GFP_KERNEL|__GFP_NORETRY, 
get_order(size))
-#define fd_dma_mem_free(addr, size) free_pages(addr, get_order(size))
-#define fd_dma_setup(addr, size, mode, io) vdma_dma_setup(addr, size, mode, io)
-
-static int virtual_dma_count;
-static int virtual_dma_residue;
-static char *virtual_dma_addr;
-static int virtual_dma_mode;
-static int doing_pdma;
-
-static irqreturn_t floppy_hardint(int irq, void *dev_id, struct pt_regs * regs)
-{
-       register unsigned char st;
-
-#undef TRACE_FLPY_INT
-
-#ifdef TRACE_FLPY_INT
-       static int calls=0;
-       static int bytes=0;
-       static int dma_wait=0;
-#endif
-       if (!doing_pdma)
-               return floppy_interrupt(irq, dev_id, regs);
-
-#ifdef TRACE_FLPY_INT
-       if(!calls)
-               bytes = virtual_dma_count;
-#endif
-
-       {
-               register int lcount;
-               register char *lptr;
-
-               st = 1;
-               for(lcount=virtual_dma_count, lptr=virtual_dma_addr; 
-                   lcount; lcount--, lptr++) {
-                       st=inb(virtual_dma_port+4) & 0xa0 ;
-                       if(st != 0xa0) 
-                               break;
-                       if(virtual_dma_mode)
-                               outb_p(*lptr, virtual_dma_port+5);
-                       else
-                               *lptr = inb_p(virtual_dma_port+5);
-               }
-               virtual_dma_count = lcount;
-               virtual_dma_addr = lptr;
-               st = inb(virtual_dma_port+4);
-       }
-
-#ifdef TRACE_FLPY_INT
-       calls++;
-#endif
-       if(st == 0x20)
-               return IRQ_HANDLED;
-       if(!(st & 0x20)) {
-               virtual_dma_residue += virtual_dma_count;
-               virtual_dma_count=0;
-#ifdef TRACE_FLPY_INT
-               printk("count=%x, residue=%x calls=%d bytes=%d dma_wait=%d\n", 
-                      virtual_dma_count, virtual_dma_residue, calls, bytes,
-                      dma_wait);
-               calls = 0;
-               dma_wait=0;
-#endif
-               doing_pdma = 0;
-               floppy_interrupt(irq, dev_id, regs);
-               return IRQ_HANDLED;
-       }
-#ifdef TRACE_FLPY_INT
-       if(!virtual_dma_count)
-               dma_wait++;
-#endif
-       return IRQ_HANDLED;
-}
-
-static void fd_disable_dma(void)
-{
-       doing_pdma = 0;
-       virtual_dma_residue += virtual_dma_count;
-       virtual_dma_count=0;
-}
-
-static int vdma_get_dma_residue(unsigned int dummy)
-{
-       return virtual_dma_count + virtual_dma_residue;
-}
-
-
-static int fd_request_irq(void)
-{
-       return request_irq(FLOPPY_IRQ, floppy_hardint,
-                          IRQF_DISABLED, "floppy", NULL);
-}
-
-#if 0
-static unsigned long vdma_mem_alloc(unsigned long size)
-{
-       return (unsigned long) vmalloc(size);
-
-}
-
-static void vdma_mem_free(unsigned long addr, unsigned long size)
-{
-       vfree((void *)addr);
-}
-#endif
-
-static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
-{
-       doing_pdma = 1;
-       virtual_dma_port = io;
-       virtual_dma_mode = (mode  == DMA_MODE_WRITE);
-       virtual_dma_addr = addr;
-       virtual_dma_count = size;
-       virtual_dma_residue = 0;
-       return 0;
-}
-
-/* XEN: This trick to force 'virtual DMA' is from include/asm-m68k/floppy.h. */
-#define FDC1 xen_floppy_init()
-static int FDC2 = -1;
-
-static int xen_floppy_init(void)
-{
-       use_virtual_dma = 1;
-       can_use_virtual_dma = 1;
-       return 0x3f0;
-}
-
-/*
- * Floppy types are stored in the rtc's CMOS RAM and so rtc_lock
- * is needed to prevent corrupted CMOS RAM in case "insmod floppy"
- * coincides with another rtc CMOS user.               Paul G.
- */
-#define FLOPPY0_TYPE   ({                              \
-       unsigned long flags;                            \
-       unsigned char val;                              \
-       spin_lock_irqsave(&rtc_lock, flags);            \
-       val = (CMOS_READ(0x10) >> 4) & 15;              \
-       spin_unlock_irqrestore(&rtc_lock, flags);       \
-       val;                                            \
-})
-
-#define FLOPPY1_TYPE   ({                              \
-       unsigned long flags;                            \
-       unsigned char val;                              \
-       spin_lock_irqsave(&rtc_lock, flags);            \
-       val = CMOS_READ(0x10) & 15;                     \
-       spin_unlock_irqrestore(&rtc_lock, flags);       \
-       val;                                            \
-})
-
-#define N_FDC 2
-#define N_DRIVE 8
-
-#define FLOPPY_MOTOR_MASK 0xf0
-
-#define EXTRA_FLOPPY_PARAMS
-
-#endif /* __ASM_XEN_X86_64_FLOPPY_H */
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/asm-x86_64/mach-xen/asm/hypercall.h
--- a/include/asm-x86_64/mach-xen/asm/hypercall.h       Sun Aug 12 15:04:04 
2007 -0600
+++ b/include/asm-x86_64/mach-xen/asm/hypercall.h       Thu Aug 16 10:58:46 
2007 -0600
@@ -38,6 +38,7 @@
 #define __HYPERCALL_H__
 
 #include <linux/string.h> /* memcpy() */
+#include <linux/stringify.h>
 
 #ifndef __HYPERVISOR_H__
 # error "please don't include this file directly"
@@ -51,7 +52,7 @@
        "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
 #else
 #define HYPERCALL_STR(name)                                    \
-       "mov hypercall_stubs,%%rax; "                           \
+       "mov "__stringify(hypercall_stubs)",%%rax; "            \
        "add $("STR(__HYPERVISOR_##name)" * 32),%%rax; "        \
        "call *%%rax"
 #endif
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/asm-x86_64/mach-xen/asm/io.h
--- a/include/asm-x86_64/mach-xen/asm/io.h      Sun Aug 12 15:04:04 2007 -0600
+++ b/include/asm-x86_64/mach-xen/asm/io.h      Thu Aug 16 10:58:46 2007 -0600
@@ -167,7 +167,7 @@ extern void iounmap(volatile void __iome
  * ISA I/O bus memory addresses are 1:1 with the physical address.
  */
 
-#define isa_virt_to_bus(_x) isa_virt_to_bus_is_UNSUPPORTED->x
+#define isa_virt_to_bus(_x) ({ BUG(); virt_to_bus(_x); })
 #define isa_page_to_bus(_x) isa_page_to_bus_is_UNSUPPORTED->x
 #define isa_bus_to_virt(_x) (void *)(__fix_to_virt(FIX_ISAMAP_BEGIN) + (_x))
 
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/xen/cpu_hotplug.h
--- a/include/xen/cpu_hotplug.h Sun Aug 12 15:04:04 2007 -0600
+++ b/include/xen/cpu_hotplug.h Thu Aug 16 10:58:46 2007 -0600
@@ -6,9 +6,6 @@
 
 #if defined(CONFIG_X86) && defined(CONFIG_SMP)
 extern cpumask_t cpu_initialized_map;
-#define cpu_set_initialized(cpu) cpu_set(cpu, cpu_initialized_map)
-#else
-#define cpu_set_initialized(cpu) ((void)0)
 #endif
 
 #if defined(CONFIG_HOTPLUG_CPU)
diff -r 41b7a0d7c2ad -r 60d8f0befd18 include/xen/xencomm.h
--- a/include/xen/xencomm.h     Sun Aug 12 15:04:04 2007 -0600
+++ b/include/xen/xencomm.h     Thu Aug 16 10:58:46 2007 -0600
@@ -30,15 +30,39 @@ struct xencomm_mini {
        uint64_t address[XENCOMM_MINI_ADDRS];
 };
 
-extern void xencomm_free(void *desc);
-extern void *xencomm_map(void *ptr, unsigned long bytes);
-extern void *__xencomm_map_no_alloc(void *ptr, unsigned long bytes, 
-                               struct xencomm_mini *xc_area);
+/* To avoid additionnal virt to phys conversion, an opaque structure is
+   presented.  */
+struct xencomm_handle;
 
-#define xencomm_map_no_alloc(ptr, bytes) \
-       ({struct xencomm_mini xc_desc\
-               __attribute__((__aligned__(sizeof(struct xencomm_mini))));\
-               __xencomm_map_no_alloc(ptr, bytes, &xc_desc);})
+extern void xencomm_free(struct xencomm_handle *desc);
+extern struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes);
+extern struct xencomm_handle *__xencomm_map_no_alloc(void *ptr,
+                       unsigned long bytes,  struct xencomm_mini *xc_area);
+
+#if 0
+#define XENCOMM_MINI_ALIGNED(xc_desc, n)                               \
+       struct xencomm_mini xc_desc ## _base[(n)]                       \
+       __attribute__((__aligned__(sizeof(struct xencomm_mini))));      \
+       struct xencomm_mini* xc_desc = &xc_desc ## _base[0];
+#else
+/*
+ * gcc bug workaround:
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16660
+ * gcc doesn't handle properly stack variable with
+ * __attribute__((__align__(sizeof(struct xencomm_mini))))
+ */
+#define XENCOMM_MINI_ALIGNED(xc_desc, n)                               \
+       unsigned char xc_desc ## _base[((n) + 1 ) *                     \
+                                      sizeof(struct xencomm_mini)];    \
+       struct xencomm_mini *xc_desc = (struct xencomm_mini*)           \
+               ((unsigned long)xc_desc ## _base +                      \
+                (sizeof(struct xencomm_mini) -                         \
+                 ((unsigned long)xc_desc ## _base) %                   \
+                 sizeof(struct xencomm_mini)));
+#endif
+#define xencomm_map_no_alloc(ptr, bytes)                       \
+       ({XENCOMM_MINI_ALIGNED(xc_desc, 1);                     \
+               __xencomm_map_no_alloc(ptr, bytes, xc_desc);})
 
 /* provided by architecture code: */
 extern unsigned long xencomm_vtop(unsigned long vaddr);
@@ -48,4 +72,6 @@ static inline void *xencomm_pa(void *ptr
        return (void *)xencomm_vtop((unsigned long)ptr);
 }
 
+#define xen_guest_handle(hnd)  ((hnd).p)
+
 #endif /* _LINUX_XENCOMM_H_ */

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

<Prev in Thread] Current Thread [Next in Thread>