Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753227AbcJJPv0 (ORCPT ); Mon, 10 Oct 2016 11:51:26 -0400 Received: from mail-db5eur01on0116.outbound.protection.outlook.com ([104.47.2.116]:48784 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751392AbcJJPvZ (ORCPT ); Mon, 10 Oct 2016 11:51:25 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=bhuvanchandra.dv@toradex.com; Subject: Re: [PATCH] tty: serial: fsl_lpuart: Fix Tx DMA edge case To: Aaron Brice , , , References: <1475791984-17705-1-git-send-email-aaron.brice@datasoft.com> CC: , , From: Bhuvanchandra DV Message-ID: <6d198918-c5a8-45e6-a2a8-5af5de61abce@toradex.com> Date: Mon, 10 Oct 2016 16:42:13 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1475791984-17705-1-git-send-email-aaron.brice@datasoft.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [115.115.243.34] X-ClientProxiedBy: HK2PR0101CA0017.apcprd01.prod.exchangelabs.com (10.167.64.27) To HE1PR05MB1403.eurprd05.prod.outlook.com (10.162.251.13) X-MS-Office365-Filtering-Correlation-Id: 4c3be912-9cf8-41f9-eee0-08d3f0fea549 X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1403;2:64XI/X9zo2S8csizWLu5IEJ8beXREn+CG139AgHjJ0ocqteM2AXgvKqNQfEr3rfrCDnRxaWuPaQCH6xMEwGobAjhP4Uul3vfzI+goo3q5P78oBuwcJe5Z5EyQNaEkfkXj3BfaTy9J8pY8BdfbrYuvZcZTsbxA0l0WoIg2DtNPl87yTN4CXgbR5K7e7tnHc0mWXk76wT/1dz8aIhdKv55Jw==;3:mtz87RG2A5sRbaGyPlYy8UmAIbxnNRw8+lN3PaDYRPujLiHEkkYhQgxpkzhH2r4AXeKHAWelex9SjyWsPsctp1AQWOF7R5hTO8xWtsZESYBUHOAPzWiaeFj/xKsAFowV+4bkHr0NMe1aRqPVq/n48w== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR05MB1403; X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1403;25:Ic8hqRjc//JeoMYqg2o9iHJrSMFZWFKpI7Wt1Krk14tBPrwJt9shJN1WynMSXM2LXxrFlUixZKkALk3YOZsuwutR5pkSv+yKY92SXMpvBQNge5Ws4cH9fJPd2R53e9juctZms/HfW65WEXv+zcYmy40Pg71+ad8oTZvWemQgJoCQ9AQCnIm1En1YtbWkn4aoFToidPLzl9jSE4UWNWmKJJ+lS3VAWN/sQLsDbfd+eRSwYnTARyZl1iMmPXtNygKx+Z5pW5XZc0iPzWv6NE1gBaqHFI7Z9aDrDthrqfLZTMu9ACAZGVcZoDVxMECLWG9uSMsUPsLk9Wzd4DjVhGz35xxOI3xYW469GgQH103C6I4N5/XMl467sfuhyiM5IThMMGT2YGA/I4aVKzzeQydjEGtcCCj93rXbL4EVWbsjAMvvBVSneX5J0yFseOjrWZ48lyJZf97kMUwE5ermwoRkF9+kt/RwgV6U9LCZXDjr6xXeRMzxRkAhAw7fh9enPqqmnPaDLItJJbmb/koNqCANQjwDoJlBkYy/xLr2mLIy7sqCQ9El6O63xpTpNKiQpX8VyLByEZ1x6piK9B0Wq9XCAD2XbvgZzmvl2Mk2ZFPSaA6G4RNQXqzDEl4jnuxVb3nLgT+aNRObLB0eVrRPK4kpuiXYlFfoShuuQKby8zCPv2OanQrcekxtuMuacGzZ40GuIhKCve2fhgfCFPAQieuxkW7JelMPs4A9FkWrqtsmrHgZwCF3MNs5dkU9KQyuzGny5cqOSDKVSfLl9/JQm0opeg== X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1403;31:1ycSP4rEmLUjLbJEpwsnyx0SPu6YJ129apqDmAn3ZiPx4N1PGK00/QOncSXKOSjjRxQe2wKQen4qOe+dHi5uTwZy7BYCCq20Xe7Z6d86iBnXPUI9mdKMPGjztlkhdMgXTMUrr9bLuZKifpvpugRDu7qgwGba20gIRmDNTMGy0CkNhXKSmb7J2O1627L5Av/KEI9gHp3XpQbOgR1UYOWFAwJGmYiXnzHf0NIc/2ACNIn0xPNGgwkoSBgWjuwwDiwBDdKuxYL1ce/0zzysoQ5ZOQ==;20:oI8dEVlC6TrQ7D2HG3V3fFF0bdiVYO6De8x23GCE/T/lAGo8YIYNL6oCGHrtSLmnj6Mp1pytIaBjhyWNEDY4WE4bOkxP49OhlhAQ3uvqUZzmLdYVhB6fv3AxI9oPB6BBpK1oBzKMe/M5dOu2cqDBSv9kWjeyI/o2czQAXmM3PJNstP1Mf6rCtmZ1wm6NxVu7715WE2yOrJThlSxtcFgFHfDUEiOen9YRzDJ+zrVYHhh81JVqMB2YXA+FkVMqSc8hCLICnMPpb504Nd+EYNeAANHVfkzQ1WXzmTh+h0y4k0gAffd7IJp299bm25H6/T9NDpi8uetYf8kAwnFJhDsZrg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046);SRVR:HE1PR05MB1403;BCL:0;PCL:0;RULEID:;SRVR:HE1PR05MB1403; X-Microsoft-Exchange-Diagnostics: 1;HE1PR05MB1403;4:heAOUSMyo/jGZKx8UgyNIueywGlxecQr8C54EebYwblLyS0atExcXxL278tx1DZK9+i7oWSMEAyTDVoV0Nqb6VDGTF/Yp9RjjQwGSfthz5l+4e2CZ+9f4SfSBGNhcm4Elb+Ckmnaf1kMc3M4qqlLvIMsGahaCVw9MTwXLOLKWwsDvz2VYzqeENXMoxtTQjsoMJMhZB8iRqlmsvnB1PYhn8JyMItdwHOc9x13ZyLTGYZGU8p+eiBo0U/G32bmm7ZclVmlXwC18dXGMdcjZGyh2fu5LYyHKhRgGKqdQMNTCtmEmcitg1xeAnHp3edJTiSZvd55BMtDUFMAtPCiRPnLazMbQIv0SQoiJSsO/1Trf2Rn/bpToyovecTe8csfncH3HW8nvW8c28E4clbHtL4q/A== X-Forefront-PRVS: 0091C8F1EB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(6049001)(7916002)(189002)(199003)(24454002)(42186005)(68736007)(19580395003)(97736004)(101416001)(586003)(4001350100001)(106356001)(105586002)(3846002)(6116002)(54356999)(76176999)(31686004)(65956001)(66066001)(92566002)(189998001)(50986999)(305945005)(19580405001)(65806001)(47776003)(23746002)(7736002)(7846002)(50466002)(5001770100001)(5660300001)(230700001)(65826007)(64126003)(81166006)(83506001)(2201001)(81156014)(4326007)(36756003)(2950100002)(77096005)(31696002)(86362001)(6666003)(8676002)(2906002)(33646002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR05MB1403;H:[10.18.0.138];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;HE1PR05MB1403;23:iRMPs8jB0WepiXs3FG0Qs2n7t4siGKQlNWwrH?= =?Windows-1252?Q?EP2GpC7/zLnzLf4eEofR9mBEs2bFKYB+c7caTIXs4cIcW9K0+PTMHyJM?= =?Windows-1252?Q?LZPgBbm8xtVv/S0xK038CK+YisQ7NbEefEgVJYpzZtptyN5QNOViMylw?= =?Windows-1252?Q?K8MIdMa+9MVd9wXcWdlvnvbkU4WzIqU3deCC7uj/FepvIuTrrfRPKT3z?= =?Windows-1252?Q?Ih4oxiK39PZh6Q8ml671OwgLs6hJ9pZKW8XzODK7wVX07XHOqfdzASmL?= =?Windows-1252?Q?vY+Jjg6UCgVJvSksqIuCFGrIn9Qb9gpiwNVeF9PdC8J4No3QzlAsEyxd?= =?Windows-1252?Q?OxlWRYyzUm2sp8r8Q+rQDKV4WOOhUiyBW02m0stUr/prcxyUltlAe7L7?= =?Windows-1252?Q?3VSDszHb8rsCgAKE9qkg4M9O0I7+UBOeI8l3C5HMGnkFf02fw/QuHXlA?= =?Windows-1252?Q?j0sh02OXpu24BRYkKys5FU098DI3oXnhkJdDd6yaqZwxiBoU7Tc3yPuD?= =?Windows-1252?Q?RSYCymZ4bJ2OissD9dqBudxMJrNJyOO49WCOt2Iu7XEWsqXe0gg5zKZg?= =?Windows-1252?Q?PwiibdEcO/E9gv4XkgxOVwVTc2CUkUZ4EXnZV+wIx4NSoigWvXbXmhso?= =?Windows-1252?Q?1xF5P4Jy1OvyVWY+hcmYRV/Zz43KGF8mRBZoiHjexOdrMEkeZDOeo8gz?= =?Windows-1252?Q?o1ns+5ClwNCuka03Rb/nA2Rc59l4JoxGE9N7AwwEyTzwhzOaCz48mNeF?= =?Windows-1252?Q?6d4n2uRC86ONHNoVb9dnL33mUmXcD9g1w7DGIuLprq8aiZRgmDdyU6oK?= =?Windows-1252?Q?/7A646Q9s76BGfpaSFTUv9XO+rWUBeBfxxQ5wzbfXC2FDeTKimX1XrzC?= =?Windows-1252?Q?qY0Qjvt8UKrQHg8dozATUElV36eTogblf7BJR012nhEn9HylpWWOBKjG?= =?Windows-1252?Q?3a5ol7O2Im4qqLe0SvXtLoDEvEV3hyOqTbcVQQv5TUHzeIUh6wOSrQqh?= =?Windows-1252?Q?e60+uL3xW4M2z1pkwie1FZSWy1pbHTng1vKWL+kV4KXNwoVtULykz+Sr?= =?Windows-1252?Q?9bcj5BOGO6ECgWctPRfbHXNyTy8qPjTyhvi+UBgftazBCyaiORUtfIl6?= =?Windows-1252?Q?Gfn6Z3hnnc7E/gEI0n62Z81cd7YOe13oaHHb+S3kc0BPTzOoN4I8vw07?= =?Windows-1252?Q?5k7ye/wx+l6WWDC4pbDCokEE+dwnz0mjYWtBCvPpk+m8yGUNLBfkpXL2?= =?Windows-1252?Q?dQVLvfQDI7A8VslyurcihV8qIFhkTN4N2qj/50PBrJSfaOCl/WSupYJ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vUUgNSKumFjjKOX2GIDoAeDDTl+hazONp2CzkJTKL9F2c+Z+YTeY/dH60gdYpTFO9xcv6WnMgSQeG8wGP2f2cvM0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2016 11:14:43.6381 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR05MB1403 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1287 Lines: 35 On 10/07/16 03:43, Aaron Brice wrote: > In the case where head == 0 on the circular buffer, there should be one > DMA buffer, not two. The second zero-length buffer would break the > lpuart driver, transfer would never complete. Tested-by: Bhuvanchandra DV > > Signed-off-by: Aaron Brice > --- > drivers/tty/serial/fsl_lpuart.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c > index de9d510..76103f2 100644 > --- a/drivers/tty/serial/fsl_lpuart.c > +++ b/drivers/tty/serial/fsl_lpuart.c > @@ -328,7 +328,7 @@ static void lpuart_dma_tx(struct lpuart_port *sport) > > sport->dma_tx_bytes = uart_circ_chars_pending(xmit); > > - if (xmit->tail < xmit->head) { > + if (xmit->tail < xmit->head || xmit->head == 0) { > sport->dma_tx_nents = 1; > sg_init_one(sgl, xmit->buf + xmit->tail, sport->dma_tx_bytes); > } else { > @@ -359,7 +359,6 @@ static void lpuart_dma_tx(struct lpuart_port *sport) > sport->dma_tx_in_progress = true; > sport->dma_tx_cookie = dmaengine_submit(sport->dma_tx_desc); > dma_async_issue_pending(sport->dma_tx_chan); > - > } > > static void lpuart_dma_tx_complete(void *arg)