Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7F84C5DF60 for ; Tue, 5 Nov 2019 17:18:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A339B2190F for ; Tue, 5 Nov 2019 17:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572974309; bh=xhBHlpLzKMxWG1uzdjlPGMv5/i3bEaDdEOzBTmgeaQk=; h=Subject:To:From:Date:List-ID:From; b=wtFFLX0+ClWKIbdvGVhh4bSoft6D1XgqcV1RhGRPLchcux/80/4emkVKrYo/uFG4z u3mN30PX1N2BuCvpiITMT2Ikb7ufLPqFbtlIUcog6294ER6kTFsl6PdIDXU4338tiY COiUlpOzpICA9FKEGZZDpEd8OHZx2on4R6Mm6OFw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390287AbfKERS3 (ORCPT ); Tue, 5 Nov 2019 12:18:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:48348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389659AbfKERS3 (ORCPT ); Tue, 5 Nov 2019 12:18:29 -0500 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4114F214B2; Tue, 5 Nov 2019 17:18:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572974308; bh=xhBHlpLzKMxWG1uzdjlPGMv5/i3bEaDdEOzBTmgeaQk=; h=Subject:To:From:Date:From; b=wcwn5OIJUorCe5Io+ArChsm+JBPj8fcO6T8HHQzKUWhyiumIYLJTCbVGOdMc2wAFI eR4jBeJTJnsKNIxYGkOT6DlKjuqtrckkXYGajtV5G6CKfkEfcVg6qj2iYXulI/+K1y 8LULAwr/CK4qbzBefLFbf8iXYXvumFgl4Jx6OZRY= Subject: patch "tty: serial: fsl_lpuart: use the sg count from dma_map_sg" added to tty-testing To: peng.fan@nxp.com, gregkh@linuxfoundation.org, stable@vger.kernel.org From: Date: Tue, 05 Nov 2019 18:18:23 +0100 Message-ID: <1572974303240239@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org This is a note to let you know that I've just added the patch titled tty: serial: fsl_lpuart: use the sg count from dma_map_sg to my tty git tree which can be found at git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git in the tty-testing branch. The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) The patch will be merged to the tty-next branch sometime soon, after it passes testing, and the merge window is open. If you have any questions about this process, please let me know. From 487ee861de176090b055eba5b252b56a3b9973d6 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Tue, 5 Nov 2019 05:51:10 +0000 Subject: tty: serial: fsl_lpuart: use the sg count from dma_map_sg The dmaengine_prep_slave_sg needs to use sg count returned by dma_map_sg, not use sport->dma_tx_nents, because the return value of dma_map_sg is not always same with "nents". When enabling iommu for lpuart + edma, iommu framework may concatenate two sgs into one. Fixes: 6250cc30c4c4e ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx") Cc: Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/1572932977-17866-1-git-send-email-peng.fan@nxp.com Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/fsl_lpuart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 22df5f8f48b6..4e128d19e0ad 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -437,8 +437,8 @@ static void lpuart_dma_tx(struct lpuart_port *sport) } sport->dma_tx_desc = dmaengine_prep_slave_sg(sport->dma_tx_chan, sgl, - sport->dma_tx_nents, - DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT); + ret, DMA_MEM_TO_DEV, + DMA_PREP_INTERRUPT); if (!sport->dma_tx_desc) { dma_unmap_sg(dev, sgl, sport->dma_tx_nents, DMA_TO_DEVICE); dev_err(dev, "Cannot prepare TX slave DMA!\n"); -- 2.23.0