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

[Xen-changelog] [xen-unstable] [XENBUS] Avoid direct use of xen_start_info. It's unevailable when



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID e061f14161b052b3287a1e41222cfa292a194fc2
# Parent  9519445d9e9d7b8bd48fcd93d1bba485508ddbff
[XENBUS] Avoid direct use of xen_start_info. It's unevailable when
building as a separate driver for an HVM guest.
Signed-off-by: Steven Smith <ssmith@xxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c |   15 +++-------
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h |    2 +
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c   |    2 -
 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c |   24 +++++++++++------
 4 files changed, 24 insertions(+), 19 deletions(-)

diff -r 9519445d9e9d -r e061f14161b0 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Mon Aug 14 
13:55:17 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Mon Aug 14 
14:17:26 2006 +0100
@@ -47,11 +47,6 @@ static DECLARE_WORK(probe_work, xenbus_p
 
 DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
 
-static inline struct xenstore_domain_interface *xenstore_domain_interface(void)
-{
-       return mfn_to_virt(xen_start_info->store_mfn);
-}
-
 static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
 {
        if (unlikely(xenstored_ready == 0)) {
@@ -90,7 +85,7 @@ static const void *get_input_chunk(XENST
 
 int xb_write(const void *data, unsigned len)
 {
-       struct xenstore_domain_interface *intf = xenstore_domain_interface();
+       struct xenstore_domain_interface *intf = xen_store_interface;
        XENSTORE_RING_IDX cons, prod;
        int rc;
 
@@ -129,7 +124,7 @@ int xb_write(const void *data, unsigned 
                intf->req_prod += avail;
 
                /* This implies mb() before other side sees interrupt. */
-               notify_remote_via_evtchn(xen_start_info->store_evtchn);
+               notify_remote_via_evtchn(xen_store_evtchn);
        }
 
        return 0;
@@ -137,7 +132,7 @@ int xb_write(const void *data, unsigned 
 
 int xb_read(void *data, unsigned len)
 {
-       struct xenstore_domain_interface *intf = xenstore_domain_interface();
+       struct xenstore_domain_interface *intf = xen_store_interface;
        XENSTORE_RING_IDX cons, prod;
        int rc;
 
@@ -180,7 +175,7 @@ int xb_read(void *data, unsigned len)
                pr_debug("Finished read of %i bytes (%i to go)\n", avail, len);
 
                /* Implies mb(): they will see new header. */
-               notify_remote_via_evtchn(xen_start_info->store_evtchn);
+               notify_remote_via_evtchn(xen_store_evtchn);
        }
 
        return 0;
@@ -195,7 +190,7 @@ int xb_init_comms(void)
                unbind_from_irqhandler(xenbus_irq, &xb_waitq);
 
        err = bind_evtchn_to_irqhandler(
-               xen_start_info->store_evtchn, wake_waiting,
+               xen_store_evtchn, wake_waiting,
                0, "xenbus", &xb_waitq);
        if (err <= 0) {
                printk(KERN_ERR "XENBUS request irq failed %i\n", err);
diff -r 9519445d9e9d -r e061f14161b0 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Mon Aug 14 
13:55:17 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Mon Aug 14 
14:17:26 2006 +0100
@@ -39,5 +39,7 @@ int xb_read(void *data, unsigned len);
 int xb_read(void *data, unsigned len);
 int xs_input_avail(void);
 extern wait_queue_head_t xb_waitq;
+extern struct xenstore_domain_interface *xen_store_interface;
+extern int xen_store_evtchn;
 
 #endif /* _XENBUS_COMMS_H */
diff -r 9519445d9e9d -r e061f14161b0 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Mon Aug 14 
13:55:17 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c      Mon Aug 14 
14:17:26 2006 +0100
@@ -285,7 +285,7 @@ static int xenbus_dev_open(struct inode 
 {
        struct xenbus_dev_data *u;
 
-       if (xen_start_info->store_evtchn == 0)
+       if (xen_store_evtchn == 0)
                return -ENOENT;
 
        nonseekable_open(inode, filp);
diff -r 9519445d9e9d -r e061f14161b0 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Aug 14 
13:55:17 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Mon Aug 14 
14:17:26 2006 +0100
@@ -54,6 +54,10 @@
 
 #include "xenbus_comms.h"
 
+int xen_store_evtchn;
+struct xenstore_domain_interface *xen_store_interface;
+static unsigned long xen_store_mfn;
+
 extern struct mutex xenwatch_mutex;
 
 static struct notifier_block *xenstore_chain;
@@ -928,8 +932,7 @@ static int xsd_kva_mmap(struct file *fil
        if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
                return -EINVAL;
 
-       if (remap_pfn_range(vma, vma->vm_start,
-                           mfn_to_pfn(xen_start_info->store_mfn),
+       if (remap_pfn_range(vma, vma->vm_start, mfn_to_pfn(xen_store_mfn),
                            size, vma->vm_page_prot))
                return -EAGAIN;
 
@@ -941,7 +944,7 @@ static int xsd_kva_read(char *page, char
 {
        int len;
 
-       len  = sprintf(page, "0x%p", mfn_to_virt(xen_start_info->store_mfn));
+       len  = sprintf(page, "0x%p", xen_store_interface);
        *eof = 1;
        return len;
 }
@@ -951,12 +954,11 @@ static int xsd_port_read(char *page, cha
 {
        int len;
 
-       len  = sprintf(page, "%d", xen_start_info->store_evtchn);
+       len  = sprintf(page, "%d", xen_store_evtchn);
        *eof = 1;
        return len;
 }
 #endif
-
 
 static int __init xenbus_probe_init(void)
 {
@@ -985,7 +987,7 @@ static int __init xenbus_probe_init(void
                if (!page)
                        return -ENOMEM;
 
-               xen_start_info->store_mfn =
+               xen_store_mfn = xen_start_info->store_mfn =
                        pfn_to_mfn(virt_to_phys((void *)page) >>
                                   PAGE_SHIFT);
 
@@ -998,7 +1000,8 @@ static int __init xenbus_probe_init(void
                if (err == -ENOSYS)
                        goto err;
                BUG_ON(err);
-               xen_start_info->store_evtchn = alloc_unbound.port;
+               xen_store_evtchn = xen_start_info->store_evtchn =
+                       alloc_unbound.port;
 
 #ifdef CONFIG_PROC_FS
                /* And finally publish the above info in /proc/xen */
@@ -1014,8 +1017,13 @@ static int __init xenbus_probe_init(void
                if (xsd_port_intf)
                        xsd_port_intf->read_proc = xsd_port_read;
 #endif
-       } else
+       } else {
                xenstored_ready = 1;
+               xen_store_evtchn = xen_start_info->store_evtchn;
+               xen_store_mfn = xen_start_info->store_mfn;
+       }
+
+       xen_store_interface = mfn_to_virt(xen_store_mfn);
 
        /* Initialize the interface to xenstore. */
        err = xs_init();

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


 


Rackspace

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