linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: "Remy Bohmer" <linux@bohmer.net>
Cc: "Andrew Victor" <linux@maxim.org.za>,
	RT <linux-rt-users@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	ARM Linux Mailing List <linux-arm-kernel@lists.arm.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH]: Atmel Serial Console interrupt handler splitup
Date: Mon, 17 Dec 2007 19:13:02 +0100	[thread overview]
Message-ID: <20071217191302.7385f8cc@dhcp-252-066.norway.atmel.com> (raw)
In-Reply-To: <20071217131701.6b2cdf2c@dhcp-252-066.norway.atmel.com>

On Mon, 17 Dec 2007 13:17:01 +0100
Haavard Skinnemoen <hskinnemoen@atmel.com> wrote:

> > 3) NEW: optional:  add-atmel-serial-dma.patch, this merged the DMA
> > code (from Chip Coldwell) in your 2.6.23 patch back on top of this
> > series. Because the AT32 bug is not been fixed for a very long time, I
> > do not expect it to be fixed soon, so I think a reordering is better
> > to make preempt-RT work on AT91.  
> 
> I'll give it a shot, but first I have some comments on your other
> patches.

I found a bug. The RX DMA buffer isn't invalidated before it's handed
over to the hardware. With the below patch, it seems to behave a lot
better on AVR32, but it still does funny things now and then (it seems
to dump a good chunk of stale TX data before rebooting), and magic sysrq
doesn't work.

I think I've spotted other potential races in the DMA code as well, but
they look a bit more difficult to hunt down. I'll give it another try
tomorrow.

Haavard

From: Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [PATCH] atmel_serial: Sync DMA RX buffer after copying from it

Calling dma_sync_single_for_cpu() before reading the buffer isn't
enough. We need to call dma_sync_single_for_device() after we're done
reading as well.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 drivers/serial/atmel_serial.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 0610ad9..e23a3ba 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -391,6 +391,8 @@ static void atmel_pdc_endrx(struct uart_port *port)
 		tty_insert_flip_string(tty, pdc->buf + pdc->ofs, count);
 		tty_flip_buffer_push(tty);
 
+		dma_sync_single_for_device(port->dev, pdc->dma_addr,
+				pdc->dma_size, DMA_FROM_DEVICE);
 		port->icount.rx += count;
 	}
 
@@ -425,6 +427,8 @@ static void atmel_pdc_timeout(struct uart_port *port)
 		tty_insert_flip_string(tty, pdc->buf + pdc->ofs, count);
 		tty_flip_buffer_push(tty);
 
+		dma_sync_single_for_device(port->dev, pdc->dma_addr,
+				pdc->dma_size, DMA_FROM_DEVICE);
 		pdc->ofs = ofs;
 		port->icount.rx += count;
 	}
-- 
1.5.3.4

  reply	other threads:[~2007-12-17 18:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-07 15:24 [PATCH]: Atmel Serial Console interrupt handler splitup Remy Bohmer
2007-12-07 18:31 ` David Brownell
2007-12-07 19:57 ` Andrew Victor
2007-12-07 20:38   ` Remy Bohmer
2007-12-07 21:16     ` Remy Bohmer
2007-12-12 21:10 ` Steven Rostedt
2007-12-12 22:29   ` Remy Bohmer
2007-12-13 16:40     ` Remy Bohmer
2007-12-13 17:33       ` Andrew Victor
2007-12-13 20:32         ` Remy Bohmer
2007-12-13 20:35           ` Remy Bohmer
2007-12-14 11:46             ` Remy Bohmer
2007-12-17 12:17               ` Haavard Skinnemoen
2007-12-17 18:13                 ` Haavard Skinnemoen [this message]
2007-12-17 20:56                 ` Remy Bohmer
2007-12-17 23:12                   ` Haavard Skinnemoen
2007-12-18  7:32                     ` Remy Bohmer
2007-12-17 23:49                   ` Russell King - ARM Linux
2007-12-18  9:07                     ` Haavard Skinnemoen
     [not found] <AANLkTi=TyvXEtoZGatP5pxymLSna9g6ULV46i72bYgc4@mail.gmail.com>
2010-10-29 13:52 ` Remy Bohmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071217191302.7385f8cc@dhcp-252-066.norway.atmel.com \
    --to=hskinnemoen@atmel.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=linux@bohmer.net \
    --cc=linux@maxim.org.za \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).