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

[Xen-changelog] [xen-unstable] [LINUX] console: ensure virtual console is disabled if mfn/evtchn



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID 126bef38ce059c8dcf617644e4442bca3ed0a763
# Parent  655281bca306a06bbc88bcb19a7a603fc4b5684b
[LINUX] console: ensure virtual console is disabled if mfn/evtchn
not provided.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/console/console.c      |   20 +++++++++++-----
 linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c |   16 +++++++-----
 2 files changed, 23 insertions(+), 13 deletions(-)

diff -r 655281bca306 -r 126bef38ce05 
linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c        Fri Sep 08 
19:15:11 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c        Fri Sep 08 
14:49:00 2006 -0700
@@ -182,17 +182,18 @@ static struct console kcons_info = {
        .index  = -1,
 };
 
-#define __RETCODE 0
 static int __init xen_console_init(void)
 {
        if (!is_running_on_xen())
-               return __RETCODE;
+               goto out;
 
        if (is_initial_xendomain()) {
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_SERIAL;
                kcons_info.write = kcons_write_dom0;
        } else {
+               if (!xen_start_info->console.domU.evtchn)
+                       goto out;
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_TTY;
                kcons_info.write = kcons_write;
@@ -212,14 +213,15 @@ static int __init xen_console_init(void)
                break;
 
        default:
-               return __RETCODE;
+               goto out;
        }
 
        wbuf = alloc_bootmem(wbuf_size);
 
        register_console(&kcons_info);
 
-       return __RETCODE;
+ out:
+       return 0;
 }
 console_initcall(xen_console_init);
 
@@ -247,7 +249,9 @@ void xencons_force_flush(void)
        int sz;
 
        /* Emergency console is synchronous, so there's nothing to flush. */
-       if (is_initial_xendomain())
+       if (!is_running_on_xen() ||
+           is_initial_xendomain() ||
+           !xen_start_info->console.domU.evtchn)
                return;
 
        /* Spin until console data is flushed through to the daemon. */
@@ -582,7 +586,11 @@ static int __init xencons_init(void)
        if (xc_mode == XC_OFF)
                return 0;
 
-       xencons_ring_init();
+       if (!is_initial_xendomain()) {
+               rc = xencons_ring_init();
+               if (rc)
+                       return rc;
+       }
 
        xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ?
                                          1 : MAX_NR_CONSOLES);
diff -r 655281bca306 -r 126bef38ce05 
linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c   Fri Sep 08 
19:15:11 2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c   Fri Sep 08 
14:49:00 2006 -0700
@@ -110,24 +110,26 @@ static irqreturn_t handle_input(int irq,
 
 int xencons_ring_init(void)
 {
-       int err;
+       int irq;
 
        if (xencons_irq)
                unbind_from_irqhandler(xencons_irq, NULL);
        xencons_irq = 0;
 
-       if (!xen_start_info->console.domU.evtchn)
-               return 0;
+       if (!is_running_on_xen() ||
+           is_initial_xendomain() ||
+           !xen_start_info->console.domU.evtchn)
+               return -ENODEV;
 
-       err = bind_evtchn_to_irqhandler(
+       irq = bind_evtchn_to_irqhandler(
                xen_start_info->console.domU.evtchn,
                handle_input, 0, "xencons", NULL);
-       if (err <= 0) {
-               printk(KERN_ERR "XEN console request irq failed %i\n", err);
+       if (irq < 0) {
+               printk(KERN_ERR "XEN console request irq failed %i\n", irq);
                return err;
        }
 
-       xencons_irq = err;
+       xencons_irq = irq;
 
        /* In case we have in-flight data after save/restore... */
        notify_daemon();

_______________________________________________
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®.