* [PATCH REPOST v4 1/2] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open"
@ 2015-04-01 11:08 Dave Martin
2015-04-01 11:14 ` Dave Martin
0 siblings, 1 reply; 3+ messages in thread
From: Dave Martin @ 2015-04-01 11:08 UTC (permalink / raw)
To: linux-arm-kernel
This reverts commit f2ee6dfa0e8597eea8b98d240b0033994e20d215.
Jakub Kici?ski observed that this patch can cause the pl011
driver to hang if if the only process with a pl011 port open is
killed by a signal, pl011_shutdown() can get called with an
arbitrary amount of data still in the FIFO.
Calling _shutdown() with the TX FIFO non-empty is questionable
behaviour and my itself be a bug.
Since the affected patch was speculative anyway, and brings limited
benefit, the simplest course is to remove the assumption that TXIS
will always be left asserted after the port is shut down.
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---
drivers/tty/serial/amba-pl011.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 5a4e9d5..6f5a072 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1639,6 +1639,9 @@ static int pl011_startup(struct uart_port *port)
writew(uap->vendor->ifls, uap->port.membase + UART011_IFLS);
+ /* Assume that TX IRQ doesn't work until we see one: */
+ uap->tx_irq_seen = 0;
+
spin_lock_irq(&uap->port.lock);
/* restore RTS and DTR */
@@ -1702,7 +1705,7 @@ static void pl011_shutdown(struct uart_port *port)
spin_lock_irq(&uap->port.lock);
uap->im = 0;
writew(uap->im, uap->port.membase + UART011_IMSC);
- writew(0xffff & ~UART011_TXIS, uap->port.membase + UART011_ICR);
+ writew(0xffff, uap->port.membase + UART011_ICR);
spin_unlock_irq(&uap->port.lock);
pl011_dma_shutdown(uap);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH REPOST v4 0/2] serial/amba-pl011: Refactor and simplify TX FIFO handling
@ 2015-04-01 11:05 Dave Martin
2015-04-01 11:09 ` [PATCH REPOST v4 1/2] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open" Dave Martin
0 siblings, 1 reply; 3+ messages in thread
From: Dave Martin @ 2015-04-01 11:05 UTC (permalink / raw)
To: linux-arm-kernel
Patches are based on
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-next
This is a repost to add Jakub's S-o-B only.
There is no code change compared with v3.
Note that I'll be mostly offline for a week or so from tomorrow.
Andre depends on this series for his SBSA UART stuff, so I recommend
to coordinate with him if there are still issues that need to be
resolved in the meantime. There are no outstanding issues that I'm
aware of.
Thanks
---Dave
Dave Martin (2):
Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is
not open"
serial/amba-pl011: Refactor and simplify TX FIFO handling
drivers/tty/serial/amba-pl011.c | 118 +++++++++------------------------------
1 file changed, 27 insertions(+), 91 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH REPOST v4 1/2] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open"
2015-04-01 11:05 [PATCH REPOST v4 0/2] serial/amba-pl011: Refactor and simplify TX FIFO handling Dave Martin
@ 2015-04-01 11:09 ` Dave Martin
0 siblings, 0 replies; 3+ messages in thread
From: Dave Martin @ 2015-04-01 11:09 UTC (permalink / raw)
To: linux-arm-kernel
This reverts commit f2ee6dfa0e8597eea8b98d240b0033994e20d215.
Jakub Kici?ski observed that this patch can cause the pl011
driver to hang if if the only process with a pl011 port open is
killed by a signal, pl011_shutdown() can get called with an
arbitrary amount of data still in the FIFO.
Calling _shutdown() with the TX FIFO non-empty is questionable
behaviour and my itself be a bug.
Since the affected patch was speculative anyway, and brings limited
benefit, the simplest course is to remove the assumption that TXIS
will always be left asserted after the port is shut down.
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---
drivers/tty/serial/amba-pl011.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 5a4e9d5..6f5a072 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1639,6 +1639,9 @@ static int pl011_startup(struct uart_port *port)
writew(uap->vendor->ifls, uap->port.membase + UART011_IFLS);
+ /* Assume that TX IRQ doesn't work until we see one: */
+ uap->tx_irq_seen = 0;
+
spin_lock_irq(&uap->port.lock);
/* restore RTS and DTR */
@@ -1702,7 +1705,7 @@ static void pl011_shutdown(struct uart_port *port)
spin_lock_irq(&uap->port.lock);
uap->im = 0;
writew(uap->im, uap->port.membase + UART011_IMSC);
- writew(0xffff & ~UART011_TXIS, uap->port.membase + UART011_ICR);
+ writew(0xffff, uap->port.membase + UART011_ICR);
spin_unlock_irq(&uap->port.lock);
pl011_dma_shutdown(uap);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-01 11:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-01 11:08 [PATCH REPOST v4 1/2] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open" Dave Martin
2015-04-01 11:14 ` Dave Martin
-- strict thread matches above, loose matches on Subject: below --
2015-04-01 11:05 [PATCH REPOST v4 0/2] serial/amba-pl011: Refactor and simplify TX FIFO handling Dave Martin
2015-04-01 11:09 ` [PATCH REPOST v4 1/2] Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open" Dave Martin
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).