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] Merged.

# HG changeset patch
# User emellor@ewan
# Node ID bd37123974b293eafe307a36f1a9669c8ec2221b
# Parent  4ab4f023a6ce08999a4d64937b3206fef163c62c
# Parent  ba0bbf9d29fffbef248beff9336be79f8f0ce45b
Merged.

diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Thu Oct  6 10:11:16 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Thu Oct  6 10:12:55 2005
@@ -180,14 +180,13 @@
 
 int bind_virq_to_irq(int virq)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_bind_virq };
        int evtchn, irq;
        int cpu = smp_processor_id();
 
        spin_lock(&irq_mapping_update_lock);
 
        if ((irq = per_cpu(virq_to_irq, cpu)[virq]) == -1) {
-               op.cmd              = EVTCHNOP_bind_virq;
                op.u.bind_virq.virq = virq;
                op.u.bind_virq.vcpu = cpu;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
@@ -212,7 +211,7 @@
 
 void unbind_virq_from_irq(int virq)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_close };
        int cpu    = smp_processor_id();
        int irq    = per_cpu(virq_to_irq, cpu)[virq];
        int evtchn = irq_to_evtchn[irq];
@@ -220,7 +219,6 @@
        spin_lock(&irq_mapping_update_lock);
 
        if (--irq_bindcount[irq] == 0) {
-               op.cmd          = EVTCHNOP_close;
                op.u.close.dom  = DOMID_SELF;
                op.u.close.port = evtchn;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
@@ -245,14 +243,13 @@
 
 int bind_ipi_to_irq(int ipi)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_bind_ipi };
        int evtchn, irq;
        int cpu = smp_processor_id();
 
        spin_lock(&irq_mapping_update_lock);
 
        if ((evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi]) == -1) {
-               op.cmd = EVTCHNOP_bind_ipi;
                op.u.bind_ipi.vcpu = cpu;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
                evtchn = op.u.bind_ipi.port;
@@ -278,7 +275,7 @@
 
 void unbind_ipi_from_irq(int ipi)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_close };
        int cpu    = smp_processor_id();
        int evtchn = per_cpu(ipi_to_evtchn, cpu)[ipi];
        int irq    = evtchn_to_irq[evtchn];
@@ -286,7 +283,6 @@
        spin_lock(&irq_mapping_update_lock);
 
        if (--irq_bindcount[irq] == 0) {
-               op.cmd          = EVTCHNOP_close;
                op.u.close.dom  = DOMID_SELF;
                op.u.close.port = evtchn;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
@@ -324,13 +320,12 @@
 
 void unbind_evtchn_from_irq(unsigned int irq)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_close };
        int evtchn = irq_to_evtchn[irq];
 
        spin_lock(&irq_mapping_update_lock);
 
        if ((--irq_bindcount[irq] == 0) && (evtchn != -1)) {
-               op.cmd          = EVTCHNOP_close;
                op.u.close.dom  = DOMID_SELF;
                op.u.close.port = evtchn;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
@@ -378,7 +373,7 @@
 /* Rebind an evtchn so that it gets delivered to a specific cpu */
 static void rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_bind_vcpu };
        int evtchn;
 
        spin_lock(&irq_mapping_update_lock);
@@ -389,7 +384,6 @@
        }
 
        /* Send future instances of this interrupt to other vcpu. */
-       op.cmd = EVTCHNOP_bind_vcpu;
        op.u.bind_vcpu.port = evtchn;
        op.u.bind_vcpu.vcpu = tcpu;
 
@@ -518,10 +512,9 @@
 
 static unsigned int startup_pirq(unsigned int irq)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_bind_pirq };
        int evtchn;
 
-       op.cmd               = EVTCHNOP_bind_pirq;
        op.u.bind_pirq.pirq  = irq;
        /* NB. We are happy to share unless we are probing. */
        op.u.bind_pirq.flags = probing_irq(irq) ? 0 : BIND_PIRQ__WILL_SHARE;
