Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit f7f5d52

Browse files
jhovoldgregkh
authored andcommitted
serial: qcom-geni: fix dma rx cancellation
commit 23ee4a2 upstream. Make sure to wait for the DMA transfer to complete when cancelling the rx command on stop_rx(). This specifically prevents the DMA completion interrupt from firing after rx has been restarted, something which can lead to an IOMMU fault and hosed rx when the interrupt handler unmaps the DMA buffer for the new command: qcom_geni_serial 988000.serial: serial engine reports 0 RX bytes in! arm-smmu 15000000.iommu: FSR = 00000402 [Format=2 TF], SID=0x563 arm-smmu 15000000.iommu: FSYNR0 = 00210013 [S1CBNDX=33 WNR PLVL=3] Bluetooth: hci0: command 0xfc00 tx timeout Bluetooth: hci0: Reading QCA version information failed (-110) Also add the missing state machine reset which is needed in case cancellation fails. Fixes: 2aaa43c ("tty: serial: qcom-geni-serial: add support for serial engine DMA") Cc: stable@vger.kernel.org # 6.3 Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20241009145110.16847-5-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6a54113 commit f7f5d52

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

drivers/tty/serial/qcom_geni_serial.c

+14-4
Original file line numberDiff line numberDiff line change
@@ -787,17 +787,27 @@ static void qcom_geni_serial_start_rx_fifo(struct uart_port *uport)
787787
static void qcom_geni_serial_stop_rx_dma(struct uart_port *uport)
788788
{
789789
struct qcom_geni_serial_port *port = to_dev_port(uport);
790+
bool done;
790791

791792
if (!qcom_geni_serial_secondary_active(uport))
792793
return;
793794

794795
geni_se_cancel_s_cmd(&port->se);
795-
qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS,
796-
S_CMD_CANCEL_EN, true);
797-
798-
if (qcom_geni_serial_secondary_active(uport))
796+
done = qcom_geni_serial_poll_bit(uport, SE_DMA_RX_IRQ_STAT,
797+
RX_EOT, true);
798+
if (done) {
799+
writel(RX_EOT | RX_DMA_DONE,
800+
uport->membase + SE_DMA_RX_IRQ_CLR);
801+
} else {
799802
qcom_geni_serial_abort_rx(uport);
800803

804+
writel(1, uport->membase + SE_DMA_RX_FSM_RST);
805+
qcom_geni_serial_poll_bit(uport, SE_DMA_RX_IRQ_STAT,
806+
RX_RESET_DONE, true);
807+
writel(RX_RESET_DONE | RX_DMA_DONE,
808+
uport->membase + SE_DMA_RX_IRQ_CLR);
809+
}
810+
801811
if (port->rx_dma_addr) {
802812
geni_se_rx_dma_unprep(&port->se, port->rx_dma_addr,
803813
DMA_RX_BUF_SIZE);

0 commit comments

Comments
 (0)