linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: fix break handling for sysrq
@ 2021-08-16 16:22 Ulrich Hecht
  2021-08-23  9:16 ` Geert Uytterhoeven
  2021-09-09 14:35 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Ulrich Hecht @ 2021-08-16 16:22 UTC (permalink / raw)
  To: linux-renesas-soc, linux-serial
  Cc: wsa, geert, yoshihiro.shimoda.uh, gregkh, jirislaby,
	linux-kernel, Ulrich Hecht

This fixes two issues that cause the sysrq sequence to be inadvertently
aborted on SCIF serial consoles:

- a NUL character remains in the RX queue after a break has been detected,
  which is then passed on to uart_handle_sysrq_char()
- the break interrupt is handled twice on controllers with multiplexed ERI
  and BRI interrupts

Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>
---
 drivers/tty/serial/sh-sci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 07eb56294371..89ee43061d3a 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1758,6 +1758,10 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr)
 
 	/* Handle BREAKs */
 	sci_handle_breaks(port);
+
+	/* drop invalid character received before break was detected */
+	serial_port_in(port, SCxRDR);
+
 	sci_clear_SCxSR(port, SCxSR_BREAK_CLEAR(port));
 
 	return IRQ_HANDLED;
@@ -1837,7 +1841,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)
 		ret = sci_er_interrupt(irq, ptr);
 
 	/* Break Interrupt */
-	if ((ssr_status & SCxSR_BRK(port)) && err_enabled)
+	if (s->irqs[SCIx_ERI_IRQ] != s->irqs[SCIx_BRI_IRQ] &&
+	    (ssr_status & SCxSR_BRK(port)) && err_enabled)
 		ret = sci_br_interrupt(irq, ptr);
 
 	/* Overrun Interrupt */
-- 
2.20.1


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

* Re: [PATCH] serial: sh-sci: fix break handling for sysrq
  2021-08-16 16:22 [PATCH] serial: sh-sci: fix break handling for sysrq Ulrich Hecht
@ 2021-08-23  9:16 ` Geert Uytterhoeven
  2021-09-09 14:35 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-08-23  9:16 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: Linux-Renesas, open list:SERIAL DRIVERS, Wolfram Sang,
	Yoshihiro Shimoda, Greg KH, Jiri Slaby,
	Linux Kernel Mailing List

On Mon, Aug 16, 2021 at 6:22 PM Ulrich Hecht <uli+renesas@fpond.eu> wrote:
> This fixes two issues that cause the sysrq sequence to be inadvertently
> aborted on SCIF serial consoles:
>
> - a NUL character remains in the RX queue after a break has been detected,
>   which is then passed on to uart_handle_sysrq_char()
> - the break interrupt is handled twice on controllers with multiplexed ERI
>   and BRI interrupts
>
> Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>

FTR:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] serial: sh-sci: fix break handling for sysrq
  2021-08-16 16:22 [PATCH] serial: sh-sci: fix break handling for sysrq Ulrich Hecht
  2021-08-23  9:16 ` Geert Uytterhoeven
@ 2021-09-09 14:35 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2021-09-09 14:35 UTC (permalink / raw)
  To: Ulrich Hecht
  Cc: linux-renesas-soc, linux-serial, geert, yoshihiro.shimoda.uh,
	gregkh, jirislaby, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

On Mon, Aug 16, 2021 at 06:22:01PM +0200, Ulrich Hecht wrote:
> This fixes two issues that cause the sysrq sequence to be inadvertently
> aborted on SCIF serial consoles:
> 
> - a NUL character remains in the RX queue after a break has been detected,
>   which is then passed on to uart_handle_sysrq_char()
> - the break interrupt is handled twice on controllers with multiplexed ERI
>   and BRI interrupts
> 
> Signed-off-by: Ulrich Hecht <uli+renesas@fpond.eu>

For the record:

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-09-09 14:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 16:22 [PATCH] serial: sh-sci: fix break handling for sysrq Ulrich Hecht
2021-08-23  9:16 ` Geert Uytterhoeven
2021-09-09 14:35 ` Wolfram Sang

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