User input is buffered anyway, so it's pointless to set the UART_LSR_OE bit.
Instead, wait for the guest kernel to consume the current input and send a new
character when the guest is ready.
This fixes the following warnings in guest kernels:
[ 207.485000] ttyS0: 1 input overrun(s)
Reported-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
{
int c;
+ if (dev->lsr & UART_LSR_DR)
+ return;
+
if (!is_readable(fileno(stdin)))
return;
if (c < 0)
return;
- if (dev->lsr & UART_LSR_DR)
- dev->lsr |= UART_LSR_OE;
-
dev->rbr = c;
dev->lsr |= UART_LSR_DR;
}