Message ID | 20221107210438.1515-6-Sergey.Semin@baikalelectronics.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2303777wru; Mon, 7 Nov 2022 13:24:16 -0800 (PST) X-Google-Smtp-Source: AMsMyM751V0Ds3e0HvDTHr8/f2gfDDc/MTGiXibq4JhqZr/I3PUVr4PT/YsYGMeYoe02IVcmiNou X-Received: by 2002:a17:907:6e06:b0:7ae:1219:7035 with SMTP id sd6-20020a1709076e0600b007ae12197035mr25267984ejc.30.1667856256241; Mon, 07 Nov 2022 13:24:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667856256; cv=none; d=google.com; s=arc-20160816; b=IwLr4O/we99mPTyTet0ek2Kh43CwyR20TFzCErgS5Wc1qJ7JBM8pDRQrQiT98AmacN iJrDFNVWUfdCcaXbANRnqGI9QLhYVV5/t4+sMvnk0VGc+gTVa7eiuAWqy9qXIZPmgZdU /dZ4DNfnw9Khuj1l5PRF+j13we867byOAm+lU6PQ7F+3NI750Rl7u6ihZrfIb6Q1D4hz b1eCiL4tJfdUqNyZu/8LisCzodR2phCvdtCGzf0ejY1nhtXpG549J7eP+I1JBWqekVSv sqyl8FrInvMsXxeAvO5jB+gTldmpV7LiVf3bPAIsaop0PKDQAkdXXnSceniiZP22Kl+Y U4MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rzMZupkEEXFysQHXF0y712yApjgBZMtEMe6Jr0GcLg4=; b=lWa6Y5lLzYvGufBTQlQcFopOB1dU1SKZ7BCGh12RJh63eB/1VwzFbiI9WdeMIwfEbe Omjg/0hgSXEEsf11SGsxDL/WXj9DtDPcMTP5DRAfjXqbNLUhgfCbK4/tMDQeAk533xp0 qUP5QHu5KFj2bt6NO+IINoxJrFEU7TTWuZmqOFPwg96ROGY4fJqg9JVwLHSWq5zS5qhq 8cA6mnZf66fLQd3Iz0mgotMFZxK6lxfHkIlwY0RYbG7djKyS0LamlNhC+xnRn33lCkP7 /PvkIzvQpul1Myii5yKrCBK9MKiHyql7+Z6gu3sCeeq5HiftqbcaFVqFYZS+G1afqcrp teuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=jDlEQeaL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q10-20020a056402518a00b00461bde34a12si12570708edd.627.2022.11.07.13.23.52; Mon, 07 Nov 2022 13:24:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=jDlEQeaL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233226AbiKGVOf (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Mon, 7 Nov 2022 16:14:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233416AbiKGVOK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Nov 2022 16:14:10 -0500 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C98B73F076; Mon, 7 Nov 2022 13:11:06 -0800 (PST) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 1903AE0ECE; Tue, 8 Nov 2022 00:04:48 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=rzMZupkEEXFysQHXF0y712yApjgBZMtEMe6Jr0GcLg4=; b=jDlEQeaLoF9j /2z/CZdoBn5gz5eExntHtCy2NnRh9d9vGG6KN5iey/l7Y54zDr+6ofhwALVpFXgb 0EddMmoW/SgCVd0JFXTBoPGFg3blnBrjsxv6FaK6HZ08WtxC5VT26xwdHVDY1Ltw OhSaZx3Y9yZ3WHPf8KEpwMrVlF8sQ7Q= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 092F4E0E6A; Tue, 8 Nov 2022 00:04:48 +0300 (MSK) Received: from localhost (192.168.168.10) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 8 Nov 2022 00:04:47 +0300 From: Serge Semin <Sergey.Semin@baikalelectronics.ru> To: Gustavo Pimentel <gustavo.pimentel@synopsys.com>, Vinod Koul <vkoul@kernel.org>, Rob Herring <robh@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Cai Huoqing <cai.huoqing@linux.dev>, Robin Murphy <robin.murphy@arm.com>, Jingoo Han <jingoohan1@gmail.com>, Frank Li <Frank.Li@nxp.com>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> CC: Serge Semin <Sergey.Semin@baikalelectronics.ru>, Serge Semin <fancer.lancer@gmail.com>, Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>, Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>, =?utf-8?q?Krzys?= =?utf-8?q?ztof_Wilczy=C5=84ski?= <kw@linux.com>, caihuoqing <caihuoqing@baidu.com>, <linux-pci@vger.kernel.org>, <dmaengine@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Gustavo Pimentel <Gustavo.Pimentel@synopsys.com> Subject: [PATCH v6 05/24] dmaengine: dw-edma: Don't permit non-inc interleaved xfers Date: Tue, 8 Nov 2022 00:04:19 +0300 Message-ID: <20221107210438.1515-6-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221107210438.1515-1-Sergey.Semin@baikalelectronics.ru> References: <20221107210438.1515-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [192.168.168.10] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748874041569463126?= X-GMAIL-MSGID: =?utf-8?q?1748874041569463126?= |
Series |
dmaengine: dw-edma: Add RP/EP local DMA controllers support
|
|
Commit Message
Serge Semin
Nov. 7, 2022, 9:04 p.m. UTC
DW eDMA controller always increments both source and destination addresses. Permitting DMA interleaved transfers with no src_inc/dst_inc flags set may lead to unexpected behaviour for the device users. Let's fix that by terminating the interleaved transfers if at least one of the dma_interleaved_template.{src_inc,dst_inc} flag is initialized with false value. Note in addition to that we need to increase the source and destination addresses accordingly after each iteration. Fixes: 85e7518f42c8 ("dmaengine: dw-edma: Add device_prep_interleave_dma() support") Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Acked-by: Vinod Koul <vkoul@kernel.org> --- drivers/dma/dw-edma/dw-edma-core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 778d91d9fc1b..35588e14f79a 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -385,6 +385,8 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) return NULL; if (xfer->xfer.il->numf > 0 && xfer->xfer.il->frame_size > 0) return NULL; + if (!xfer->xfer.il->src_inc || !xfer->xfer.il->dst_inc) + return NULL; } else { return NULL; } @@ -484,15 +486,13 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) struct dma_interleaved_template *il = xfer->xfer.il; struct data_chunk *dc = &il->sgl[i]; - if (il->src_sgl) { - src_addr += burst->sz; + src_addr += burst->sz; + if (il->src_sgl) src_addr += dmaengine_get_src_icg(il, dc); - } - if (il->dst_sgl) { - dst_addr += burst->sz; + dst_addr += burst->sz; + if (il->dst_sgl) dst_addr += dmaengine_get_dst_icg(il, dc); - } } }