From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: fujita.tomonori@lab.ntt.co.jp, linux-kernel@vger.kernel.org,
iommu@lists.linux-foundation.org
Cc: albert_herranz@yahoo.es, chrisw@sous-sol.org,
Ian.Campbell@eu.citrix.com, jeremy@goop.org, dwmw2@infradead.org
Subject: [PATCH 1/6] swiotlb: add swiotlb_tbl_map_single library function
Date: Tue, 11 May 2010 11:39:08 -0400 [thread overview]
Message-ID: <1273592353-23224-2-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1273592353-23224-1-git-send-email-konrad.wilk@oracle.com>
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
next prev parent reply other threads:[~2010-05-11 15:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-11 15:39 [PATCH] swiotlb v0.8: seperation of physical/virtual address translation Konrad Rzeszutek Wilk
2010-05-11 15:39 ` Konrad Rzeszutek Wilk [this message]
2010-05-11 15:39 ` [PATCH 2/6] swiotlb: add the swiotlb initialization function with iotlb memory Konrad Rzeszutek Wilk
2010-05-11 15:39 ` [PATCH 3/6] swiotlb: Make internal bookkeeping functions have 'swiotlb_tbl' prefix Konrad Rzeszutek Wilk
2010-05-11 15:39 ` [PATCH 4/6] swiotlb: search and replace "int dir" with "enum dma_data_direction dir" Konrad Rzeszutek Wilk
2010-05-11 15:39 ` [PATCH 5/6] swiotlb: Make swiotlb bookkeeping functions visible in the header file Konrad Rzeszutek Wilk
2010-05-11 15:39 ` [PATCH 6/6] swiotlb: EXPORT_SYMBOL_GPL functions + variables that are defined " Konrad Rzeszutek Wilk
2010-05-11 18:28 ` [PATCH 5/6] swiotlb: Make swiotlb bookkeeping functions visible " Albert Herranz
2010-05-11 18:36 ` Jeremy Fitzhardinge
2010-05-11 18:46 ` Konrad Rzeszutek Wilk
2010-05-11 19:01 ` Albert Herranz
2010-05-11 19:39 ` Konrad Rzeszutek Wilk
2010-05-13 5:04 ` Albert Herranz
2010-05-18 3:28 ` FUJITA Tomonori
2010-05-18 16:52 ` Albert Herranz
2010-05-19 3:34 ` FUJITA Tomonori
2010-05-19 5:22 ` Albert Herranz
2010-05-19 7:10 ` Russell King - ARM Linux
2010-05-19 11:54 ` FUJITA Tomonori
2010-05-17 9:48 ` [PATCH] swiotlb v0.8: seperation of physical/virtual address translation FUJITA Tomonori
2010-05-26 15:42 ` Konrad Rzeszutek Wilk
2010-05-28 16:23 ` Konrad Rzeszutek Wilk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1273592353-23224-2-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=albert_herranz@yahoo.es \
--cc=chrisw@sous-sol.org \
--cc=dwmw2@infradead.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=iommu@lists.linux-foundation.org \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®