lkml.org 
[lkml]   [2019]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v6 5/8] iommu: Add bounce page APIs
    From
    Date
    Hi Joerg,

    On 8/15/19 11:48 PM, Joerg Roedel wrote:
    > On Thu, Aug 15, 2019 at 02:15:32PM +0800, Lu Baolu wrote:
    >> iommu_map/unmap() APIs haven't parameters for dma direction and
    >> attributions. These parameters are elementary for DMA APIs. Say,
    >> after map, if the dma direction is TO_DEVICE and a bounce buffer is
    >> used, we must sync the data from the original dma buffer to the bounce
    >> buffer; In the opposite direction, if dma is FROM_DEVICE, before unmap,
    >> we need to sync the data from the bounce buffer onto the original
    >> buffer.
    >
    > The DMA direction from DMA-API maps to the protections in iommu_map():
    >
    > DMA_FROM_DEVICE: IOMMU_WRITE
    > DMA_TO_DEVICE: IOMMU_READ
    > DMA_BIDIRECTIONAL IOMMU_READ | IOMMU_WRITE
    >
    > And for the sync DMA-API also has separate functions for either
    > direction. So I don't see why these extra functions are needed in the
    > IOMMU-API.
    >

    Okay. I understand that adding these APIs in iommu.c is not a good idea.
    And, I also don't think merging the bounce buffer implementation into
    iommu_map() is feasible since iommu_map() is not DMA API centric.

    The bounce buffer implementation will eventually be part of DMA APIs
    defined in dma-iommu.c, but currently those APIs are not ready for x86
    use yet. So I will put them in iommu/vt-d driver for this time being and
    will move them to dma-iommu.c later.

    Does this work for you?

    Best regards,
    Lu Baolu

    \
     
     \ /
      Last update: 2019-08-16 04:47    [W:4.013 / U:0.048 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site