@@ -547,7 +540,7 @@
 
 static void shutdown_pirq(unsigned int irq)
 {
-       evtchn_op_t op;
+       evtchn_op_t op = { .cmd = EVTCHNOP_close };
        int evtchn = irq_to_evtchn[irq];
 
        if (!VALID_EVTCHN(evtchn))
@@ -555,7 +548,6 @@
 
        mask_evtchn(evtchn);
 
-       op.cmd          = EVTCHNOP_close;
        op.u.close.dom  = DOMID_SELF;
        op.u.close.port = evtchn;
        BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
@@ -666,6 +658,7 @@
                        continue;
 
                /* Get a new binding from Xen. */
+               memset(&op, 0, sizeof(op));
                op.cmd              = EVTCHNOP_bind_virq;
                op.u.bind_virq.virq = virq;
                op.u.bind_virq.vcpu = 0;
@@ -689,6 +682,7 @@
                evtchn_to_irq[evtchn] = -1;
 
                /* Get a new binding from Xen. */
+               memset(&op, 0, sizeof(op));
                op.cmd = EVTCHNOP_bind_ipi;
                op.u.bind_ipi.vcpu = 0;
                BUG_ON(HYPERVISOR_event_channel_op(&op) != 0);
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/drivers/xen/blkback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Thu Oct  6 
10:11:16 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c      Thu Oct  6 
10:12:55 2005
@@ -68,8 +68,13 @@
 int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
 {
        blkif_sring_t *sring;
-       evtchn_op_t op = { .cmd = EVTCHNOP_bind_interdomain };
        int err;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_bind_interdomain,
+               .u.bind_interdomain.dom1 = DOMID_SELF,
+               .u.bind_interdomain.dom2 = blkif->domid,
+               .u.bind_interdomain.port1 = 0,
+               .u.bind_interdomain.port2 = evtchn };
 
        if ( (blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL )
                return -ENOMEM;
@@ -80,10 +85,6 @@
                return err;
        }
 
-       op.u.bind_interdomain.dom1 = DOMID_SELF;
-       op.u.bind_interdomain.dom2 = blkif->domid;
-       op.u.bind_interdomain.port1 = 0;
-       op.u.bind_interdomain.port2 = evtchn;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                unmap_frontend_page(blkif);
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Oct  6 
10:11:16 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Oct  6 
10:12:55 2005
@@ -485,8 +485,11 @@
 static int setup_blkring(struct xenbus_device *dev, struct blkfront_info *info)
 {
        blkif_sring_t *sring;
-       evtchn_op_t op = { .cmd = EVTCHNOP_alloc_unbound };
        int err;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_alloc_unbound,
+               .u.alloc_unbound.dom = DOMID_SELF,
+               .u.alloc_unbound.remote_dom = info->backend_id };
 
        info->ring_ref = GRANT_INVALID_REF;
 
@@ -508,7 +511,6 @@
        }
        info->ring_ref = err;
 
-       op.u.alloc_unbound.dom = info->backend_id;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                gnttab_end_foreign_access(info->ring_ref, 0);
@@ -518,7 +520,9 @@
                xenbus_dev_error(dev, err, "allocating event channel");
                return err;
        }
+
        blkif_connect(info, op.u.alloc_unbound.port);
+
        return 0;
 }
 
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/drivers/xen/blktap/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c       Thu Oct  6 
10:11:16 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blktap/interface.c       Thu Oct  6 
10:12:55 2005
@@ -68,8 +68,13 @@
 int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn)
 {
        blkif_sring_t *sring;
-       evtchn_op_t op = { .cmd = EVTCHNOP_bind_interdomain };
        int err;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_bind_interdomain,
+               .u.bind_interdomain.dom1 = DOMID_SELF,
+               .u.bind_interdomain.dom2 = blkif->domid,
+               .u.bind_interdomain.port1 = 0,
+               .u.bind_interdomain.port2 = evtchn };
 
        if ((blkif->blk_ring_area = alloc_vm_area(PAGE_SIZE)) == NULL)
                return -ENOMEM;
