From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 0/*] serial/amba-pl011: Activate TX IRQ passively
Date: Wed, 25 Mar 2015 18:22:26 +0000 [thread overview]
Message-ID: <1427307746-2811-1-git-send-email-Dave.Martin@arm.com> (raw)
Thanks to Jakub Kici?ski for his bug report and discussion, and for
showing out how we can manage without the softirq (and providing a
patch, though merging my rework with it got difficult, so I don't
include it in the series now).
There are two alternate versions of the series threaded from this cover
letter:
* [PATCH v3] - patch against v4.0-rc5 that supersedes the previous
series; this is the less churny option.
* [PATCH v3, tty-next..] - patches against tty-next that
modify/partially revert the previous series without needing a
rebase.
Take your pick.
Changes since v2:
* Remove the optimisation that assumes TXIS stays asserted across port
shutdown..startup (thanks to Jakub Kici?ski for spotting this on
raspberrypi-2). This turns out to be untrue in certain situations,
namely when the only process with the port open is killed by a
signal. This may indicate a bug in serial_core, but the "correct"
behaviour for this case is not completely obvious.
For this repost, I just revert the optimisation so that the pl011
driver doesn't hang in this situation. It didn't bring much real
benefit in any case.
* Remove the tx softirq and rework the code for more intelligible
code flow.
* pl011_start_tx() now simply stuffs the FIFO until it's full (in which
case the TX IRQ will definitely fire), or until the serial_core
circular buffer is empty (in which case we don't care about the
interrupt because there is nothing more to send).
Original cover letter:
The current PL011 driver transmits a dummy character when the UART
is opened, to assert the TX IRQ for the first time
(see pl011_startup()). The UART is put in loopback mode temporarily,
so the receiver presumably shouldn't see anything.
However...
At least some platforms containing a PL011 send characters down the
wire even when loopback mode is enabled. This means that a
spurious NUL character may be seen at the receiver when the PL011 is
opened through the TTY layer.
The current code also temporarily sets the baud rate to maximum and
the character width to the minimum, to that the dummy TX completes
as quickly as possible. If this is seen by the receiver it will
result in a framing error and can knock the receiver out of sync --
turning subsequent output into garbage until synchronisation
is reestablished. (Particularly problematic during boot with systemd.)
To avoid spurious transmissions, this patch removes assumptions about
whether the TX IRQ will fire until at least one TX IRQ has been seen.
Instead, the UART will unmask the TX IRQ and then slow-start via
polling and timer-based soft IRQs initially. If the TTY layer writes
enough data to fill the FIFO to the interrupt threshold in one go,
the TX IRQ should assert, at which point the driver changes to
fully interrupt-driven TX.
In this way, the TX IRQ is activated as a side-effect instead of
being done deliberately.
This should also mean that the driver works on the SBSA Generic
UART[1] (a cut-down PL011) without invasive changes. The Generic
UART lacks some features needed for the dummy TX approach to work
(FIFO disabling and loopback).
[1] Server Base System Architecture (ARM-DEN-0029-v2.3)
http://infocenter.arm.com/
(click-thru required :/)
--
1.7.10.4
next reply other threads:[~2015-03-25 18:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 18:22 Dave Martin [this message]
2015-03-25 18:25 ` [PATCH v3 0/1] serial/amba-pl011: Activate TX IRQ passively Dave Martin
2015-03-25 18:25 ` [PATCH v3] " Dave Martin
2015-03-25 18:26 ` [PATCH v3, tty-next.. 0/2] " Dave Martin
2015-03-25 18:26 ` [PATCH v3, tty-next.. 1/2] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open" Dave Martin
2015-03-25 18:26 ` [PATCH v3, tty-next.. 2/2] serial/amba-pl011: Activate TX IRQ passively Dave Martin
2015-03-26 21:30 ` [PATCH v3 0/*] " Greg Kroah-Hartman
2015-03-27 14:51 ` Dave Martin
2015-03-27 20:47 ` Russell King - ARM Linux
2015-03-30 12:02 ` Dave P Martin
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=1427307746-2811-1-git-send-email-Dave.Martin@arm.com \
--to=dave.martin@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).