From patchwork Fri Apr 5 06:08:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13618556 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 499271EB2B; Fri, 5 Apr 2024 06:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712297319; cv=none; b=PeSTkjlIbXAb9P3gup/1+F9WfW+n5FsTtKhjOo3IAYc9RAiRlgK/N9gG+OxXBzRgOtrfOADp7cHN6BJ+fPAeIJ2ZxjMVy4EB95upu9brdn0Y1Y59rk8DaJRGFsloaUGvjMPaSfC5lnSZsAecZYGzNNWO97+njFu0UOE5GIy2ANI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712297319; c=relaxed/simple; bh=3a2D8FLQ+zRKWr+dT+h2iE0Z2sanm7uNODeFnm2l0+Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=BZqJI5J8BfqGhXCWnjpQbma41TgAAp+qYteLANOYl3MPvvqVp5R2wo0G8IaRK86Wph9ucVJSlMVp6t2BJ7uzwiqZENiCNvS8wkYyLzLkD0tia+i5zbtJNwcizpcny9tm1DTCk/SBgbzNKv/bIYAlg0e0a2gurBqRPOLIFSIC/3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gpGfKh6n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gpGfKh6n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AEF8C433F1; Fri, 5 Apr 2024 06:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712297319; bh=3a2D8FLQ+zRKWr+dT+h2iE0Z2sanm7uNODeFnm2l0+Y=; h=From:To:Cc:Subject:Date:From; b=gpGfKh6nDc7tcL07n3W/XO8V28YegkSc6XbhqFudjoYAoEcSCW65UXjShFQohkTxJ NkiOqw/nDvbB/7Wp8V++4rR754zLEnQCcGMJRDCQZkS6sXlochANSJ2qkSpvu3MJ8f y4pEho6HNQUYBnegAqqNlAWtWmwqqthP7t4QvOrj9dvOwHufEauqpiADXvX44F5c0y ++d/E1f7AGfsF1/fvL7o4l72BK0/4NRsWrn9Ypb09dKMMkBEfhBmAElQHZArl2523F A9gXXuQqCULLb5f/umebextqlEBfVsOgazcNMvjXfsBfITmLHpDWCKZMxCYz9u2VDC py2I1SMgou3Pw== From: "Jiri Slaby (SUSE)" To: gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Jiri Slaby (SUSE)" , Al Cooper , Alexander Shiyan , Alexandre Belloni , Alexandre Torgue , Alim Akhtar , Andrew Morton , "Aneesh Kumar K.V" , AngeloGioacchino Del Regno , Baolin Wang , Baruch Siach , Bjorn Andersson , Claudiu Beznea , "David S. Miller" , Fabio Estevam , Hammer Hsieh , =?utf-8?q?Christian_K=C3=B6nig?= , Christophe Leroy , Chunyan Zhang , Jerome Brunet , Jonathan Hunter , Kevin Hilman , Konrad Dybcio , Krzysztof Kozlowski , Kumaravel Thiagarajan , Laxman Dewangan , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, "Maciej W. Rozycki" , Manivannan Sadhasivam , Martin Blumenstingl , Matthias Brugger , Maxime Coquelin , Michael Ellerman , Michal Simek , "Naveen N. Rao" , Neil Armstrong , Nicolas Ferre , Nicholas Piggin , Orson Zhai , =?utf-8?q?Pali_Roh=C3=A1r?= , Patrice Chotard , Peter Korsgaard , Richard Genoud , Russell King , Sascha Hauer , Shawn Guo , Stefani Seibold , Sumit Semwal , Taichi Sugaya , Takao Orito , Tharun Kumar P , Thierry Reding , Timur Tabi , Vineet Gupta Subject: [PATCH 00/15] tty: serial: switch from circ_buf to kfifo Date: Fri, 5 Apr 2024 08:08:11 +0200 Message-ID: <20240405060826.2521-1-jirislaby@kernel.org> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This series switches tty serial layer to use kfifo instead of circ_buf. The reasoning can be found in the switching patch in this series: """ Switch from struct circ_buf to proper kfifo. kfifo provides much better API, esp. when wrap-around of the buffer needs to be taken into account. Look at pl011_dma_tx_refill() or cpm_uart_tx_pump() changes for example. Kfifo API can also fill in scatter-gather DMA structures, so it easier for that use case too. Look at lpuart_dma_tx() for example. Note that not all drivers can be converted to that (like atmel_serial), they handle DMA specially. Note that usb-serial uses kfifo for TX for ages. """ Cc: Al Cooper Cc: Alexander Shiyan Cc: Alexandre Belloni Cc: Alexandre Torgue Cc: Alim Akhtar Cc: Andrew Morton Cc: "Aneesh Kumar K.V" Cc: AngeloGioacchino Del Regno Cc: Baolin Wang Cc: Baruch Siach Cc: Bjorn Andersson Cc: Claudiu Beznea Cc: "David S. Miller" Cc: Fabio Estevam Cc: Hammer Hsieh Cc: "Christian König" Cc: Christophe Leroy Cc: Chunyan Zhang Cc: Jerome Brunet Cc: Jonathan Hunter Cc: Kevin Hilman Cc: Konrad Dybcio Cc: Krzysztof Kozlowski Cc: Kumaravel Thiagarajan Cc: Laxman Dewangan Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: "Maciej W. Rozycki" Cc: Manivannan Sadhasivam Cc: Martin Blumenstingl Cc: Matthias Brugger Cc: Maxime Coquelin Cc: Michael Ellerman Cc: Michal Simek Cc: "Naveen N. Rao" Cc: Neil Armstrong Cc: Nicolas Ferre Cc: Nicholas Piggin Cc: Orson Zhai Cc: "Pali Rohár" Cc: Patrice Chotard Cc: Peter Korsgaard Cc: Richard Genoud Cc: Russell King Cc: Sascha Hauer Cc: Shawn Guo Cc: Stefani Seibold Cc: Sumit Semwal Cc: Taichi Sugaya Cc: Takao Orito Cc: Tharun Kumar P Cc: Thierry Reding Cc: Timur Tabi Cc: Vineet Gupta Jiri Slaby (SUSE) (15): kfifo: drop __kfifo_dma_out_finish_r() kfifo: introduce and use kfifo_skip_count() kfifo: add kfifo_out_linear{,_ptr}() kfifo: remove support for physically non-contiguous memory kfifo: rename l to len_to_end in setup_sgl() kfifo: pass offset to setup_sgl_buf() instead of a pointer kfifo: add kfifo_dma_out_prepare_mapped() kfifo: fix typos in kernel-doc tty: 8250_dma: use dmaengine_prep_slave_sg() tty: 8250_omap: use dmaengine_prep_slave_sg() tty: msm_serial: use dmaengine_prep_slave_sg() tty: serial: switch from circ_buf to kfifo tty: atmel_serial: use single DMA mapping for TX tty: atmel_serial: define macro for RX size tty: atmel_serial: use single DMA mapping for RX drivers/tty/serial/8250/8250_bcm7271.c | 14 +-- drivers/tty/serial/8250/8250_core.c | 3 +- drivers/tty/serial/8250/8250_dma.c | 31 +++-- drivers/tty/serial/8250/8250_exar.c | 5 +- drivers/tty/serial/8250/8250_mtk.c | 2 +- drivers/tty/serial/8250/8250_omap.c | 48 +++++--- drivers/tty/serial/8250/8250_pci1xxxx.c | 50 ++++---- drivers/tty/serial/8250/8250_port.c | 22 ++-- drivers/tty/serial/amba-pl011.c | 46 +++----- drivers/tty/serial/ar933x_uart.c | 15 ++- drivers/tty/serial/arc_uart.c | 8 +- drivers/tty/serial/atmel_serial.c | 150 +++++++++++------------- drivers/tty/serial/clps711x.c | 12 +- drivers/tty/serial/cpm_uart.c | 20 ++-- drivers/tty/serial/digicolor-usart.c | 12 +- drivers/tty/serial/dz.c | 13 +- drivers/tty/serial/fsl_linflexuart.c | 17 +-- drivers/tty/serial/fsl_lpuart.c | 39 +++--- drivers/tty/serial/icom.c | 25 +--- drivers/tty/serial/imx.c | 54 ++++----- drivers/tty/serial/ip22zilog.c | 26 ++-- drivers/tty/serial/jsm/jsm_cls.c | 29 ++--- drivers/tty/serial/jsm/jsm_neo.c | 38 ++---- drivers/tty/serial/max3100.c | 14 +-- drivers/tty/serial/max310x.c | 35 +++--- drivers/tty/serial/men_z135_uart.c | 26 ++-- drivers/tty/serial/meson_uart.c | 11 +- drivers/tty/serial/milbeaut_usio.c | 15 +-- drivers/tty/serial/msm_serial.c | 114 +++++++++--------- drivers/tty/serial/mvebu-uart.c | 8 +- drivers/tty/serial/mxs-auart.c | 23 +--- drivers/tty/serial/pch_uart.c | 21 ++-- drivers/tty/serial/pic32_uart.c | 15 ++- drivers/tty/serial/pmac_zilog.c | 24 ++-- drivers/tty/serial/qcom_geni_serial.c | 36 +++--- drivers/tty/serial/rda-uart.c | 17 +-- drivers/tty/serial/samsung_tty.c | 54 +++++---- drivers/tty/serial/sb1250-duart.c | 13 +- drivers/tty/serial/sc16is7xx.c | 40 +++---- drivers/tty/serial/sccnxp.c | 16 ++- drivers/tty/serial/serial-tegra.c | 43 ++++--- drivers/tty/serial/serial_core.c | 56 ++++----- drivers/tty/serial/serial_port.c | 2 +- drivers/tty/serial/sh-sci.c | 51 ++++---- drivers/tty/serial/sprd_serial.c | 20 ++-- drivers/tty/serial/st-asc.c | 4 +- drivers/tty/serial/stm32-usart.c | 52 ++++---- drivers/tty/serial/sunhv.c | 35 +++--- drivers/tty/serial/sunplus-uart.c | 16 +-- drivers/tty/serial/sunsab.c | 30 ++--- drivers/tty/serial/sunsu.c | 15 +-- drivers/tty/serial/sunzilog.c | 27 ++--- drivers/tty/serial/tegra-tcu.c | 10 +- drivers/tty/serial/timbuart.c | 17 ++- drivers/tty/serial/uartlite.c | 13 +- drivers/tty/serial/ucc_uart.c | 20 ++-- drivers/tty/serial/xilinx_uartps.c | 20 ++-- drivers/tty/serial/zs.c | 13 +- include/linux/kfifo.h | 143 ++++++++++++++++------ include/linux/serial_core.h | 49 +++++--- lib/kfifo.c | 107 +++++++++-------- 61 files changed, 944 insertions(+), 960 deletions(-) Tested-by: Anders Roxell