Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755472AbcLOTJy (ORCPT ); Thu, 15 Dec 2016 14:09:54 -0500 Received: from mail-cys01nam02on0089.outbound.protection.outlook.com ([104.47.37.89]:61408 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754305AbcLOTJv (ORCPT ); Thu, 15 Dec 2016 14:09:51 -0500 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; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:2866;Count:27 From: Appana Durga Kedareswara Rao To: Jose Abreu , "dan.j.williams@intel.com" , "vinod.koul@intel.com" , "michal.simek@xilinx.com" , Soren Brinkmann , "moritz.fischer@ettus.com" , "laurent.pinchart@ideasonboard.com" , "luis@debethencourt.com" , Anirudha Sarangi CC: "dmaengine@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 2/3] dmaeninge: xilinx_dma: Fix bug in multiple frame stores scenario in vdma Thread-Topic: [PATCH 2/3] dmaeninge: xilinx_dma: Fix bug in multiple frame stores scenario in vdma Thread-Index: AQHSVuWKeAv0STYsN0iupc5V13K6T6EIp48AgACywOA= Date: Thu, 15 Dec 2016 19:09:39 +0000 Message-ID: References: <1481814682-31780-1-git-send-email-appanad@xilinx.com> <1481814682-31780-3-git-send-email-appanad@xilinx.com> <9d92984b-e04a-cd29-e933-d8ea4d610c94@synopsys.com> In-Reply-To: <9d92984b-e04a-cd29-e933-d8ea4d610c94@synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.23.228.222] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22762.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-IncomingHeaderCount: 27 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)(39840400002)(39450400003)(39860400002)(39850400002)(2980300002)(438002)(189002)(199003)(51914003)(356003)(97756001)(46406003)(5660300001)(8676002)(4326007)(5250100002)(81156014)(626004)(8746002)(2906002)(106466001)(8936002)(92566002)(2920100001)(2900100001)(81166006)(33656002)(2501003)(189998001)(54356999)(76176999)(50466002)(23726003)(50986999)(5001770100001)(6116002)(3846002)(102836003)(305945005)(7736002)(63266004)(2950100002)(7696004)(106116001)(229853002)(6862003)(2201001)(38730400001)(55846006)(47776003)(6636002)(107986001)(422495003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR02MB2262;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT011;1:8SYvfBJmlqIYOgR/uknbbllHfAaMmA28O4w/FCEu0hr6LUfhaLina2dOH7tdqWYz7iYUsz9tkG6HKucS464gZPEqs/vm9FwVurrC/RzZIIyrij/fQ/FpgTvOud5twNwd2psFMg5tW09XVyw0Y8+BhSxmy3UavS2lQ3b3Cg+3MtAnBgEN4nlRzMatv3XMzeJBIozMcCR09cO26m71KTGS2JJYrurfFlz9VEA6XknWpoYpF1ipFz9StkraRoxaHeGGMC3KtxES9V5ll8pRrth4NOjmfaRJpCGXQt1/nL8x6EB4bcHCMe+B1ZtxflqJYavQ0KaDbSx7ELp0ywU931qWLm1LFiikiQ4zynxw0gI5FnKEX8sTBpTe8YjAfIUunmSQWFRn0Z45KJDiIQ5cXnTk9DaHmcIBTD2/EALbO7LZ0ybXz5iYt3rtRyYaM6JTWd/E5KEcDtDmQylrdqUjSx9DjFgMtB8pptcIGh0j1DvEB44yxKpz5pCArOY4M8h+q2SI5f0OAnPwxT1OzX/2GrZhos5AXyjuHxf+4Lc63Eommuj2y+E1S/ABxLfVQDZjOUkVtMo0uFIVTYVNHx9YI+notdSOVpmlZI2Hfi2IZzAD+a2I/h/Fepcqv6610MJZ+KIAHLHp1/u0CNV7C8OGGnwf2g== X-MS-Office365-Filtering-Correlation-Id: 32f3bf2d-c321-481c-96bd-08d4251df05d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:CY4PR02MB2262; X-Microsoft-Exchange-Diagnostics: 1;CY4PR02MB2262;3:Rqa44rXsmJl9sJhsI8cy4NMTF1I3ZIvqsOsVghwXoJhufJHGF5hixCwc0MReIgz5XHvNwCVjvtXxM7Oa6mrVOts2wKN34L/PuzdgbA5dHmAu5QV9WPGtEOizJUag6jxXZ+6B0yPTY+4SxqbUw/AK97UHkQfv3bAGVpldf25goPGLfvbgylIVu1Jhm5Fa0jB+2WGoNjR39lSuK2Zdl9eCWhaaCb+Pfy9uVBCoW85Wh/Kdp0c1Rc4oHhbrLDFXsVeVZEcj9ok6x5yy+kqG5LyNraKx6+PZX0k1bT5hVsL7ctsA3dJO1wNOyAGF1U2lp6WKkAAAXJs8BwwCXpqN/oBW55rPXx4APb5wCZWE3xrtSVhALGFUqVQFoN7MTIsPY664MHpP0LsVK7w3WTvrBlMEGg==;25:PnJI4rrn+97NbwMOYf+wWfgrMW8VaZDFx9MNt6f8fbW9ZU7j4mxAHR1A7af8bLVILQgbMQ8xIgksHTszs8IgwWzizBNJNJGl23o1HKZ9dzhFnkgkGP151HqoD61M07YwgnGPHHL5V1mtP1Y9qKkEZ/kyEWLQjBeZaa5nbVklJAE94/YHkfwv+f/BRGrb333WbWSgRx7Z0JUd+RBj+kbjt3Mq6+nsghWjqUO66R2CyKwfLXVcUSBt0kcVcXPo67VWqtkp2WKo3hGhW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Scan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(13023025)(13024025)(13015025)(13017025)(13018025)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123555025)(20161123564025)(20161123562025)(6072148);SRVR:CY4PR02MB2262;BCL:0;PCL:0;RULEID:;SRVR:CY4PR02MB2262; X-Microsoft-Exchange-Diagnostics: 1;CY4PR02MB2262;4:/H4xsxLm5x8H3fxQWrCpFLNl02iACYfi1eTVvAkzMqBfqahHl4JV3d9Tm8btJ+1v32RMa+OJ4xQt/UuZ5IuWtsfQAgSpAfhIl6owPbU5UvI55JzfbfzJC97kdhFcTLcDOy+Y4xQnSLYQcaQ10N3H5po96TLsSvYmKWSZtcppLcyTBF9HyYhtnQsXJuenpLYx9d7RnRJr78Hen6WDFxzgIxSKYUz8E5WnQl3S+zGBmuRNI4wtXdtpPoNstpb6BAa4S4rNMxtUiWtHbxFWkQGUSo+zo+hSoG+Zm4c5rcql8lW0uwQ5IkBhESypZgOKTuLtvjqjIEsNXXJoEsRPp6G3k3eAzIrLVcG865fqfRGjGU9f5CkgEytkmiDa5PZbhRKkJo5x0DkPGQLm35Cqcd58BACZg8WQ4oMQEnxAvXft3z8xoMpFkMgQtXShN/yFz8pYssC3x1Lvtun5iEC55s5SR1v/Yym7DvFvt5jpFuVcy8DmqmOdwE/wYfND/aWwDKXfuql65IV5zI/nIK1yFFJHZ0+AjDkCjEHPGEUFKDsFZ2tWNJdFVU5Y1FvbbQWjhYc9m3rN+fnU9+T/0uTmDQYClHQ+wdgxBdUaFNy4oTQnoGmSz3YUK4OQB7GaFUCjQu68Xdj7lFmUM/LMIdKb/z7Dr0qabM58gx5Nl+thatrYqRDiiHPuQoy/nce7avRqdSa40TOPJuAcQ5swrvc2E0YekyTxXkUP9J3+iM5F0AS84Ug= X-Forefront-PRVS: 0157DEB61B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR02MB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VFkA3p9nA==;5:kTRzEg69nW9O5BH/G/rupRDhxujO53PLpS+9SuInbT0C/C67AiqfeTIKNjDqzHBOyXiHkjBKbcgXdN++UUNh05RPEQl8vZ/oDp/o5OOLhPUKH8qYp1qL0kb0dmKtJaBuazhacnRD3siqS+15EohiHQ==;24:lWH+fj+Jlr1BiuG4a0EA+rAjhmGL0J4wgt5Pvt2Jat+iuGeAY1XbCNZSKk7IQkqDUnS1epo5g0KqbDzTSd8+Pg5eQJ3gFTmIJrBgz05t8NE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR02MB2262;7:+HNQADs9k0j4SLd9Icsvm/iMRBZH+Rv4eBa/LISNTAMRzZrrN151kedwMiwA1wHtoIZ7xzHm8fZkofk30Pc5KvYb0XtW51w0DcZkC5+fopAHFWrq7LaTj+Ex9/pracapKPcDJYvIIuP+IQndJFxLcOvjl+yIImIL33jCNigndNr/LkPn8qggBdH0nuXh6gZuHTDxtyKFDftesQT0r8u1+mQXhplxuhTbjtzwHq1n6zyqhd6V3HsqHKqUJED8Kg6sUyo5LUmellZ0rMAF1XPk4CHz6xAtQM7Qc4EixbdGI7ci+3lli8t+1l2Kes4CDjUerq1itgxugJhIIREY9CoVn1enK6c8NNyeXfbIcSsQ/UJR7XWgUMsWBPQG6wnJcP4sw2faWDTQEkMW1jv/YdVPbiLPabQLPzTv06hzBdoSB+R9l6xjfDs5zJjk+NTc7pIjbuuxzEqmYkGNj/Ft8v0jGw== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2016 19:09:44.7870 (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: CY4PR02MB2262 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 quoted-printable to 8bit by mail.home.local id uBFJ9xUE030343 Content-Length: 2890 Lines: 101 Hi Jose Miguel Abreu, Thanks for the review.... > > - last = segment; > > + for (j = 0; j < chan->num_frms; ) { > > + list_for_each_entry(segment, &desc->segments, node) > { > > + if (chan->ext_addr) > > + vdma_desc_write_64(chan, > > + > XILINX_VDMA_REG_START_ADDRESS_64(i++), > > + segment->hw.buf_addr, > > + segment->hw.buf_addr_msb); > > + else > > + vdma_desc_write(chan, > > + > XILINX_VDMA_REG_START_ADDRESS(i++), > > + segment->hw.buf_addr); > > + > > + last = segment; > > Hmm, is it possible to submit more than one segment? If so, then i and j will get > out of sync. If h/w is configured for more than 1 frame buffer and user submits more than one frame buffer We can submit more than one frame/ segment to hw right?? > > > + } > > + list_del(&desc->node); > > + list_add_tail(&desc->node, &chan->active_list); > > + j++; > > But if i is non zero and pending_list has more than num_frms then i will not > wrap-around as it should and will write to invalid framebuffer location, right? Yep will fix in v2... If (if (list_empty(&chan->pending_list)) || (i == chan->num_frms) break; Above condition is sufficient right??? > > > + if (list_empty(&chan->pending_list)) > > + break; > > + desc = list_first_entry(&chan->pending_list, > > + struct > xilinx_dma_tx_descriptor, > > + node); > > } > > > > if (!last) > > @@ -1114,14 +1124,13 @@ static void xilinx_vdma_start_transfer(struct > xilinx_dma_chan *chan) > > vdma_desc_write(chan, XILINX_DMA_REG_FRMDLY_STRIDE, > > last->hw.stride); > > vdma_desc_write(chan, XILINX_DMA_REG_VSIZE, last- > >hw.vsize); > > Maybe a check that all framebuffers contain valid addresses should be done > before programming vsize so that VDMA does not try to write to invalid > addresses. Do we really need to check for valid address??? I didn't get you what to do you mean by invalid address could you please explain??? In the driver we are reading form the pending_list which will be updated by pep_interleaved_dma Call so we are under assumption that user sends the proper address right??? > > > + > > + chan->desc_submitcount += j; > > + chan->desc_pendingcount -= j; > > } > > > > chan->idle = false; > > if (!chan->has_sg) { > > - list_del(&desc->node); > > - list_add_tail(&desc->node, &chan->active_list); > > - chan->desc_submitcount++; > > - chan->desc_pendingcount--; > > if (chan->desc_submitcount == chan->num_frms) > > chan->desc_submitcount = 0; > > "desc_submitcount >= chan->num_frms would be safer here. Sure will fix in v2... Regards, Kedar. > > > } else { > > Best regards, > Jose Miguel Abreu > -- > To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body > of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html