public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarod Wilson <jwilson@redhat.com>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] firewire: fw-ohci: sync AT dma buffer before use
Date: Wed, 12 Mar 2008 17:43:29 -0400	[thread overview]
Message-ID: <200803121743.29438.jwilson@redhat.com> (raw)

Per DMA API docs, when using dma_map_single(), DMA_TO_DEVICE synchronization
must be done after the last modification of the memory region by software
before it can be handed off to the device and safely read. Such a sync is
currently missing from firewire_ohci:at_context_queue_packet().

At least on my setup, where I could within seconds reliably reproduce a panic
in handle_at_packet() by simply dd'ing from two drives on different controllers,
the panic is gone.

See http://bugzilla.kernel.org/show_bug.cgi?id=9617

Signed-off-by: Jarod Wilson <jwilson@redhat.com>

---

 drivers/firewire/fw-ohci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index 081a434..fc45868 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -780,6 +780,10 @@ at_context_queue_packet(struct context *ctx, struct fw_packet *packet)
 
 	context_append(ctx, d, z, 4 - z);
 
+	/* Sync the DMA buffer up for the device to read from */
+	dma_sync_single_for_device(ohci->card.device, payload_bus,
+				   packet->payload_length, DMA_TO_DEVICE);
+
 	/* If the context isn't already running, start it up. */
 	reg = reg_read(ctx->ohci, CONTROL_SET(ctx->regs));
 	if ((reg & CONTEXT_RUN) == 0)

-- 
Jarod Wilson
jwilson@redhat.com

             reply	other threads:[~2008-03-12 21:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 21:43 Jarod Wilson [this message]
2008-03-12 22:35 ` [PATCH] firewire: fw-ohci: sync AT dma buffer before use David Moore
2008-03-12 23:24   ` Stefan Richter
2008-03-12 23:16 ` Stefan Richter
2008-03-13  1:11   ` Jarod Wilson
2008-03-13  8:49     ` Stefan Richter
2008-03-14 18:26       ` Jarod Wilson

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=200803121743.29438.jwilson@redhat.com \
    --to=jwilson@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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