Received: by 10.223.164.202 with SMTP id h10csp592556wrb; Tue, 14 Nov 2017 06:36:28 -0800 (PST) X-Google-Smtp-Source: AGs4zMbsiPthx/lf+DErg5j+/6eonO6BQfhHu52VBJYSDvO88Hgll5mXh14hJkl6A/L+AZFBz0q1 X-Received: by 10.98.8.67 with SMTP id c64mr5294728pfd.50.1510670188120; Tue, 14 Nov 2017 06:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510670188; cv=none; d=google.com; s=arc-20160816; b=AfAT9gmHZmIurcjD16OUePAd3Xpt4FfRry2TB+jFzO6KLxvKuG9EjAihK3ngLFMAld vfwUhy8Z0cVa2rLzNW5AoAR4Hpw1EGTVNIUT9cKqKWJ/wg404nqJb1ON7oEKfS+yM0Lz fYGDe6grdl8/17YIoa/qRUw+MxKApn87tzXgkppU/tt0tXpUE8csTvp2tRboktd8M8Pz 4ekPUQTRkUrExgkiWHCPKIbrECR84IumUcwP33rftNwRgDa2w2yoUPYG/fNt/k4xdFov iVY9ngwqPfg5PnYVW5uJv7tJ32cP/Xgo/qVSBv1mprty4e6ehrAjQaTpDBItC8Vd5UHa DJUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=zvswoc3Qi8UKAHf8TPPp6yjhSb1Wf9DevG6LE3uSAgY=; b=wvjDBZp7DXpVrNthglyIvr+FQC6fahDArp2y1VnJ0oXuob4UbVHBjqRWkejxrvwwwf CSCh4h3zNUUYla5yikh/7aI8mm/Lrl7qLL1G3gB3vie5/Ymj6Ff53grD80+1NDSyBx8T r/wITXVk3JbBhVspQVTQukYTit/3IF4z1Gdq+d9nia+dAWdqefFjSGOxxwXRrcLFhLyP uQyZwxkUlLPgcT6igJAoTbN6A8dbGDlhmqwqYJ3emCzDcKxaKx9zYUlbNGibOCorHymU Q3tygi0CPY/FKs+ufeQaxwiAhfjTGLzFkVITD/7gQVNJWoNW0yxzDvFdYs3sBA89vnJ1 a5dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=QeBL87t0; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n2si500940pgv.530.2017.11.14.06.36.16; Tue, 14 Nov 2017 06:36:28 -0800 (PST) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=QeBL87t0; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755759AbdKNOeY (ORCPT + 88 others); Tue, 14 Nov 2017 09:34:24 -0500 Received: from fllnx210.ext.ti.com ([198.47.19.17]:47919 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755613AbdKNOck (ORCPT ); Tue, 14 Nov 2017 09:32:40 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id vAEEVnS9018563; Tue, 14 Nov 2017 08:31:49 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1510669909; bh=opbjbKAt0eD9zxDCea76io9y+TR4pS40f1fSG+Y0pTk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QeBL87t0gYyJ2wkG07D8yNNocontT5X9kuXR/kQRYZfb6Xsdhzwf96nXAsfcp8lv2 QfLbSoKXfVR6S9IDNyVTffNWTIkNlYgo1W86CjO3tBbCdWVCUlYrHs9EUzN8rCk3Oh G6m54wEtl0sxtFUUuN/MgVSz0gC4KYCnOfTDfNQE= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAEEVnDC000367; Tue, 14 Nov 2017 08:31:49 -0600 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Tue, 14 Nov 2017 08:31:49 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Tue, 14 Nov 2017 08:31:48 -0600 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id vAEEVX78018797; Tue, 14 Nov 2017 08:31:47 -0600 From: Peter Ujfalusi To: CC: , , , , Linus Walleij Subject: [PATCH 07/10] dmaengine: amba-pl08x: Use vchan_terminate_vdesc() instead of desc_free Date: Tue, 14 Nov 2017 16:32:09 +0200 Message-ID: <20171114143212.8311-8-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171114143212.8311-1-peter.ujfalusi@ti.com> References: <20171114143212.8311-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. CC: Linus Walleij Signed-off-by: Peter Ujfalusi --- drivers/dma/amba-pl08x.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index b52b0d55247e..97483df1f82e 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -2182,7 +2182,7 @@ static int pl08x_terminate_all(struct dma_chan *chan) } /* 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 dma_chan *chan) 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_device *adev, const struct amba_id *id) 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_device *adev, const struct amba_id *id) 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 = -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki From 1583859582482649616@xxx Sun Nov 12 11:30:04 +0000 2017 X-GM-THRID: 1583854673980966490 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread