xen hvc console
Subsystems (3)
I had a quick try to make it work, but no success thus far. Should it be enough to apply the patch and then boot with "console=/dev/hvc0"?
Also, why do you comment out the EARLY_PRINTK stuff in Kconfig?
J
Quoted 2 lines · Jeremy Fitzhardinge
I had a quick try to make it work, but no success thus far. Should it be enough to apply the patch and then boot with "console=/dev/hvc0"?
Without /dev/, i.e. "console=hvc0". But, yes, that should be it. Works for me.
Quoted 1 line
Also, why do you comment out the
EARLY_PRINTKstuff inKconfig?
Doesn't compile due to setup_early_printk() being gone.
I also think we don't need early_printk in xen any more. The hvc console supports a two-step setup. One can be done very early at boot (hvc_instantiate) and one later on, once everything (memory, irqs) is up and running, during normal device initialization (hvc_alloc).
I'm still playing with it a bit and browse through the console code. Right now early hvc initialization happens in console_init, I'll try to do it earlier at boot.
cheers,
Gerd
Signature · 1 line
Gerd Hoffmann <[email protected]>
Quoted 2 lines · Jeremy Fitzhardinge
I had a quick try to make it work, but no success thus far. Should it be enough to apply the patch and then boot with "console=/dev/hvc0"?
Patch updates ;)
xen-kill-earlyprintk-hacks.patch
reverse the hackish early_console bits for xen
early-printk-boot-console.patch
some generic early printk & boot console fixups (already sent to lkml).
xen-hvc-console.patch
slightly updated xen-hvc-console patch, CONFIG_EARLY_PRINTK isn't commented out any more.
xen-hvc-earlyprintk.patch
add early printk support via hvc console, enable using "earlyprintk=xen" on the kernel command line.
cheers,
Gerd
Signature · 1 line
Gerd Hoffmann <[email protected]>
--- arch/i386/kernel/early_printk.c | 2 -- drivers/xen/console/console.c | 4 ++++ init/main.c | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-)
arch/i386/kernel/early_printk.c +0 -2
@@ -1,4 +1,2 @@ -#ifndef CONFIG_XEN #include "../../x86_64/kernel/early_printk.c" -#endif
drivers/xen/console/console.c +4 -0
@@ -142,6 +142,8 @@ static void kcons_write_dom0(struct cons } } +#if 0 +void early_printk (const char *fmt, ...) {va_list args;
@@ -183,6 +185,8 @@ void __init disable_early_printk(void) early_console_initialized = 0; } +#endif +static struct tty_driver *kcons_device (struct console *c,int *index) { *index =0 ;
init/main.c +0 -2
@@ -507,8 +507,6 @@ asmlinkage void __init start_kernel(voidunwind_init ();lockdep_init (); -//setup_early_printk(NULL); -local_irq_disable ();early_boot_irqs_off ();early_init_irq_lock_class ();
--- arch/x86_64/kernel/early_printk.c | 20 +++++--------------- drivers/char/tty_io.c | 5 ----- kernel/printk.c | 26 ++++++++++++++++---------- 3 files changed, 21 insertions(+), 30 deletions(-)
arch/x86_64/kernel/early_printk.c +5 -15
@@ -244,22 +244,12 @@ static int __init setup_early_printk(cha early_console = &simnow_console; keep_early =1 ; } + +if (keep_early) + early_console->flags &= ~CON_BOOT ; +else + early_console->flags |=CON_BOOT ;register_console (early_console);return 0 ; } -early_param ("earlyprintk" , setup_early_printk); - -void __init disable_early_printk (void ) -{ -if (!early_console_initialized || !early_console) -return ; -if (!keep_early) { -printk ("disabling early console\n" ); -unregister_console (early_console); - early_console_initialized =0 ; - }else { -printk ("keeping early console\n" ); - } -} -
kernel/printk.c +16 -10
@@ -931,8 +931,16 @@ void register_console(struct console *co {int i;unsigned long flags; +struct console *bootconsole =NULL ; -if (preferred_console <0 ) +if (console_drivers) { +if (console->flags &CON_BOOT ) +return ; +if (console_drivers->flags &CON_BOOT ) + bootconsole = console_drivers; + } + +if (preferred_console <0 || bootconsole || !console_drivers) preferred_console = selected_console;/*
@@ -978,8 +986,11 @@ void register_console(struct console *coif (!(console->flags &CON_ENABLED ))return ; -if (console_drivers && (console_drivers->flags &CON_BOOT )) { -unregister_console (console_drivers); +if (bootconsole) { +printk (KERN_INFO "console handover: boot [%s%d] -> real [%s%d]\n" , + bootconsole->name, bootconsole->index, + console->name, console->index); +unregister_console (bootconsole); console->flags &= ~CON_PRINTBUFFER ; }
@@ -1030,16 +1041,11 @@ int unregister_console(struct console *c } } -/* If last console is removed, we re-enable picking the first -* one that gets registered. Without that, pmac early boot console -* would prevent fbcon from taking over. -* +/* * If this isn't the last console and it has CON_CONSDEV set, we * need to set it on the next preferred console. */ -if (console_drivers ==NULL ) - preferred_console = selected_console; -else if (console->flags &CON_CONSDEV ) +if (console_drivers !=NULL && console->flags &CON_CONSDEV ) console_drivers->flags |=CON_CONSDEV ;release_console_sem ();
drivers/char/tty_io.c +0 -5
@@ -141,8 +141,6 @@ static DECLARE_MUTEX(allocated_ptys_lockstatic int ptmx_open (struct inode *,struct file *);#endif -extern void disable_early_printk (void ); -static void initialize_tty_struct (struct tty_struct *tty);static ssize_t tty_read (struct file *,char __user *,size_t ,loff_t *);
@@ -3881,9 +3879,6 @@ void __init console_init(void)* set up the console device so that later boot sequences can * inform about problems etc.. */ -#ifdef CONFIG_EARLY_PRINTK -disable_early_printk (); -#endif call = __con_initcall_start;while (call < __con_initcall_end) { (*call)();
From: Gerd Hoffmann <[email protected]>
--- arch/i386/xen/Kconfig | 1 arch/i386/xen/events.c | 3 drivers/char/hvc_console.c | 4 + drivers/xen/console/Makefile | 3 drivers/xen/console/hvc_xen.c | 135 ++++++++++++++++++++++++++++++++++++++++++ include/xen/events.h | 1 6 files changed, 145 insertions(+), 2 deletions(-)
arch/i386/xen/Kconfig +1 -0
@@ -5,6 +5,7 @@ config XEN bool "Enable support for Xen hypervisor" depends PARAVIRT + select HVC_DRIVER default y help This is the Linux Xen port.
drivers/char/hvc_console.c +4 -0
@@ -49,6 +49,10 @@#define TIMEOUT (10) +#ifndef NO_IRQ +#define NO_IRQ 0 +#endif +/* * Wait this long per iteration while trying to push buffered data to the * hypervisor before allowing the tty to complete a close operation.
drivers/xen/console/Makefile +2 -1
@@ -1,2 +1,3 @@ -obj-y := console.o xencons_ring.o +#obj-y := console.o xencons_ring.o +obj-y := hvc_xen.o
drivers/xen/console/hvc_xen.c new file +135 -0
135 lines not on this page · raw message
arch/i386/xen/events.c +2 -1
@@ -209,7 +209,7 @@ static int find_unbound_irq(void)return irq; } -static int bind_evtchn_to_irq (unsigned int evtchn) +int bind_evtchn_to_irq (unsigned int evtchn) {int irq;
@@ -233,6 +233,7 @@ static int bind_evtchn_to_irq(unsigned ireturn irq; } +EXPORT_SYMBOL_GPL (bind_evtchn_to_irq);static int bind_virq_to_irq (unsigned int virq,unsigned int cpu) {
include/xen/events.h +1 -0
@@ -5,6 +5,7 @@#include <xen/interface/event_channel.h> #include <asm/xen/hypercall.h> +int bind_evtchn_to_irq (unsigned int evtchn); int bind_evtchn_to_irqhandler(unsigned int evtchn, irqreturn_t (*handler)(int, void *), unsigned long irqflags, const char *devname,
--- arch/x86_64/kernel/early_printk.c | 8 ++++++++ drivers/xen/console/hvc_xen.c | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
arch/x86_64/kernel/early_printk.c +8 -0
@@ -197,6 +197,10 @@ static struct console simnow_console = { .index = -1, }; +#ifdef CONFIG_XEN +extern struct console xenboot_console; +#endif +/* Direct interface for emergencies */ struct console *early_console = &early_vga_console;static int early_console_initialized =0 ;
@@ -243,6 +247,10 @@ static int __init setup_early_printk(chasimnow_init (buf +6 ); early_console = &simnow_console; keep_early =1 ; +#ifdef CONFIG_XEN + }else if (!strncmp (buf,"xen" ,3 )) { + early_console = &xenboot_console; +#endif }if (keep_early)
drivers/xen/console/hvc_xen.c +24 -0
@@ -133,3 +133,27 @@ static int xen_cons_init(void)module_init (xen_init);module_exit (xen_fini);console_initcall (xen_cons_init); + +static void xenboot_write_console (struct console *console,const char *string, +unsigned len) +{ +unsigned int linelen, off =0 ; +const char *pos; + +while (off < len &&NULL != (pos =strchr (string+off,'\n' ))) { + linelen = pos-string+off; +if (off + linelen > len) +break ; +write_console (0 , string+off, linelen); +write_console (0 ,"\r\n" ,2 ); + off += linelen +1 ; + } +if (off < len) +write_console (0 , string+off, len-off); +} + +struct console xenboot_console = { + .name ="xenboot" , + .write = xenboot_write_console, + .flags =CON_PRINTBUFFER |CON_BOOT , +};
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/virtualization