Received: by 10.213.65.68 with SMTP id h4csp470461imn; Fri, 16 Mar 2018 08:44:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELvu2E//tkwJ8Zi2Z0nU92Xledgb2xvRz1BJUd0zif5SgHiMHscdU8daznqsgu0PDrLodUCz X-Received: by 10.98.46.197 with SMTP id u188mr2001754pfu.32.1521215081666; Fri, 16 Mar 2018 08:44:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215081; cv=none; d=google.com; s=arc-20160816; b=e6gjkXUs7KoerQOcYXl9N+Neq+tUZpcLvFfjIpOAk8uVRmdtamCEIycVEDUpmDNSqO jJ0KUPOC2S+FQ7VS4TFoxOoY+b2UkPpP0eqFWnd+Q+0Fu597PElLMGS1O0vKcquvDYB+ c4oDfMMBLKqYPdw72ubVsajZBOmBPujxoblaHiiPefTdpkDPm00gYdO90D0+OjcWFWFF I6/fC0TXpJC9+QcbjPItjE3f8Bpf2WTRWzwRm9cykuCXwqeBQiwJ7w92uDnVsey1OrTT nybQF5u2HkMIPZo1JKu0CUvgzr5luPdz+RHA2HnRhU88UZHmj3LoEKU+ltQ5egSCi8LF cLkw== 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=ywWvcA2SH3obzGp8Ty2KhBdpHZUoTf8R11F7EtH4mXI=; b=XO9wOPxVigk24E9eEZYYF5W2ITi7Rm/JiPpJw/DZh/KBz+QU+0Z+9mwkqeE2LBFvEm g3BTSpqHncPwsprJDJFGVWnu0md3Ai2qyCxZSuM32/z2fp+HXNWmZ3bOjlj3o4PtJjhn zwCIhL8acm9a3dDfx9w/3X2Cs7PuQ40uPSototQTwsrGPSbFw2qC1TTxAMZo80fQee/X p3PDteoQCkqQnX//EtNIeUVuNgX0BDBvy48K7ITnPZHLCsEe6KU1rtmBzEBzsFdVdllB 4Klm0fQBbTISUpMJPsEXyFRcymCZhI8+d2YxO/Dygaxl7Fh+c4Nh9n57OzZnyJokt9or 0kPQ== 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 p66si4864781pfk.100.2018.03.16.08.44.27; Fri, 16 Mar 2018 08:44:41 -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 S965273AbeCPPna (ORCPT + 99 others); Fri, 16 Mar 2018 11:43:30 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45516 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965014AbeCPPn2 (ORCPT ); Fri, 16 Mar 2018 11:43:28 -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 0F9DC25A; Fri, 16 Mar 2018 15:43:27 +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.15 078/128] dmaengine: amba-pl08x: Use vchan_terminate_vdesc() instead of desc_free Date: Fri, 16 Mar 2018 16:23:39 +0100 Message-Id: <20180316152340.552983019@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152336.199007505@linuxfoundation.org> References: <20180316152336.199007505@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.15-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 =