Skip to content

Commit 23ee4a2

Browse files
jhovoldgregkh
authored andcommitted
serial: qcom-geni: fix dma rx cancellation
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: [email protected] # 6.3 Cc: Bartosz Golaszewski <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 23f5f5d commit 23ee4a2

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

drivers/tty/serial/qcom_geni_serial.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -805,17 +805,27 @@ static void qcom_geni_serial_start_rx_fifo(struct uart_port *uport)
805805
static void qcom_geni_serial_stop_rx_dma(struct uart_port *uport)
806806
{
807807
struct qcom_geni_serial_port *port = to_dev_port(uport);
808+
bool done;
808809

809810
if (!qcom_geni_serial_secondary_active(uport))
810811
return;
811812

812813
geni_se_cancel_s_cmd(&port->se);
813-
qcom_geni_serial_poll_bit(uport, SE_GENI_S_IRQ_STATUS,
814-
S_CMD_CANCEL_EN, true);
815-
816-
if (qcom_geni_serial_secondary_active(uport))
814+
done = qcom_geni_serial_poll_bit(uport, SE_DMA_RX_IRQ_STAT,
815+
RX_EOT, true);
816+
if (done) {
817+
writel(RX_EOT | RX_DMA_DONE,
818+
uport->membase + SE_DMA_RX_IRQ_CLR);
819+
} else {
817820
qcom_geni_serial_abort_rx(uport);
818821

822+
writel(1, uport->membase + SE_DMA_RX_FSM_RST);
823+
qcom_geni_serial_poll_bit(uport, SE_DMA_RX_IRQ_STAT,
824+
RX_RESET_DONE, true);
825+
writel(RX_RESET_DONE | RX_DMA_DONE,
826+
uport->membase + SE_DMA_RX_IRQ_CLR);
827+
}
828+
819829
if (port->rx_dma_addr) {
820830
geni_se_rx_dma_unprep(&port->se, port->rx_dma_addr,
821831
DMA_RX_BUF_SIZE);

0 commit comments

Comments
 (0)