From patchwork Mon Apr 15 12:14:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 162188 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2850020jan; Mon, 15 Apr 2019 05:15:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaIngvpKUX9QC1ut1uKc4ZpnQXhstSm3yi0F+VZSHhtdgdT1kG2DzbimNeTC+YfuMyvCNO X-Received: by 2002:a63:5057:: with SMTP id q23mr70591599pgl.30.1555330522886; Mon, 15 Apr 2019 05:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555330522; cv=none; d=google.com; s=arc-20160816; b=MCU5myl7JQItSZ67m34N239hZK5tp25AozbVjR/KtF0btNphu71aU/a2cW+z4SZpJX m1v63BTJonhj7fvPqAJ0FY5KbeY+l57DrycC8le4nbwRRajyAhh2LZAdhH9HS3Jlw/sf 7A8pZDEpDFRPmZfurbda3xKM3laS4inCcmYQUSQV6K2DMSW9s5kLF20nGcDlFbFk/vLZ ShJdTp71F11ieZ6JQFQSh57SkpOINtFZkIEdSVNJQ1flKB7RdbSheyifmN/c/vMKrL/q K2F21Q+Wp8UjbYs4pLk/QBXmtJc0+JruLfMdDflOoe2DmQvZoc1rDzqrYHs8HKPLU1Xl /8cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=CAUNijlh9/PyuN9Nu9xMccDkwi74nLVT9vlXbtkz1ds=; b=KjucMcwSNCb3EqjpQ1jm2K3jKc7cBnFjKUifwRjdTQyhfOuu8x9EZNRfO146kmfbLX 6QpdkctuUz9CqSQnv1LWVtvp5sd8vcXR0Rcl8CGwpbkjG3BvfP90LxUknzNJ+keD8Zd9 PB6vMRjxGdaFhMUljVqhJPixvu6j4X2QlXlUwsa1UhegsMEcyjS7UXLXET32HsMQemNA Rxg8CEhQ4JequZ7tDDNyury3SxJpYZs8Ndw1R83Mpyw/2hV5NDPabJQCrL8ZFZi0Hd5g 12t23J37gN7od+rwq4Pmz390DFRq+u4L7cH1Bx6EDwJbm2J4RJebpQAVsfycwvaDMA6v aMmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ucpboVWl; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si36430758pla.316.2019.04.15.05.15.22; Mon, 15 Apr 2019 05:15:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ucpboVWl; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727466AbfDOMPV (ORCPT + 30 others); Mon, 15 Apr 2019 08:15:21 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36324 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727433AbfDOMPS (ORCPT ); Mon, 15 Apr 2019 08:15:18 -0400 Received: by mail-pg1-f196.google.com with SMTP id 85so8502231pgc.3 for ; Mon, 15 Apr 2019 05:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=CAUNijlh9/PyuN9Nu9xMccDkwi74nLVT9vlXbtkz1ds=; b=ucpboVWlQ5/w5Wu9P8+gVZtpfga1IRqvUoAo5DPUJU0Pxdb6xA3tpyd1e57aAy0pgb ieOVfBtAJXpRZlmX+n4tMGCGGW29Ce6U+Q6HYFKnLDDgGfjQRvXQU+sW3fvbiDsXBT5q xoHIE5eZorhruD6XJdKUujPzV+O+DgFbHynEfd/Zn795a42mbE+slNNCFEcGW3VOb7Hg WSm2R4TRtGlQQY0mBjPS4YHtzOABnCp0hiYddfZLU/keK/qtdoA74w0aJDpksXTM5gNY mE8OQW8PaFIsb4FMsKRjHLw1c1kymt/Cs2IWeMgDqIoJlEDmlNXpkEGl0QBxGHpw2OdI IHPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=CAUNijlh9/PyuN9Nu9xMccDkwi74nLVT9vlXbtkz1ds=; b=ec8UHP8MBN0/ZXwtrEw2NWDnGJhkVA1xQoTJJoADmgVjoM3OLNpsrcaRsdgFRbDyr+ 9YUv4eDG9P/aHiQvDCHi8MCNWQsJz6ogGMY2/UOteSxJ+nGhrQ3+HJVzpPoo1ed5/Mp/ q5ieMNdl57PLVFrtgzBdehpAnuImAnUx4/yVqthm0PuWmm86XvrhznuVEyAjzppOqFJK Lry1m7tpiwqiZssjJq4l1HPXNnJs+ku/lNnup5MM5qlMRJvC0z1Af/ZvZ5DnSh5pd8bf 21uC7VrEZ/GP/bl4tWx1+iqLKGkl0Uge35oQEMjvbqmCtRoPhiwejCsGSMBecjhqL0s5 Cp0g== X-Gm-Message-State: APjAAAX4A4cVF2XyZiIkvdJzn3pyM8eQqH5iluJmkXfF86NRgWUzGGD6 1z+pA2lEyLZ6cXPoT1uVm+2rww== X-Received: by 2002:a63:b64:: with SMTP id a36mr70563796pgl.58.1555330518223; Mon, 15 Apr 2019 05:15:18 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 6sm64157155pfj.95.2019.04.15.05.15.12 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 05:15:16 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org Cc: eric.long@unisoc.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] dmaengine: sprd: Fix the possible crash when getting engine status Date: Mon, 15 Apr 2019 20:14:55 +0800 Message-Id: <2eecd528e85377f03e6fbc5e7d6544b9c9f59cb1.1555330115.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We will get a NULL virtual descriptor by vchan_find_desc() when the descriptor has been submitted, that will crash the kernel when getting the engine status. In this case, since the descriptor has been submitted, which means the pointer 'schan->cur_desc' will point to the current descriptor, then we can use 'schan->cur_desc' to get the engine status to avoid this issue. Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 48431e2..e29342a 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -625,7 +625,7 @@ static enum dma_status sprd_dma_tx_status(struct dma_chan *chan, else pos = 0; } else if (schan->cur_desc && schan->cur_desc->vd.tx.cookie == cookie) { - struct sprd_dma_desc *sdesc = to_sprd_dma_desc(vd); + struct sprd_dma_desc *sdesc = schan->cur_desc; if (sdesc->dir == DMA_DEV_TO_MEM) pos = sprd_dma_get_dst_addr(schan); From patchwork Mon Apr 15 12:14:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 162190 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2850123jan; Mon, 15 Apr 2019 05:15:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqxV1h5gyzHjQGfMmxhbhavRkygvJQvCizvCpDEbcPS8wLJdOMe/hmXQWu7L/AqMTGPEMj1K X-Received: by 2002:a17:902:848d:: with SMTP id c13mr74854914plo.279.1555330527775; Mon, 15 Apr 2019 05:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555330527; cv=none; d=google.com; s=arc-20160816; b=d7yPVFWc4DNSkx6mJ2D88m6eBcEV4gjcPZ7hWIZf4iheUO3X/M7j3ziMarbdskMgVs DBDp6PUAlHwZulV+BZLUbDU1tlch1Z1Tsj0MXjiQq+Tjw2G+B54c7r3Tc1zaZLNE0V1n qgjD/BHaISAMOGISWHDDyOAvg8wVQMX7wSMRFZP936f85mChKr9x2INrfxOYoLXqx21o fSEGJGZw3Ul0g9TXOBZ/neZidgRUP7HOdXEOuvLxI5jFvhGO56W7g1MDT0OONfprtNED IE3tTQPak5NWOuBUcxYfYwGkPS4a+mL7yL1gQAEgE2g4HcvWfvbpbNd6i/sS0acLHIbY hglw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=XiE8oaht+rMtBmlWqUkyAiRGtKqurxER2iPBNv/AZyQ=; b=mBY8tuCNj9m6hfxTTkY+abZNn//66ZaM/lcTqQjy/wtDNPxEDBstC9aa6HOfElVgEu QEr80OLEp9+joLsSy1XL4UxcOiOBCaMDIbwRoGsQsTuMUIAUQk0Sm5k3AcPIrBAwrqt3 0ioFZhG4FN2H3MnebJQpiF0RozwSHm0bTSUJW4I99pT6dy8/jsPm4pTlfMwgHBncwbFJ hW4hYePNgykRebn8Vy7n+8TTY84/RCzErbFhQYLZ5woMCysKFz17WZkN8f13yriOZppB qmcKKrlV5MWjN73OXIb3IVTDj2BYXYAX91T3wlokpPvbeVzTjzp1qRGTaa2BlHK3SqiJ mGcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="qLRP/D/h"; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si36430758pla.316.2019.04.15.05.15.27; Mon, 15 Apr 2019 05:15:27 -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; dkim=pass header.i=@linaro.org header.s=google header.b="qLRP/D/h"; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727481AbfDOMPZ (ORCPT + 30 others); Mon, 15 Apr 2019 08:15:25 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46393 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727335AbfDOMPX (ORCPT ); Mon, 15 Apr 2019 08:15:23 -0400 Received: by mail-pf1-f194.google.com with SMTP id 9so8476310pfj.13 for ; Mon, 15 Apr 2019 05:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=XiE8oaht+rMtBmlWqUkyAiRGtKqurxER2iPBNv/AZyQ=; b=qLRP/D/hBzlVyCM9RDEp0f+vh3r0DuWzHyoLapUEEZa49Vw6obIm07znxPAArbNXDx y6lOAS00ZKnidgR6SGOXa/t9lPXGvLz2q1ti+8fdgPMQz+fteVALwWaLWAie/7RPNYgl g6ubl5Vdy9CbG1gzDzKSgBj6TNhnWikVKlpJld4b4VDeqtqp32k3aX7QErvNQEfWWE6e iuq1j14ALAK4WEAVMOv7851BZgFKS2KkKlZ0dujn8lAzV3Twm+7blCirxwnLpnlfdlA+ FBtgU/fzY7iGtpk5ap8KVOqTRhlwfUHIGmPAcKDwT927EK3tNeHmrW5+kIdlQ4osChFs FAxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=XiE8oaht+rMtBmlWqUkyAiRGtKqurxER2iPBNv/AZyQ=; b=Rav1SxelHocZ2LtX/22n5I8tkCw0J/LKeUg1LGkdv1+SHpwHQJkSzDQITcVGAcUxwc FWy3bO98YMemY59LFKUGkxN7M3aWdmZ4ObluWjCRVJmJ3v6H0E7OSy2LYNNDdv6EqOID JmaBTRCVAWz4l1hZ1Xg3u7wYkhQY9LpwFcfx8lI6o9HQFRjYbpPm8dsX5IEbsx0/ncxR DQaKSb9UkNO+k0UWv2vrI99wGMI6v16L/CTCSPMhc+lnZCyd1UgIsf1KniYaNpvh5fym ZTciuZpE694oPN2hq3aSVoxRg4umpNYAnmnrpPtB3vMUHq40rEfwNjPBQaLdsl2TzhwV TAoA== X-Gm-Message-State: APjAAAWmsEUAFSHCieGvgFhwf6b6ygko39owhV1/KWufkT8ycLrKrJ7B bS7vUmEf4L6R/GogsUpcRFoEIg== X-Received: by 2002:a63:185a:: with SMTP id 26mr43154699pgy.337.1555330522160; Mon, 15 Apr 2019 05:15:22 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 6sm64157155pfj.95.2019.04.15.05.15.18 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 05:15:21 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org Cc: eric.long@unisoc.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] dmaengine: sprd: Add validation of current descriptor in irq handler Date: Mon, 15 Apr 2019 20:14:56 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When user terminates one DMA channel to free all its descriptors, but at the same time one transaction interrupt was triggered possibly, now we should not handle this interrupt by validating if the 'schan->cur_desc' was set as NULL to avoid crashing the kernel. Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index e29342a..431e289 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -552,12 +552,17 @@ static irqreturn_t dma_irq_handle(int irq, void *dev_id) schan = &sdev->channels[i]; spin_lock(&schan->vc.lock); + + sdesc = schan->cur_desc; + if (!sdesc) { + spin_unlock(&schan->vc.lock); + return IRQ_HANDLED; + } + int_type = sprd_dma_get_int_type(schan); req_type = sprd_dma_get_req_type(schan); sprd_dma_clear_int(schan); - sdesc = schan->cur_desc; - /* cyclic mode schedule callback */ cyclic = schan->linklist.phy_addr ? true : false; if (cyclic == true) { From patchwork Mon Apr 15 12:14:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 162189 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2850117jan; Mon, 15 Apr 2019 05:15:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTECk2P/hejv6JIbRHaHr/mCbkMSvcqrqjh9yqpkxQE+jbMK17739yeJ+k+prVrxq7zqBO X-Received: by 2002:a17:902:b58e:: with SMTP id a14mr45824393pls.44.1555330527399; Mon, 15 Apr 2019 05:15:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555330527; cv=none; d=google.com; s=arc-20160816; b=FVTCWZZObX0vcTvvt23o5pbNOTYu6v0+OxUXbBRveRZDKbCfVw+ZxGqigGocXcy3Jf mjHJbrBim7/N3VQyMpUn7dTRx3AW2P4CftSK2UV79oZrWJ/D8wTMDs+9pzvhm6hkWSc1 LD37WASfv6CY4sYOiHKj5pfsJuMYR7sQLwgyGDP0BUC+0nA5+lZb709eJstvWELkOgJO HOManeqnadt4Flz3E0E3gffoDT7ldn+TZH5o3hB01ODkyFgOWkCwGUzlPdDjzFw322Kz M+uuqG3Hp32DvnueXk1zsaiyLTHZ6dLuup85xJCRLujP1VHZgGFF0gBq3IeJz/XSENfk ZJ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=l9ir60nNJwBbII3Z7YfygeQjey9MNonvD8+mCs5l+c4=; b=0nET4TGoUmghKw3hArKqAn26C6hVfDcqVamj8s3K+/YZLovHUQBq16gkXIfRTyEFpq i0JI0YaIPPQM85Lp7ven7lwN549RJcjTDvB8kF0O4/n8OMlMotRi9RFWwQAeAijF0n17 aMkxorbc9t6piqxxxwWhsjgzEHIFY6m+IUj7TXyNgsPOZY6gMq7bf6TsfjdSMK+M4NlZ T83TerRr2N+/yK0cNqlY8hWxrSCc1BSNS+ex0rK4zOFY6KDCYDYhTlmITLN+VLaqtR3G DdzmpBCMOSW4OhRsjnHJhJdnnKP1Y2aAak+d9RaPkTiU8nh62Tq3pKlAQbrTv5w4+jEB 0Brw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XZ3GWmt1; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 11si36430758pla.316.2019.04.15.05.15.27; Mon, 15 Apr 2019 05:15:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dmaengine-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=@linaro.org header.s=google header.b=XZ3GWmt1; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727335AbfDOMP0 (ORCPT + 3 others); Mon, 15 Apr 2019 08:15:26 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:44552 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727482AbfDOMP0 (ORCPT ); Mon, 15 Apr 2019 08:15:26 -0400 Received: by mail-pg1-f195.google.com with SMTP id i2so8481425pgj.11 for ; Mon, 15 Apr 2019 05:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=l9ir60nNJwBbII3Z7YfygeQjey9MNonvD8+mCs5l+c4=; b=XZ3GWmt1mWC7qqDk0CPUMjbeP75BO7JsbiGnDALS1fBKvH9BaB8hWahTFAEy+c4eNd bwLKGTd3LrMkmeBsQ4r81KbvlCg4JPSsx3nPRGh29o4erxiT+uTL4DJ0Yl+J1JG0pmWV UROk08EZ3klQ2fO6BBKeLCN+dladovWVISj58XT/H0kjpcXZPMJZ0Nv/4DEpUU5b6jd4 ACocZm20dVGjbONsv8C7eLZZve99otr8o6wQDye6PjU8/eucZhH/oNQqVmCkr0Fc9YWA +mMpDMi4f6QzajlBm23N/sz1qZ39Lf2doqpQN5upgUdgSWlrEvbjM2VDL2I8dNC0aEd9 QuPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=l9ir60nNJwBbII3Z7YfygeQjey9MNonvD8+mCs5l+c4=; b=KOT5ZNdlD3jAU9Q25OztRzfGs+Yaub4pXNYSWtkyQSR8jBdBBUaI213mjxnsc8zVt9 Lh/3Xki3aDQkZobjXKs4VH386oACOBuz0ICRixeMIlkzUCs+n7+2jh0T/6fDJdwcJm+T Mpod6ne/2gcnGZf2GuzFDLPWdrVzKJcXj8sXLKq2MH+5q3NGrw8IE+pC3cOm+LS6IKEo /EJyMVqr0xhppHEHLWAuBMdE8hnW907e/8pmDJxRlX/fVz7X127p/Z22fdg98yA4HQAh em+BN3/34qvUJzzqtbMpMq1DTiNPRAPzZHxCFgPtj64WVibbALvoDw8Pu0TjiZQxkFx9 CnWA== X-Gm-Message-State: APjAAAVwhERm8Rwnh3XAvLNyDcQXGWwXDS+vpCXhMWNJvkSNLyDUK6Af fls1iOK1LpjkilnAUK6ay1XpLg== X-Received: by 2002:a62:62c3:: with SMTP id w186mr42971295pfb.73.1555330525672; Mon, 15 Apr 2019 05:15:25 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 6sm64157155pfj.95.2019.04.15.05.15.22 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 05:15:24 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org Cc: eric.long@unisoc.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] dmaengine: sprd: Fix the incorrect start for 2-stage destination channels Date: Mon, 15 Apr 2019 20:14:57 +0800 Message-Id: <035654558b82bc26ee78a815cc9287e478baac92.1555330115.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Eric Long The 2-stage destination channel will be triggered by source channel automatically, which means we should not trigger it by software request. Signed-off-by: Eric Long Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 431e289..0f92e60 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -510,7 +510,9 @@ static void sprd_dma_start(struct sprd_dma_chn *schan) sprd_dma_set_uid(schan); sprd_dma_enable_chn(schan); - if (schan->dev_id == SPRD_DMA_SOFTWARE_UID) + if (schan->dev_id == SPRD_DMA_SOFTWARE_UID && + schan->chn_mode != SPRD_DMA_DST_CHN0 && + schan->chn_mode != SPRD_DMA_DST_CHN1) sprd_dma_soft_request(schan); } From patchwork Mon Apr 15 12:14:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 162191 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2850216jan; Mon, 15 Apr 2019 05:15:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/yGihbR5zX8ZQN3HKhOfOtCGQR8c1tI6boO5iOZmLSis3uKp8m9yGX2mVGG6DT/ANPjx4 X-Received: by 2002:a63:fc5a:: with SMTP id r26mr66601711pgk.97.1555330533586; Mon, 15 Apr 2019 05:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555330533; cv=none; d=google.com; s=arc-20160816; b=H6A+xJOZU9fHu1S23nfDmIeT1uTPeFhqS2s/eBKLJp4AAsi06orSfk4O1PgYRPDGaC 9I4DlrHF2oIp68a15/1NJpDBnETh02m8MMtU4o+326PysXHc4F971MsB0chw5slZzaYt EYXpBv1AhaLi/kFDLOenp4iZ1b7nc5YtZmfDRT1qLGmwYJ5wlHsC9XeDCJP/KCzJTNut 8yM7ACkqyJRz4lhMEQqew4CoP46VpBDpouq8Q6NQcdKrisWf3+LrKaW8t6W0O/gvntEV eBHuEScaYL3cJSqfsiNdY1HHEK3DeTCN7A3mgDgUK0OQAkKnianSRDpBb5sSmTcEwTWH JxrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=lTV/HwBV1wkVNbsMEdMR98H0jnrUsLsqBHs1N83HCIU=; b=GNMIXsmF9HZVvaOvG8hhlR89YUg1WjDTSGRTrez2lVkUexFhrMkHf411p+zrI2phcz lQ5e0gO4V813u8apiNJ12aPb3tUJQo0N3OJRtERRXOIY5scqwIs9/T6Qs9zRko/BnQqR pMtB0Bp0z1qUT6DkCYP5hkBd2A21Zr6yAXNZ9KBDk4zmwJDm0G4dzALyPSRty3BIU8OP MEvbJTzQIS2JRxM+LG9hvoPy93MuubW0ZcADEaxAnYPeQHtaMFWV3VlZVdJXOBCgiHaq HFas+47xhy6GVnDV8i9kpKlP0XRwX0YE34x3cCRPaV+yI9TTAVP0aVgKX4Y320kxG9tU XMNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=exbKQxTI; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si44875146pgb.435.2019.04.15.05.15.33; Mon, 15 Apr 2019 05:15:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dmaengine-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=@linaro.org header.s=google header.b=exbKQxTI; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727501AbfDOMPc (ORCPT + 3 others); Mon, 15 Apr 2019 08:15:32 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:41355 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727483AbfDOMPa (ORCPT ); Mon, 15 Apr 2019 08:15:30 -0400 Received: by mail-pl1-f195.google.com with SMTP id d1so8475091plj.8 for ; Mon, 15 Apr 2019 05:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=lTV/HwBV1wkVNbsMEdMR98H0jnrUsLsqBHs1N83HCIU=; b=exbKQxTI4xxMk74weN1pp2wuWgBFrTV9NGMiVFBHcSOizFz6Pm1jJnsGxfzgw6aiZl WTZuVOV27S2Q/kVYJy44QMwfvkZWepHXib3hYamU+tiN/c6VURhf7etsMsdTK1o9qLie yNGlyJ6v2Yz3v1vgXciDRK2F/rULdNOQq6GrSAivnwrVe6HeUA/T6mjfNByP14j6smbK 2Smp0i7gWEX//tj2tce9NLHqnI4U4FGzml63MT5exyr1d8fubsuqsrcHqbQOG7ICSlTP fxw1JPFdDt2h8Rr4kaYNFEzpqeXIRZnuD604uXsMxWfqqzHlCNmLHN8py/gbxBb2OFJQ VTsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=lTV/HwBV1wkVNbsMEdMR98H0jnrUsLsqBHs1N83HCIU=; b=WlfbnzT478xDA3drCWiJaBNc/7uOg5enBHT72fQ6VoYEDL/1mOW6HkNKVud6sFjgUD F3M+tf+VDEE5ldGyZSxrmBjy/cQbLuo41QbPfRD/NVDhNLBPWN3Hgf/ixRka1bS7nfNK 0XLM1HJOMFeqR34rqgdWFunINvlpfxL1520JP+E1z6Q/mmTQ6VVaDnveeR6m/0v/4IxX dKQR29JKMwKYizVu/yZZyhGH45CcC9JnWsPwAFqKWIcwbNxBRmCGZ5renpZB2Sn3tB7O ZQbfbtolKIthwPy9Gf3lWWAQ+SRxFT0qmhjdhnWoYhA2DahG9g6xUDEGNSdOplA7jA7H b3TQ== X-Gm-Message-State: APjAAAWU2dN8PuETGgi/KiCBp+RF4MuXBZUSWB9UWEpnpoiR9teNRsUa dAoumPBdmegWtXCKiPIm3I26Sw== X-Received: by 2002:a17:902:6bc7:: with SMTP id m7mr27139625plt.146.1555330530070; Mon, 15 Apr 2019 05:15:30 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 6sm64157155pfj.95.2019.04.15.05.15.25 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 05:15:29 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org Cc: eric.long@unisoc.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] dmaengine: sprd: Add device validation to support multiple controllers Date: Mon, 15 Apr 2019 20:14:58 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Eric Long Since we can support multiple DMA engine controllers, we should add device validation in filter function to check if the correct controller to be requested. Signed-off-by: Eric Long Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 5 +++++ 1 file changed, 5 insertions(+) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 0f92e60..9f99d4b 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -1020,8 +1020,13 @@ static void sprd_dma_free_desc(struct virt_dma_desc *vd) static bool sprd_dma_filter_fn(struct dma_chan *chan, void *param) { struct sprd_dma_chn *schan = to_sprd_dma_chan(chan); + struct of_phandle_args *dma_spec = + container_of(param, struct of_phandle_args, args[0]); u32 slave_id = *(u32 *)param; + if (chan->device->dev->of_node != dma_spec->np) + return false; + schan->dev_id = slave_id; return true; } From patchwork Mon Apr 15 12:14:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 162192 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2850281jan; Mon, 15 Apr 2019 05:15:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwT3jEKUXlOtJh+19FjN5rDfpxOH0CtRkPlc05mnWGo//h/PvpgRLYAxK9DJq/3ndP0oFPb X-Received: by 2002:a62:4649:: with SMTP id t70mr75491138pfa.100.1555330537485; Mon, 15 Apr 2019 05:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555330537; cv=none; d=google.com; s=arc-20160816; b=fG8bQzenVYTUX9mGGKTWGpH1c0yZB0L3sOKmOQJkd/J99IoKlK6cql6GtcA8ZxTvrd YklR5b+suFkLo/zRU0wzY//sPskR5bwbIQj+FU2wh+fg7DObWQ98uaJs9qwXiWnCyLm8 p78lAVdppIgedzHE3+yrRVmX1pN6MqAfOHkwHzgq+SxrNZ3AiXfisir9Kk0QTdCsywIB 9tGMzwnuHRxiszIrf+a0S2j/dHZlyVQJR1scmwF7zOgBN6wk22qeaJGgasNk44AlCt5o EZ7kEPJSouDRssMeU718JiuA6Dxi4wLkElh1qLZKOwGuLkM7f3yyrZzOe3E1LFzGj+bL uvxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=EPBexP/YCMERN6VOL5fv1yV7pop7BN15G/3B+N0nQ3U=; b=vtxqob+sD95p+or6ucJExdtB6TY28bWtmKaP8CtD3/ZVyFFCpWqYSh+BpdD1nIWw5q Lv511arSU+AY9b10FCxAWfv7hobeatrOU18aW1e5HW0LmnrH69hGP1toGGU7hO9P4hTr 4g3Xi5jvdX3UtXit8xv1zAdwY4OW7FlcCCRHNBc97F1akZMXdFtFfN6wlucOYtGkhHGx qcWD4+vqdZk1zySlfihDCA/96/X9FIWdk8E33tcwSSrT3QWKRLcMg0dBEcFcpb5uWuNs LHUc1QimhPIaeEiFwvlMb6v7nwvFleDdDZ+W5llFPk3CHOjpQdXtNz8DHduwKROn0+m7 7BbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k0T6x4sW; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si34319695pfa.282.2019.04.15.05.15.37; Mon, 15 Apr 2019 05:15:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dmaengine-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=@linaro.org header.s=google header.b=k0T6x4sW; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727496AbfDOMPg (ORCPT + 3 others); Mon, 15 Apr 2019 08:15:36 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:45571 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727505AbfDOMPe (ORCPT ); Mon, 15 Apr 2019 08:15:34 -0400 Received: by mail-pl1-f196.google.com with SMTP id bf11so8459242plb.12 for ; Mon, 15 Apr 2019 05:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=EPBexP/YCMERN6VOL5fv1yV7pop7BN15G/3B+N0nQ3U=; b=k0T6x4sWoWO1mBc+OId0DMBw+LrVnMU9zm0p6EsTYO/gUBNMYZKo11zY+DswnZgNt9 hvgxI0ywLRGa/hlJyBh506+Le5G4rFLeuxya780+q9eWikKxy5O8aa0W/8gUdOOgE+np +FMg36Tr6d8dmrUl4QkCHHOgqLjaCvk6UvWbVIXZXio120GB05/WUAhYgaSyCabsZZei sax3hHlC/z6qHbXVkOmlIz+6SZw+rp4CMc2+cxPc5twLByBb1aPExtKsDBTydLG5yAcB xFDHS8C7Uzmn04mEefA0Xs6oJBmLCpJyJok+fN94irPRBuLhOmGMbLtslyRZj9czrBwD 27Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=EPBexP/YCMERN6VOL5fv1yV7pop7BN15G/3B+N0nQ3U=; b=pVZ21fzG94XV/hZLTLZ+lbHHTqxuGNmBjQr1RcbaXH+M3LNf2jkl9sAC3XCMnkcPye BeytUFm3pS36++EILVPuRVHdQQZyesCTK3HOjVVlXYyZBxX40bULp8VWNrzzOQYXuGvT O32/L6HSyd9TIrn2/RCFUDedu9NA+bCXhDmcA5NsUotbBcUMIMVVBVBv7/xs5BVqRU+6 QrUAyF0ZRGhlJ6In5bVnDGsViq94TgdJdZjFUYLkYaaIK1zthRCq0JJSvUnyGU+cCJ/e 72VsEpSAHQjnp3/azioBGB6YE1aRAVm0pN6CUWQJwiw8EJ0lQdOTpXIQ1D/IH9VkbRR0 1CbQ== X-Gm-Message-State: APjAAAUMOCe4o25kUrZDDfkRroopS+/3ZfSMUT8RJyauelKPFLeImCxW 0H7erQf2GTf+Q2Y/xLoRrLfanw== X-Received: by 2002:a17:902:d701:: with SMTP id w1mr76553552ply.124.1555330533557; Mon, 15 Apr 2019 05:15:33 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 6sm64157155pfj.95.2019.04.15.05.15.30 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 05:15:32 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org Cc: eric.long@unisoc.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] dmaengine: sprd: Fix block length overflow Date: Mon, 15 Apr 2019 20:14:59 +0800 Message-Id: <93626039ad49c1c9d5726218b060c2267c1779cf.1555330115.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org From: Eric Long The maximum value of block length is 0xffff, so if the configured transfer length is more than 0xffff, that will cause block length overflow to lead a configuration error. Thus we can set block length as the maximum burst length to avoid this issue, since the maximum burst length will not be a big value which is more than 0xffff. Signed-off-by: Eric Long Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 9f99d4b..a64271e 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -778,7 +778,7 @@ static int sprd_dma_fill_desc(struct dma_chan *chan, temp |= slave_cfg->src_maxburst & SPRD_DMA_FRG_LEN_MASK; hw->frg_len = temp; - hw->blk_len = len & SPRD_DMA_BLK_LEN_MASK; + hw->blk_len = slave_cfg->src_maxburst & SPRD_DMA_BLK_LEN_MASK; hw->trsc_len = len & SPRD_DMA_TRSC_LEN_MASK; temp = (dst_step & SPRD_DMA_TRSF_STEP_MASK) << SPRD_DMA_DEST_TRSF_STEP_OFFSET; From patchwork Mon Apr 15 12:15:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 162194 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2850435jan; Mon, 15 Apr 2019 05:15:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxi7R2Zutua1mEzsCMDXc8dC2Uaf9tSuF9BV09jppVUZ1LpXimARPJQdM3T5Ug+bqy4WV1s X-Received: by 2002:a63:3d85:: with SMTP id k127mr69849384pga.152.1555330545498; Mon, 15 Apr 2019 05:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555330545; cv=none; d=google.com; s=arc-20160816; b=Sgi0C1RcewiUPSzBENq/GgYvSgsUSwSNEKzriq/fWGc09v95fRk+hCKu/yxbHOROSc GwHS3deYRnqRl0nGScqFB8cICVQjNd73LOWPsx6t4WwI/i3vS/diriVObczOtdDwxT2d 414Q1XxQoLWmWR3eAp28t2WZ0XN7WIy7MEr4ogPxKRHVgrAhGcFJIJgdRE+N98AKCqXY dnyzDjUFU0PVm3VfzCgBKDUSjCudrf/as4JmC8YVU9M9/U2p4pNfKA3/GgYv6OOv6aO0 KJVJHjQhhdPUjNMrwuPA7d9TRONGV5rJy3zcgcuIWgn3VEug9tiO/eZXPSMUyjRE6bgg hVeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=OLZzLqUboevMo/zGKOZIE23Q23oS2GeJKEJKfaBooIQ=; b=ktx3Js8nlBcDDe2NOmCPqYsqsRo3zg2pTZiu75EpTa5uBBVnh0aGZny9DG0+eetwW1 TtZHiMxZpcIhJnOJgvUufIxZL1QsRV11JfY4eceHuAYakfNdPvJH61ZxxCNfkQVtGYsN pGWMcMyiU+Its5VsBCk1ZKP+UqrAezpZeGA3estGV66Mnu9QSlpvM8sUQ4WsJg98YSKz 3TCMXeHMxoUcX5oYumXzxig5lXMEF0gx1blW3xl/HGS2d6WIz7Va6Tfxzv7NyrNP1yEb r6cn5A71Lp15srHU43LPYZNwpe2dGQqJHjxOhHBI0ZfEdZlxw2Cj2FvvqvjO14029E6A jqSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SYRkR298; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p2si30048649pgi.372.2019.04.15.05.15.45; Mon, 15 Apr 2019 05:15:45 -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; dkim=pass header.i=@linaro.org header.s=google header.b=SYRkR298; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727547AbfDOMPo (ORCPT + 30 others); Mon, 15 Apr 2019 08:15:44 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39824 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727517AbfDOMPh (ORCPT ); Mon, 15 Apr 2019 08:15:37 -0400 Received: by mail-pf1-f194.google.com with SMTP id i17so8504010pfo.6 for ; Mon, 15 Apr 2019 05:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=OLZzLqUboevMo/zGKOZIE23Q23oS2GeJKEJKfaBooIQ=; b=SYRkR298A05uhWDzh3IUYZxWHo6jbGm4Y12GyENCpC0LW3h39lL+yHnRPlVBfvq0nv luuqBV0yEWf3bYy8ktE9+x3k+80S3LAYhP3slKw1pXNeX+vqzSbtjqk+QXhBX9CFyi57 m9LxZzhQJUgifPk+56jRx0Tyuyi+vlAcB/W1hVdasAOAdzxFj2CoipBJ1UGJ72wgBKXX NLC0zIlPNIWrEDIQB73d7HImzT5QSdZrBU3Itnco6IwleZlnrkvWRUaZ5r/ux7WMuto2 gom2m98f2ucsoSixQcKZsWM8IY+1q97kd+OgW2t+0FIMtg4XPzZoBL/cyl5WQovKAQHx JTaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=OLZzLqUboevMo/zGKOZIE23Q23oS2GeJKEJKfaBooIQ=; b=bq/GknLD83udrm366mTcsHCfXErBnoaBcgCz3Vcz58ow1ZFaBLRhOJIeJLU3syq2DX zHfjYmATJ73CBRN2S4j1KIoiyULBzHU+L0BNRgl0FZR3/v6MWka5i3aF1waYWLPuQ2d1 Oo4S+Jbw0gSRoYYRZiSWywM2Nt7PIWClXaXeGmsosEgRj0dMKqPtDAv5VhpM0W5UzNna wz1nf8m3nV5j/vhFz/0zgyOyTl59lJSKHP362ArDE40cnCblyxviwMKHV6NzZiZVzGW4 wejC8/sf/lPkuiNnmzFvxQ4O2+uLZ8zDQyrlwbqRkuC3sRyuC9oRM4+GaBxVkw9Htmoz 63Rg== X-Gm-Message-State: APjAAAVFcmLSrV9N5N6WLtF5hv7fBZxOutgmY520R8LPTcopWK2HclGO 49WMsqiuSNQBK4BkThi5kaSuJg== X-Received: by 2002:aa7:8251:: with SMTP id e17mr57741476pfn.147.1555330537319; Mon, 15 Apr 2019 05:15:37 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 6sm64157155pfj.95.2019.04.15.05.15.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 05:15:36 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org Cc: eric.long@unisoc.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] dmaengine: sprd: Fix the right place to configure 2-stage transfer Date: Mon, 15 Apr 2019 20:15:00 +0800 Message-Id: <8fe45a4139ba57eb014d921b6988e43f7fe07b11.1555330115.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Long Move the 2-stage configuration before configuring the link-list mode, since we will use some 2-stage configuration to fill the link-list configuration. Signed-off-by: Eric Long Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index a64271e..cc9c24d 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -911,6 +911,12 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan, schan->linklist.virt_addr = 0; } + /* Set channel mode and trigger mode for 2-stage transfer */ + schan->chn_mode = + (flags >> SPRD_DMA_CHN_MODE_SHIFT) & SPRD_DMA_CHN_MODE_MASK; + schan->trg_mode = + (flags >> SPRD_DMA_TRG_MODE_SHIFT) & SPRD_DMA_TRG_MODE_MASK; + sdesc = kzalloc(sizeof(*sdesc), GFP_NOWAIT); if (!sdesc) return NULL; @@ -944,12 +950,6 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan, } } - /* Set channel mode and trigger mode for 2-stage transfer */ - schan->chn_mode = - (flags >> SPRD_DMA_CHN_MODE_SHIFT) & SPRD_DMA_CHN_MODE_MASK; - schan->trg_mode = - (flags >> SPRD_DMA_TRG_MODE_SHIFT) & SPRD_DMA_TRG_MODE_MASK; - ret = sprd_dma_fill_desc(chan, &sdesc->chn_hw, 0, 0, src, dst, len, dir, flags, slave_cfg); if (ret) { From patchwork Mon Apr 15 12:15:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 162193 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2850388jan; Mon, 15 Apr 2019 05:15:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwTp7idpn7j12SrHiWAoaeRp2Uww06YN2V7qaaDLFwbIpw3o3VHXY+jCl/S3m0BcCTNlSqe X-Received: by 2002:a63:54b:: with SMTP id 72mr67132725pgf.323.1555330542964; Mon, 15 Apr 2019 05:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555330542; cv=none; d=google.com; s=arc-20160816; b=rbr1J4iLyxcBNZ+qaDju5vwaDY4/SAI3YwmCFcK8WsLyuUAW3rl4jB5sqX0iSBxEUa t2MxnZZUjwciX8HzYF1NL7eTeCRS7zJlu/nC2BoTJV70hI7YlHpW7vv2SPxlMmre946v KZrlVN7L2pBNKFhvBtwCZ2hejmJ/65IRuX2O8kO1VH/x/Sjjz94crX/PwLe1aAT+d5SA czYl4NjUeQEMVRU3EDGKeb9dhqnz2acDr/hNobUTIeixdrDTaDqgnQC0CdoA3AQysOhR SDMGkjdcvGNiuDCaBm+5BHGoiMshVgR0KLslUPCxm34nxtUXnDjSpH3+J6hXNzL9ByIf bJfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=FU8i9sjlSh306RyY3KlsqQMktsvNVB138smTRNfYHGU=; b=U+EpUC7H0V5YUpgGC1Fr2AjOEUNa0Gg0paL38adO6mgxHNLeqDQ+UwLQFfnE/kML4x WLHWKY0pupjfrwd+zUFHmd/5JK4/1VuX8FISQtYMCus1857iNOeFUbdg16b+ms/my5By UdMXJ3ShrskY2LlQZ70WuMwcCWKdzqCvQpz+JrlPMCRKn2MUiunBvLzLpOGNZurrnMGm JmF6r6SV+wFuVbCkbg3hF7qNSFsu5iiSk+eVzqaMYHAD6dK7EIV3e+Ab8z7ooopGBp9U oDvRi5NEh9hvQPnMcbBNbPQWqEH63RKNlTvTUlOOaOgoEvGL+3E5B67MLvdc03IY/Hly 5ytg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AFS5IiI7; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32si8736392pld.309.2019.04.15.05.15.42; Mon, 15 Apr 2019 05:15:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dmaengine-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=@linaro.org header.s=google header.b=AFS5IiI7; spf=pass (google.com: best guess record for domain of dmaengine-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=dmaengine-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727467AbfDOMPm (ORCPT + 3 others); Mon, 15 Apr 2019 08:15:42 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43094 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727512AbfDOMPl (ORCPT ); Mon, 15 Apr 2019 08:15:41 -0400 Received: by mail-pl1-f194.google.com with SMTP id n8so8465239plp.10 for ; Mon, 15 Apr 2019 05:15:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=FU8i9sjlSh306RyY3KlsqQMktsvNVB138smTRNfYHGU=; b=AFS5IiI7xOQqGJvdX3jWPeHMgEaddq60Wu+mQTWo9KU//G0mncQiIddMO45w+tjPA+ Kv3+9yZefuPBQeli3eiNPKZqkd8JNSY4QuxA6x4tLrpRpTL9T89A6scpglan6YaBRyZj gChs7FtshKwf/UtqCecWfo393HIOS3cc53Nq54k39Zf5AKKQ7C0w8GCK/RIZFsXU+Ng3 imk61hg41zMEk1DH96nE5Jn+jGjJAq1Ow+yVNBB13nOVKc3FS9P+Xm+830WtjJYASdp+ AR0CJWj7vwkz5MWIPEAGve53UGAvZ3V0KUy+v3HUG6rY5S6cd+nnQ0x6Zl7pXuPqfKjL dnZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=FU8i9sjlSh306RyY3KlsqQMktsvNVB138smTRNfYHGU=; b=FN/hWW138jFm8/+ERl+OKKxsJb6HAhYl1PHIuBN+oYiPhD18QUiATXamaE3W3nqICc PFatUb4KtRabSefn9hf3nGgrVRGilNAxfW9qilos2ORtDKw6LT1aBv4PmHE74H1fpQoG uPJ00Fh+RBG1R4XIyypxlchvc6JfbRtBXZbnI8DrIWrODxMXCqknl3VzSnkp22OjO/Oj m4Gc9VzmCuUm0uHquCHUS16scyYuMxfe0KVIoGPB227/iFeNfxdS1qw77aAuV4SrYj/x +wASnkvZUD9/pvFSn8q4385yBK/OIr1lK5Q8ZO1eD+cly8gZS3bQ838DAdWIWjO8RbAp Px7A== X-Gm-Message-State: APjAAAXOEzWM4Jpn/Nu/SGGKYRcmqYynY2Q7RZszAAoFlnLc99Yg7jkY wFcBFPG822JBV8rQhhGoQM1/Mg== X-Received: by 2002:a17:902:32b:: with SMTP id 40mr53043634pld.204.1555330540739; Mon, 15 Apr 2019 05:15:40 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id 6sm64157155pfj.95.2019.04.15.05.15.37 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Apr 2019 05:15:40 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org Cc: eric.long@unisoc.com, orsonzhai@gmail.com, zhang.lyra@gmail.com, broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] dmaengine: sprd: Add interrupt support for 2-stage transfer Date: Mon, 15 Apr 2019 20:15:01 +0800 Message-Id: <07c070b4397296a4500d04abe16dfd8a71a2f211.1555330115.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org For 2-stage transfer, some users like Audio still need transaction interrupt to notify when the 2-stage transfer is completed. Thus we should enable 2-stage transfer interrupt to support this feature. Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index cc9c24d..4c18f44 100644 --- a/drivers/dma/sprd-dma.c +++ b/drivers/dma/sprd-dma.c @@ -62,6 +62,8 @@ /* SPRD_DMA_GLB_2STAGE_GRP register definition */ #define SPRD_DMA_GLB_2STAGE_EN BIT(24) #define SPRD_DMA_GLB_CHN_INT_MASK GENMASK(23, 20) +#define SPRD_DMA_GLB_DEST_INT BIT(22) +#define SPRD_DMA_GLB_SRC_INT BIT(20) #define SPRD_DMA_GLB_LIST_DONE_TRG BIT(19) #define SPRD_DMA_GLB_TRANS_DONE_TRG BIT(18) #define SPRD_DMA_GLB_BLOCK_DONE_TRG BIT(17) @@ -135,6 +137,7 @@ /* define DMA channel mode & trigger mode mask */ #define SPRD_DMA_CHN_MODE_MASK GENMASK(7, 0) #define SPRD_DMA_TRG_MODE_MASK GENMASK(7, 0) +#define SPRD_DMA_INT_TYPE_MASK GENMASK(7, 0) /* define the DMA transfer step type */ #define SPRD_DMA_NONE_STEP 0 @@ -190,6 +193,7 @@ struct sprd_dma_chn { u32 dev_id; enum sprd_dma_chn_mode chn_mode; enum sprd_dma_trg_mode trg_mode; + enum sprd_dma_int_type int_type; struct sprd_dma_desc *cur_desc; }; @@ -429,6 +433,9 @@ static int sprd_dma_set_2stage_config(struct sprd_dma_chn *schan) val = chn & SPRD_DMA_GLB_SRC_CHN_MASK; val |= BIT(schan->trg_mode - 1) << SPRD_DMA_GLB_TRG_OFFSET; val |= SPRD_DMA_GLB_2STAGE_EN; + if (schan->int_type != SPRD_DMA_NO_INT) + val |= SPRD_DMA_GLB_SRC_INT; + sprd_dma_glb_update(sdev, SPRD_DMA_GLB_2STAGE_GRP1, val, val); break; @@ -436,6 +443,9 @@ static int sprd_dma_set_2stage_config(struct sprd_dma_chn *schan) val = chn & SPRD_DMA_GLB_SRC_CHN_MASK; val |= BIT(schan->trg_mode - 1) << SPRD_DMA_GLB_TRG_OFFSET; val |= SPRD_DMA_GLB_2STAGE_EN; + if (schan->int_type != SPRD_DMA_NO_INT) + val |= SPRD_DMA_GLB_SRC_INT; + sprd_dma_glb_update(sdev, SPRD_DMA_GLB_2STAGE_GRP2, val, val); break; @@ -443,6 +453,9 @@ static int sprd_dma_set_2stage_config(struct sprd_dma_chn *schan) val = (chn << SPRD_DMA_GLB_DEST_CHN_OFFSET) & SPRD_DMA_GLB_DEST_CHN_MASK; val |= SPRD_DMA_GLB_2STAGE_EN; + if (schan->int_type != SPRD_DMA_NO_INT) + val |= SPRD_DMA_GLB_DEST_INT; + sprd_dma_glb_update(sdev, SPRD_DMA_GLB_2STAGE_GRP1, val, val); break; @@ -450,6 +463,9 @@ static int sprd_dma_set_2stage_config(struct sprd_dma_chn *schan) val = (chn << SPRD_DMA_GLB_DEST_CHN_OFFSET) & SPRD_DMA_GLB_DEST_CHN_MASK; val |= SPRD_DMA_GLB_2STAGE_EN; + if (schan->int_type != SPRD_DMA_NO_INT) + val |= SPRD_DMA_GLB_DEST_INT; + sprd_dma_glb_update(sdev, SPRD_DMA_GLB_2STAGE_GRP2, val, val); break; @@ -911,11 +927,15 @@ static int sprd_dma_fill_linklist_desc(struct dma_chan *chan, schan->linklist.virt_addr = 0; } - /* Set channel mode and trigger mode for 2-stage transfer */ + /* + * Set channel mode, interrupt mode and trigger mode for 2-stage + * transfer. + */ schan->chn_mode = (flags >> SPRD_DMA_CHN_MODE_SHIFT) & SPRD_DMA_CHN_MODE_MASK; schan->trg_mode = (flags >> SPRD_DMA_TRG_MODE_SHIFT) & SPRD_DMA_TRG_MODE_MASK; + schan->int_type = flags & SPRD_DMA_INT_TYPE_MASK; sdesc = kzalloc(sizeof(*sdesc), GFP_NOWAIT); if (!sdesc)