/[pkg-src]/trunk/kernel26-xen/patches-2.6.25-r1/1006-2.6.25-xen-Enable-Xen-console-by-default-in-domU.patch |
Contents of /trunk/kernel26-xen/patches-2.6.25-r1/1006-2.6.25-xen-Enable-Xen-console-by-default-in-domU.patch
Parent Directory | Revision Log
Revision 606 -
(show annotations)
(download)
Thu May 22 23:13:13 2008 UTC (15 years, 11 months ago) by niro
File size: 4763 byte(s)
Thu May 22 23:13:13 2008 UTC (15 years, 11 months ago) by niro
File size: 4763 byte(s)
-ver bump to 2.6.25-magellan-r1: - linux-2.6.25.4 - fbcondecor-0.9.4 - squashfs-3.3 - unionfs-2.3.3 - tuxonice-3.0-rc7 - linux-phc-0.3.0 - acpi-dstd-0.9a - reiser4 - xen-3.2.0 . ipw3945-1.2.2
1 | From 246e1fc0e1db8cd62e7c297559a34b3be729c76e Mon Sep 17 00:00:00 2001 |
2 | From: Markus Armbruster <armbru@redhat.com> |
3 | Date: Thu, 10 Apr 2008 17:46:39 +0200 |
4 | Subject: [PATCH] xen: Enable Xen console by default in domU |
5 | |
6 | Without console= arguments on the kernel command line, the first |
7 | console to register becomes enabled and the preferred console (the one |
8 | behind /dev/console). This is tty (assuming CONFIG_VT_CONSOLE is |
9 | enabled, which it commonly is). |
10 | |
11 | This is okay as long tty is a useful console. But unless we have the |
12 | PV framebuffer, and it is enabled for this domain, tty0 in domU is |
13 | merely a dummy. In that case, we want the preferred console to be the |
14 | Xen console hvc0, and we want it without having to fiddle with the |
15 | kernel command line. |
16 | |
17 | Even with PV framebuffer enabled, we still want to enable the Xen |
18 | console as well. |
19 | |
20 | Problem: when tty registers, we can't yet know whether the PVFB is |
21 | enabled. By the time we can know (xenstore is up), the console setup |
22 | game is over. |
23 | |
24 | Enable the Xen console hvc by default, and make it the preferred |
25 | console. Change the preferred console to tty when PVFB probes |
26 | successfully, unless we've been given console kernel parameters. |
27 | |
28 | Signed-off-by: Markus Armbruster <armbru@redhat.com> |
29 | --- |
30 | arch/x86/xen/enlighten.c | 6 ++++++ |
31 | drivers/video/xen-fbfront.c | 25 +++++++++++++++++++++++++ |
32 | include/linux/console.h | 2 ++ |
33 | kernel/printk.c | 2 ++ |
34 | 4 files changed, 35 insertions(+), 0 deletions(-) |
35 | |
36 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c |
37 | index 66ffdb2..a5b111d 100644 |
38 | --- a/arch/x86/xen/enlighten.c |
39 | +++ b/arch/x86/xen/enlighten.c |
40 | @@ -25,6 +25,7 @@ |
41 | #include <linux/mm.h> |
42 | #include <linux/page-flags.h> |
43 | #include <linux/highmem.h> |
44 | +#include <linux/console.h> |
45 | |
46 | #include <xen/interface/xen.h> |
47 | #include <xen/interface/physdev.h> |
48 | @@ -1245,6 +1246,11 @@ asmlinkage void __init xen_start_kernel(void) |
49 | ? __pa(xen_start_info->mod_start) : 0; |
50 | boot_params.hdr.ramdisk_size = xen_start_info->mod_len; |
51 | |
52 | + if (!is_initial_xendomain()) { |
53 | + add_preferred_console("tty", 0, NULL); |
54 | + add_preferred_console("hvc", 0, NULL); |
55 | + } |
56 | + |
57 | /* Start the world */ |
58 | start_kernel(); |
59 | } |
60 | diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c |
61 | index 619a6f8..4e10876 100644 |
62 | --- a/drivers/video/xen-fbfront.c |
63 | +++ b/drivers/video/xen-fbfront.c |
64 | @@ -18,6 +18,7 @@ |
65 | * frame buffer. |
66 | */ |
67 | |
68 | +#include <linux/console.h> |
69 | #include <linux/kernel.h> |
70 | #include <linux/errno.h> |
71 | #include <linux/fb.h> |
72 | @@ -48,6 +49,7 @@ struct xenfb_info { |
73 | |
74 | static u32 xenfb_mem_len = XENFB_WIDTH * XENFB_HEIGHT * XENFB_DEPTH / 8; |
75 | |
76 | +static void xenfb_make_preferred_console(void); |
77 | static int xenfb_remove(struct xenbus_device *); |
78 | static void xenfb_init_shared_page(struct xenfb_info *); |
79 | static int xenfb_connect_backend(struct xenbus_device *, struct xenfb_info *); |
80 | @@ -348,6 +350,7 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, |
81 | if (ret < 0) |
82 | goto error; |
83 | |
84 | + xenfb_make_preferred_console(); |
85 | return 0; |
86 | |
87 | error_nomem: |
88 | @@ -358,6 +361,28 @@ static int __devinit xenfb_probe(struct xenbus_device *dev, |
89 | return ret; |
90 | } |
91 | |
92 | +static __devinit void |
93 | +xenfb_make_preferred_console(void) |
94 | +{ |
95 | + struct console *c; |
96 | + |
97 | + if (console_set_on_cmdline) |
98 | + return; |
99 | + |
100 | + acquire_console_sem(); |
101 | + for (c = console_drivers; c; c = c->next) { |
102 | + if (!strcmp(c->name, "tty") && c->index == 0) |
103 | + break; |
104 | + } |
105 | + release_console_sem(); |
106 | + if (c) { |
107 | + unregister_console(c); |
108 | + c->flags |= CON_CONSDEV; |
109 | + c->flags &= ~CON_PRINTBUFFER; /* don't print again */ |
110 | + register_console(c); |
111 | + } |
112 | +} |
113 | + |
114 | static int xenfb_resume(struct xenbus_device *dev) |
115 | { |
116 | struct xenfb_info *info = dev->dev.driver_data; |
117 | diff --git a/include/linux/console.h b/include/linux/console.h |
118 | index a5f88a6..7f51fa8 100644 |
119 | --- a/include/linux/console.h |
120 | +++ b/include/linux/console.h |
121 | @@ -107,6 +107,8 @@ struct console { |
122 | struct console *next; |
123 | }; |
124 | |
125 | +extern int console_set_on_cmdline; |
126 | + |
127 | extern int add_preferred_console(char *name, int idx, char *options); |
128 | extern int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options); |
129 | extern void register_console(struct console *); |
130 | diff --git a/kernel/printk.c b/kernel/printk.c |
131 | index bdd4ea8..99b9da0 100644 |
132 | --- a/kernel/printk.c |
133 | +++ b/kernel/printk.c |
134 | @@ -118,6 +118,7 @@ struct console_cmdline |
135 | static struct console_cmdline console_cmdline[MAX_CMDLINECONSOLES]; |
136 | static int selected_console = -1; |
137 | static int preferred_console = -1; |
138 | +int console_set_on_cmdline; |
139 | |
140 | /* Flag: console code may call schedule() */ |
141 | static int console_may_schedule; |
142 | @@ -842,6 +843,7 @@ static int __init console_setup(char *str) |
143 | *s = 0; |
144 | |
145 | add_preferred_console(buf, idx, options); |
146 | + console_set_on_cmdline = 1; |
147 | return 1; |
148 | } |
149 | __setup("console=", console_setup); |
150 | -- |
151 | 1.5.4.1 |
152 |