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

[Xen-devel] [PATCH] get xenstore buffer in vmx guest

To: Ian Pratt <m+Ian.Pratt@xxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] get xenstore buffer in vmx guest
From: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
Date: Mon, 05 Sep 2005 16:38:20 +0800
Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 05 Sep 2005 08:39:29 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510
This patch add support to get xenstore buffer in unmodified vmx guest.
mfn_to_virt it not available in unmodified kernel so use an external symbol for it. This symbol will be exported by event channel pci device
driver. The driver will use ioremap to get the access to this page.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>

diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Tue Aug 30 20:36:49 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c Fri Sep 2 22:47:27 2005
@@ -48,12 +48,12 @@

 static inline struct ringbuf_head *outbuf(void)
 {
-       return mfn_to_virt(xen_start_info.store_mfn);
+       return XENSTORE_BUF;
 }

 static inline struct ringbuf_head *inbuf(void)
 {
-       return mfn_to_virt(xen_start_info.store_mfn) + PAGE_SIZE/2;
+       return XENSTORE_BUF + PAGE_SIZE/2;
 }

static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
@@ -218,7 +218,7 @@
        }

        /* FIXME zero out page -- domain builder should probably do this*/
-       memset(mfn_to_virt(xen_start_info.store_mfn), 0, PAGE_SIZE);
+       memset(XENSTORE_BUF, 0, PAGE_SIZE);

        return 0;
 }
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h Tue Aug 30 20:36:49 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h Fri Sep 2 22:47:27 2005
@@ -38,4 +38,11 @@
 int xs_input_avail(void);
 extern wait_queue_head_t xb_waitq;

+#ifdef CONFIG_XEN
+#define XENSTORE_BUF mfn_to_virt(xen_start_info.store_mfn)
+#else
+extern void *shared_xenstore_buf;
+#define XENSTORE_BUF shared_xenstore_buf
+#endif
+
 #endif /* _XENBUS_COMMS_H */
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Tue Aug 30 20:36:49 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c Fri Sep 2 22:47:27 2005
@@ -648,4 +648,5 @@
        return 0;
 }

-postcore_initcall(xenbus_probe_init);
+module_init(xenbus_probe_init);
+MODULE_LICENSE("GPL");

diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c    Fri Sep  2 
22:47:27 2005
@@ -48,12 +48,12 @@
 
 static inline struct ringbuf_head *outbuf(void)
 {
-       return mfn_to_virt(xen_start_info.store_mfn);
+       return XENSTORE_BUF;
 }
 
 static inline struct ringbuf_head *inbuf(void)
 {
-       return mfn_to_virt(xen_start_info.store_mfn) + PAGE_SIZE/2;
+       return XENSTORE_BUF + PAGE_SIZE/2;
 }
 
 static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
@@ -218,7 +218,7 @@
        }
 
        /* FIXME zero out page -- domain builder should probably do this*/
-       memset(mfn_to_virt(xen_start_info.store_mfn), 0, PAGE_SIZE);
+       memset(XENSTORE_BUF, 0, PAGE_SIZE);
 
        return 0;
 }
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h    Fri Sep  2 
22:47:27 2005
@@ -38,4 +38,11 @@
 int xs_input_avail(void);
 extern wait_queue_head_t xb_waitq;
 
+#ifdef CONFIG_XEN
+#define XENSTORE_BUF mfn_to_virt(xen_start_info.store_mfn)
+#else
+extern void *shared_xenstore_buf;
+#define XENSTORE_BUF shared_xenstore_buf
+#endif
+
 #endif /* _XENBUS_COMMS_H */
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Tue Aug 30 
20:36:49 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Fri Sep  2 
22:47:27 2005
@@ -648,4 +648,5 @@
        return 0;
 }
 
-postcore_initcall(xenbus_probe_init);
+module_init(xenbus_probe_init);
+MODULE_LICENSE("GPL");

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>