From patchwork Fri Dec 23 08:52:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Appana Durga Kedareswara rao X-Patchwork-Id: 9487265 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6327C601C0 for ; Fri, 23 Dec 2016 08:53:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58E0726246 for ; Fri, 23 Dec 2016 08:53:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DF9726538; Fri, 23 Dec 2016 08:53:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 971A426246 for ; Fri, 23 Dec 2016 08:53:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759327AbcLWIwe (ORCPT ); Fri, 23 Dec 2016 03:52:34 -0500 Received: from mail-sn1nam01on0057.outbound.protection.outlook.com ([104.47.32.57]:63689 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757581AbcLWIwa (ORCPT ); Fri, 23 Dec 2016 03:52:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=scfGh0+wrrvD47cYDmLKLy0u0IIcnjy1X5/EKYPhNlk=; b=BvllwX6u4HK+wxGj6KbOMtP0Wp2n51POPUv4Ddp9avAMFJNp0CRuh57t4CoJUr39eERej5q9Sd1DQxA4DPhNZjw5kiIbVlGkVdYuA4I+OsGm79PBMrzJl+bixE+VdWDe055N/vJknHJLUqqi+bzUarAg+SQUmCsQoyNdaki88D8= Received: from MWHPR02CA0019.namprd02.prod.outlook.com (10.168.209.157) by CO1PR02MB208.namprd02.prod.outlook.com (10.242.165.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.803.11; Fri, 23 Dec 2016 08:52:28 +0000 Received: from CY1NAM02FT041.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::209) by MWHPR02CA0019.outlook.office365.com (2603:10b6:300:4b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14 via Frontend Transport; Fri, 23 Dec 2016 08:52:28 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT041.mail.protection.outlook.com (10.152.74.156) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.789.10 via Frontend Transport; Fri, 23 Dec 2016 08:52:27 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1cKLaU-0005SO-Qd; Fri, 23 Dec 2016 00:52:26 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1cKLaU-00070J-Mp; Fri, 23 Dec 2016 00:52:26 -0800 Received: from xsj-pvapsmtp01 (maildrop.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id uBN8qIGh013007; Fri, 23 Dec 2016 00:52:18 -0800 Received: from [172.23.64.208] (helo=xhdrdevl6.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1cKLaM-0006zO-3T; Fri, 23 Dec 2016 00:52:18 -0800 Received: by xhdrdevl6.xilinx.com (Postfix, from userid 13614) id 3EC61F2001C; Fri, 23 Dec 2016 14:22:17 +0530 (IST) From: Kedareswara rao Appana To: , , , , , , , , CC: , , Subject: [PATCH v2 1/3] dmaengine: xilinx_dma: Check for channel idle state before submitting dma descriptor Date: Fri, 23 Dec 2016 14:22:13 +0530 Message-ID: <1482483135-14767-2-git-send-email-appanad@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1482483135-14767-1-git-send-email-appanad@xilinx.com> References: <1482483135-14767-1-git-send-email-appanad@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22778.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39410400002)(39450400003)(39840400002)(39860400002)(39850400002)(2980300002)(438002)(199003)(189002)(36756003)(5003940100001)(2906002)(4326007)(6666003)(2950100002)(356003)(76176999)(50986999)(8676002)(81166006)(81156014)(8936002)(5001770100001)(36386004)(50226002)(2201001)(50466002)(5660300001)(189998001)(626004)(92566002)(48376002)(305945005)(33646002)(90966002)(45336002)(47776003)(46386002)(63266004)(38730400001)(42186005)(52956003)(103686003)(106466001)(107986001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO1PR02MB208; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1NAM02FT041; 1:lhCPCH06zyAQXaejYwdsd10P8UoNUOC6KUX++QwRd7Xw1sjdiW1aJTRKFSMIYBWzfa/CFmGfk9IZaqNgTOIRDOrGHvFDfu7nnFmnMGEK3iw5jpi6H2C/n/5jUZXBGauz58JyzZ542nKhp8kI2JyZoEjQr3N750GwOPI2ncBicOpLW/73u7qjZ8lBFjYQSHM+X8q5RJOydlikp2oaui8jB53BV3LAtXfvEzdlcsNJaBHSmCjJbuDdDvjdZnvnnTHFhopOmydqBeIxbihxw24jKS2ViCXTHpVaff2wSwVNSDSwzS/xAndA/IEStuuBoyvlxnZs8lUCcM36uOV9/W1JdNh3etmQzh8xry0CQ1iMcnhNe4ZqHZLkO4eOXKrT19/n07O3ObfXQgcKNjuoGsnPsitAFFX9p4Kc9Rjn02tGRCXIQSeDdsgaxSOt4YNo4hy9sdgE4XSXQnGuJqApXhcgEMIFEYx/rgHVcEHK2ls//xeza27K/xReqsU1wcVhP63acXJcqUaplJe0ZueJEZLMTAPeBeVw2+sWa5Q1zawvvQBqgi5CH6CEItqy82C5roYPlnbouURJOsWs/28b4t6fO1ipx2F/0K/MCkHlR1XQl/WRNfb+opb9piGkwuiRs6XskcOHxjc7gMafMR3FEUhEow== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 3ba10346-1073-48d6-12ba-08d42b1105f8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002); SRVR:CO1PR02MB208; X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB208; 3:aNzvUzertrJnjAheP7qu/Go4K0RufzVKYRjNeMIC3K08GkEC9rYDHSLPRRt+o/3OneKYg2FAqJNvxVRRk17eURRMyz6oyfc0Vi4CjdGKPl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rqZoA0gPTBkcMTViZY0IjLZPorW2hfR4tYu9vyS4aI3EfJZ+am6UP3h3qy29dLg8d83sIxXRdEDPuGifeQy21F/HW/FaQZ6Va91+FhLabYz5NTU5rZVuqWt88SOdLvHtD66gTVIdKNNoQulQus= X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB208; 31:8QQHKp4GRBpigfPN+yx3WXrrE6XVoua9ARU4F3/krS6CkIL+wXYJVdwbmEoowSErsyVOH1auxd8SHF2pbTBEisCYdQeRnR8p1dTL1Oh0c5WDfMZV4k0X0qushctO4HbZl6lVSndViTHct2zfqLp/G8M84kBO3KKtccwU0VRjQPLq3EKpgjqijfWcGQVL1qWYuaapf2v5ReGg8MYzqqdIlzuNdpaYeqvS4p8JfUVoVqKIJDXoDaTgz3l239MvsEWSaEhcbZdpS6E4Ip4VUy8a20u15htBPyPOTy2rRA5Jxts=; 20:dl4vNhVscGdYh6905fYH3zo7ERRFzxtXmC7w9FzY9xk2Ih0/YR7uwLpCFOmos+znqW+fLLi1otD8yryRsuJw5DfLlwsvUF1ReeAREvBsuIozQOZ2OlfBxnLhG1UlkX2T2IlOp+fUKE+QhqxagR5XoniDysNN3Z1OnfUfKympDosNpVATKnXBbNLi5AcIYFuuEC5jMGA1bxkl740xmn2PWbyMt1zDyIwlNHzQ91Y4g7g5QNnV5o5XpU5UAcBBkMgzXfGzgje+MW6NmkMtxXTfd72aGvoiPGsIqw+J0A01FbPj4sf3vMmexB56YOeJuQfRLx6+IDgV375pc9Fa+2KB/l5hmKFP/oGhlVhNxrvXfLnrfPs6zv6qK020C8DniSoF2Qbq2aXSKQpRnZYreQUoZ5XsgC0q3zgW8z27C/pKRrWYZfkNADLS6mseBcmplYRyE7dXJgJl07xE7ln7ajZmP2/mc/P+DXzCQ7NW3Ht27Jrfghf1zxPm+/9kkghvDARL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(13017025)(13024025)(13023025)(13015025)(13018025)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123564025)(20161123562025)(20161123555025)(6072148); SRVR:CO1PR02MB208; BCL:0; PCL:0; RULEID:; SRVR:CO1PR02MB208; X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB208; 4:i7lvgZ4L+7BLrVjtoM1tlIg72j8i5TcSK7GYnd8W91CMauvv3ez3nYhwaSxtCtSdEagsXcKWwJRINWz7jVz32wHemrLvy1/DiEhBq8T9VTYHyTgbuv3VrsM1wP7CQtVSfRo/ihfQNG2fBXcAMKES07vJ1nGCRrmPYcHFV7RFBTiqkHVCFRwuhlg84f+0KQDOEzg6tTcZA1HkBJ28IXLr+n1mFfbgAePGTc13mKqGgBl4k7zJ0KgqtSiJAWEiOAO2wHpnku6TZM37wlpVfymz9l7Z61Yx6Axch1vnYUOc+yjVMtG0xgut3Px324kpJzLwIsm0MrT8iunLfP9qZYmPOfLLs6AK2JoA2QtHRjAYASM7gooSiAfqr6ZhnbbOcZPjie3I7VX4mVUB/xh39wsQThCdJ707GI7PdKZP154k5QQKlcmwCs+x7nWjLOwM6KOc8UWUdvr7xg9oSf9vmjJ4y76+3U9/VvjWxx9UKIduP0KQgUHC4pPhwacHrf3p22fmzp+1yNe/Bz7ShbqoPy9qwRuhpVMvd91a5krS8o0MePhNeEUbZXxg0kXT+nJbeIzOpbrsHJBqaCkxdPurd3OG73LBlxb/RPLi5LTxb7BtbAdYZ1NDVIxJMvR2mz6nsq9Rlt6i51vyVJiLk4RpyKKuEmtkc91/se5lYzz/orXL7aYulTPP9PS6Kbjql3OdY2uYRZgvk/tQAuzyStVFYNCelwPMvPpHqDzZtba0d/+/qa4= X-Forefront-PRVS: 016572D96D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO1PR02MB208; 23:bmF7CJeKDhwQWOvEtYrFEev7U1C5WMRKLBtVACSKRW?= =?us-ascii?Q?/yiE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6wETlmlQiGt7AxNpwWh2WHcYZdFn4bZxFX9vqoc/t921/sVUlAU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB208; 7:gj9zTfnSWQC6wDJReXvYVQMGNGZF6IsF0P99F9h69g8moCNsGfXiLjmpEXAEc689yWHB3Jpd8ABM7MOjWTKvMXHu4KrPtOR5pDtDZ/GOdvnwmzxdFZ9TwqOnu89at8EOqyTe6Xetuk1CNFyb/DMC1kzWs4M0pKD/OZY9Ldrw6XUuMQh797t8zac0osr4OpOjxPlQHx0Fax2GOPNe/xYMAl8HyvHXoSddB4Klc2iETTYurgUCGNuvAUf45woNLMbKTMP2CsGJQL+LoiHsiSb9zM6ufy8jtwIdwf+BqQrAw0TGk68gT4opUmx5AfqVvTNfBq+9QkOqzMrZgYfsbxdU3azx1M1SjQSVRHZc+X1GnxzS0Vd9TYw/B1ikxusKqocuVQmAp+VhgyTfjjzts19XTvmGINpo7pHKz90Pvnh/SMJiU75JmMs+SOLwelk2RYS6QklExLEYvuIuiWF8+Ebc7Q== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2016 08:52:27.4727 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR02MB208 Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add channel idle state to ensure that dma descriptor is not submitted when VDMA engine is in progress. Reviewed-by: Jose Abreu Signed-off-by: Kedareswara rao Appana --- Changes fro v2: ---> Add idle check in the reset as suggested by Jose Abreu ---> Removed xilinx_dma_is_running/xilinx_dma_is_idle checks in the driver and used common idle checks across the driver as suggested by Laurent Pinchart. drivers/dma/xilinx/xilinx_dma.c | 56 +++++++++++++---------------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c index 8288fe4..be7eb41 100644 --- a/drivers/dma/xilinx/xilinx_dma.c +++ b/drivers/dma/xilinx/xilinx_dma.c @@ -321,6 +321,7 @@ struct xilinx_dma_tx_descriptor { * @cyclic: Check for cyclic transfers. * @genlock: Support genlock mode * @err: Channel has errors + * @idle: Check for channel idle * @tasklet: Cleanup work after irq * @config: Device configuration info * @flush_on_fsync: Flush on Frame sync @@ -351,6 +352,7 @@ struct xilinx_dma_chan { bool cyclic; bool genlock; bool err; + bool idle; struct tasklet_struct tasklet; struct xilinx_vdma_config config; bool flush_on_fsync; @@ -920,32 +922,6 @@ static enum dma_status xilinx_dma_tx_status(struct dma_chan *dchan, } /** - * xilinx_dma_is_running - Check if DMA channel is running - * @chan: Driver specific DMA channel - * - * Return: '1' if running, '0' if not. - */ -static bool xilinx_dma_is_running(struct xilinx_dma_chan *chan) -{ - return !(dma_ctrl_read(chan, XILINX_DMA_REG_DMASR) & - XILINX_DMA_DMASR_HALTED) && - (dma_ctrl_read(chan, XILINX_DMA_REG_DMACR) & - XILINX_DMA_DMACR_RUNSTOP); -} - -/** - * xilinx_dma_is_idle - Check if DMA channel is idle - * @chan: Driver specific DMA channel - * - * Return: '1' if idle, '0' if not. - */ -static bool xilinx_dma_is_idle(struct xilinx_dma_chan *chan) -{ - return dma_ctrl_read(chan, XILINX_DMA_REG_DMASR) & - XILINX_DMA_DMASR_IDLE; -} - -/** * xilinx_dma_halt - Halt DMA channel * @chan: Driver specific DMA channel */ @@ -966,6 +942,7 @@ static void xilinx_dma_halt(struct xilinx_dma_chan *chan) chan, dma_ctrl_read(chan, XILINX_DMA_REG_DMASR)); chan->err = true; } + chan->idle = true; } /** @@ -1007,6 +984,9 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) if (chan->err) return; + if (!chan->idle) + return; + if (list_empty(&chan->pending_list)) return; @@ -1018,13 +998,6 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) tail_segment = list_last_entry(&tail_desc->segments, struct xilinx_vdma_tx_segment, node); - /* If it is SG mode and hardware is busy, cannot submit */ - if (chan->has_sg && xilinx_dma_is_running(chan) && - !xilinx_dma_is_idle(chan)) { - dev_dbg(chan->dev, "DMA controller still busy\n"); - return; - } - /* * If hardware is idle, then all descriptors on the running lists are * done, start new transfers @@ -1110,6 +1083,7 @@ static void xilinx_vdma_start_transfer(struct xilinx_dma_chan *chan) vdma_desc_write(chan, XILINX_DMA_REG_VSIZE, last->hw.vsize); } + chan->idle = false; if (!chan->has_sg) { list_del(&desc->node); list_add_tail(&desc->node, &chan->active_list); @@ -1136,6 +1110,9 @@ static void xilinx_cdma_start_transfer(struct xilinx_dma_chan *chan) if (chan->err) return; + if (!chan->idle) + return; + if (list_empty(&chan->pending_list)) return; @@ -1181,6 +1158,7 @@ static void xilinx_cdma_start_transfer(struct xilinx_dma_chan *chan) list_splice_tail_init(&chan->pending_list, &chan->active_list); chan->desc_pendingcount = 0; + chan->idle = false; } /** @@ -1196,15 +1174,11 @@ static void xilinx_dma_start_transfer(struct xilinx_dma_chan *chan) if (chan->err) return; - if (list_empty(&chan->pending_list)) + if (!chan->idle) return; - /* If it is SG mode and hardware is busy, cannot submit */ - if (chan->has_sg && xilinx_dma_is_running(chan) && - !xilinx_dma_is_idle(chan)) { - dev_dbg(chan->dev, "DMA controller still busy\n"); + if (list_empty(&chan->pending_list)) return; - } head_desc = list_first_entry(&chan->pending_list, struct xilinx_dma_tx_descriptor, node); @@ -1302,6 +1276,7 @@ static void xilinx_dma_start_transfer(struct xilinx_dma_chan *chan) list_splice_tail_init(&chan->pending_list, &chan->active_list); chan->desc_pendingcount = 0; + chan->idle = false; } /** @@ -1366,6 +1341,7 @@ static int xilinx_dma_reset(struct xilinx_dma_chan *chan) } chan->err = false; + chan->idle = true; return err; } @@ -1447,6 +1423,7 @@ static irqreturn_t xilinx_dma_irq_handler(int irq, void *data) if (status & XILINX_DMA_DMASR_FRM_CNT_IRQ) { spin_lock(&chan->lock); xilinx_dma_complete_descriptor(chan); + chan->idle = true; chan->start_transfer(chan); spin_unlock(&chan->lock); } @@ -2327,6 +2304,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev, chan->has_sg = xdev->has_sg; chan->desc_pendingcount = 0x0; chan->ext_addr = xdev->ext_addr; + chan->idle = true; spin_lock_init(&chan->lock); INIT_LIST_HEAD(&chan->pending_list);