All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] get xenstore buffer in vmx guest
@ 2005-09-05  8:38 Xiaofeng Ling
  2005-09-05 11:14 ` Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Xiaofeng Ling @ 2005-09-05  8:38 UTC (permalink / raw)
  To: Ian Pratt, Keir Fraser; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

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@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>

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");


[-- Attachment #2: vbd-xenbus.patch --]
[-- Type: text/x-patch, Size: 1761 bytes --]

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");


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] get xenstore buffer in vmx guest
  2005-09-05  8:38 [PATCH] get xenstore buffer in vmx guest Xiaofeng Ling
@ 2005-09-05 11:14 ` Rusty Russell
  0 siblings, 0 replies; 5+ messages in thread
From: Rusty Russell @ 2005-09-05 11:14 UTC (permalink / raw)
  To: Xiaofeng Ling; +Cc: Ian Pratt, xen-devel

On Mon, 2005-09-05 at 16:38 +0800, Xiaofeng Ling wrote:
>   static inline struct ringbuf_head *outbuf(void)
>   {
> -	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.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] get xenstore buffer in vmx guest
@ 2005-09-05 14:22 Ling, Xiaofeng
  2005-09-06  0:15 ` Rusty Russell
  0 siblings, 1 reply; 5+ messages in thread
From: Ling, Xiaofeng @ 2005-09-05 14:22 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Ian Pratt, xen-devel


Rusty Russell <mailto:rusty@rustcorp.com.au> wrote:
> On Mon, 2005-09-05 at 16:38 +0800, Xiaofeng Ling wrote:
>>   static inline struct ringbuf_head *outbuf(void)
>>   {
>> -	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. 
ok, so the new patch will be:

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    Mon Sep  5 22:15:45 2005
@@ -48,12 +48,12 @@

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

 static inline struct ringbuf_head *inbuf(void)
 {
-   return mfn_to_virt(xen_start_info.store_mfn) + PAGE_SIZE/2;
+   return xenstore_page_virt() + 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_page_virt(), 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    Mon Sep  5 22:15:45 2005
@@ -38,4 +38,17 @@
 int xs_input_avail(void);
 extern wait_queue_head_t xb_waitq;

+#ifdef CONFIG_XEN
+static inline void *xenstore_page_virt(void)
+{
+    return (void*)mfn_to_virt(xen_start_info.store_mfn);
+}
+#else
+extern void *shared_xenstore_buf;
+static inline void *xenstore_page_virt(void)
+{
+    return 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    Mon Sep  5 22:18:22 2005
@@ -648,4 +648,5 @@
    return 0;
 }

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] get xenstore buffer in vmx guest
  2005-09-05 14:22 Ling, Xiaofeng
@ 2005-09-06  0:15 ` Rusty Russell
  2005-09-06  5:29   ` Xiaofeng Ling
  0 siblings, 1 reply; 5+ messages in thread
From: Rusty Russell @ 2005-09-06  0:15 UTC (permalink / raw)
  To: Ling, Xiaofeng; +Cc: Ian Pratt, xen-devel

On Mon, 2005-09-05 at 22:22 +0800, Ling, Xiaofeng wrote:
> Rusty Russell <mailto:rusty@rustcorp.com.au> wrote:
> > 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. 
> ok, so the new patch will be:

> --- 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    Mon Sep  5 22:15:45 2005
> @@ -38,4 +38,17 @@
>  int xs_input_avail(void);
>  extern wait_queue_head_t xb_waitq;
> 
> +#ifdef CONFIG_XEN
> +static inline void *xenstore_page_virt(void)
> +{
> +    return (void*)mfn_to_virt(xen_start_info.store_mfn);
> +}

Great!   I think the (void*) cast is redundant though?

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

This should probably be:
	MODULE_LICENSE("Dual BSD/GPL");

Cheers,
Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] get xenstore buffer in vmx guest
  2005-09-06  0:15 ` Rusty Russell
@ 2005-09-06  5:29   ` Xiaofeng Ling
  0 siblings, 0 replies; 5+ messages in thread
From: Xiaofeng Ling @ 2005-09-06  5:29 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Ian Pratt, xen-devel

Rusty Russell wrote:
> On Mon, 2005-09-05 at 22:22 +0800, Ling, Xiaofeng wrote:
> 
>>Rusty Russell <mailto:rusty@rustcorp.com.au> wrote:
>>+#ifdef CONFIG_XEN
>>+static inline void *xenstore_page_virt(void)
>>+{
>>+    return (void*)mfn_to_virt(xen_start_info.store_mfn);
>>+}
> 
> 
> Great!   I think the (void*) cast is redundant though?
yes

> 
>>-postcore_initcall(xenbus_probe_init);
>>+module_init(xenbus_probe_init);
>>+MODULE_LICENSE("GPL");
> 
> 
> This should probably be:
> 	MODULE_LICENSE("Dual BSD/GPL");
ok.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-09-06  5:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-05  8:38 [PATCH] get xenstore buffer in vmx guest Xiaofeng Ling
2005-09-05 11:14 ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2005-09-05 14:22 Ling, Xiaofeng
2005-09-06  0:15 ` Rusty Russell
2005-09-06  5:29   ` Xiaofeng Ling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.