@@ -80,10 +85,6 @@
                return err;
        }
 
-       op.u.bind_interdomain.dom1 = DOMID_SELF;
-       op.u.bind_interdomain.dom2 = blkif->domid;
-       op.u.bind_interdomain.port1 = 0;
-       op.u.bind_interdomain.port2 = evtchn;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                unmap_frontend_page(blkif);
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/drivers/xen/netback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Thu Oct  6 
10:11:16 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netback/interface.c      Thu Oct  6 
10:12:55 2005
@@ -177,8 +177,13 @@
 int netif_map(netif_t *netif, unsigned long tx_ring_ref,
              unsigned long rx_ring_ref, unsigned int evtchn)
 {
-       evtchn_op_t op = { .cmd = EVTCHNOP_bind_interdomain };
        int err;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_bind_interdomain,
+               .u.bind_interdomain.dom1 = DOMID_SELF,
+               .u.bind_interdomain.dom2 = netif->domid,
+               .u.bind_interdomain.port1 = 0,
+               .u.bind_interdomain.port2 = evtchn };
 
        netif->comms_area = alloc_vm_area(2*PAGE_SIZE);
        if (netif->comms_area == NULL)
@@ -190,10 +195,6 @@
                return err;
        }
 
-       op.u.bind_interdomain.dom1 = DOMID_SELF;
-       op.u.bind_interdomain.dom2 = netif->domid;
-       op.u.bind_interdomain.port1 = 0;
-       op.u.bind_interdomain.port2 = evtchn;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                unmap_frontend_pages(netif);
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Oct  6 
10:11:16 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Oct  6 
10:12:55 2005
@@ -972,8 +972,11 @@
 
 static int setup_device(struct xenbus_device *dev, struct netfront_info *info)
 {
-       evtchn_op_t op = { .cmd = EVTCHNOP_alloc_unbound };
        int err;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_alloc_unbound,
+               .u.alloc_unbound.dom = DOMID_SELF,
+               .u.alloc_unbound.remote_dom = info->backend_id };
 
        info->tx_ring_ref = GRANT_INVALID_REF;
        info->rx_ring_ref = GRANT_INVALID_REF;
@@ -1010,13 +1013,14 @@
        }
        info->rx_ring_ref = err;
 
-       op.u.alloc_unbound.dom = info->backend_id;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                xenbus_dev_error(dev, err, "allocating event channel");
                goto out;
        }
+
        connect_device(info, op.u.alloc_unbound.port);
+
        return 0;
 
  out:
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c      Thu Oct  6 
10:11:16 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c      Thu Oct  6 
10:12:55 2005
@@ -117,8 +117,13 @@
 int
 tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn)
 {
-       evtchn_op_t op = {.cmd = EVTCHNOP_bind_interdomain };
        int err;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_bind_interdomain,
+               .u.bind_interdomain.dom1 = DOMID_SELF,
+               .u.bind_interdomain.dom2 = tpmif->domid,
+               .u.bind_interdomain.port1 = 0,
+               .u.bind_interdomain.port2 = evtchn };
 
        if ((tpmif->tx_area = alloc_vm_area(PAGE_SIZE)) == NULL)
                return -ENOMEM;
@@ -129,10 +134,6 @@
                return err;
        }
 
-       op.u.bind_interdomain.dom1 = DOMID_SELF;
-       op.u.bind_interdomain.dom2 = tpmif->domid;
-       op.u.bind_interdomain.port1 = 0;
-       op.u.bind_interdomain.port2 = evtchn;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                unmap_frontend_page(tpmif);
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Thu Oct  6 
10:11:16 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c      Thu Oct  6 
10:12:55 2005
@@ -244,9 +244,11 @@
 {
        tpmif_tx_interface_t *sring;
        struct tpm_private *tp = &my_private;
-
-       evtchn_op_t op = { .cmd = EVTCHNOP_alloc_unbound };
        int err;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_alloc_unbound,
+               .u.alloc_unbound.dom = DOMID_SELF,
+               .u.alloc_unbound.remote_dom = backend_id } ;
 
        sring = (void *)__get_free_page(GFP_KERNEL);
        if (!sring) {
@@ -269,7 +271,6 @@
        }
        info->ring_ref = err;
 
