I posted for comment on xen-devel the virtual console retry patch, which
was posted here with the subject "Booting xen_maple_defconfig kernel on
bare hardware", reiterating Hollis' objection that Xen really should
stop hijacking a major already reserved for a real serial driver.  Keir
seemed open to changing the driver to support its own major number, so
I'm posting this here for comment before I post it to xen-devel.   It is
the minimally invasive approach I can find, and works well on my JS21.

Note that you have to put `xencons=xvc' in your Linux .config, and run
`mknod /dev/xvc c 232 0' in your rootfs to use it.

Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>

---

 drivers/xen/console/console.c |   19 +++++++++++++++++--
 include/linux/major.h         |    2 ++
 2 files changed, 19 insertions(+), 2 deletions(-)

diff -r 17aa29a18b08 drivers/xen/console/console.c
--- a/drivers/xen/console/console.c     Thu Jul 27 18:57:20 2006 -0400
+++ b/drivers/xen/console/console.c     Thu Aug 03 12:34:30 2006 -0400
@@ -63,12 +63,14 @@
  *  'xencons=off'  [XC_OFF]:     Console is disabled.
  *  'xencons=tty'  [XC_TTY]:     Console attached to '/dev/tty[0-9]+'.
  *  'xencons=ttyS' [XC_SERIAL]:  Console attached to '/dev/ttyS[0-9]+'.
+ *  'xencons=xvc'  [XC_XVC]:     Console attached to '/dev/xvc'.
  *                 [XC_DEFAULT]: DOM0 -> XC_SERIAL ; all others -> XC_TTY.
  * 
  * NB. In mode XC_TTY, we create dummy consoles for tty2-63. This suppresses
  * warnings from standard distro startup scripts.
  */
-static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
+static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL, XC_XVC } 
+    xc_mode = XC_DEFAULT;
 static int xc_num = -1;
 
 #ifdef CONFIG_MAGIC_SYSRQ
@@ -85,6 +87,8 @@ static int __init xencons_setup(char *st
                xc_mode = XC_SERIAL;
        else if (!strncmp(str, "tty", 3))
                xc_mode = XC_TTY;
+       else if (!strncmp(str, "xvc", 3))
+               xc_mode = XC_XVC;
        else if (!strncmp(str, "off", 3))
                xc_mode = XC_OFF;
 
@@ -192,7 +196,7 @@ static int __init xen_console_init(void)
                if (xc_mode == XC_DEFAULT)
                        xc_mode = XC_SERIAL;
                kcons_info.write = kcons_write_dom0;
-               if (xc_mode == XC_SERIAL)
+               if (xc_mode == XC_SERIAL || xc_mode == XC_XVC)
                        kcons_info.flags |= CON_ENABLED;
        } else {
                if (xc_mode == XC_DEFAULT)
@@ -201,6 +205,12 @@ static int __init xen_console_init(void)
        }
 
        switch (xc_mode) {
+       case XC_XVC:
+               strcpy(kcons_info.name, "xvc");
+               if (xc_num == -1)
+                       xc_num = 0;
+               break;
+
        case XC_SERIAL:
                strcpy(kcons_info.name, "ttyS");
                if (xc_num == -1)
@@ -597,6 +607,11 @@ static int __init xencons_init(void)
                DRV(xencons_driver)->name        = "ttyS";
                DRV(xencons_driver)->minor_start = 64 + xc_num;
                DRV(xencons_driver)->name_base   = 0 + xc_num;
+       } else if (xc_mode == XC_XVC) {
+               DRV(xencons_driver)->name        = "xvc";
+               DRV(xencons_driver)->major       = XEN_VIRTUAL_CONSOLE;
+               DRV(xencons_driver)->minor_start = 0;
+               DRV(xencons_driver)->name_base   = 0;
        } else {
                DRV(xencons_driver)->name        = "tty";
                DRV(xencons_driver)->minor_start = xc_num;
diff -r 17aa29a18b08 include/linux/major.h
--- a/include/linux/major.h     Thu Jul 27 18:57:20 2006 -0400
+++ b/include/linux/major.h     Thu Aug 03 12:34:30 2006 -0400
@@ -166,4 +166,6 @@
 
 #define VIOTAPE_MAJOR          230
 
+#define XEN_VIRTUAL_CONSOLE    232
+
 #endif

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

Reply via email to