Skip to contentSkip to conversation

get xenstore buffer in vmx guest

PATCH In review Xiaofeng Ling 2 participants 2 messages Sep 5, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 get xenstore buffer in vmx guest

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.

linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +2 -2
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
@@ -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;
}

linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h +7 -0
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
@@ -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 */
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +2 -1
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
@@ -648,4 +648,5 @@
 	return 0;
 }
 
-postcore_initcall(xenbus_probe_init);
+module_init(xenbus_probe_init);
+MODULE_LICENSE("GPL");
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +3 -3
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
@@ -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;
 }
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h +7 -0
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.h
@@ -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 */
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +2 -1
diff -r 287d36b46fa3 linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
@@ -648,4 +648,5 @@
 	return 0;
 }
 
-postcore_initcall(xenbus_probe_init);
+module_init(xenbus_probe_init);
+MODULE_LICENSE("GPL");

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c line 52

Quoted 5 lines · Xiaofeng Ling
  static inline struct ringbuf_head *outbuf(void)
  {
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c +1 -1
-	return mfn_to_virt(xen_start_info.store_mfn);
+	return XENSTORE_BUF;
  }

Just a minor thing: I'd really prefer an inline function called xenstore_page_virt() or something, rather than a macro which looks like a constant.

Thanks!
Rusty.

Signature · 1 line
A bad analogy is like a leaky screwdriver -- Richard Braakman