From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Yicong Yang <yang.yicong@picoheart.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-serial <linux-serial@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
geshijian@picoheart.com, yangyang.8776@picoheart.com,
yanligen@picoheart.com
Subject: Re: [PATCH] serial: 8250_dw: Prefer SRBR in bogus RX timeout workaround if available
Date: Wed, 1 Jul 2026 11:45:32 +0300 (EEST) [thread overview]
Message-ID: <ce31a5fe-8b6e-62af-038b-4e65cb94493d@linux.intel.com> (raw)
In-Reply-To: <b175fd37-e998-40b1-99c3-491e3d6f7e04@picoheart.com>
[-- Attachment #1: Type: text/plain, Size: 5298 bytes --]
On Wed, 1 Jul 2026, Yicong Yang wrote:
> On 7/1/26 2:18 AM, Ilpo Järvinen wrote:
> > On Wed, 1 Jul 2026, Yicong Yang wrote:
> >> On 6/29/26 11:56 PM, Ilpo Järvinen wrote:
> >>> On Mon, 29 Jun 2026, Yicong Yang wrote:
> >>>
> >>>> The DW uart could get into the cases where a bogus RX timeout
> >>>> interrupt is asserted but no available data. This could be
> >>>> workaround by doing a bogus read.
> >>>>
> >>>> Currently the driver's using the standard RBR (receive buffer
> >>>> register) for this bogus read. However the reading of RBR
> >>>> in this case is allowed to raise a hardware error if vendor
> >>>> choose to implement in this way (our platform). It's also
> >>>> allowed to do the bogus read using SRBR (shadow RBR) for
> >>>> workaround which won't raise the hardware error. So change
> >>>> to use the SRBR to workaround the issue if it's available.
> >>>>
> >>>> Signed-off-by: Yicong Yang <yang.yicong@picoheart.com>
> >>>> ---
> >>>> drivers/tty/serial/8250/8250_dw.c | 15 +++++++++++++--
> >>>> drivers/tty/serial/8250/8250_dwlib.c | 3 +++
> >>>> drivers/tty/serial/8250/8250_dwlib.h | 4 ++++
> >>>> 3 files changed, 20 insertions(+), 2 deletions(-)
> >>>>
> >>>> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> >>>> index 84ffba045ffa..fea7dfa30e78 100644
> >>>> --- a/drivers/tty/serial/8250/8250_dw.c
> >>>> +++ b/drivers/tty/serial/8250/8250_dw.c
> >>>> @@ -440,8 +440,19 @@ static int dw8250_handle_irq(struct uart_port *p)
> >>>> if (!up->dma && rx_timeout) {
> >>>> status = serial_lsr_in(up);
> >>>>
> >>>> - if (!(status & (UART_LSR_DR | UART_LSR_BI)))
> >>>> - serial_port_in(p, UART_RX);
> >>>> + if (!(status & (UART_LSR_DR | UART_LSR_BI))) {
> >>>> + /*
> >>>> + * Do the bogus read from Shadow RBR (SRBR) if provided.
> >>>> + * Both RBR and SRBR are supported ways to workaround
> >>>
> >>> Hi,
> >>>
> >>> I've not come across this being mentioned anywhere else than in kernel
> >>> related context, but you seem to imply there something that tells about
> >>> "supported ways"?
> >>>
> >>
> >> in fact we got this workaround method that's documented in the synopsys
> >> dw_uart issue report, so comment "supported" here. quote the related part
> >> of the workaround below:
> >>
> >> [read USR[3] for the rx fifo status]
> >> If the read value is '0' (indicating the RX FIFO is empty), do a dummy
> >> read of the RBR or shadow RBR (SRBR) register without processing the
> >> invalid read data.
> >>
> >> ...Note: Reading the RBR results in a PSLVERR immediately if
> >> REG_TIMEOUT_WIDTH parameter is set to '0'. Whereas, reading SRBR does
> >> not result in PSLVERR.
> >
> > Okay, thanks.
> >
> >>> If there's no such thing, I'm bit hesitant to declare presence of SRBR
> >>> guarantees reading it universally solves this issue.
> >>>
> >>> BUT, I suppose it does on your HW since you must have hit this code path,
> >>> and thus PSLVERR, yourself to actually discover this issue so I assume
> >>> you've then also confirmed that this patch solves the issue in your case
> >>> which isn't entirely without merit either.
> >>>
> >>
> >> actually it's hard to reproduce, only once at boot time in our several
> >> hundreds reboot test. we locate the code line here by the backtrace of
> >> the system error. the issue hasn't reproduced yet on the patched kernel
> >> (hundred reboots so far, but still going on), and I suppose it's correct
> >> as provided by the IP designer.
> >
> > For testing, you could have logged when this condition is actually hit
> > in the first place. I usually do that to increase my own confidence if the
> > problem is particularly hard to reproduce.
>
> thanks for the kind and useful guidance :) did add a log message in the
> workaround branch so we'll know if the issue hits.
>
> >
> > I don't know if it always triggers PSLVERR or if that's some % of !(status
> > & (UART_LSR_DR | UART_LSR_BI)) cases because RBR read is racy with Rx but
> > that could also be determined if similar debug is applied without the
> > patch, I guess.
>
> as the PSLVERR is caused by the reading of RBR so even in the latter case
> we should still using the SRBR here if availabe to avoid the PSLVERR as
> long as we enter this branch, I suppose this should be the safest way.
I was not commenting on how to fix it, but about probabilty of hitting
PSLVERR when taking this branch.
Rx coming in (it's racing with the driver's code) may make the read not
result in PSLVERR even when this branch is taken. It could be this does no
matter and taking this branch in practice always results in PSLVERR if RBR
is read, which means even any hit of this branch confirms SRBR does indeed
work.
But if RBR reads do not always lead to PSLVERR because incoming Rx makes
RBR read "safe" it's less clear how many times the branch should be taken
before confidently declaring the fix works.
> > But with clearly more boots and it working, that's probably enough as
> > evidence together with the issue report offering it as a workaround.
> >
>
> sure, will wait a bit and try to catch the condition.
>
> thanks.
>
--
i.
prev parent reply other threads:[~2026-07-01 8:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 7:55 [PATCH] serial: 8250_dw: Prefer SRBR in bogus RX timeout workaround if available Yicong Yang
2026-06-29 14:56 ` Andy Shevchenko
2026-06-29 15:14 ` Ilpo Järvinen
2026-06-29 15:16 ` Andy Shevchenko
2026-06-29 15:56 ` Ilpo Järvinen
2026-06-29 16:07 ` Andy Shevchenko
2026-06-30 17:51 ` Yicong Yang
2026-06-30 18:18 ` Ilpo Järvinen
2026-06-30 18:42 ` Yicong Yang
2026-07-01 8:45 ` Ilpo Järvinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ce31a5fe-8b6e-62af-038b-4e65cb94493d@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=geshijian@picoheart.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=yang.yicong@picoheart.com \
--cc=yangyang.8776@picoheart.com \
--cc=yanligen@picoheart.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox