<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/tty/serial/imx.c, branch v6.3.2</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.3.2</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.3.2'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2023-02-16T12:50:31+00:00</updated>
<entry>
<title>serial: imx: remove a redundant check</title>
<updated>2023-02-16T12:50:31+00:00</updated>
<author>
<name>Tom Rix</name>
<email>trix@redhat.com</email>
</author>
<published>2023-02-11T15:45:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f92730eed57f8057e1e120a0a2e8ad04ba155d4'/>
<id>urn:sha1:3f92730eed57f8057e1e120a0a2e8ad04ba155d4</id>
<content type='text'>
cpp_check reports
drivers/tty/serial/imx.c:1207:15: style: Condition 'r_bytes&gt;0' is always true [knownConditionTrueFalse]
  if (r_bytes &gt; 0) {

r_byte is set to
  r_bytes = rx_ring-&gt;head - rx_ring-&gt;tail;

The head - tail calculation is also done by the earlier check
  if (rx_ring-&gt;head &lt;= sg_dma_len(sgl) &amp;&amp;
      rx_ring-&gt;head &gt; rx_ring-&gt;tail) {

so r_bytes will always be &gt; 0, so the second check is not needed.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Reviewed-by: Iuliana Prodan &lt;iuliana.prodan@nxp.com&gt;
Link: https://lore.kernel.org/r/20230211154550.2130670-1-trix@redhat.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: get rid of registers shadowing</title>
<updated>2023-02-08T12:15:10+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:16:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f2d9fbb6f4a7175ce41afe292d46685ef7752a67'/>
<id>urn:sha1:f2d9fbb6f4a7175ce41afe292d46685ef7752a67</id>
<content type='text'>
Neither registers shadowing is functionally needed as all the registers are
read-write, nor the shadowing makes much sense for speed-up, as most speed
critical reads/writes (of data Rx/Tx registers) are not shadowed anyway.
Moreover, the shadowing code is obviously pure overhead on the write path.

Get rid of the shadowing code and variables due to above considerations.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201141603.4205-1-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: refine local variables in rxint()</title>
<updated>2023-02-08T12:12:07+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:27:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2af4b918848b4102f0bf5761057e2506258e0bb8'/>
<id>urn:sha1:2af4b918848b4102f0bf5761057e2506258e0bb8</id>
<content type='text'>
The 'rx' is chip register, similar to 'usr2', so let it be of 'u32' type as
well.

Move 'flg' to be FIFO read loop local as it's not used outside.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201142700.4346-8-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: stop using USR2 in FIFO reading loop</title>
<updated>2023-02-08T12:12:05+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:26:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=53701b6d2ce7202cff88943ee812917c896a8e90'/>
<id>urn:sha1:53701b6d2ce7202cff88943ee812917c896a8e90</id>
<content type='text'>
The chip provides all the needed bits in the URXD0 register that we read
anyway for data, so get rid of reading USR2 and use only URXD0 bits
instead.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201142700.4346-7-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: remove redundant USR2 read from FIFO reading loop</title>
<updated>2023-02-08T12:12:02+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:26:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0fbca4798af88c20a2b9e4c98ac762408a24b668'/>
<id>urn:sha1:0fbca4798af88c20a2b9e4c98ac762408a24b668</id>
<content type='text'>
There is no need to read USR2 twice at every loop iteration: get rid of the
second read.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201142700.4346-6-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: do not break from FIFO reading loop prematurely</title>
<updated>2023-02-08T12:11:58+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:26:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fbf971701d03ede858f5ca8b8b8e328671ab04f4'/>
<id>urn:sha1:fbf971701d03ede858f5ca8b8b8e328671ab04f4</id>
<content type='text'>
There is no reason to prematurely break out of FIFO reading loop, and it
might cause needless reenters into ISR, so keep reading until FIFO is
empty.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201142700.4346-5-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: do not sysrq broken chars</title>
<updated>2023-02-08T12:11:55+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:26:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e1c6a7e5f87d66fce5c6890845400f8425acda4f'/>
<id>urn:sha1:e1c6a7e5f87d66fce5c6890845400f8425acda4f</id>
<content type='text'>
Do not call uart_handle_sysrq_char() if we got any receive error along with
the character, as we don't want random junk to be considered a sysrq.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201142700.4346-4-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: work-around for hardware RX flood</title>
<updated>2023-02-08T12:11:52+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:26:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=496a4471b7c3ae5c0be1a3fccd69e7debc127e08'/>
<id>urn:sha1:496a4471b7c3ae5c0be1a3fccd69e7debc127e08</id>
<content type='text'>
Check if hardware Rx flood is in progress, and issue soft reset to UART to
stop the flood.

A way to reproduce the flood (checked on iMX6SX) is: open iMX UART at 9600
8N1, and from external source send 0xf0 char at 115200 8N1. In about 90% of
cases this starts a flood of "receiving" of 0xff characters by the iMX UART
that is terminated by any activity on RxD line, or could be stopped by
issuing soft reset to the UART (just stop/start of RX does not help). Note
that in essence what we did here is sending isolated start bit about 2.4
times shorter than it is to be if issued on the UART configured baud rate.

There was earlier attempt to fix similar issue in: 'commit
b38cb7d25711 ("serial: imx: Disable new features of autobaud detection")',
but apparently it only gets harder to reproduce the issue after that
commit.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201142700.4346-3-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: imx: factor-out common code to imx_uart_soft_reset()</title>
<updated>2023-02-08T12:11:48+00:00</updated>
<author>
<name>Sergey Organov</name>
<email>sorganov@gmail.com</email>
</author>
<published>2023-02-01T14:26:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d45fb2e430e54fac6af3cabb39c36171c4bf3f52'/>
<id>urn:sha1:d45fb2e430e54fac6af3cabb39c36171c4bf3f52</id>
<content type='text'>
We perform soft reset in 2 places, slightly differently for no sufficient
reasons, so move more generic variant to a function, and re-use the code.

Out of 2 repeat counters, 10 and 100, select 10, as the code works at
interrupts disabled, and in practice the reset happens immediately.

Signed-off-by: Sergey Organov &lt;sorganov@gmail.com&gt;
Link: https://lore.kernel.org/r/20230201142700.4346-2-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>tty: serial: imx: disable Ageing Timer interrupt request irq</title>
<updated>2023-02-08T12:09:00+00:00</updated>
<author>
<name>Peng Fan</name>
<email>peng.fan@nxp.com</email>
</author>
<published>2023-02-06T01:30:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ef25e16ea9674b713a68c3bda821556ce9901254'/>
<id>urn:sha1:ef25e16ea9674b713a68c3bda821556ce9901254</id>
<content type='text'>
There maybe pending USR interrupt before requesting irq, however
uart_add_one_port has not executed, so there will be kernel panic:
[    0.795668] Unable to handle kernel NULL pointer dereference at virtual addre
ss 0000000000000080
[    0.802701] Mem abort info:
[    0.805367]   ESR = 0x0000000096000004
[    0.808950]   EC = 0x25: DABT (current EL), IL = 32 bits
[    0.814033]   SET = 0, FnV = 0
[    0.816950]   EA = 0, S1PTW = 0
[    0.819950]   FSC = 0x04: level 0 translation fault
[    0.824617] Data abort info:
[    0.827367]   ISV = 0, ISS = 0x00000004
[    0.831033]   CM = 0, WnR = 0
[    0.833866] [0000000000000080] user address but active_mm is swapper
[    0.839951] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
[    0.845953] Modules linked in:
[    0.848869] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.1.1+g56321e101aca #1
[    0.855617] Hardware name: Freescale i.MX8MP EVK (DT)
[    0.860452] pstate: 000000c5 (nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    0.867117] pc : __imx_uart_rxint.constprop.0+0x11c/0x2c0
[    0.872283] lr : imx_uart_int+0xf8/0x1ec

The issue only happends in the inmate linux when Jailhouse hypervisor
enabled. The test procedure is:
while true; do
	jailhouse enable imx8mp.cell
	jailhouse cell linux xxxx
	sleep 10
	jailhouse cell destroy 1
	jailhouse disable
	sleep 5
done

And during the upper test, press keys to the 2nd linux console.
When `jailhouse cell destroy 1`, the 2nd linux has no chance to put
the uart to a quiese state, so USR1/2 may has pending interrupts. Then
when `jailhosue cell linux xx` to start 2nd linux again, the issue
trigger.

In order to disable irqs before requesting them, both UCR1 and UCR2 irqs
should be disabled, so here fix that, disable the Ageing Timer interrupt
in UCR2 as UCR1 does.

Fixes: 8a61f0c70ae6 ("serial: imx: Disable irqs before requesting them")
Suggested-by: Sherry Sun &lt;sherry.sun@nxp.com&gt;
Reviewed-by: Sherry Sun &lt;sherry.sun@nxp.com&gt;
Signed-off-by: Peng Fan &lt;peng.fan@nxp.com&gt;
Acked-by: Jason Liu &lt;jason.hui.liu@nxp.com&gt;
Link: https://lore.kernel.org/r/20230206013016.29352-1-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
