Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753869AbbFXRM0 (ORCPT ); Wed, 24 Jun 2015 13:12:26 -0400 Received: from mail-bn1bon0068.outbound.protection.outlook.com ([157.56.111.68]:45792 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752837AbbFXRMQ (ORCPT ); Wed, 24 Jun 2015 13:12:16 -0400 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none; From: Appana Durga Kedareswara Rao To: Jeremy Trimble CC: Vinod Koul , "dan.j.williams@intel.com" , Michal Simek , "Soren Brinkmann" , Anirudha Sarangi , "dmaengine@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v7] dma: Add Xilinx AXI Direct Memory Access Engine driver support Thread-Topic: [PATCH v7] dma: Add Xilinx AXI Direct Memory Access Engine driver support Thread-Index: AQHQon9A9kU/tLGXRkiyV8/V08t2PJ2zlLGAgAhbjfA= Date: Wed, 24 Jun 2015 17:12:10 +0000 Message-ID: References: <1433831736-18253-1-git-send-email-appanad@xilinx.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.23.231.165] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21630.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD006;1:gVFV9G1O6t5lkKJkEfpExLw/0CtZCVrySNd96NqffPXGMjvzcQhmH5mCTELep5MnetArDuIo/etbWtk6neuOPX4me6XXSmTE+a/LtbdBwHkDjO3XpNsZijHKP3/LV3OUsRuYl+AcaXO7CdgeJg6pG2vYULcU1cwjmrLedOXsTDMmeCUd+pXnq4F3VkzM+XV8a+YkGktYB+L8bJY0X2EuGE8zdRaDhdc4KNoygBMvquVcYT71mFAJPjJQDt8QT6lWpsQl2AO8NxY4iwJSH6Ig0gouHbFgU2gUUPcTUZuFcXf1ZdWjXC9jvTUtf31cZ/Y1srXiD0C8A3NGO2z+O/iXRA== X-Forefront-Antispam-Report: CIP:149.199.60.100;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(51704005)(377454003)(13464003)(189002)(199003)(62966003)(102836002)(2900100001)(2950100001)(2920100001)(23676002)(5250100002)(5890100001)(2656002)(19580405001)(19580395003)(87936001)(5003600100002)(86362001)(106466001)(77156002)(92566002)(33656002)(63266004)(76176999)(54356999)(50986999)(110136002)(5001960100002)(5001920100001)(189998001)(46102003)(50466002)(106116001)(55846006)(47776003)(6806004)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2FFO11HUB028;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB028;2:FQsqxmQnSDpY0Iryx43ESVasiS1w+9TX/xGfsXre2Ww3ZEi6WyhPj9FsneIotPYX;3:RSuwm7BWUjMXu70wKSem+kvpZiHY0Gl+chMOlwv27eu5Vju/tpbjkvmmGgne8MtxGijsXUAKBV64VNduqosYTcPFAXgFFVTX0M+epj8PHT5J84NocxZKtJ4Qqvrfb8L3se4DXzegqIxIcOOVzhFozoxw1SgLu9FDZvdwO8/MeFam4TWmlRm3bFSWuwK3OVGnjYb+OTgOGwgBvuTRCqhUTEThbP9GiOXPuVm55vWNa+AO3krXamYTlIIUF8q/qT6/;20:WmeDYGdH/t9a3g0TXliOS69EJuhtv2HjtSLHXeBYGFXVA7xgvgrNcZwF4+7/dI4Nkd5YNTylsVEkvnEDzAY1uLKwLQTMfAZJ5hcf5y45Prgeul8KzDFY4fwr+TMGyXmhx/aiSXwoeTELAqySMiYW+r58SggM3OTdRSE1PyfsMOFaAViekJ0UZbDo9W6CIozc2B2o/70xC4WZ1lGsZaZe/OfGyfLrEc1Kq9noVqX+9q+eSbgBq78MBlwATqPI4QXDkwCiigChcqQRlV04n/IkQ9tXwjTCzTYxT+eGNwXlTOhB3Y+bOwhwF4ie1MxaLTZNdd8vpUMmWjJw95PC50+jSuoccu9acvExfsUx494S0iOKfWVyn/YEDS6TI6ATkJ46iVAlZHgsddkxP0h3CAYyAo4To0eOL/jjckPVqpJ/IMiH3HIBCK5+smamAIMR4hkZb0r0HXbYqhqh/n6OW0G2HvfjK5Qe5m5miSxzEI4MCAybEoFA6Z/D8uiWPgQjoH1C X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2FFO11HUB028; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BY2FFO11HUB028;BCL:0;PCL:0;RULEID:;SRVR:BY2FFO11HUB028; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB028;4:QFAYFu+kA5JDvRo3Hcj8ndyOWfljD9IZT5Ur9P10yencfT7laKQVMMN+djf7YucxQ6esHFQTLYwjaMUDEh6V5tNzUl5O+9H5La3qzwFKU0WH0ZIBi95qraVypZv+GFk3vGIY70chUG+s03wuOWSVzEEIZ1egwbGdLzvVEIX8rtUjEekWSpRKp7lw6EClneaxUA7phCLKDUyVIkmgBsV1QscSqtT4pe3HiyqsM44stBLYGX12yYNtgpEeslsa4awVMPrWwV9RLXXeNCv1kfNFLZagCIvckfVZruQyD8Ud4hs= X-Forefront-PRVS: 061725F016 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCWTJGRk8xMUhVQjAyODsyMzpiQ2l2MS9IOVExOElKTW5YTlZ0bityeWY3?= =?utf-8?B?cEZ6YitLRUg1aE80L0dDK1hLb2pvb3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rVHJselYzbXRSWVdBTnN3ZEpnT0diRGNETHk2NGVNTXRJUTh0?= =?utf-8?B?RThxTTdGaHVSMHRweVdhdmh1VWl6VG5mM3pOZXZnOStlVFdQZ2lwTXlncG9t?= =?utf-8?B?SktYMHJjNVFtejkyYkxpU3hDOEdQaFg1Rk8wNWtqUUtjNThrUmlBQ3JaL2xm?= =?utf-8?B?azBxRlAwMU5PQitiMlZWT0w0VUhSZVZRMXpPY1V0Ny9BNnkxTE85b2ZYV2Mw?= =?utf-8?B?RFFyYnpTNHAvUHZhU1ZtOU96V2pZNlBEVG5ISDV5dzRqd080RUp5RTVWcUF4?= =?utf-8?B?QUQxU3JHaFRSREtSUmwwZm93RkNQY21vSXd6ZitZemZ0dTN6R2Q4L0tjS3ps?= =?utf-8?B?bzJFamsxNjVZVWJLRlhUS2hzdUhvZ2RuV2hHQlZNMlo4L3d4L1BaaUEwb0JG?= =?utf-8?B?amRQOS9tSStPRDFoYkFBSWQ0YmFGZi9kZ2ttT09odTJMTHhEaXB2OHF5UmFz?= =?utf-8?Q?fwzkkSyh4PqtzUw50HUEPQAjDALm?= X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11HUB028;5:tEMpcRb1DyNjPll3Sq08E+S+gaKTF1vC7B8N7z20jQC7vnsJ9yUq/UdpQVV0CEUD73VqXVxYoGAqkfSuSm0a3Cn/BqXxARkeuj060LejkhwOFLHSXeCVM4/rxykGyHRFslZEnDJm50ANL/5O/so0+w==;24:xnjHiCFT4i4edU65lilHWzrzov1v3CaJypu4STMvw3BF832gVexsy8bSZWZPwdjf+dgfYWyihOr100L6ufdahWzhkyYsMBdavUtEXDxD4uI= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2015 17:12:14.3106 (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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2FFO11HUB028 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t5OHCVNL018629 Content-Length: 4422 Lines: 101 Hi Jeremy Trimble, > -----Original Message----- > From: Jeremy Trimble [mailto:jeremy.trimble@gmail.com] > Sent: Friday, June 19, 2015 10:19 PM > To: Appana Durga Kedareswara Rao > Cc: Vinod Koul; dan.j.williams@intel.com; Michal Simek; Soren Brinkmann; > Appana Durga Kedareswara Rao; Anirudha Sarangi; Punnaiah Choudary > Kalluri; dmaengine@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > linux-kernel@vger.kernel.org; Srikanth Thokala > Subject: Re: [PATCH v7] dma: Add Xilinx AXI Direct Memory Access Engine > driver support > > > +/** > > + * xilinx_dma_start_transfer - Starts DMA transfer > > + * @chan: Driver specific channel struct pointer */ static void > > +xilinx_dma_start_transfer(struct xilinx_dma_chan *chan) { > > + struct xilinx_dma_tx_descriptor *desc; > > + struct xilinx_dma_tx_segment *head, *tail = NULL; > > + > > + if (chan->err) > > + return; > > + > > + if (list_empty(&chan->pending_list)) > > + return; > > + > > + if (!chan->idle) > > + return; > > + > > + desc = list_first_entry(&chan->pending_list, > > + struct xilinx_dma_tx_descriptor, > > + node); > > + > > + if (chan->has_sg && xilinx_dma_is_running(chan) && > > + !xilinx_dma_is_idle(chan)) { > > + tail = list_entry(desc->segments.prev, > > + struct xilinx_dma_tx_segment, node); > > + dma_ctrl_write(chan, XILINX_DMA_REG_TAILDESC, tail->phys); > > + goto out_free_desc; > > + } > > + > > + if (chan->has_sg) { > > + head = list_first_entry(&desc->segments, > > + struct xilinx_dma_tx_segment, node); > > + tail = list_entry(desc->segments.prev, > > + struct xilinx_dma_tx_segment, node); > > + dma_ctrl_write(chan, XILINX_DMA_REG_CURDESC, head->phys); > > + } > > + > > + /* Enable interrupts */ > > + dma_ctrl_set(chan, XILINX_DMA_REG_CONTROL, > > + XILINX_DMA_XR_IRQ_ALL_MASK); > > + > > + xilinx_dma_start(chan); > > + if (chan->err) > > + return; > > + > > + /* Start the transfer */ > > + if (chan->has_sg) { > > + dma_ctrl_write(chan, XILINX_DMA_REG_TAILDESC, tail->phys); > > + } else { > > + struct xilinx_dma_tx_segment *segment; > > + struct xilinx_dma_desc_hw *hw; > > + > > + segment = list_first_entry(&desc->segments, > > + struct xilinx_dma_tx_segment, node); > > + hw = &segment->hw; > > + > > + if (desc->direction == DMA_MEM_TO_DEV) > > + dma_ctrl_write(chan, XILINX_DMA_REG_SRCADDR, > > + hw->buf_addr); > > + else > > + dma_ctrl_write(chan, XILINX_DMA_REG_DSTADDR, > > + hw->buf_addr); > > + > > + /* Start the transfer */ > > + dma_ctrl_write(chan, XILINX_DMA_REG_BTT, > > + hw->control & XILINX_DMA_MAX_TRANS_LEN); > > + } > > + > > +out_free_desc: > > + list_del(&desc->node); > > + chan->idle = false; > > + chan->active_desc = desc; > > +} > > What prevents chan->active_desc from being overwritten before the > previous descriptor is transferred to done_list. For instance, if two transfers > are queued with issue_pending() in quick succession (such that > xilinx_dma_start_transfer() is called twice before the interrupt for the first > transfer occurs), won't the first descriptor be overwritten and lost? Yes there is some flaws in this implementation. Will fix it in the next version of the patch. Regards, Kedar. This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately. ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?