[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100509223623X.fujita.tomonori@lab.ntt.co.jp>
Date: Sun, 9 May 2010 22:41:15 +0900
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To: konrad.wilk@...cle.com
Cc: fujita.tomonori@....ntt.co.jp, linux-kernel@...r.kernel.org,
iommu@...ts.linux-foundation.org, albert_herranz@...oo.es,
linux@...elenboom.it, chrisw@...s-sol.org,
Ian.Campbell@...citrix.com, jeremy@...p.org, dwmw2@...radead.org,
alex.williamson@...com
Subject: Re: [PATCH 2/6] swiotlb: swiotlb_tbl_map_single: abstract out
swiotlb_virt_to_bus calls out.
On Wed, 7 Apr 2010 16:29:26 -0400
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com> wrote:
> We want to move that function out of swiotlb_tbl_map_single so that the caller
> of this function does the virt->phys->bus address translation.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> ---
> lib/swiotlb.c | 22 ++++++++++++++--------
> 1 files changed, 14 insertions(+), 8 deletions(-)
It would be better to do something like that instead of spreading
swiotlb_virt_to_bus()?
=
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Subject: [PATCH] swiotlb: add swiotlb_tlb_map_single library function
swiotlb_tlb_map_single() takes the dma address of iotlb instead of
using swiotlb_virt_to_bus().
Signed-off-by: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
---
lib/swiotlb.c | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index a37ee04..58f489a 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -373,25 +373,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_tlb_map_single(struct device *hwdev, u64 tlb_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;
+ tlb_dma_addr &= mask;
+
+ offset_slots = ALIGN(tlb_dma_addr, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
/*
* Carefully handle integer overflow which can occur when mask == ~0UL.
@@ -480,6 +477,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_tlb_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.5
--
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