Received: by 10.213.65.68 with SMTP id h4csp500790imn; Fri, 16 Mar 2018 09:39:05 -0700 (PDT) X-Google-Smtp-Source: AG47ELsBOCWR0UmhadWiYojHoprh9QIPbMIhcUwAiY+iOl6lzBiMhqnrKb8/LczBGOpYlh7zJhrA X-Received: by 10.167.128.2 with SMTP id j2mr2101422pfi.179.1521218345820; Fri, 16 Mar 2018 09:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521218345; cv=none; d=google.com; s=arc-20160816; b=cFnF3TZteJXuO+dAUPO1oJ8ssyiXs0JgYD70ar2Oi7nqEKodzxwQaEiKAWwKCE9yaA SItDwVTf9jnoHnwUq5TY5wrdb/eMiStr0QAnIc6hyBRGICEaoulO7HeEF1SJwzBCr/Ev g4qxnOqdMsXD0qgVH2/RtpTXHG+/q7+v8X8SP965Q+rK5wbEAqHrKuVxCxAnCJnjZlWT blMoKBa9FXIUIAplxRtbR9iVUcNSze7+/7ADE1y/emunFoPgEU06o2LMKoKmbio9QF07 z5i9ENLHdoUDKlpgQ9o4d6hulOp9DPw3z0crZLlo2q+MUNMDJoqPoI2JPeO3CYqANjvT MG7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=nx409yigX7xTWSvWWDyp5yQV0/6z1WBNRiktLiXwL8c=; b=rESMpsZvK2JxgDT2kl0WfLLR/yyPsKZXLULlOgw8k37ocvTDTO+S3A9ha4N32pq8Eb RCmmf3Bn6X5zs+uY41oq5P8jhiPmGsQltpnHdr/9yFZ1JsWKVaQDnaeZN/02mCVi4X91 /CbcWnnfRBrxwMc6i5kjlUEWhFM0gcIjbEUAx6FH6hsPCYydDUNPIqUeAVpfnaWWL9Uc AN5blqF05A3/A50cBvzdrkcW8/x0yJsc0vKktn3zAo1QusP875Z72ZS/QPt3CqRZKKdo MM6keRLjYjmcFq275Y2prnpFIQrXH9XZEItWn87vDAOy+aYDBZMXwsv5LUc8bTv31pXS llnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si5054894pgp.666.2018.03.16.09.38.51; Fri, 16 Mar 2018 09:39:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753216AbeCPQgX (ORCPT + 99 others); Fri, 16 Mar 2018 12:36:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:41564 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934160AbeCPPhm (ORCPT ); Fri, 16 Mar 2018 11:37:42 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 91AB41240; Fri, 16 Mar 2018 15:37:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Ujfalusi , Linus Walleij , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 065/109] dmaengine: amba-pl08x: Use vchan_terminate_vdesc() instead of desc_free Date: Fri, 16 Mar 2018 16:23:34 +0100 Message-Id: <20180316152333.519781666@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152329.844663293@linuxfoundation.org> References: <20180316152329.844663293@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Peter Ujfalusi [ Upstream commit 47d71bc75d072ce25c1063aa629e55e1cfb961b2 ] To avoid race with vchan_complete, use the race free way to terminate running transfer. Implement the device_synchronize callback to make sure that the terminated descriptor is freed. Signed-off-by: Peter Ujfalusi Reviewed-by: Linus Walleij Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/dma/amba-pl08x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -2182,7 +2182,7 @@ static int pl08x_terminate_all(struct dm } /* Dequeue jobs and free LLIs */ if (plchan->at) { - pl08x_desc_free(&plchan->at->vd); + vchan_terminate_vdesc(&plchan->at->vd); plchan->at = NULL; } /* Dequeue jobs not yet fired as well */ @@ -2193,6 +2193,13 @@ static int pl08x_terminate_all(struct dm return 0; } +static void pl08x_synchronize(struct dma_chan *chan) +{ + struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); + + vchan_synchronize(&plchan->vc); +} + static int pl08x_pause(struct dma_chan *chan) { struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); @@ -2773,6 +2780,7 @@ static int pl08x_probe(struct amba_devic pl08x->memcpy.device_pause = pl08x_pause; pl08x->memcpy.device_resume = pl08x_resume; pl08x->memcpy.device_terminate_all = pl08x_terminate_all; + pl08x->memcpy.device_synchronize = pl08x_synchronize; pl08x->memcpy.src_addr_widths = PL80X_DMA_BUSWIDTHS; pl08x->memcpy.dst_addr_widths = PL80X_DMA_BUSWIDTHS; pl08x->memcpy.directions = BIT(DMA_MEM_TO_MEM); @@ -2802,6 +2810,7 @@ static int pl08x_probe(struct amba_devic pl08x->slave.device_pause = pl08x_pause; pl08x->slave.device_resume = pl08x_resume; pl08x->slave.device_terminate_all = pl08x_terminate_all; + pl08x->slave.device_synchronize = pl08x_synchronize; pl08x->slave.src_addr_widths = PL80X_DMA_BUSWIDTHS; pl08x->slave.dst_addr_widths = PL80X_DMA_BUSWIDTHS; pl08x->slave.directions =