Re: univ8250_console replaces earlycon too early

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So I changed the following line:
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/kernel/v5.10/drivers/tty/serial/8250/8250_core.c;l=579

diff --git a/drivers/tty/serial/8250/8250_core.c
b/drivers/tty/serial/8250/8250_core.c
index cae61d1ebec5..c26056b67c38 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -576,7 +584,7 @@ serial8250_register_ports(struct uart_driver *drv,
struct device *dev)
        }
 }

-#ifdef CONFIG_SERIAL_8250_CONSOLE
+#if 0

 static void univ8250_console_write(struct console *co, const char *s,
                                   unsigned int count)

I now no longer see the missing gap in my serial logs: https://0paste.com/233818

Here is my command line: earlycon=uart,mmio32,0xfedc9000 console=ttyS0,115200
I can't unset SERIAL_8250_CONSOLE since that provides my earlycon.

What is the purpose of the universal console on x86? It looks like
serial8250_isa_init_ports is called from serial8250_init:
https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/kernel/v5.10/drivers/tty/serial/8250/8250_core.c;l=1173
When called this way, it tries to probe 0x3f8, and fails, so the
earlyconsole isn't replaced until the ACPI node is parsed.

Thanks,
Raul


On Fri, Apr 2, 2021 at 5:05 PM Raul Rangel <rrangel@xxxxxxxxxxxx> wrote:
>
> Hello,
>
> I'm working on an x86 system that doesn't have any legacy UARTs
> (0x3f8, etc) mapped. Instead it uses MMIO UARTs defined by ACPI. It
> seems that in this case the univ8250_console console is registered too
> early. It replaces `earlycon` before the ACPI consoles have had a
> chance to load. This results in losing about 500ms of console logs in
> my case.
>
> Here is my log with some print statements:
> ```
> [    0.677076] serial8250_isa_init_ports: start
> [    0.681808] serial8250_isa_init_ports: checking old serial port 0
> [    0.688566] serial8250_isa_init_ports: iobase: 0x3f8, irq: 4,
> uartclk: 1843200
> [    0.696579] serial8250_isa_init_ports: checking old serial port 1
> [    0.703338] serial8250_isa_init_ports: iobase: 0x2f8, irq: 3,
> uartclk: 1843200
> [    0.711352] serial8250_isa_init_ports: checking old serial port 2
> [    0.718110] serial8250_isa_init_ports: iobase: 0x3e8, irq: 4,
> uartclk: 1843200
> [    0.726124] serial8250_isa_init_ports: checking old serial port 3
> [    0.732884] serial8250_isa_init_ports: iobase: 0x2e8, irq: 3,
> uartclk: 1843200
> [    0.740899] univ8250_console_setup: iobase: 0x3f8, irq: 4, uartclk: 1843200
> [    0.748623] serial8250_console_setup: iobase: 0x3f8, irq: 4, uartclk: 1843200
> [    0.756540] serial8250_console_setup: options: 115200
> [    0.762147] serial8250_console_setup: iobase: 0x3f8, irq: 4, uartclk: 1843200
> [    0.770064] printk: console [ttyS0] enabled <- univ8250_console
> [    0.774789] printk: bootconsole [uart0] disabled
> ... nothing
> [    1.224845] printk: console [ttyS0] enabled <- This is the
> AMDI0020:00 console getting loaded
> [    1.229061] uart_add_one_port: Setting up console!
> [    1.235099] serial8250_register_8250_port: Done!
> [    1.239748] serial8250_register_8250_port: idx: 0, iobase: 0x0,
> membase: ffff96e70007d000, irq: 4, uartclk: 48000000
> [    1.250329] serial8250_register_8250_port: idx: 1, iobase: 0x2f8,
> membase: 0000000000000000, irq: 3, uartclk: 1843200
> [    1.260957] serial8250_register_8250_port: idx: 2, iobase: 0x3e8,
> membase: 0000000000000000, irq: 4, uartclk: 1843200
> [    1.271585] serial8250_register_8250_port: idx: 3, iobase: 0x2e8,
> membase: 0000000000000000, irq: 3, uartclk: 1843200
> [    1.282213] dw-apb-uart AMDI0020:00: RX: register port done
> [    1.287897] dw-apb-uart AMDI0020:00: RX: set active
> [    1.292805] dw-apb-uart AMDI0020:00: RX: done
> [    1.297599] dw-apb-uart AMDI0020:01: RX: dw8250_probe: Probing UART
> [    1.303976] dw-apb-uart AMDI0020:01: RX: UART Clock: 0
> [    1.309143] dw-apb-uart AMDI0020:01: RX: Overriding baud clock: 48000000
> [    1.315911] dw-apb-uart AMDI0020:01: RX: Quirks
> [    1.320674] dw-apb-uart AMDI0020:01: RX: setup port
> [    1.325665] dw-apb-uart AMDI0020:01: RX: setup port done
> [    1.331007] dw-apb-uart AMDI0020:01: RX: register port
> ```
>
> What would be the correct way to fix this?
> Should we probe the legacy (0x3f8) device before attaching
> univ8250_console so it doesn't override earlycon?
>
> Thanks,
> Raul



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux