linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pmac_zilog: Workaround problem due to interrupt on closed port
@ 2010-01-11  3:51 Benjamin Herrenschmidt
  2010-01-11  8:28 ` Rob Landley
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2010-01-11  3:51 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: David Miller, Rob Landley

It seems that in qemu, we can see an interrupt in R3 despite the
fact that it's masked in W1. The chip doesn't actually issue an
interrupt, but we can "see" it when taking an interrupt for the
other channel. This may be a qemu bug ... or not, so let's be
safe and avoid calling into the UART layer when that happens which
woulc cause a crash.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

David: This would affect sunzilog as well I believe. I'm not sure
if it's a bug in qemu emulation of the ESCC or if a real ESCC can
show it so I decided to be safe :-) The ESCC doc I have doesn't
appear to specify whether the interrupt status bits in R3 are
prior or post masking by W1. I can reproduce that by having the
kernel low level "udbg" debug console on channel B and the main
console on channel A (which is itself an uncommon setup).

diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c
index 0700cd1..683e66f 100644
--- a/drivers/serial/pmac_zilog.c
+++ b/drivers/serial/pmac_zilog.c
@@ -411,6 +411,17 @@ static void pmz_transmit_chars(struct uart_pmac_port *uap)
 		goto ack_tx_int;
 	}
 
+	/* Under some circumstances, we see interrupts reported for
+	 * a closed channel. The interrupt mask in R1 is clear, but
+	 * R3 still signals the interrupts and we see them when taking
+	 * an interrupt for the other channel (this could be a qemu
+	 * bug but since the ESCC doc doesn't specify precsiely whether
+	 * R3 interrup status bits are masked by R1 interrupt enable
+	 * bits, better safe than sorry). --BenH.
+	 */
+	if (!ZS_IS_OPEN(uap))
+		goto ack_tx_int;
+
 	if (uap->port.x_char) {
 		uap->flags |= PMACZILOG_FLAG_TX_ACTIVE;
 		write_zsdata(uap, uap->port.x_char);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pmac_zilog: Workaround problem due to interrupt on closed port
  2010-01-11  3:51 [PATCH] pmac_zilog: Workaround problem due to interrupt on closed port Benjamin Herrenschmidt
@ 2010-01-11  8:28 ` Rob Landley
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Landley @ 2010-01-11  8:28 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, David Miller

On Sunday 10 January 2010 21:51:42 Benjamin Herrenschmidt wrote:
> It seems that in qemu, we can see an interrupt in R3 despite the
> fact that it's masked in W1. The chip doesn't actually issue an
> interrupt, but we can "see" it when taking an interrupt for the
> other channel. This may be a qemu bug ... or not, so let's be
> safe and avoid calling into the UART layer when that happens which
> woulc cause a crash.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Acked-by: Rob Landley <rob@landley.net>

Tested it, and it worked for me.

Thanks,

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-11  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11  3:51 [PATCH] pmac_zilog: Workaround problem due to interrupt on closed port Benjamin Herrenschmidt
2010-01-11  8:28 ` Rob Landley

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).