On Thu, Aug 03, 2006 at 09:01:15AM +0100, Keir Fraser wrote:
> On 2 Aug 2006, at 22:42, Amos Waterland wrote:
> > I am currently using the below patch, but would really prefer not
> > to. It's basic approach is to have the Xen virtual console driver
> > react "gracefully" in the case that a real serial driver has already
> > registered ttyS0-ttyS3. It's current behavior is to fail if the
> > 8250 driver was initialized ahead of it, and console is lost. In
> > the process I found a bug in Linux, and have included the patch for
> > it since otherwise the Xen driver initialization will succeed but
> > with negative side effects in the kobject subsystem.
> >
> > What is the story?
>
> We need to obtain our own device number and then patch the driver. It'd
> be great if someone else wants to look into this.
>
> -- Keir
The below is the least invasive approach I can find, and works well on
my PPC64 blades: I can boot the exact same kernel on bare hardware and
as a dom0. I am sure there will be distro concerns (such as
/etc/inittab and /etc/securetty), but I'd like to get the ball rolling
with this initial submission.
Note that you have to put `xencons=xvc0' in your Linux .config, and run
`mknod /dev/xvc0 c 232 0' in your rootfs.
Signed-off-by: Amos Waterland <apw@xxxxxxxxxx>
---
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 18:57:28 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[0-9]+'.
* [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 18:57:28 2006 -0400
@@ -166,4 +166,6 @@
#define VIOTAPE_MAJOR 230
+#define XEN_VIRTUAL_CONSOLE 232
+
#endif
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|