lkml.org 
[lkml]   [2008]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] firewire: fw-ohci: sync AT dma buffer before use
From
Date
On Wed, 2008-03-12 at 17:43 -0400, Jarod Wilson wrote:
> 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)
>

Two things:

1. The dma_sync should probably be done before the context_append
because the controller could in theory start reading the data as soon as
context_append is called right?

2. As an optimization, we should attempt to allocate the payload in the
lower 32-bits of physical memory, to prevent extra memcopies on x86_64.
I think this can be done by adding GFP_DMA32 to kmalloc where the
payload was allocated in fw-cdev.c. There might be other places where
we would benefit from GFP_DMA32 also. Of course, these optimizations
are probably better saved for another patch.

-David



\
 
 \ /
  Last update: 2008-03-12 23:39    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site