xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Xen (PV and HVM) multiple PV consoles
@ 2012-01-26 12:42 Stefano Stabellini
  2012-01-26 12:43 ` [PATCH 1/2] hvc_xen: support PV on HVM consoles Stefano Stabellini
  2012-01-26 12:43 ` [PATCH 2/2] hvc_xen: implement multiconsole support Stefano Stabellini
  0 siblings, 2 replies; 11+ messages in thread
From: Stefano Stabellini @ 2012-01-26 12:42 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com
  Cc: Stefano Stabellini, Konrad Rzeszutek Wilk, linux-kernel

Hi all,
this small patch series (sent before a few times) achieves two goals:

- make PV consoles work for PV on HVM guests;

- implement support for multiple PV consoles for PV and PV on HVM guests.


It has been tested with pv and hvm guests, with console=ttyS0,
console=hvc0, and earlyprintk=xen, with and without serial='pty' in the
VM config file.


Stefano Stabellini (2):
      hvc_xen: support PV on HVM consoles
      hvc_xen: implement multiconsole support

 drivers/tty/hvc/hvc_xen.c          |  461 ++++++++++++++++++++++++++++++++---
 include/xen/interface/hvm/params.h |    6 +-
 2 files changed, 426 insertions(+), 41 deletions(-)

A branch with these patches based on 3.2 is available here:

git://xenbits.xen.org/people/sstabellini/linux-pvhvm.git 3.2-multiconsole

Cheers,

Stefano

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 0/2] Xen PV on HVM multiple PV consoles
@ 2010-12-01 18:25 Stefano Stabellini
  2010-12-01 18:26 ` [PATCH 2/2] hvc_xen: implement multiconsole support stefano.stabellini
  0 siblings, 1 reply; 11+ messages in thread
From: Stefano Stabellini @ 2010-12-01 18:25 UTC (permalink / raw)
  To: linux-kernel; +Cc: xen-devel, Jeremy Fitzhardinge, Stefano Stabellini

Hi all,
this small patch series achieves two goals:

- make PV consoles work for PV on HVM guests;

- implement support for multiple PV consoles for PV and PV on HVM guests.

Stefano Stabellini (2):
      hvc_xen: support PV on HVM consoles
      hvc_xen: implement multiconsole support

 drivers/char/hvc_xen.c             |  479 ++++++++++++++++++++++++++++++++----
 include/xen/interface/hvm/params.h |    6 +-
 2 files changed, 441 insertions(+), 44 deletions(-)

A branch with these patches on 2.6.37-rc4 is available here:

git://xenbits.xen.org/people/sstabellini/linux-pvhvm.git 2.6.37-rc4-pvhvm-pvconsole

Cheers,

Stefano

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 1/2] hvc_xen: support PV on HVM consoles
@ 2010-08-09 15:10 stefano.stabellini
  2010-08-09 15:10 ` [PATCH 2/2] hvc_xen: implement multiconsole support stefano.stabellini
  0 siblings, 1 reply; 11+ messages in thread
From: stefano.stabellini @ 2010-08-09 15:10 UTC (permalink / raw)
  To: xen-devel; +Cc: jeremy, Stefano Stabellini

From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 drivers/char/hvc_xen.c             |   63 ++++++++++++++++++++++++++++++-----
 include/xen/interface/hvm/params.h |    6 +++-
 2 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/drivers/char/hvc_xen.c b/drivers/char/hvc_xen.c
index 60446f8..454a9cd 100644
--- a/drivers/char/hvc_xen.c
+++ b/drivers/char/hvc_xen.c
@@ -24,9 +24,12 @@
 #include <linux/init.h>
 #include <linux/types.h>
 
+#include <asm/io.h>
 #include <asm/xen/hypervisor.h>
 
 #include <xen/xen.h>
+#include <xen/interface/xen.h>
+#include <xen/hvm.h>
 #include <xen/page.h>
 #include <xen/events.h>
 #include <xen/interface/io/console.h>
@@ -42,9 +45,13 @@ static int xencons_irq;
 /* ------------------------------------------------------------------ */
 
 static unsigned long console_pfn = ~0ul;
