<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/tty/serial, branch v6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.2</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-01-31T10:15:16Z</updated>
<entry>
<title>serial: 8250_dma: Fix DMA Rx rearm race</title>
<updated>2023-01-31T10:15:16Z</updated>
<author>
<name>Ilpo Järvinen</name>
<email>ilpo.jarvinen@linux.intel.com</email>
</author>
<published>2023-01-30T11:48:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=57e9af7831dcf211c5c689c2a6f209f4abdf0bce'/>
<id>urn:sha1:57e9af7831dcf211c5c689c2a6f209f4abdf0bce</id>
<content type='text'>
As DMA Rx can be completed from two places, it is possible that DMA Rx
completes before DMA completion callback had a chance to complete it.
Once the previous DMA Rx has been completed, a new one can be started
on the next UART interrupt. The following race is possible
(uart_unlock_and_check_sysrq_irqrestore() replaced with
spin_unlock_irqrestore() for simplicity/clarity):

CPU0					CPU1
					dma_rx_complete()
serial8250_handle_irq()
  spin_lock_irqsave(&amp;port-&gt;lock)
  handle_rx_dma()
    serial8250_rx_dma_flush()
      __dma_rx_complete()
        dma-&gt;rx_running = 0
        // Complete DMA Rx
  spin_unlock_irqrestore(&amp;port-&gt;lock)

serial8250_handle_irq()
  spin_lock_irqsave(&amp;port-&gt;lock)
  handle_rx_dma()
    serial8250_rx_dma()
      dma-&gt;rx_running = 1
      // Setup a new DMA Rx
  spin_unlock_irqrestore(&amp;port-&gt;lock)

					  spin_lock_irqsave(&amp;port-&gt;lock)
					  // sees dma-&gt;rx_running = 1
					  __dma_rx_complete()
					    dma-&gt;rx_running = 0
					    // Incorrectly complete
					    // running DMA Rx

This race seems somewhat theoretical to occur for real but handle it
correctly regardless. Check what is the DMA status before complething
anything in __dma_rx_complete().

Reported-by: Gilles BULOZ &lt;gilles.buloz@kontron.com&gt;
Tested-by: Gilles BULOZ &lt;gilles.buloz@kontron.com&gt;
Fixes: 9ee4b83e51f7 ("serial: 8250: Add support for dmaengine")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen &lt;ilpo.jarvinen@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20230130114841.25749-3-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: 8250_dma: Fix DMA Rx completion race</title>
<updated>2023-01-31T10:15:16Z</updated>
<author>
<name>Ilpo Järvinen</name>
<email>ilpo.jarvinen@linux.intel.com</email>
</author>
<published>2023-01-30T11:48:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=31352811e13dc2313f101b890fd4b1ce760b5fe7'/>
<id>urn:sha1:31352811e13dc2313f101b890fd4b1ce760b5fe7</id>
<content type='text'>
__dma_rx_complete() is called from two places:
  - Through the DMA completion callback dma_rx_complete()
  - From serial8250_rx_dma_flush() after IIR_RLSI or IIR_RX_TIMEOUT
The former does not hold port's lock during __dma_rx_complete() which
allows these two to race and potentially insert the same data twice.

Extend port's lock coverage in dma_rx_complete() to prevent the race
and check if the DMA Rx is still pending completion before calling
into __dma_rx_complete().

Reported-by: Gilles BULOZ &lt;gilles.buloz@kontron.com&gt;
Tested-by: Gilles BULOZ &lt;gilles.buloz@kontron.com&gt;
Fixes: 9ee4b83e51f7 ("serial: 8250: Add support for dmaengine")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen &lt;ilpo.jarvinen@linux.intel.com&gt;
Link: https://lore.kernel.org/r/20230130114841.25749-2-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler</title>
<updated>2023-01-31T10:15:01Z</updated>
<author>
<name>Marek Vasut</name>
<email>marex@denx.de</email>
</author>
<published>2023-01-20T16:03:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3f6c02fa712bd453871877fe1d1969625617471e'/>
<id>urn:sha1:3f6c02fa712bd453871877fe1d1969625617471e</id>
<content type='text'>
Requesting an interrupt with IRQF_ONESHOT will run the primary handler
in the hard-IRQ context even in the force-threaded mode. The
force-threaded mode is used by PREEMPT_RT in order to avoid acquiring
sleeping locks (spinlock_t) in hard-IRQ context. This combination
makes it impossible and leads to "sleeping while atomic" warnings.

