Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759255AbcDHXVG (ORCPT ); Fri, 8 Apr 2016 19:21:06 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:35292 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759075AbcDHXVE (ORCPT ); Fri, 8 Apr 2016 19:21:04 -0400 Subject: Re: [PATCH v1 06/12] serial: 8250_dma: stop ongoing RX DMA on exception To: Andy Shevchenko References: <1460061433-63750-1-git-send-email-andriy.shevchenko@linux.intel.com> <1460061433-63750-7-git-send-email-andriy.shevchenko@linux.intel.com> <5706F325.6090001@hurleysoftware.com> Cc: Andy Shevchenko , Vinod Koul , "linux-kernel@vger.kernel.org" , dmaengine , Greg Kroah-Hartman , "Puustinen, Ismo" , Heikki Krogerus , "linux-serial@vger.kernel.org" From: Peter Hurley Message-ID: <57083CDA.4090709@hurleysoftware.com> Date: Fri, 8 Apr 2016 16:20:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2048 Lines: 52 On 04/08/2016 01:07 AM, Andy Shevchenko wrote: > On Fri, Apr 8, 2016 at 2:54 AM, Peter Hurley wrote: >> On 04/07/2016 01:37 PM, Andy Shevchenko wrote: >>> If we get an exeption interrupt. i.e. UART_IIR_RLSI, stop any ongoing RX DMA >>> transfer otherwise it might generates more spurious interrupts and make port >>> unavailable anymore. >> >> Then how to know which rx byte the error is for if dma continues anyway? >> What if there are multiple error bytes? > > And how should it work? > We get an interrupt during DMA, if we don't stop DMA it will be racy > with direct readings. It makes sense to me that the ongoing DMA needs paused, flushed & terminated, but the UART should have already aborted the DMA at the first error byte, so it doesn't make sense to me that the DMA hardware went sideways. Have you verified that the actual byte in error is reported as the frame/parity byte and that error-free data is unmangled? Like with a data pattern and a logic analyzer? >> >> >>> As has been seen on Intel Broxton system: >> >> This system shouldn't be setup for UART DMA imo. > > Same approach is done in 8250_omap. Well, omap8250 has totally different (and possibly unnecessary) rx dma flow. During the development of the omap8250 driver, it was discovered that the normal 8250 rx dma flow didn't work reliably on OMAP; ie., the rx dma wouldn't start once rx uart interrupt had already happened. *So omap8250 sets up rx dma before any data has been received* That's the dma that is cancelled when an RLSI interrupt is received; on OMAP the residue is always 0. Well, it turns out that the omap8250 rx dma flow *may* be limited to only 1 specific design, the am335x, which has a bunch of other dma issues, with both tx and rx dma. So all that omap8250 dma handling might be going away anyway. IOW, omap8250 is a terrible dma model; do not use. [Granted the current model needs some work as well; eg., using ping-pong dma buffers to weather dmaengine descriptor completion latency). Regards, Peter Hurley