+static unsigned int console_evtchn = xen_start_info->console.domU.evtchn;
+static struct xencons_interface *xencons_if = NULL;
 
 static inline struct xencons_interface *xencons_interface(void)
 {
+	if (xencons_if != NULL)
+		return xencons_if;
 	if (console_pfn == ~0ul)
 		return mfn_to_virt(xen_start_info->console.domU.mfn);
 	else
@@ -54,7 +61,7 @@ static inline struct xencons_interface *xencons_interface(void)
 static inline void notify_daemon(void)
 {
 	/* Use evtchn: this is called early, before irq is set up. */
-	notify_remote_via_evtchn(xen_start_info->console.domU.evtchn);
+	notify_remote_via_evtchn(console_evtchn);
 }
 
 static int __write_console(const char *data, int len)
@@ -130,16 +137,53 @@ static const struct hv_ops hvc_ops = {
 	.notifier_hangup = notifier_hangup_irq,
 };
 
+static int xen_hvm_console_init(void)
+{
+	int r;
+	uint64_t v = 0;
+	unsigned long mfn;
+
+	if (!xen_hvm_domain())
+		return -ENODEV;
+
+	if (xencons_if != NULL)
+		return -EBUSY;
+
+	r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
+	if (r < 0)
+		return -ENODEV;
+	console_evtchn = v;
+	hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v);
+	if (r < 0)
+		return -ENODEV;
+	mfn = v;
+	xencons_if = ioremap(mfn << PAGE_SHIFT, PAGE_SIZE);
+	if (xencons_if == NULL)
+		return -ENODEV;
+
+	return 0;
+}
+
 static int __init xen_init(void)
 {
 	struct hvc_struct *hp;
+	int r;
+
+	if (!xen_domain() || xen_initial_domain())
+		return -ENODEV;
 
-	if (!xen_pv_domain() ||
-	    xen_initial_domain() ||
-	    !xen_start_info->console.domU.evtchn)
+	if (xen_pv_domain() && !xen_start_info->console.domU.evtchn)
 		return -ENODEV;
 
-	xencons_irq = bind_evtchn_to_irq(xen_start_info->console.domU.evtchn);
+	if (xen_pv_domain())
+		console_pfn = mfn_to_pfn(xen_start_info->console.domU.mfn);
+	else {
+		r = xen_hvm_console_init();
+		if (r < 0)
+			return r;
+	}
+
+	xencons_irq = bind_evtchn_to_irq(console_evtchn);
 	if (xencons_irq < 0)
 		xencons_irq = 0; /* NO_IRQ */
 
@@ -149,15 +193,13 @@ static int __init xen_init(void)
 
 	hvc = hp;
 
-	console_pfn = mfn_to_pfn(xen_start_info->console.domU.mfn);
-
 	return 0;
 }
 
 void xen_console_resume(void)
 {
 	if (xencons_irq)
-		rebind_evtchn_irq(xen_start_info->console.domU.evtchn, xencons_irq);
+		rebind_evtchn_irq(console_evtchn, xencons_irq);
 }
 
 static void __exit xen_fini(void)
@@ -168,9 +210,12 @@ static void __exit xen_fini(void)
 
 static int xen_cons_init(void)
 {
-	if (!xen_pv_domain())
+	if (!xen_domain())
 		return 0;
 
+	if (xen_hvm_domain())
+		xen_hvm_console_init();
+
 	hvc_instantiate(HVC_COOKIE, 0, &hvc_ops);
 	return 0;
 }
diff --git a/include/xen/interface/hvm/params.h b/include/xen/interface/hvm/params.h
index 1888d8c..1b4f923 100644
--- a/include/xen/interface/hvm/params.h
+++ b/include/xen/interface/hvm/params.h
@@ -90,6 +90,10 @@
 /* Boolean: Enable aligning all periodic vpts to reduce interrupts */
 #define HVM_PARAM_VPT_ALIGN    16
 
-#define HVM_NR_PARAMS          17
+/* Console debug shared memory ring and event channel */
+#define HVM_PARAM_CONSOLE_PFN    17
+#define HVM_PARAM_CONSOLE_EVTCHN 18
+
+#define HVM_NR_PARAMS          19
 
 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */
-- 
1.5.6.5

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

end of thread, other threads:[~2012-01-27 18:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-26 12:42 [PATCH 0/2] Xen (PV and HVM) multiple PV consoles Stefano Stabellini
2012-01-26 12:43 ` [PATCH 1/2] hvc_xen: support PV on HVM consoles Stefano Stabellini
2012-01-27 14:02   ` Konrad Rzeszutek Wilk
2012-01-27 15:29     ` Stefano Stabellini
2012-01-26 12:43 ` [PATCH 2/2] hvc_xen: implement multiconsole support Stefano Stabellini
2012-01-27 16:03   ` [Xen-devel] " Konrad Rzeszutek Wilk
2012-01-27 17:16     ` Stefano Stabellini
2012-01-27 18:36       ` Konrad Rzeszutek Wilk
2012-01-27 18:37   ` Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2010-12-01 18:25 [PATCH 0/2] Xen PV on HVM multiple PV consoles Stefano Stabellini
2010-12-01 18:26 ` [PATCH 2/2] hvc_xen: implement multiconsole support stefano.stabellini
2010-08-09 15:10 [PATCH 1/2] hvc_xen: support PV on HVM consoles stefano.stabellini
2010-08-09 15:10 ` [PATCH 2/2] hvc_xen: implement multiconsole support stefano.stabellini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).