mirror of https://lore.kernel.org/lkml/
 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: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3efb10970712070724i6fa66666t2b8422329759ce24@mail.gmail.com>
     [not found] ` <Pine.LNX.4.58.0712121606241.23712@gandalf.stny.rr.com>
     [not found]   ` <3efb10970712121429l7b41d57md4f826f6aaf4b71@mail.gmail.com>
     [not found]     ` <3efb10970712130840r7a2c5f72jca641d1cac545464@mail.gmail.com>
     [not found]       ` <cd73a99e0712130933s6f601ef7sed90f48c08d9adaa@mail.gmail.com>
     [not found]         ` <3efb10970712131232j5f747420g4aa8b5bd956e3dd3@mail.gmail.com>
     [not found]           ` <3efb10970712131235t47a9ceb5y7d9a7d5023d07bf6@mail.gmail.com>
     [not found]             ` <3efb10970712140346l1845d563k900d72d8788ac6f5@mail.gmail.com>
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]                       ` <cd73a99e0712180208x73eb1095qbea96f1a9746298b@mail.gmail.com>
2007-12-18 10:29                         ` Haavard Skinnemoen
2007-12-18 11:53                           ` 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

all inboxes | Powered by JetHome®