xen/arm: Merge early_printk function in console code
v4 cover xen/arm: Merge early_printk function in console code
Hello all,
This patch series aims to merge early printk in the console code. This will avoid the developper to care wheter the message is printed before or after the console is initialized.
Sincerely yours,
Julien Grall (5):
xen/arm: earlyprintk: move early_flush in early_puts xen/arm: earlyprintk: export early_puts
xen/arm: Rename EARLY_PRINTK compile option to CONFIG_EARLY_PRINTK xen/console: Add support for early printk
xen/arm: Replace early_{printk,panic} call to {printk,panic} call
xen/arch/arm/Rules.mk | 2 +- xen/arch/arm/arm32/head.S | 18 ++++----- xen/arch/arm/arm64/head.S | 18 ++++----- xen/arch/arm/early_printk.c | 36 +----------------- xen/arch/arm/mm.c | 5 +-- xen/arch/arm/setup.c | 28 +++++++------- xen/common/device_tree.c | 74 +++++++++++++++--------------------- xen/drivers/char/console.c | 6 ++- xen/drivers/char/dt-uart.c | 9 ++--- xen/drivers/char/exynos4210-uart.c | 13 +++---- xen/drivers/char/omap-uart.c | 13 +++---- xen/drivers/char/pl011.c | 13 +++---- xen/drivers/video/arm_hdlcd.c | 29 +++++++------- xen/include/asm-arm/early_printk.h | 27 +------------ xen/include/xen/early_printk.h | 21 ++++++++++ 15 files changed, 130 insertions(+), 182 deletions(-) create mode 100644 xen/include/xen/early_printk.h
Signature · 1 line
1.7.10.4
PATCH v4 1/5 xen/arm: earlyprintk: move early_flush in early_puts
early_puts function will be exported to be used in the console code. To avoid loosing characters (see why in commit cafdceb "xen/arm: avoid lost characters with early_printk), early_flush needs to be called in this function.
--- xen/arch/arm/early_printk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
xen/arch/arm/early_printk.c +6 -6
@@ -29,12 +29,6 @@ static void __init early_puts(const char *s)early_putch (*s); s++; } -} - -static void __init early_vprintk (const char *fmt,va_list args) -{ -vsnprintf (buf,sizeof (buf), fmt, args); -early_puts (buf);/* * Wait the UART has finished to transfer all characters before
@@ -43,6 +37,12 @@ static void __init early_vprintk(const char *fmt, va_list args)early_flush (); } +static void __init early_vprintk (const char *fmt,va_list args) +{ +vsnprintf (buf,sizeof (buf), fmt, args); +early_puts (buf); +} +void __init early_printk (const char *fmt, ...) {va_list args;
Signature · 1 line
1.7.10.4
PATCH v4 2/5 xen/arm: earlyprintk: export early_puts
In reply to Julien Grall---
Changes in v2:
- Fix coding style
--- xen/arch/arm/early_printk.c | 2 +- xen/include/asm-arm/early_printk.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
xen/arch/arm/early_printk.c +1 -1
@@ -21,7 +21,7 @@ void early_flush(void);/* Early printk buffer */ static char __initdata buf[512 ]; -static void __init early_puts (const char *s) +void early_puts (const char *s) {while (*s !='\0' ) {if (*s =='\n' )
xen/include/asm-arm/early_printk.h +3 -0
@@ -24,6 +24,7 @@#ifdef EARLY_PRINTK +void early_puts (const char *s);void early_printk (const char *fmt, ...) __attribute__((format (printf,1 ,2 )));void noreturnearly_panic (const char *fmt, ...)
@@ -31,6 +32,8 @@ void noreturn early_panic(const char *fmt, ...)#else +static inline void early_puts (const char *) {} +static inline __attribute__((format (printf,1 ,2 )))void early_printk (const char *fmt, ...) {}
Signature · 1 line
1.7.10.4
PATCH v4 3/5 xen/arm: Rename EARLY_PRINTK compile option to CONFIG_EARLY_PRINTK
In reply to Julien GrallMost of common compile option start with CONFIG_. Rename EARLY_PRINTK option to CONFIG_EARLY_PRINTK to be compliant.
This option will be used in common code (eg console) later.
--- xen/arch/arm/Rules.mk | 2 +- xen/arch/arm/arm32/head.S | 18 +++++++++--------- xen/arch/arm/arm64/head.S | 18 +++++++++--------- xen/include/asm-arm/early_printk.h | 6 +++--- 4 files changed, 22 insertions(+), 22 deletions(-)
xen/arch/arm/Rules.mk +1 -1
@@ -93,7 +93,7 @@ ifneq ($(EARLY_PRINTK_INC),) EARLY_PRINTK := y endif -CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK +CFLAGS-$(EARLY_PRINTK) += -DCONFIG_EARLY_PRINTK CFLAGS-$(EARLY_PRINTK_INIT_UART) += -DEARLY_PRINTK_INIT_UART CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\" CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
xen/arch/arm/arm32/head.S +9 -9
@@ -34,7 +34,7 @@ #define PT_UPPER(x) (PT_##x & 0xf00) #define PT_LOWER(x) (PT_##x & 0x0ff) -#if (defined (EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) +#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) #include EARLY_PRINTK_INC #endif
@@ -59,7 +59,7 @@ */ /* Macro to print a string to the UART, if there is one. * Clobbers r0-r3. */ -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK #define PRINT(_s) \ adr r0, 98f ; \ bl puts ; \
@@ -67,9 +67,9 @@ 98: .asciz _s ; \ .align 2 ; \ 99: -#else /* EARLY_PRINTK */ +#else /* CONFIG_EARLY_PRINTK */ #define PRINT(s) -#endif /* !EARLY_PRINTK */ +#endif /* !CONFIG_EARLY_PRINTK */ .arm
@@ -149,7 +149,7 @@ common_start: b 2b 1: -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK ldr r11, =EARLY_UART_BASE_ADDRESS /* r11 := UART base address */ teq r12, #0 /* Boot CPU sets up the UART too */ bleq init_uart
@@ -330,7 +330,7 @@ paging: /* Now we can install the fixmap and dtb mappings, since we * don't need the 1:1 map any more */ dsb -#if defined(EARLY_PRINTK) /* Fixmap is only used by early printk */ +#if defined(CONFIG_EARLY_PRINTK) /* Fixmap is only used by early printk */ /* Non-boot CPUs don't need to rebuild the fixmap itself, just * the mapping from boot_second to xen_fixmap */ teq r12, #0
@@ -492,7 +492,7 @@ ENTRY(relocate_xen) mov pc, lr -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK /* Bring up the UART. * r11: Early UART base address * Clobbers r0-r2 */
@@ -537,7 +537,7 @@ putn: hex: .ascii "0123456789abcdef" .align 2 -#else /* EARLY_PRINTK */ +#else /* CONFIG_EARLY_PRINTK */ init_uart: .global early_puts
@@ -545,7 +545,7 @@ early_puts: puts: putn: mov pc, lr -#endif /* !EARLY_PRINTK */ +#endif /* !CONFIG_EARLY_PRINTK */ /* * Local variables:
xen/arch/arm/arm64/head.S +9 -9
@@ -30,7 +30,7 @@ #define PT_DEV 0xe71 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=0 P=1 */ #define PT_DEV_L3 0xe73 /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=100 T=1 P=1 */ -#if (defined (EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) +#if (defined (CONFIG_EARLY_PRINTK)) && (defined (EARLY_PRINTK_INC)) #include EARLY_PRINTK_INC #endif
@@ -71,7 +71,7 @@ /* Macro to print a string to the UART, if there is one. * Clobbers x0-x3. */ -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK #define PRINT(_s) \ adr x0, 98f ; \ bl puts ; \
@@ -79,9 +79,9 @@ 98: .asciz _s ; \ .align 2 ; \ 99: -#else /* EARLY_PRINTK */ +#else /* CONFIG_EARLY_PRINTK */ #define PRINT(s) -#endif /* !EARLY_PRINTK */ +#endif /* !CONFIG_EARLY_PRINTK */ /*.aarch64*/
@@ -174,7 +174,7 @@ common_start: b 2b 1: -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK ldr x23, =EARLY_UART_BASE_ADDRESS /* x23 := UART base address */ cbnz x22, 1f bl init_uart /* Boot CPU sets up the UART too */
@@ -343,7 +343,7 @@ paging: /* Now we can install the fixmap and dtb mappings, since we * don't need the 1:1 map any more */ dsb sy -#if defined(EARLY_PRINTK) /* Fixmap is only used by early printk */ +#if defined(CONFIG_EARLY_PRINTK) /* Fixmap is only used by early printk */ /* Non-boot CPUs don't need to rebuild the fixmap itself, just * the mapping from boot_second to xen_fixmap */ cbnz x22, 1f
@@ -489,7 +489,7 @@ ENTRY(relocate_xen) ret -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK /* Bring up the UART. * x23: Early UART base address * Clobbers x0-x1 */
@@ -536,7 +536,7 @@ putn: hex: .ascii "0123456789abcdef" .align 2 -#else /* EARLY_PRINTK */ +#else /* CONFIG_EARLY_PRINTK */ init_uart: .global early_puts
@@ -544,7 +544,7 @@ early_puts: puts: putn: ret -#endif /* EARLY_PRINTK */ +#endif /* !CONFIG_EARLY_PRINTK */ /* * Local variables:
xen/include/asm-arm/early_printk.h +3 -3
@@ -12,7 +12,7 @@#include <xen/config.h> -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK /* need to add the uart address offset in page to the fixmap address */ #define EARLY_UART_VIRTUAL_ADDRESS \
@@ -22,7 +22,7 @@#ifndef __ASSEMBLY__ -#ifdef EARLY_PRINTK +#ifdef CONFIG_EARLY_PRINTK void early_puts (const char *s);void early_printk (const char *fmt, ...)
@@ -42,7 +42,7 @@ static inline void noreturn __attribute__((format (printf, 1, 2))) early_panic(const char *fmt, ...) {while (1 );} -#endif +#endif /* !CONFIG_EARLY_PRINTK */ #endif /* __ASSEMBLY__ */
Signature · 1 line
1.7.10.4
PATCH v4 4/5 xen/console: Add support for early printk
In reply to Julien GrallOn ARM, a function (early_printk) was introduced to output message when the serial port is not initialized.
This solution is fragile because the developper needs to know when the serial port is initialized, to use either early_printk or printk. Moreover some functions (mainly in common code), only use printk. This will result to a loss of message sometimes.
Directly call early_printk in console code when the serial port is not yet initialized. For this purpose use serial_steal_fn.
---
Changes in v4:
- Define early_puts as NULL when CONFIG_EARLY_PRINTK is not enabled
Changes in v2:
- Create xen/early_printk.h
--- xen/arch/arm/early_printk.c | 1 + xen/drivers/char/console.c | 6 +++++- xen/include/asm-arm/early_printk.h | 3 --- xen/include/xen/early_printk.h | 21 +++++++++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 xen/include/xen/early_printk.h
xen/arch/arm/early_printk.c +1 -0
@@ -13,6 +13,7 @@#include <xen/lib.h> #include <xen/stdarg.h> #include <xen/string.h> +#include <xen/early_printk.h> #include <asm/early_printk.h> void early_putch (char c);
xen/drivers/char/console.c +5 -1
@@ -28,6 +28,7 @@#include <asm/debugger.h> #include <asm/div64.h> #include <xen/hypercall.h> /* for do_console_io */ +#include <xen/early_printk.h> /* console: comma-separated list of console outputs. */ static char __initdata opt_console[30 ] =OPT_CONSOLE_STR ;
@@ -255,7 +256,7 @@ long read_console_ring(struct xen_sysctl_readconsole *op)static char serial_rx_ring[SERIAL_RX_SIZE ];static unsigned int serial_rx_cons, serial_rx_prod; -static void (*serial_steal_fn)(const char *); +static void (*serial_steal_fn)(const char *) = early_puts;int console_steal (int handle,void (*fn)(const char *)) {
@@ -699,7 +700,10 @@ void __init console_init_preirq(void)else if ( !strncmp (p,"none" ,4 ) )continue ;else if ( (sh =serial_parse_handle (p)) >=0 ) + { sercon_handle = sh; + serial_steal_fn =NULL ; + }else {char *q =strchr (p,',' );
xen/include/asm-arm/early_printk.h +0 -3
@@ -24,7 +24,6 @@#ifdef CONFIG_EARLY_PRINTK -void early_puts (const char *s);void early_printk (const char *fmt, ...) __attribute__((format (printf,1 ,2 )));void noreturnearly_panic (const char *fmt, ...)
@@ -32,8 +31,6 @@ void noreturn early_panic(const char *fmt, ...)#else -static inline void early_puts (const char *) {} -static inline __attribute__((format (printf,1 ,2 )))void early_printk (const char *fmt, ...) {}
xen/include/xen/early_printk.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* printk() for use before the console is initialized +*/ +#ifndef __XEN_EARLY_PRINTK_H__ +#define __XEN_EARLY_PRINTK_H__ + +#ifdef CONFIG_EARLY_PRINTK +void early_puts (const char *s); +#else +#define early_puts NULL +#endif + +#endif +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/
Signature · 1 line
1.7.10.4
Re: [PATCH v4 4/5] xen/console: Add support for early printk
Quoted 10 lines · Julien Grall
On ARM, a function (
early_printk) was introduced to output message when the serial port is not initialized.This solution is fragile because the developper needs to know when the serial
port is initialized, to use eitherearly_printkor printk. Moreover some functions (mainly in common code), only use printk. This will result to a loss
of message sometimes.
Quoted 6 lines
Directly call
early_printkin console code when the serial port is not yet initialized. For this purpose useserial_steal_fn.Cc Keir Fraser <[email protected]>Signed-off-by Julien Grall <[email protected]>
Quoted 109 lines
---
Changes in v4:
- Defineearly_putsas NULL whenCONFIG_EARLY_PRINTKis not enabled
Changes in v2:
- Createxen/early_printk.h--- xen/arch/arm/early_printk.c | 1 + xen/drivers/char/console.c | 6 +++++- xen/include/asm-arm/early_printk.h | 3 --- xen/include/xen/early_printk.h | 21 +++++++++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 xen/include/xen/early_printk.hxen/arch/arm/early_printk.c +1
-0@@ -13,6 +13,7 @@#include <xen/lib.h> #include <xen/stdarg.h> #include <xen/string.h> +#include <xen/early_printk.h> #include <asm/early_printk.h> void early_putch (char c);xen/drivers/char/console.c +2
-1@@ -28,6 +28,7 @@#include <asm/debugger.h> #include <asm/div64.h> #include <xen/hypercall.h> /* for do_console_io */ +#include <xen/early_printk.h> /* console: comma-separated list of console outputs. */ static char __initdata opt_console[30 ] =OPT_CONSOLE_STR ;@@ -255,7 +256,7 @@ long read_console_ring(struct xen_sysctl_readconsole *op)static char serial_rx_ring[SERIAL_RX_SIZE ];static unsigned int serial_rx_cons, serial_rx_prod; -static void (*serial_steal_fn)(const char *); +static void (*serial_steal_fn)(const char *) = early_puts;int console_steal (int handle,void (*fn)(const char *)){
xen/drivers/char/console.c +3
-0@@ -699,7 +700,10 @@ void __init console_init_preirq(void)else if ( !strncmp (p,"none" ,4 ) )continue ;else if ( (sh =serial_parse_handle (p)) >=0 ) + { sercon_handle = sh; + serial_steal_fn =NULL ; + }else {char *q =strchr (p,',' );xen/include/asm-arm/early_printk.h +0
-3@@ -24,7 +24,6 @@#ifdef CONFIG_EARLY_PRINTK -void early_puts (const char *s);void early_printk (const char *fmt, ...) __attribute__((format (printf,1 ,2 )));void noreturnearly_panic (const char *fmt, ...)@@ -32,8 +31,6 @@ void noreturn early_panic(const char *fmt, ...)#else -static inline void early_puts (const char *) {} -static inline __attribute__((format (printf,1 ,2 )))void early_printk (const char *fmt, ...) {}xen/include/xen/early_printk.h new file +21
-1@@ -0,0 +1,21 @@ +/* +* printk() for use before the console is initialized +*/ +#ifndef __XEN_EARLY_PRINTK_H__ +#define __XEN_EARLY_PRINTK_H__ + +#ifdef CONFIG_EARLY_PRINTK +void early_puts (const char *s); +#else +#define early_puts NULL +#endif + +#endif +/* +* Local variables: +* mode: C +* c-file-style: "BSD" +* c-basic-offset: 4 +* indent-tabs-mode: nil +* End: +*/ --
Quoted 3 lines
1.7.10.4
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v4 5/5 xen/arm: Replace early_{printk, panic} call to {printk, panic} call
In reply to Julien GrallNow that the console supports earlyprintk, we can get a rid of early_printk and early_panic calls.
---
Changes in v3:
- Replace dt_printk by printk directly
Changes in v2:
- Update commit title to reflect I also removed early_panic
- Remove orphan early_panic in arm64 code
- Remove asm/early_printk.h include where it's unecessary
Ian, I have removed your ack with the change I made on v3
--- xen/arch/arm/early_printk.c | 33 ---------------- xen/arch/arm/mm.c | 5 +-- xen/arch/arm/setup.c | 28 +++++++------- xen/common/device_tree.c | 74 +++++++++++++++--------------------- xen/drivers/char/dt-uart.c | 9 ++--- xen/drivers/char/exynos4210-uart.c | 13 +++---- xen/drivers/char/omap-uart.c | 13 +++---- xen/drivers/char/pl011.c | 13 +++---- xen/drivers/video/arm_hdlcd.c | 29 +++++++------- xen/include/asm-arm/early_printk.h | 23 ----------- 10 files changed, 81 insertions(+), 159 deletions(-)
xen/arch/arm/early_printk.c +0 -33
@@ -14,14 +14,10 @@#include <xen/stdarg.h> #include <xen/string.h> #include <xen/early_printk.h> -#include <asm/early_printk.h> void early_putch (char c);void early_flush (void ); -/* Early printk buffer */ -static char __initdata buf[512 ]; -void early_puts (const char *s) {while (*s !='\0' ) {
@@ -37,32 +33,3 @@ void early_puts(const char *s)*/ early_flush (); } - -static void __init early_vprintk (const char *fmt,va_list args) -{ -vsnprintf (buf,sizeof (buf), fmt, args); -early_puts (buf); -} - -void __init early_printk (const char *fmt, ...) -{ -va_list args; - -va_start (args, fmt); -early_vprintk (fmt, args); -va_end (args); -} - -void __init -early_panic (const char *fmt, ...) -{ -va_list args; - -va_start (args, fmt); -early_vprintk (fmt, args); -va_end (args); - -early_printk ("\n\nEarly Panic: Stopping\n" ); - -while (1 ); -}
xen/arch/arm/mm.c +2 -3
@@ -37,7 +37,6 @@#include <public/memory.h> #include <xen/sched.h> #include <xen/vmap.h> -#include <asm/early_printk.h> #include <xsm/xsm.h> #include <xen/pfn.h>
@@ -649,8 +648,8 @@ void __init setup_xenheap_mappings(unsigned long base_mfn, xenheap_mfn_start = base_mfn;if ( base_mfn < xenheap_mfn_start ) -early_panic ("cannot add xenheap mapping at %lx below heap start %lx" , - base_mfn, xenheap_mfn_start); +panic ("cannot add xenheap mapping at %lx below heap start %lx" , + base_mfn, xenheap_mfn_start); end_mfn = base_mfn + nr_mfns;
xen/arch/arm/setup.c +13 -15
@@ -39,7 +39,6 @@#include <asm/page.h> #include <asm/current.h> #include <asm/setup.h> -#include <asm/early_printk.h> #include <asm/gic.h> #include <asm/cpufeature.h> #include <asm/platform.h>
@@ -346,10 +345,10 @@ static paddr_t __init get_xen_paddr(void) }if ( !paddr ) -early_panic ("Not enough memory to relocate Xen" ); +panic ("Not enough memory to relocate Xen" ); -early_printk ("Placing Xen at 0x%" PRIpaddr"-0x%" PRIpaddr"\n" , - paddr, paddr + min_size); +printk ("Placing Xen at 0x%" PRIpaddr"-0x%" PRIpaddr"\n" , + paddr, paddr + min_size); early_info.modules.module[MOD_XEN ].start = paddr; early_info.modules.module[MOD_XEN ].size = min_size;
@@ -371,7 +370,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)void *fdt;if ( !early_info.mem.nr_banks ) -early_panic ("No memory bank" ); +panic ("No memory bank" );/* * We are going to accumulate two regions here.
@@ -430,8 +429,8 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)if ( i != early_info.mem.nr_banks ) { -early_printk ("WARNING: only using %d out of %d memory banks\n" , - i, early_info.mem.nr_banks); +printk ("WARNING: only using %d out of %d memory banks\n" , + i, early_info.mem.nr_banks); early_info.mem.nr_banks = i; }
@@ -465,14 +464,13 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) }while ( xenheap_pages >128 <<(20 -PAGE_SHIFT ) );if ( ! e ) -early_panic ("Not not enough space for xenheap" ); +panic ("Not not enough space for xenheap" ); domheap_pages = heap_pages - xenheap_pages; -early_printk ("Xen heap: %" PRIpaddr"-%" PRIpaddr" (%lu pages)\n" , - e - (pfn_to_paddr (xenheap_pages)), e, - xenheap_pages); -early_printk ("Dom heap: %lu pages\n" , domheap_pages); +printk ("Xen heap: %" PRIpaddr"-%" PRIpaddr" (%lu pages)\n" , + e - (pfn_to_paddr (xenheap_pages)), e, xenheap_pages); +printk ("Dom heap: %lu pages\n" , domheap_pages);setup_xenheap_mappings ((e >>PAGE_SHIFT ) - xenheap_pages, xenheap_pages);
@@ -606,8 +604,8 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size)if ( bank != early_info.mem.nr_banks ) { -early_printk ("WARNING: only using %d out of %d memory banks\n" , - bank, early_info.mem.nr_banks); +printk ("WARNING: only using %d out of %d memory banks\n" , + bank, early_info.mem.nr_banks); early_info.mem.nr_banks = bank; }
@@ -672,7 +670,7 @@ void __init start_xen(unsigned long boot_phys_offset, fdt_size =device_tree_early_init (device_tree_flattened, fdt_paddr); cmdline =device_tree_bootargs (device_tree_flattened); -early_printk ("Command line: %s\n" , cmdline); +printk ("Command line: %s\n" , cmdline);cmdline_parse (cmdline);setup_pagetables (boot_phys_offset,get_xen_paddr ());
xen/common/device_tree.c +31 -43
231 lines not on this page · raw message
xen/drivers/char/dt-uart.c +4 -5
@@ -18,7 +18,6 @@*/ #include <asm/device.h> -#include <asm/early_printk.h> #include <asm/types.h> #include <xen/console.h> #include <xen/device_tree.h>
@@ -44,7 +43,7 @@ void __init dt_uart_init(void)if ( !console_has ("dtuart" ) || !strcmp (opt_dtuart,"" ) ) { -early_printk ("No console\n" ); +printk ("No console\n" );return ; }
@@ -54,7 +53,7 @@ void __init dt_uart_init(void)else options ="" ; -early_printk ("Looking for UART console %s\n" , devpath); +printk ("Looking for UART console %s\n" , devpath);if ( *devpath =='/' ) dev =dt_find_node_by_path (devpath);else
@@ -62,12 +61,12 @@ void __init dt_uart_init(void)if ( !dev ) { -early_printk ("Unable to find device \"%s\"\n" , devpath); +printk ("Unable to find device \"%s\"\n" , devpath);return ; } ret =device_init (dev,DEVICE_SERIAL , options);if ( ret ) -early_printk ("Unable to initialize serial: %d\n" , ret); +printk ("Unable to initialize serial: %d\n" , ret); }
xen/drivers/char/exynos4210-uart.c +5 -8
@@ -24,7 +24,6 @@#include <xen/init.h> #include <xen/irq.h> #include <xen/mm.h> -#include <asm/early_printk.h> #include <asm/device.h> #include <asm/exynos4210-uart.h> #include <asm/io.h>
@@ -314,9 +313,7 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev,u64 addr, size;if (strcmp (config,"" ) ) - { -early_printk ("WARNING: UART configuration is not supported\n" ); - } +printk ("WARNING: UART configuration is not supported\n" ); uart = &exynos4210_com;
@@ -329,22 +326,22 @@ static int __init exynos4210_uart_init(struct dt_device_node *dev, res =dt_device_get_address (dev,0 , &addr, &size);if ( res ) { -early_printk ("exynos4210: Unable to retrieve the base" -" address of the UART\n" ); +printk ("exynos4210: Unable to retrieve the base" +" address of the UART\n" );return res; } res =dt_device_get_irq (dev,0 , &uart->irq);if ( res ) { -early_printk ("exynos4210: Unable to retrieve the IRQ\n" ); +printk ("exynos4210: Unable to retrieve the IRQ\n" );return res; } uart->regs =ioremap_nocache (addr, size);if ( !uart->regs ) { -early_printk ("exynos4210: Unable to map the UART memory\n" ); +printk ("exynos4210: Unable to map the UART memory\n" );return -ENOMEM ; }
xen/drivers/char/omap-uart.c +6 -7
@@ -15,7 +15,6 @@#include <xen/serial.h> #include <xen/init.h> #include <xen/irq.h> -#include <asm/early_printk.h> #include <xen/device_tree.h> #include <asm/device.h> #include <xen/errno.h>
@@ -301,14 +300,14 @@ static int __init omap_uart_init(struct dt_device_node *dev,u64 addr, size;if (strcmp (config,"" ) ) -early_printk ("WARNING: UART configuration is not supported\n" ); +printk ("WARNING: UART configuration is not supported\n" ); uart = &omap_com; res =dt_property_read_u32 (dev,"clock-frequency" , &clkspec);if ( !res ) { -early_printk ("omap-uart: Unable to retrieve the clock frequency\n" ); +printk ("omap-uart: Unable to retrieve the clock frequency\n" );return -EINVAL ; }
@@ -321,22 +320,22 @@ static int __init omap_uart_init(struct dt_device_node *dev, res =dt_device_get_address (dev,0 , &addr, &size);if ( res ) { -early_printk ("omap-uart: Unable to retrieve the base" -" address of the UART\n" ); +printk ("omap-uart: Unable to retrieve the base" +" address of the UART\n" );return res; } res =dt_device_get_irq (dev,0 , &uart->irq);if ( res ) { -early_printk ("omap-uart: Unable to retrieve the IRQ\n" ); +printk ("omap-uart: Unable to retrieve the IRQ\n" );return res; } uart->regs =ioremap_nocache (addr, size);if ( !uart->regs ) { -early_printk ("omap-uart: Unable to map the UART memory\n" ); +printk ("omap-uart: Unable to map the UART memory\n" );return -ENOMEM ; }
xen/drivers/char/pl011.c +6 -7
@@ -22,7 +22,6 @@#include <xen/serial.h> #include <xen/init.h> #include <xen/irq.h> -#include <asm/early_printk.h> #include <xen/device_tree.h> #include <xen/errno.h> #include <asm/device.h>
@@ -107,7 +106,7 @@ static void __init pl011_init_preirq(struct serial_port *port)/* Baud rate already set: read it out from the divisor latch. */ divisor = (pl011_read (uart,IBRD ) <<6 ) | (pl011_read (uart,FBRD ));if (!divisor) -early_panic ("pl011: No Baud rate configured\n" ); +panic ("pl011: No Baud rate configured\n" ); uart->baud = (uart->clock_hz <<2 ) / divisor; }/* This write must follow FBRD and IBRD writes. */
@@ -229,7 +228,7 @@ static int __init pl011_uart_init(struct dt_device_node *dev,if (strcmp (config,"" ) ) { -early_printk ("WARNING: UART configuration is not supported\n" ); +printk ("WARNING: UART configuration is not supported\n" ); } uart = &pl011_com;
@@ -243,22 +242,22 @@ static int __init pl011_uart_init(struct dt_device_node *dev, res =dt_device_get_address (dev,0 , &addr, &size);if ( res ) { -early_printk ("pl011: Unable to retrieve the base" -" address of the UART\n" ); +printk ("pl011: Unable to retrieve the base" +" address of the UART\n" );return res; } res =dt_device_get_irq (dev,0 , &uart->irq);if ( res ) { -early_printk ("pl011: Unable to retrieve the IRQ\n" ); +printk ("pl011: Unable to retrieve the IRQ\n" );return res; } uart->regs =ioremap_nocache (addr, size);if ( !uart->regs ) { -early_printk ("pl011: Unable to map the UART memory\n" ); +printk ("pl011: Unable to map the UART memory\n" );return -ENOMEM ; }
xen/drivers/video/arm_hdlcd.c +14 -15
@@ -25,7 +25,6 @@#include <xen/libfdt/libfdt.h> #include <xen/init.h> #include <xen/mm.h> -#include <asm/early_printk.h> #include "font.h" #include "lfb.h" #include "modelines.h"
@@ -123,21 +122,21 @@ void __init video_init(void)if ( !dev ) { -early_printk ("HDLCD: Cannot find node compatible with \"arm,hdcld\"\n" ); +printk ("HDLCD: Cannot find node compatible with \"arm,hdcld\"\n" );return ; } res =dt_device_get_address (dev,0 , &hdlcd_start, &hdlcd_size);if ( !res ) { -early_printk ("HDLCD: Unable to retrieve MMIO base address\n" ); +printk ("HDLCD: Unable to retrieve MMIO base address\n" );return ; } cells =dt_get_property (dev,"framebuffer" , &lenp);if ( !cells ) { -early_printk ("HDLCD: Unable to retrieve framebuffer property\n" ); +printk ("HDLCD: Unable to retrieve framebuffer property\n" );return ; }
@@ -146,13 +145,13 @@ void __init video_init(void)if ( !hdlcd_start ) { -early_printk (KERN_ERR "HDLCD: address missing from device tree, disabling driver\n" ); +printk (KERN_ERR "HDLCD: address missing from device tree, disabling driver\n" );return ; }if ( !framebuffer_start ) { -early_printk (KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n" ); +printk (KERN_ERR "HDLCD: framebuffer address missing from device tree, disabling driver\n" );return ; }
@@ -166,13 +165,13 @@ void __init video_init(void)else if (strlen (mode_string) <strlen ("800x600@60" ) ||strlen (mode_string) >sizeof (_mode_string) -1 ) { -early_printk (KERN_ERR "HDLCD: invalid modeline=%s\n" , mode_string); +printk (KERN_ERR "HDLCD: invalid modeline=%s\n" , mode_string);return ; }else {char *s =strchr (mode_string,'-' );if ( !s ) { -early_printk (KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n" , +printk (KERN_INFO "HDLCD: bpp not found in modeline %s, assume 32 bpp\n" , mode_string);get_color_masks ("32" , &c);memcpy (_mode_string, mode_string,strlen (mode_string) +1 );
@@ -180,13 +179,13 @@ void __init video_init(void) }else {if (strlen (s) <6 ) { -early_printk (KERN_ERR "HDLCD: invalid mode %s\n" , mode_string); +printk (KERN_ERR "HDLCD: invalid mode %s\n" , mode_string);return ; } s++;if (get_color_masks (s, &c) <0 ) { -early_printk (KERN_WARNING "HDLCD: unsupported bpp %s\n" , s); +printk (KERN_WARNING "HDLCD: unsupported bpp %s\n" , s);return ; } bytes_per_pixel =simple_strtoll (s,NULL ,10 ) /8 ;
@@ -205,23 +204,23 @@ void __init video_init(void) }if ( !videomode ) { -early_printk (KERN_WARNING "HDLCD: unsupported videomode %s\n" , - _mode_string); +printk (KERN_WARNING "HDLCD: unsupported videomode %s\n" , + _mode_string);return ; }if ( framebuffer_size < bytes_per_pixel * videomode->xres * videomode->yres ) { -early_printk (KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n" ); +printk (KERN_ERR "HDLCD: the framebuffer is too small, disabling the HDLCD driver\n" );return ; } -early_printk (KERN_INFO "Initializing HDLCD driver\n" ); +printk (KERN_INFO "Initializing HDLCD driver\n" ); lfb =ioremap_wc (framebuffer_start, framebuffer_size);if ( !lfb ) { -early_printk (KERN_ERR "Couldn't map the framebuffer\n" ); +printk (KERN_ERR "Couldn't map the framebuffer\n" );return ; }memset (lfb,0x00 , bytes_per_pixel * videomode->xres * videomode->yres);
xen/include/asm-arm/early_printk.h +0 -23
@@ -18,29 +18,6 @@#define EARLY_UART_VIRTUAL_ADDRESS \ (FIXMAP_ADDR(FIXMAP_CONSOLE) +(EARLY_UART_BASE_ADDRESS & ~PAGE_MASK)) -#endif - -#ifndef __ASSEMBLY__ - -#ifdef CONFIG_EARLY_PRINTK - -void early_printk (const char *fmt, ...) - __attribute__((format (printf,1 ,2 ))); -void noreturnearly_panic (const char *fmt, ...) - __attribute__((format (printf,1 ,2 ))); - -#else - -static inline __attribute__((format (printf,1 ,2 )))void -early_printk (const char *fmt, ...) -{} - -static inline void noreturn -__attribute__((format (printf,1 ,2 )))early_panic (const char *fmt, ...) -{while (1 );} -#endif /* !CONFIG_EARLY_PRINTK */ -#endif /* __ASSEMBLY__ */ -#endif
Signature · 1 line
1.7.10.4
Quoted 9 lines · Julien Grall
Hello all,
This patch series aims to merge early printk in the console code. This will avoid the developper to care wheter the message is printed before or after the console is initialized.
Sincerely yours,
Julien Grall (5):
Acked the last one and applied, but:
Quoted 1 line
xen/arm: earlyprintk: move
early_flushinearly_puts
Some rejects in head.S for both subarchs here. Trivial to resolve though.
Quoted 4 lines
xen/arm: earlyprintk: export
early_puts
xen/arm: RenameEARLY_PRINTKcompile option toCONFIG_EARLY_PRINTKxen/console: Add support for early printk
xen/arm: Replace early_{printk,panic} call to {printk,panic} call
There were rejects in device_tree.c for this one, since the XSM patches happened in the interim. I'm pretty sure I've fixed it up correctly though.
Please do check though.
Quoted 19 lines
xen/arch/arm/Rules.mk | 2 +- xen/arch/arm/arm32/head.S | 18 ++++----- xen/arch/arm/arm64/head.S | 18 ++++----- xen/arch/arm/early_printk.c | 36 +----------------- xen/arch/arm/mm.c | 5 +-- xen/arch/arm/setup.c | 28 +++++++------- xen/common/device_tree.c | 74 +++++++++++++++--------------------- xen/drivers/char/console.c | 6 ++- xen/drivers/char/dt-uart.c | 9 ++--- xen/drivers/char/exynos4210-uart.c | 13 +++---- xen/drivers/char/omap-uart.c | 13 +++---- xen/drivers/char/pl011.c | 13 +++---- xen/drivers/video/arm_hdlcd.c | 29 +++++++------- xen/include/asm-arm/early_printk.h | 27 +------------ xen/include/xen/early_printk.h | 21 ++++++++++ 15 files changed, 130 insertions(+), 182 deletions(-) create mode 100644 xen/include/xen/early_printk.h
Quoted 7 lines · Ian Campbell
Quoted 6 lines · Julien Grall
Hello all,
This patch series aims to merge early printk in the console code. This will avoid the developper to care wheter the message is printed before or after the console is initialized.
Quoted 5 lines
Quoted 3 lines
Sincerely yours,
Julien Grall (5):
Acked the last one and applied, but:
Thanks!
Quoted 9 lines
Quoted 1 line
xen/arm: earlyprintk: move
early_flushinearly_putsSome rejects in
head.Sfor both subarchs here. Trivial to resolve though.Quoted 4 lines
xen/arm: earlyprintk: export
early_puts
xen/arm: RenameEARLY_PRINTKcompile option toCONFIG_EARLY_PRINTKxen/console: Add support for early printk
xen/arm: Replace early_{printk,panic} call to {printk,panic} call
Quoted 5 lines
There were rejects in
device_tree.cfor this one, since the XSM patches happened in the interim. I'm pretty sure I've fixed it up correctly though.Please do check though.
Both changes sounds good to me. Thanks for resolving the conflicts!
Signature · 1 line
Julien Grall