-       op.u.alloc_unbound.dom = backend_id;
        err = HYPERVISOR_event_channel_op(&op);
        if (err) {
                gnttab_end_foreign_access(info->ring_ref, 0);
@@ -278,7 +279,9 @@
                xenbus_dev_error(dev, err, "allocating event channel");
                return err;
        }
+
        tpmif_connect(op.u.alloc_unbound.port, backend_id);
+
        return 0;
 }
 
@@ -439,26 +442,32 @@
        return 0;
 }
 
-static int tpmfront_suspend(struct xenbus_device *dev)
+static int
+tpmfront_suspend(struct xenbus_device *dev)
 {
        struct tpmfront_info *info = dev->data;
        struct tpm_private *tp = &my_private;
-
-       /* lock so no app can send */
+       u32 ctr = 0;
+
+       /* lock, so no app can send */
        down(&suspend_lock);
 
-       while (atomic_read(&tp->tx_busy)) {
-               printk("---- TPMIF: Outstanding request.\n");
-#if 0
+       while (atomic_read(&tp->tx_busy) && ctr <= 25) {
+               if ((ctr % 10) == 0)
+                       printk("INFO: Waiting for outstanding request.\n");
                /*
-                * Would like to wait until the outstanding request
-                * has come back, but this does not work properly, yet.
+                * Wait for a request to be responded to.
                 */
-               interruptible_sleep_on_timeout(&tp->wait_q,
-                                              100);
-#else
-               break;
-#endif
+               interruptible_sleep_on_timeout(&tp->wait_q, 100);
+               ctr++;
+       }
+
+       if (atomic_read(&tp->tx_busy)) {
+               /*
+                * A temporary work-around.
+                */
+               printk("WARNING: Resetting busy flag.");
+               atomic_set(&tp->tx_busy, 0);
        }
 
        unregister_xenbus_watch(&info->watch);
@@ -466,44 +475,34 @@
        kfree(info->backend);
        info->backend = NULL;
 
-       destroy_tpmring(info, tp);
-
        return 0;
 }
 
-static int tpmif_recover(void)
-{
-       return 0;
-}
-
-static int tpmfront_resume(struct xenbus_device *dev)
+static int
+tpmfront_resume(struct xenbus_device *dev)
 {
        struct tpmfront_info *info = dev->data;
-       int err;
-
-       err = talk_to_backend(dev, info);
-       if (!err) {
-               tpmif_recover();
-       }
-
-       /* unlock so apps can resume */
+       int err = talk_to_backend(dev, info);
+
+       /* unlock, so apps can resume sending */
        up(&suspend_lock);
 
        return err;
 }
 
-static void tpmif_connect(u16 evtchn, domid_t domid)
+static void
+tpmif_connect(u16 evtchn, domid_t domid)
 {
        int err = 0;
        struct tpm_private *tp = &my_private;
 
        tp->evtchn = evtchn;
-       tp->backend_id  = domid;
-
-       err = bind_evtchn_to_irqhandler(
-               tp->evtchn,
-               tpmif_int, SA_SAMPLE_RANDOM, "tpmif", tp);
-       if ( err <= 0 ) {
+       tp->backend_id = domid;
+
+       err = bind_evtchn_to_irqhandler(tp->evtchn,
+                                       tpmif_int, SA_SAMPLE_RANDOM, "tpmif",
+                                       tp);
+       if (err <= 0) {
                WPRINTK("bind_evtchn_to_irqhandler failed (err=%d)\n", err);
                return;
        }
@@ -638,7 +637,7 @@
 
                if (NULL == txb) {
                        DPRINTK("txb (i=%d) is NULL. buffers initilized?\n", i);
-                       DPRINTK("Not transmittin anything!\n");
+                       DPRINTK("Not transmitting anything!\n");
                        spin_unlock_irq(&tp->tx_lock);
                        return -EFAULT;
                }
diff -r 4ab4f023a6ce -r bd37123974b2 
linux-2.6-xen-sparse/include/asm-xen/evtchn.h
--- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h     Thu Oct  6 10:11:16 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h     Thu Oct  6 10:12:55 2005
@@ -123,9 +123,9 @@
 
 static inline void notify_remote_via_evtchn(int port)
 {
-       evtchn_op_t op;
-       op.cmd = EVTCHNOP_send;
-       op.u.send.local_port = port;
+       evtchn_op_t op = {
+               .cmd = EVTCHNOP_send,
+               .u.send.local_port = port };
        (void)HYPERVISOR_event_channel_op(&op);
 }
 
diff -r 4ab4f023a6ce -r bd37123974b2 tools/examples/network-bridge
--- a/tools/examples/network-bridge     Thu Oct  6 10:11:16 2005
+++ b/tools/examples/network-bridge     Thu Oct  6 10:12:55 2005
@@ -38,22 +38,6 @@
 # Print routes.
 #
 #============================================================================
-
-# Exit if anything goes wrong.
-set -e 
-
-# First arg is the operation.
-OP=$1
-shift
-
-# Pull variables in args in to environment.
-for arg ; do export "${arg}" ; done
-
-bridge=${bridge:-xen-br0}
-netdev=${netdev:-eth0}
-antispoof=${antispoof:-no}
-
-echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2
 
 # Gentoo doesn't have ifup/ifdown: define appropriate alternatives
 which ifup >& /dev/null
@@ -65,6 +49,22 @@
         /etc/init.d/net.$1 stop
     }
 fi
+
+# Exit if anything goes wrong.
+set -e 
+
+# First arg is the operation.
+OP=$1
+shift
+
+# Pull variables in args in to environment.
+for arg ; do export "${arg}" ; done
+
+bridge=${bridge:-xen-br0}
+netdev=${netdev:-eth0}
+antispoof=${antispoof:-no}
+
+echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2
 
 # Usage: transfer_addrs src dst
 # Copy all IP addresses (including aliases) from device $src to device $dst.
diff -r 4ab4f023a6ce -r bd37123974b2 tools/libxc/xc_evtchn.c
--- a/tools/libxc/xc_evtchn.c   Thu Oct  6 10:11:16 2005
+++ b/tools/libxc/xc_evtchn.c   Thu Oct  6 10:12:55 2005
@@ -33,15 +33,16 @@
 
 
 int xc_evtchn_alloc_unbound(int xc_handle,
+                            u32 remote_dom,
                             u32 dom,
                             int *port)
 {
-    evtchn_op_t op;
     int         rc;
-
-    op.cmd = EVTCHNOP_alloc_unbound;
-    op.u.alloc_unbound.dom  = (domid_t)dom;
-    op.u.alloc_unbound.port = (port != NULL) ? *port : 0;
+    evtchn_op_t op = {
+        .cmd = EVTCHNOP_alloc_unbound,
+        .u.alloc_unbound.remote_dom = (domid_t)remote_dom,
+        .u.alloc_unbound.dom  = (domid_t)dom,
+        .u.alloc_unbound.port = (port != NULL) ? *port : 0 };
 
     if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
     {
@@ -59,15 +60,13 @@
                                int *port1,
                                int *port2)
 {
-    evtchn_op_t op;
     int         rc;
-
-    op.cmd = EVTCHNOP_bind_interdomain;
-    op.u.bind_interdomain.dom1  = (domid_t)dom1;
-    op.u.bind_interdomain.dom2  = (domid_t)dom2;
-    op.u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0;
-    op.u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0;
-
+    evtchn_op_t op = {
+        .cmd = EVTCHNOP_bind_interdomain,
+        .u.bind_interdomain.dom1  = (domid_t)dom1,
+        .u.bind_interdomain.dom2  = (domid_t)dom2,
+        .u.bind_interdomain.port1 = (port1 != NULL) ? *port1 : 0,
+        .u.bind_interdomain.port2 = (port2 != NULL) ? *port2 : 0 };
 
     if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
     {
@@ -85,12 +84,11 @@
                         int virq,
                         int *port)
 {
-    evtchn_op_t op;
     int         rc;
-
-    op.cmd = EVTCHNOP_bind_virq;
-    op.u.bind_virq.virq = (u32)virq;
-    op.u.bind_virq.vcpu = 0;
+    evtchn_op_t op = {
+        .cmd = EVTCHNOP_bind_virq,
+        .u.bind_virq.virq = (u32)virq,
+        .u.bind_virq.vcpu = 0 };
 
     if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
     {
@@ -106,10 +104,10 @@
                     u32 dom,
                     int port)
 {
-    evtchn_op_t op;
-    op.cmd = EVTCHNOP_close;
-    op.u.close.dom  = (domid_t)dom;
-    op.u.close.port = port;
+    evtchn_op_t op = {
+        .cmd          = EVTCHNOP_close,
+        .u.close.dom  = (domid_t)dom,
+        .u.close.port = port };
     return do_evtchn_op(xc_handle, &op);
 }
 
@@ -117,9 +115,9 @@
 int xc_evtchn_send(int xc_handle,
                    int local_port)
 {
-    evtchn_op_t op;
-    op.cmd = EVTCHNOP_send;
-    op.u.send.local_port = local_port;
+    evtchn_op_t op = {
+        .cmd = EVTCHNOP_send,
+        .u.send.local_port = local_port };
     return do_evtchn_op(xc_handle, &op);
 }
 
@@ -129,13 +127,12 @@
                      int port,
                      xc_evtchn_status_t *status)
 {
-    evtchn_op_t op;
     int         rc;
+    evtchn_op_t op = {
+        .cmd           = EVTCHNOP_status,
+        .u.status.dom  = (domid_t)dom,
+        .u.status.port = port };
 
-    op.cmd = EVTCHNOP_status;
-    op.u.status.dom  = (domid_t)dom;
-    op.u.status.port = port;
-   
     if ( (rc = do_evtchn_op(xc_handle, &op)) == 0 )
         memcpy(status, &op.u.status, sizeof(*status));
     
diff -r 4ab4f023a6ce -r bd37123974b2 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Thu Oct  6 10:11:16 2005
+++ b/tools/libxc/xenctrl.h     Thu Oct  6 10:12:55 2005
@@ -306,13 +306,15 @@
  * well-known port within a domain to receive events on.
  *
  * @parm xc_handle a handle to an open hypervisor interface
- * @parm dom the ID of the domain.  This maybe DOMID_SELF
+ * @parm remote_dom the ID of the domain who will later bind
+ * @parm dom the ID of the local domain (the 'allocatee')
  * @parm port a pointer to a port.  This is an in/out parameter.  If *port is
  *            0, then a new port will be assigned, if port is > 0 then that
  *            port is allocated if the port is unallocated.
  * @return 0 on success, -1 on failure
  */
 int xc_evtchn_alloc_unbound(int xc_handle,
+                            u32 remote_dom,
                             u32 dom,
                             int *port);
 
diff -r 4ab4f023a6ce -r bd37123974b2 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Thu Oct  6 10:11:16 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu Oct  6 10:12:55 2005
@@ -432,16 +432,16 @@
 {
     XcObject *xc = (XcObject *)self;
 
-    u32 dom;
+    u32 dom = DOMID_SELF, remote_dom;
     int port = 0;
 
-    static char *kwd_list[] = { "dom", "port", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
-                                      &dom, &port) )
-        return NULL;
-
-    if ( xc_evtchn_alloc_unbound(xc->xc_handle, dom, &port) != 0 )
+    static char *kwd_list[] = { "remote_dom", "dom", "port", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|ii", kwd_list,
+                                      &remote_dom, &dom, &port) )
+        return NULL;
+
+    if ( xc_evtchn_alloc_unbound(xc->xc_handle, remote_dom, dom, &port) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
     return PyInt_FromLong(port);
diff -r 4ab4f023a6ce -r bd37123974b2 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py     Thu Oct  6 10:11:16 2005
+++ b/tools/python/xen/xend/server/tpmif.py     Thu Oct  6 10:12:55 2005
@@ -39,9 +39,24 @@
         """@see DevController.getDeviceDetails"""
         
         devid = int(sxp.child_value(config, 'instance', '0'))
-        log.debug("The domain has a TPM with instance %d." % devid)
+        log.info("The domain has a TPM with instance %d." % devid)
 
         back  = { 'instance' : "%i" % devid }
         front = { 'handle' : "%i" % devid }
 
         return (devid, back, front)
+
+    def configuration(self, devid):
+
+        log.info("The configuration method is called.")
+
+        result = DevContoller.configuration(self, devid)
+
+        (instance) = self.readBackend(devif,
+                                      'instance')
+
+        if instance:
+            result.append(['instance', instance])
+            log.info("configuration: instance=%d." % instance)
+
+        return result
diff -r 4ab4f023a6ce -r bd37123974b2 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Oct  6 10:11:16 2005
+++ b/tools/python/xen/xm/main.py       Thu Oct  6 10:12:55 2005
@@ -86,8 +86,8 @@
     shutdown [-w|-a] <DomId>  shutdown a domain
     sysrq   <DomId> <letter>  send a sysrq to a domain
     unpause <DomId>           unpause a paused domain
-    vcpu-enable <DomId> <VCPU>        disable VCPU in a domain
-    vcpu-disable <DomId> <VCPU>       enable VCPU in a domain
+    vcpu-enable <DomId> <VCPU>        enable VCPU in a domain
+    vcpu-disable <DomId> <VCPU>       disable VCPU in a domain
     vcpu-list <DomId>                 get the list of VCPUs for a domain
     vcpu-pin <DomId> <VCpu> <CPUS>    set which cpus a VCPU can use. 
 
diff -r 4ab4f023a6ce -r bd37123974b2 xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c  Thu Oct  6 10:11:16 2005
+++ b/xen/arch/x86/x86_32/mm.c  Thu Oct  6 10:12:55 2005
@@ -156,6 +156,7 @@
      */
     if ( (offsetof(struct pfn_info, u.inuse._domain) != 
           (offsetof(struct pfn_info, count_info) + sizeof(u32))) ||
+         ((offsetof(struct pfn_info, count_info) & 7) != 0) ||
          (sizeof(struct pfn_info) != 24) )
     {
         printk("Weird pfn_info layout (%ld,%ld,%d)\n",
diff -r 4ab4f023a6ce -r bd37123974b2 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Thu Oct  6 10:11:16 2005
+++ b/xen/arch/x86/x86_64/mm.c  Thu Oct  6 10:12:55 2005
@@ -137,8 +137,10 @@
      * count_info and domain fields must be adjacent, as we perform atomic
      * 64-bit operations on them.
      */
-    if ( (offsetof(struct pfn_info, u.inuse._domain) != 
-          (offsetof(struct pfn_info, count_info) + sizeof(u32))) )
+    if ( ((offsetof(struct pfn_info, u.inuse._domain) != 
+           (offsetof(struct pfn_info, count_info) + sizeof(u32)))) ||
+         ((offsetof(struct pfn_info, count_info) & 7) != 0) ||
+         (sizeof(struct pfn_info) != 40) )
     {
         printk("Weird pfn_info layout (%ld,%ld,%ld)\n",
                offsetof(struct pfn_info, count_info),
diff -r 4ab4f023a6ce -r bd37123974b2 xen/common/event_channel.c
--- a/xen/common/event_channel.c        Thu Oct  6 10:11:16 2005
+++ b/xen/common/event_channel.c        Thu Oct  6 10:12:55 2005
@@ -63,9 +63,18 @@
 static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 {
     struct evtchn *chn;
-    struct domain *d = current->domain;
+    struct domain *d;
     int            port = alloc->port;
+    domid_t        dom = alloc->dom;
     long           rc = 0;
+
+    if ( dom == DOMID_SELF )
+        dom = current->domain->domain_id;
+    else if ( !IS_PRIV(current->domain) )
+        return -EPERM;
+
+    if ( (d = find_domain_by_id(dom)) == NULL )
+        return -ESRCH;
 
     spin_lock(&d->evtchn_lock);
 
@@ -84,11 +93,11 @@
     {
     case ECS_FREE:
         chn->state = ECS_UNBOUND;
-        chn->u.unbound.remote_domid = alloc->dom;
+        chn->u.unbound.remote_domid = alloc->remote_dom;
         break;
 
     case ECS_UNBOUND:
-        if ( chn->u.unbound.remote_domid != alloc->dom )
+        if ( chn->u.unbound.remote_domid != alloc->remote_dom )
             ERROR_EXIT(-EINVAL);
         break;
 
@@ -99,7 +108,10 @@
  out:
     spin_unlock(&d->evtchn_lock);
 
+    put_domain(d);
+
     alloc->port = port;
+
     return rc;
 }
 
diff -r 4ab4f023a6ce -r bd37123974b2 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Thu Oct  6 10:11:16 2005
+++ b/xen/include/asm-x86/mm.h  Thu Oct  6 10:12:55 2005
@@ -22,9 +22,6 @@
     /* Each frame can be threaded onto a doubly-linked list. */
     struct list_head list;
 
-    /* Timestamp from 'TLB clock', used to reduce need for safety flushes. */
-    u32 tlbflush_timestamp;
-
     /* Reference count and various PGC_xxx flags and fields. */
     u32 count_info;
 
@@ -37,17 +34,20 @@
             u32 _domain; /* pickled format */
             /* Type reference count and various PGT_xxx flags and fields. */
             unsigned long type_info;
-        } inuse;
+        } __attribute__ ((packed)) inuse;
 
         /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
         struct {
+            /* Order-size of the free chunk this page is the head of. */
+            u32 order;
             /* Mask of possibly-tainted TLBs. */
             cpumask_t cpumask;
-            /* Order-size of the free chunk this page is the head of. */
-            u8 order;
-        } free;
+        } __attribute__ ((packed)) free;
 
     } u;
+
+    /* Timestamp from 'TLB clock', used to reduce need for safety flushes. */
+    u32 tlbflush_timestamp;
 };
 
  /* The following page types are MUTUALLY EXCLUSIVE. */
diff -r 4ab4f023a6ce -r bd37123974b2 xen/include/public/event_channel.h
--- a/xen/include/public/event_channel.h        Thu Oct  6 10:11:16 2005
+++ b/xen/include/public/event_channel.h        Thu Oct  6 10:12:55 2005
@@ -10,14 +10,16 @@
 #define __XEN_PUBLIC_EVENT_CHANNEL_H__
 
 /*
- * EVTCHNOP_alloc_unbound: Prepare a local port for binding to <dom>.
- * <port> may be wildcarded by setting to zero, in which case a fresh port
- * will be allocated, and the field filled in on return.
+ * EVTCHNOP_alloc_unbound: Allocate a port in <dom> for later binding to
+ * <remote_dom>. <port> may be wildcarded by setting to zero, in which case a
+ * fresh port will be allocated, and the field filled in on return.
+ * NOTES:
+ *  1. If the caller is unprivileged then <dom> must be DOMID_SELF.
  */
 #define EVTCHNOP_alloc_unbound    6
 typedef struct evtchn_alloc_unbound {
     /* IN parameters */
-    domid_t dom;
+    domid_t dom, remote_dom;
     /* IN/OUT parameters */
     u32     port;
 } evtchn_alloc_unbound_t;

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

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