[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1277235772-26757-18-git-send-email-konrad.wilk@oracle.com>
Date: Tue, 22 Jun 2010 15:42:50 -0400
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: linux-kernel@...r.kernel.org, fujita.tomonori@....ntt.co.jp,
iommu@...ts.linux-foundation.org, albert_herranz@...oo.es,
x86@...nel.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Subject: [PATCH 17/19] swiotlb-xen: Coalesce usage of xen_swiotlb_map.
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@...cle.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists