Re: query about dma_sync_*_for_cpu and direction=TO_DEVICE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 14, 2009 at 8:32 AM, Vineet Gupta <vineetg76@xxxxxxxxx> wrote:
> Hi,
>
> I've read dma mapping and dma-api kernel documentation as well as the
> DMA API change at http://lwn.net/Articles/75780/ which describes fork
> of dma_sync_* to dma_sync_*_for_cpu and dma_sync_*_for_device.
>
> It seems the names of API are self explanatory and direction parameter
> is not needed (except for handling BIDIRECTIONAL case).
> So for e.g. If software wants to access the dma buffer, post DMA,  it
> will invoke dma_sync_single_for_cpu so that non-coherent arch can
> invalidate the corresponding cache lines. This implies FROM_DEVICE
> semantics. Does that mean dma_sync_single_for_cpu invoked with
> direction = TO_DEVICE should return error.

drivers/ieee1394/sbp2.c:

static int sbp2_create_command_orb(struct sbp2_lu *lu,
                                   struct sbp2_command_info *cmd,
                                   struct scsi_cmnd *SCpnt)
{
        dma_sync_single_for_cpu(dmadev, cmd->command_orb_dma,
                                sizeof(struct sbp2_command_orb), DMA_TO_DEVICE);

???
> Corollary case is when dma_sync_single_for_device is invoked with
> direction = FROM_DEVICE, is tha error too (buggy driver).
>
> The architecture for which I'm implementing DMA coherency APIs has
> non-coherent DMA memory and logical-to-bus mapping / DMA bounce is not
> a issue.
>
> Thanks,
> Vineet
>


-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux