lkml.org 
[lkml]   [2010]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 17/19] swiotlb-xen: Coalesce usage of xen_swiotlb_map.
    Date
    We don't use the 'struct device' anymore, and the xen_swiotlb_map ended
    up just passing on the values and recomputing the same value
    (start_dma_addr) every time - so now we do it only once.

    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    ---
    lib/swiotlb-xen.c | 23 +++++++++++------------
    1 files changed, 11 insertions(+), 12 deletions(-)

    diff --git a/lib/swiotlb-xen.c b/lib/swiotlb-xen.c
    index 12e9dcd..b15f85c 100644
    --- a/lib/swiotlb-xen.c
    +++ b/lib/swiotlb-xen.c
    @@ -46,6 +46,11 @@

    static char *xen_io_tlb_start, *xen_io_tlb_end;
    static unsigned long xen_io_tlb_nslabs;
    +/*
    + * Quick lookup value of the bus address of the IOTLB.
    + */
    +
    +u64 start_dma_addr;

    static dma_addr_t xen_phys_to_bus(phys_addr_t paddr)
    {
    @@ -110,15 +115,6 @@ static int is_xen_swiotlb_buffer(dma_addr_t dma_addr)
    return 0;
    }

    -static void *
    -xen_map_single(struct device *hwdev, phys_addr_t phys, size_t size,
    - enum dma_data_direction dir)
    -{
    - u64 start_dma_addr = xen_virt_to_bus(xen_io_tlb_start);
    -
    - return swiotlb_tbl_map_single(hwdev, start_dma_addr, phys, size, dir);
    -}
    -
    static int max_dma_bits = 32;

    static int
    @@ -174,6 +170,7 @@ void __init xen_swiotlb_init(int verbose)
    if (rc)
    goto error;

    + start_dma_addr = xen_virt_to_bus(xen_io_tlb_start);
    swiotlb_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs, verbose);

    return;
    @@ -266,7 +263,7 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
    /*
    * Oh well, have to allocate and map a bounce buffer.
    */
    - map = xen_map_single(dev, phys, size, dir);
    + map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir);
    if (!map)
    return DMA_ERROR_CODE;

    @@ -404,8 +401,10 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
    if (swiotlb_force ||
    !dma_capable(hwdev, dev_addr, sg->length) ||
    range_straddles_page_boundary(paddr, sg->length)) {
    - void *map = xen_map_single(hwdev, sg_phys(sg),
    - sg->length, dir);
    + void *map = swiotlb_tbl_map_single(hwdev,
    + start_dma_addr,
    + sg_phys(sg),
    + sg->length, dir);
    if (!map) {
    /* Don't panic here, we expect map_sg users
    to do proper error handling. */
    --
    1.7.0.1


    \
     
     \ /
      Last update: 2010-06-22 21:47    [W:0.022 / U:30.116 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site