ia64/xen-unstable

changeset 1425:46406c62b1d3

bitkeeper revision 1.929 (40beeffatmTqXw9_IGgwiDQCZdOKhA)

Got rid of xencons0 and /dev/xen/cons entirely. DOM0 now attaches
to /dev/ttyS0; all others attach to /dev/tty1. The default
attachment can be changed using the 'xencons=' boot-parameter
switch.
author kaf24@scramble.cl.cam.ac.uk
date Thu Jun 03 09:31:38 2004 +0000 (2004-06-03)
parents 26483a083da1
children 00e1d3ae9894
files README.CD docs/Console-HOWTO.txt docs/Xen-HOWTO.txt xenolinux-2.4.26-sparse/arch/xen/drivers/console/console.c
line diff
     1.1 --- a/README.CD	Wed Jun 02 22:54:02 2004 +0000
     1.2 +++ b/README.CD	Thu Jun 03 09:31:38 2004 +0000
     1.3 @@ -544,20 +544,16 @@ remove ttyN from /etc/inittab for domain
     1.4  /etc/rc.sysinit script #'ing the lines out of /etc/inittab won't work
     1.5  as it ignores the '#' and tries to access them anyway.
     1.6  
     1.7 -Every Xenolinux instance owns a bidirectional 'virtual
     1.8 -console'. Boot-time output will be directed to this console by default
     1.9 -for all domain other than 0 (because the console name is tty0); domain
    1.10 -0 requires you to specify 'console=xencons0' as a boot parameter. It
    1.11 -is also possible to log in via the virtual console --- once again, for
    1.12 -most domains your normal startup scripts will work as normal (e.g., by
    1.13 -running mingetty on tty1-7). For domain 0, you must connect to the
    1.14 -special 'xencons' device node:
    1.15 - # mkdir -p /dev/xen
    1.16 - # mknod /dev/xen/cons c 4 123
    1.17 - # echo "c:2345:respawn:/sbin/mingetty --noclear xen/cons" >>/etc/inittab
    1.18 -If you wish to permit root logins via the special DOM0 node then you
    1.19 -must also add 'xen/cons' to the list of trusted ttys in
    1.20 -/etc/securetty.
    1.21 +Every Xenolinux instance owns a bidirectional 'virtual console'.
    1.22 +The device node to which this console is attached can be configured
    1.23 +by specifying 'xencons=' on the OS command line:
    1.24 + 'xencons=off'  --> disable virtual console
    1.25 + 'xencons=tty'  --> attach console to /dev/tty1 (tty0 at boot-time)
    1.26 + 'xencons=ttyS' --> attach console to /dev/ttyS0
    1.27 +The default is to attach to /dev/tty1, and also to create dummy
    1.28 +devices for /dev/tty2-63 to avoid warnings from many standard distro
    1.29 +startup scripts. The exception is domain 0, which by default attaches
    1.30 +to /dev/ttyS0.
    1.31  
    1.32  Note that, because domains>0 don't have any privileged access at all,
    1.33  certain commands in the default boot sequence will fail e.g. attempts
     2.1 --- a/docs/Console-HOWTO.txt	Wed Jun 02 22:54:02 2004 +0000
     2.2 +++ b/docs/Console-HOWTO.txt	Thu Jun 03 09:31:38 2004 +0000
     2.3 @@ -1,7 +1,7 @@
     2.4      New console I/O infrastructure in Xen 1.3
     2.5      =========================================
     2.6  
     2.7 -    Keir Fraser, University of Cambridge, 22nd March 2004
     2.8 +    Keir Fraser, University of Cambridge, 3rd June 2004
     2.9  
    2.10   I thought I'd write a quick note about using the new console I/O
    2.11   infrastructure in Xen 1.3. Significant new features compared with 1.2,
    2.12 @@ -11,13 +11,26 @@
    2.13    - a new terminal client (replaces the use of telnet in character mode)
    2.14    - proper handling of terminal emulation
    2.15  
    2.16 +Accessing the virtual console from within the guest OS
    2.17 +------------------------------------------------------
    2.18 + Every Xenolinux instance owns a bidirectional 'virtual console'.
    2.19 + The device node to which this console is attached can be configured
    2.20 + by specifying 'xencons=' on the OS command line:
    2.21 +  'xencons=off'  --> disable virtual console
    2.22 +  'xencons=tty'  --> attach console to /dev/tty1 (tty0 at boot-time)
    2.23 +  'xencons=ttyS' --> attach console to /dev/ttyS0
    2.24 + The default is to attach to /dev/tty1, and also to create dummy
    2.25 + devices for /dev/tty2-63 to avoid warnings from many standard distro
    2.26 + startup scripts. The exception is domain 0, which by default attaches
    2.27 + to /dev/ttyS0.
    2.28 +
    2.29  Domain 0 virtual console
    2.30  ------------------------
    2.31   The virtual console for domain 0 is shared with Xen's console. For
    2.32   example, if you specify 'console=com1' as a boot parameter to Xen,
    2.33   then domain 0 will have bi-directional access to the primary serial
    2.34   line. Boot-time messages can be directed to the virtual console by
    2.35 - specifying 'console=xencons0' as a boot parameter to Xenolinux.
    2.36 + specifying 'console=ttyS0' as a boot parameter to Xenolinux.
    2.37  
    2.38  Connecting to the virtual console
    2.39  ---------------------------------
    2.40 @@ -33,18 +46,9 @@ Logging in via virtual console
    2.41   'getty' is running. In most domains the virtual console is named tty1
    2.42   so standard startup scripts and /etc/inittab should work
    2.43   fine. Furthermore, tty2-63 are created as dummy console devices to
    2.44 - suppress warnings from standard startup scripts.
    2.45 -
    2.46 - In domain 0 we avoid conflict with the 'real' console by registering
    2.47 - the virtual console with a special device number. A suitable device
    2.48 - node must therefore be created, and a new line added to inittab:
    2.49 -  # mkdir -p /dev/xen
    2.50 -  # mknod /dev/xen/cons c 4 123
    2.51 -  # echo "c:2345:respawn:/sbin/mingetty --noclear xen/cons" >>/etc/inittab
    2.52 - Additionally, if you wish to allow root logins via the virtual
    2.53 - console, then 'xen/cons' must be added to the trusted tty list in
    2.54 - /etc/securetty. On some systems you *may* also need to modify the
    2.55 - file /etc/securettys (note the final 's').
    2.56 + suppress warnings from standard startup scripts. If the OS has
    2.57 + attached the virtual console to /dev/ttyS0 then you will need to
    2.58 + start a 'mingetty' on that device node.
    2.59  
    2.60  Virtual console for other domains
    2.61  ---------------------------------
     3.1 --- a/docs/Xen-HOWTO.txt	Wed Jun 02 22:54:02 2004 +0000
     3.2 +++ b/docs/Xen-HOWTO.txt	Thu Jun 03 09:31:38 2004 +0000
     3.3 @@ -282,7 +282,12 @@ starting the domain.
     3.4  Boot-time output will be directed to this console by default, because
     3.5  the console name is tty0. It is also possible to log in via the
     3.6  virtual console --- once again, your normal startup scripts will work
     3.7 -as normal (e.g., by running mingetty on tty1-7).
     3.8 +as normal (e.g., by running mingetty on tty1-7).  The device node to
     3.9 +which the virtual console is attached can be configured by specifying
    3.10 +'xencons=' on the OS command line: 
    3.11 + 'xencons=off' --> disable virtual console
    3.12 + 'xencons=tty' --> attach console to /dev/tty1 (tty0 at boot-time)
    3.13 + 'xencons=ttyS' --> attach console to /dev/ttyS0
    3.14  
    3.15  
    3.16  Manage Running Domains
     4.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/console/console.c	Wed Jun 02 22:54:02 2004 +0000
     4.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/console/console.c	Thu Jun 03 09:31:38 2004 +0000
     4.3 @@ -31,12 +31,28 @@
     4.4  #include <asm/ctrl_if.h>
     4.5  
     4.6  /*
     4.7 - * NB. /dev/xencons[0-9]+ are only exported by domain 0.
     4.8 - * All other domains use the normal /dev/tty[0-9]+ device nodes.
     4.9 - * Only /dev/tty1 is currently hooked up to real I/O -- all others are
    4.10 - * dummies to suppress warnings from standard distro startip scripts.
    4.11 + * Modes:
    4.12 + *  'xencons=off'  [XC_OFF]:     Console is disabled.
    4.13 + *  'xencons=tty'  [XC_TTY]:     Console attached to '/dev/tty[0-9]+'.
    4.14 + *  'xencons=ttyS' [XC_SERIAL]:  Console attached to '/dev/ttyS[0-9]+'.
    4.15 + *                 [XC_DEFAULT]: DOM0 -> XC_SERIAL ; all others -> XC_TTY.
    4.16 + * 
    4.17 + * NB. In mode XC_TTY, we create dummy consoles for tty2-63. This suppresses
    4.18 + * warnings from standard distro startup scripts.
    4.19   */
    4.20 -#define XENCONS_TTY_MINOR   123
    4.21 +static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
    4.22 +
    4.23 +static int __init xencons_setup(char *str)
    4.24 +{
    4.25 +    if ( !strcmp(str, "tty") )
    4.26 +        xc_mode = XC_TTY;
    4.27 +    else if ( !strcmp(str, "ttyS") )
    4.28 +        xc_mode = XC_SERIAL;
    4.29 +    else if ( !strcmp(str, "off") )
    4.30 +        xc_mode = XC_OFF;
    4.31 +    return 1;
    4.32 +}
    4.33 +__setup("xencons", xencons_setup);
    4.34  
    4.35  /* The kernel and user-land drivers share a common transmit buffer. */
    4.36  #define WBUF_SIZE     4096
    4.37 @@ -99,36 +115,38 @@ static void kcons_write_dom0(
    4.38  
    4.39  static kdev_t kcons_device(struct console *c)
    4.40  {
    4.41 -    return MKDEV(TTY_MAJOR, 1);
    4.42 -}
    4.43 -
    4.44 -static kdev_t kcons_device_dom0(struct console *c)
    4.45 -{
    4.46 -    return MKDEV(TTY_MAJOR, XENCONS_TTY_MINOR);
    4.47 +    return MKDEV(TTY_MAJOR, (xc_mode == XC_SERIAL) ? 64 : 1);
    4.48  }
    4.49  
    4.50  static struct console kcons_info = {
    4.51 +    device:  kcons_device,
    4.52      flags:   CON_PRINTBUFFER,
    4.53 -    index:   -1,
    4.54 +    index:   -1
    4.55  };
    4.56  
    4.57  void xen_console_init(void)
    4.58  {
    4.59      if ( start_info.flags & SIF_INITDOMAIN )
    4.60      {
    4.61 -        strcpy(kcons_info.name, "xencons");
    4.62 -        kcons_info.device = kcons_device_dom0;
    4.63 -        kcons_info.write  = kcons_write_dom0;
    4.64 +        if ( xc_mode == XC_DEFAULT )
    4.65 +            xc_mode = XC_SERIAL;
    4.66 +        kcons_info.write = kcons_write_dom0;
    4.67      }
    4.68      else
    4.69      {
    4.70 -        strcpy(kcons_info.name, "tty");
    4.71 -        kcons_info.device = kcons_device;
    4.72 -        kcons_info.write  = kcons_write;
    4.73 +        if ( xc_mode == XC_DEFAULT )
    4.74 +            xc_mode = XC_TTY;
    4.75 +        kcons_info.write = kcons_write;
    4.76      }
    4.77  
    4.78 -    kcons_info.write = 
    4.79 -        (start_info.flags & SIF_INITDOMAIN) ? kcons_write_dom0 : kcons_write;
    4.80 +    if ( xc_mode == XC_OFF )
    4.81 +        return;
    4.82 +
    4.83 +    if ( xc_mode == XC_SERIAL )
    4.84 +        strcpy(kcons_info.name, "ttyS");
    4.85 +    else
    4.86 +        strcpy(kcons_info.name, "tty");
    4.87 +
    4.88      register_console(&kcons_info);
    4.89  }
    4.90  
    4.91 @@ -527,7 +545,6 @@ static int __init xencons_init(void)
    4.92      memset(&xencons_driver, 0, sizeof(struct tty_driver));
    4.93      xencons_driver.magic           = TTY_DRIVER_MAGIC;
    4.94      xencons_driver.major           = TTY_MAJOR;
    4.95 -    xencons_driver.num             = MAX_NR_CONSOLES;
    4.96      xencons_driver.type            = TTY_DRIVER_TYPE_SERIAL;
    4.97      xencons_driver.subtype         = SERIAL_TYPE_NORMAL;
    4.98      xencons_driver.init_termios    = tty_std_termios;
    4.99 @@ -538,15 +555,20 @@ static int __init xencons_init(void)
   4.100      xencons_driver.termios         = xencons_termios;
   4.101      xencons_driver.termios_locked  = xencons_termios_locked;
   4.102  
   4.103 -    if ( start_info.flags & SIF_INITDOMAIN )
   4.104 +    if ( xc_mode == XC_OFF )
   4.105 +        return 0;
   4.106 +
   4.107 +    if ( xc_mode == XC_SERIAL )
   4.108      {
   4.109 -        xencons_driver.name        = "xencons";
   4.110 -        xencons_driver.minor_start = XENCONS_TTY_MINOR;
   4.111 +        xencons_driver.name        = "ttyS";
   4.112 +        xencons_driver.minor_start = 64;
   4.113 +        xencons_driver.num         = 1;
   4.114      }
   4.115      else
   4.116      {
   4.117          xencons_driver.name        = "tty";
   4.118          xencons_driver.minor_start = 1;
   4.119 +        xencons_driver.num         = MAX_NR_CONSOLES;
   4.120      }
   4.121  
   4.122      xencons_driver.open            = xencons_open;