Use one interrupt handler for both handlers (primary and secondary)
and drop the IRQF_ONESHOT flag which is not needed.

Fixes: e359b4411c283 ("serial: stm32: fix threaded interrupt handling")
Reviewed-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Tested-by: Valentin Caron &lt;valentin.caron@foss.st.com&gt; # V3
Signed-off-by: Marek Vasut &lt;marex@denx.de&gt;
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230120160332.57930-1-marex@denx.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'tty-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty</title>
<updated>2023-01-21T19:12:42Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-01-21T19:12:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bd5cc6ee8f4e823e466a075a79db3cd355cee28e'/>
<id>urn:sha1:bd5cc6ee8f4e823e466a075a79db3cd355cee28e</id>
<content type='text'>
Pull tty/serial driver fixes from Greg KH:
 "Here are some small tty and serial driver fixes for 6.2-rc5 that
  resolve a number of tiny reported issues and some new device ids. They
  include:

   - new device id for the exar serial driver

   - speakup tty driver bugfix

   - atmel serial driver baudrate fixup

   - stm32 serial driver bugfix and then revert as the bugfix broke the
     build. That will come back in a later pull request once it is all
     worked out properly.

   - amba-pl011 serial driver rs486 mode bugfix

   - qcom_geni serial driver bugfix

  Most of these have been in linux-next with no reported problems (well,
  other than the build breakage which generated the revert), the new
  device id passed 0-day testing"

* tag 'tty-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  serial: exar: Add support for Sealevel 7xxxC serial cards
  Revert "serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler"
  tty: serial: qcom_geni: avoid duplicate struct member init
  serial: atmel: fix incorrect baudrate setup
  tty: fix possible null-ptr-defer in spk_ttyio_release
  serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler
  serial: amba-pl011: fix high priority character transmission in rs486 mode
  serial: pch_uart: Pass correct sg to dma_unmap_sg()
  tty: serial: qcom-geni-serial: fix slab-out-of-bounds on RX FIFO buffer
</content>
</entry>
<entry>
<title>serial: exar: Add support for Sealevel 7xxxC serial cards</title>
<updated>2023-01-20T12:38:38Z</updated>
<author>
<name>Matthew Howell</name>
<email>matthew.howell@sealevel.com</email>
</author>
<published>2023-01-19T19:40:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=14ee78d5932afeb710c8305196a676a715bfdea8'/>
<id>urn:sha1:14ee78d5932afeb710c8305196a676a715bfdea8</id>
<content type='text'>
Add support for Sealevel 7xxxC serial cards.

This patch:
* Adds IDs to recognize 7xxxC cards from Sealevel Systems.
* Updates exar_pci_probe() to set nr_ports to last two bytes of primary
  dev ID for these cards.

Signed-off-by: Matthew Howell &lt;matthew.howell@sealevel.com&gt;
Cc: stable &lt;stable@kernel.org&gt;
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2301191440010.22558@tstest-VirtualBox
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler"</title>
<updated>2023-01-20T10:18:36Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2023-01-20T10:16:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2cbafffbf69addd7509072f4be5917f81d238cf6'/>
<id>urn:sha1:2cbafffbf69addd7509072f4be5917f81d238cf6</id>
<content type='text'>
This reverts commit f24771b62a83239f0dce816bddf0f6807f436235 as it is
reported to break the build.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Link: https://lore.kernel.org/r/202301200130.ttBiTzfO-lkp@intel.com
Fixes: f24771b62a83 ("serial: stm32: Merge hard IRQ and threaded IRQ handling into single IRQ handler")
Cc: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Cc: Valentin Caron &lt;valentin.caron@foss.st.com&gt; # V3
Cc: Marek Vasut &lt;marex@denx.de&gt;
Cc: Johan Hovold &lt;johan@kernel.org&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'printk-for-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux</title>
<updated>2023-01-19T20:32:07Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2023-01-19T20:32:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d368967cb1039b5c4cccb62b5a4b9468c50cd143'/>
<id>urn:sha1:d368967cb1039b5c4cccb62b5a4b9468c50cd143</id>
<content type='text'>
Pull printk fixes from Petr Mladek:

 - Prevent a potential deadlock when configuring kgdb console

 - Fix a kernel doc warning

