From patchwork Tue Mar 19 09:52:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 13596509 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 29A127D083; Tue, 19 Mar 2024 09:53:28 +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=1710842009; cv=none; b=X101GlxGEzS86pcPvQ29m+3PTOZbSfTJWbYqPjD0NiaalDf9bwYtPwZGpfRq9+trVu6a4BeKDCnk4To5RKIBAaE4tMVG8hcUHWbr3qCcsXUvwQcM2iwvrcN9RqqJOBn/Kk8l5bmnBlJyu/bYLwxdLhlqQ8SpYe9hRKB9yUbOhh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710842009; c=relaxed/simple; bh=ai0U2zh0od3mIZWy2eSqdoVTkokovEgyzUxpISIiZ7Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=rXvZ8vxFlmBQD64RYl7EYJBG/tnvnYMHxdzpaiy6+p1rFvGRRoaS6Q4ZaKPs11stygWqxvZjVZtBDqgwfW2+7DD8elUQBR5rTHgTY1LSH8z5Y+F+eBzWeG3djGhTzXZ8ZiFl76BI22CgYucsBVyuosuHNJHNVYaU1B8GTRciFFo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OGizSRYd; 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="OGizSRYd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 320E8C43390; Tue, 19 Mar 2024 09:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710842008; bh=ai0U2zh0od3mIZWy2eSqdoVTkokovEgyzUxpISIiZ7Q=; h=From:To:Cc:Subject:Date:From; b=OGizSRYd4Dt2lxl4soBg5WoJ+adA/2jX4E2a5JOsSA9V9OZ4is/tXnnNlo9Y1tHQW K/vGAF2iFcOVfkpMeKFF3u6/RwBV0G1Gg+PYPkO4miEuzIcQZ2seSd2b1Hx20LKhsj CvEv99RJ4UUkgEGDABwEOgFmHMi5TgA3IaEdP/hv1iq1jc7f2zJ9zs8Jc11Y/oQgTf ABirlSDmm6oOoYx83oht/L71/YC1NdESe8b3jgviAUCn3gHX6AUupeH9SUVbNw0MK+ ysie6fH0jEz65NWHe2vS1tE3p4hK7iT+/ysrJ7hXzy6tuOr6AVCJ2pvZr/Y5ylbTHP AadAssOLVrSEw== From: "Jiri Slaby (SUSE)" To: linux-serial@vger.kernel.org Cc: 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: [RFT 00/15] tty: serial: switch from circ_buf to kfifo Date: Tue, 19 Mar 2024 10:52:59 +0100 Message-ID: <20240319095315.27624-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. Excerpt from the switching patch: """ 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. """ This is Request for Testing as I cannot test all the changes (obviously). So please test your HW's serial properly. And of course comments welcome. I will send this as PATCHes later, when -rc1 is out, at earliest. 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: Richard Genoud # on at91sam9g20-ek sama5d3_xplained and sama5d2_xplained