lkml.org 
[lkml]   [2010]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/6] swiotlb: add swiotlb_tbl_map_single library function
    Date
    From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

    swiotlb_tbl_map_single() takes the dma address of iotlb instead of
    using swiotlb_virt_to_bus().

    [v2: changed swiotlb_tlb to swiotlb_tbl]

    Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
    Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    ---
    lib/swiotlb.c | 25 +++++++++++++++++--------
    1 files changed, 17 insertions(+), 8 deletions(-)

    diff --git a/lib/swiotlb.c b/lib/swiotlb.c
    index 5fddf72..cb83d54 100644
    --- a/lib/swiotlb.c
    +++ b/lib/swiotlb.c
    @@ -361,25 +361,22 @@ static void swiotlb_bounce(phys_addr_t phys, char *dma_addr, size_t size,
    }
    }

    -/*
    - * Allocates bounce buffer and returns its kernel virtual address.
    - */
    -static void *
    -map_single(struct device *hwdev, phys_addr_t phys, size_t size, int dir)
    +void *swiotlb_tbl_map_single(struct device *hwdev, u64 tbl_dma_addr,
    + phys_addr_t phys, size_t size, int dir)
    {
    unsigned long flags;
    char *dma_addr;
    unsigned int nslots, stride, index, wrap;
    int i;
    - unsigned long start_dma_addr;
    unsigned long mask;
    unsigned long offset_slots;
    unsigned long max_slots;

    mask = dma_get_seg_boundary(hwdev);
    - start_dma_addr = swiotlb_virt_to_bus(hwdev, io_tlb_start) & mask;

    - offset_slots = ALIGN(start_dma_addr, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
    + tbl_dma_addr &= mask;
    +
    + offset_slots = ALIGN(tbl_dma_addr, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;

    /*
    * Carefully handle integer overflow which can occur when mask == ~0UL.
    @@ -468,6 +465,18 @@ found:
    }

    /*
    + * Allocates bounce buffer and returns its kernel virtual address.
    + */
    +
    +static void *
    +map_single(struct device *hwdev, phys_addr_t phys, size_t size, int dir)
    +{
    + u64 start_dma_addr = swiotlb_virt_to_bus(hwdev, io_tlb_start);
    +
    + return swiotlb_tbl_map_single(hwdev, start_dma_addr, phys, size, dir);
    +}
    +
    +/*
    * dma_addr is the kernel virtual address of the bounce buffer to unmap.
    */
    static void
    --
    1.6.2.5


    \
     
     \ /
      Last update: 2010-05-12 10:15    [W:0.024 / U:1.088 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site