* tag 'printk-for-6.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
  kernel/printk/printk.c: Fix W=1 kernel-doc warning
  tty: serial: kgdboc: fix mutex locking order for configure_kgdboc()
</content>
</entry>
<entry>
<title>tty: serial: qcom_geni: avoid duplicate struct member init</title>
<updated>2023-01-19T15:24:59Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2022-12-15T16:54:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5342ab0af45064cbdc773645b93ab70c24ee161f'/>
<id>urn:sha1:5342ab0af45064cbdc773645b93ab70c24ee161f</id>
<content type='text'>
When -Woverride-init is enabled in a build, gcc points out that
qcom_geni_serial_pm_ops contains conflicting initializers:

drivers/tty/serial/qcom_geni_serial.c:1586:20: error: initialized field overwritten [-Werror=override-init]
 1586 |         .restore = qcom_geni_serial_sys_hib_resume,
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/qcom_geni_serial.c:1586:20: note: (near initialization for 'qcom_geni_serial_pm_ops.restore')
drivers/tty/serial/qcom_geni_serial.c:1587:17: error: initialized field overwritten [-Werror=override-init]
 1587 |         .thaw = qcom_geni_serial_sys_hib_resume,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Open-code the initializers with the version that was already used,
and use the pm_sleep_ptr() method to deal with unused ones,
in place of the __maybe_unused annotation.

Fixes: 35781d8356a2 ("tty: serial: qcom-geni-serial: Add support for Hibernation feature")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Reviewed-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Link: https://lore.kernel.org/r/20221215165453.1864836-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>serial: atmel: fix incorrect baudrate setup</title>
<updated>2023-01-19T15:24:39Z</updated>
<author>
<name>Tobias Schramm</name>
<email>t.schramm@manjaro.org</email>
</author>
<published>2023-01-09T07:29:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5bfdd3c654bd879bff50c2e85e42f85ae698b42f'/>
<id>urn:sha1:5bfdd3c654bd879bff50c2e85e42f85ae698b42f</id>
<content type='text'>
Commit ba47f97a18f2 ("serial: core: remove baud_rates when serial console
setup") changed uart_set_options to select the correct baudrate
configuration based on the absolute error between requested baudrate and
available standard baudrate settings.
Prior to that commit the baudrate was selected based on which predefined
standard baudrate did not exceed the requested baudrate.
This change of selection logic was never reflected in the atmel serial
driver. Thus the comment left in the atmel serial driver is no longer
accurate.
Additionally the manual rounding up described in that comment and applied
via (quot - 1) requests an incorrect baudrate. Since uart_set_options uses
tty_termios_encode_baud_rate to determine the appropriate baudrate flags
this can cause baudrate selection to fail entirely because
tty_termios_encode_baud_rate will only select a baudrate if relative error
between requested and selected baudrate does not exceed +/-2%.
Fix that by requesting actual, exact baudrate used by the serial.

Fixes: ba47f97a18f2 ("serial: core: remove baud_rates when serial console setup")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Tobias Schramm &lt;t.schramm@manjaro.org&gt;
Acked-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Link: https://lore.kernel.org/r/20230109072940.202936-1-t.schramm@manjaro.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rework/console-list-lock' into for-linus</title>
<updated>2023-01-19T13:56:38Z</updated>
<author>
<name>Petr Mladek</name>
<email>pmladek@suse.com</email>
</author>
<published>2023-01-19T13:56:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=21493c6e96e550509ead696ecca9f0d7196ee91c'/>
<id>urn:sha1:21493c6e96e550509ead696ecca9f0d7196ee91c</id>
<content type='text'>
</content>
</entry>
</feed>
