openbmc / obmc-console

OpenBMC host console infrastructure
Apache License 2.0
17 stars 25 forks source link

Serial Over Lan (SOL) no login prompt on Linux IRQ mode #15

Open akashgj opened 4 years ago

akashgj commented 4 years ago

I am using BMC Aspeed AST-2500 in our motherboard with OpenBMC firmware. 'obmc-console' is used to get host messages over BMC. obmc-console.conf looks like

lpc-address = 0x3f8 sirq = 4 local-tty = ttyS4 local-tty-baud = 115200

BIOS serial redirection is enabled over COM port 0 (0x3f8, sirq=4, baudrate=115200) for super-IO.

we set /dev/ttyS0 in CentOS to work in polling mode by making its irq=0 using the following command

$ setserial /dev/ttyS0 uart 16550a irq 0

Now we are getting CentOS login prompt on SOL.

When we change /dev/ttyS0 back to interrupt mode with irq=4, we are not getting login prompt on SOL.

Kitsok commented 3 years ago

I didn't try to set polling mode, but have the same: if VUART is used for host-BMC serial communications, it works only during POST stage. Update: Just tried to enable polling mode via setserial and there is a communication via VUART.

amboar commented 3 years ago

There's a solution discussed in this thread:

https://lore.kernel.org/openbmc/20210727093015.GQ875@home.paul.comp/T/#m544ebf6b9177ed928d6a93ec2cee7be6c9a85ad2

Unfortunately lore didn't archive the message with the solution for the UART routing (possibly due to it being an HTML message), but it's available here:

https://lists.ozlabs.org/pipermail/openbmc/attachments/20210802/bfd7d272/attachment.htm

Kitsok commented 3 years ago

The recipe is the following:

  1. In DTS disable UART1(ttyS0), UART2(ttyS1), enable UART3(ttyS2), UART4(ttyS3), disable VUART, enable uart_routing
  2. In obmc-console prepare config server.ttyS3.conf with baud = 115200 local-tty = ttyS3 local-tty-baud = 115200
  3. Set up routing via sysfs (UART1<->UART4) root@:/sys/devices/platform/ahb/ahb:apb/1e789000.lpc/1e78909c.uart_routing# echo -n uart4 > uart1 root@:/sys/devices/platform/ahb/ahb:apb/1e789000.lpc/1e78909c.uart_routing# echo -n uart1 > uart4 root@:/sys/devices/platform/ahb/ahb:apb/1e789000.lpc/1e78909c.uart_routing# cat uart* io1 io2 io3 io4 uart2 uart3 [uart4] io6 [io2] io3 io4 io1 uart3 uart4 uart1 io6 [io3] io4 io1 io2 uart4 uart1 uart2 io6 io4 io1 io2 io3 [uart1] uart2 uart3 io6 [io5] io1 io2 io3 io4 uart1 uart2 uart3 uart4 io6 root@:/sys/devices/platform/ahb/ahb:apb/1e789000.lpc/1e78909c.uart_routing#
  4. Enable UART1 and 2 clocks either using devmem (wrong way) uart1_clock_en() { local val=$(devmem 0x1e6e200c) local val2=$(iotools and $val 0xffff7fff) devmem 0x1e6e200c w $val2 || : } or by patching kernel: ` diff --git a/drivers/clk/clk-aspeed.c b/drivers/clk/clk-aspeed.c index bc8d130..a32502b 100644 --- a/drivers/clk/clk-aspeed.c +++ b/drivers/clk/clk-aspeed.c @@ -67,8 +67,8 @@ static const struct aspeed_gate_data aspeed_gates[] = { [ASPEED_CLK_GATE_D1CLK] = { 10, 13, "d1clk-gate", NULL, 0 }, / GFX CRT / [ASPEED_CLK_GATE_YCLK] = { 13, 4, "yclk-gate", NULL, 0 }, / HAC / [ASPEED_CLK_GATE_USBPORT1CLK] = { 14, 14, "usb-port1-gate", NULL, 0 }, / USB2 hub/USB2 host port 1/USB1.1 dev /
    • [ASPEED_CLK_GATE_UART1CLK] = { 15, -1, "uart1clk-gate", "uart", 0 }, / UART1 /
    • [ASPEED_CLK_GATE_UART2CLK] = { 16, -1, "uart2clk-gate", "uart", 0 }, / UART2 /
    • [ASPEED_CLK_GATE_UART1CLK] = { 15, -1, "uart1clk-gate", "uart", CLK_IS_CRITICAL }, / UART1 /
    • [ASPEED_CLK_GATE_UART2CLK] = { 16, -1, "uart2clk-gate", "uart", CLK_IS_CRITICAL }, / UART2 / [ASPEED_CLK_GATE_UART5CLK] = { 17, -1, "uart5clk-gate", "uart", 0 }, / UART5 / [ASPEED_CLK_GATE_ESPICLK] = { 19, -1, "espiclk-gate", NULL, 0 }, / eSPI / [ASPEED_CLK_GATE_MAC1CLK] = { 20, 11, "mac1clk-gate", "mac", 0 }, / MAC1 / -- 2.7.4

` In latter case it is probably necessary to set up 0x1e6e200c register in U-Boot.

  1. It is also vital to allow LPC reset of UART1 and UART2 from LPC, but in my case it's there by default.

In case you want to use VUART there are 2 ways:

  1. In BIOS, before control is passed to OS loader, disable UART in SIO (not verified) or
  2. In OS set UART driver polling mode using setserial irq 0. Hope this can help.
amboar commented 3 years ago

Fundamentally that all shouldn't be necessary. I haven't had the bandwidth to understand the problem and figure out what's going wrong.

The VUARTs work fine with interrupts on Power systems.