mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: albert_herranz@yahoo.es, fujita.tomonori@lab.ntt.co.jp,
	akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, jeremy@goop.org,
	iommu@lists.linux-foundation.org, linux@arm.linux.org.uk,
	dwmw2@infradead.org, chrisw@sous-sol.org,
	Ian.Campbell@eu.citrix.com
Subject: [PATCH 1/5] swiotlb: add swiotlb_tbl_map_single library function
Date: Fri,  4 Jun 2010 13:52:31 -0400	[thread overview]
Message-ID: <1275673955-30267-2-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1275673955-30267-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]
[v3: changed u64 to dma_addr_t]

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

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index a009055..783aff0 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, dma_addr_t 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)
+{
+	dma_addr_t 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


  reply	other threads:[~2010-06-04 17:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-04 17:52 [PATCH] swiotlb-0.8.2: seperation of physical/virtual address translation and core memory allocation Konrad Rzeszutek Wilk
2010-06-04 17:52 ` Konrad Rzeszutek Wilk [this message]
2010-06-04 17:52   ` [PATCH 2/5] swiotlb: add the swiotlb initialization function with iotlb memory Konrad Rzeszutek Wilk
2010-06-04 17:52     ` [PATCH 3/5] swiotlb: Make internal bookkeeping functions have 'swiotlb_tbl' prefix Konrad Rzeszutek Wilk
2010-06-04 17:52       ` [PATCH 4/5] swiotlb: search and replace "int dir" with "enum dma_data_direction dir" Konrad Rzeszutek Wilk
2010-06-04 17:52         ` [PATCH 5/5] swiotlb: Make swiotlb bookkeeping functions visible in the header file Konrad Rzeszutek Wilk
2010-06-04 18:42 ` [PATCH] swiotlb-0.8.2: seperation of physical/virtual address translation and core memory allocation Andrew Morton
2010-06-04 20:06   ` [PATCH] swiotlb-0.8.2^H3: " Konrad Rzeszutek Wilk
2010-06-05 12:07     ` Stephen Rothwell
2010-06-07 16:01       ` 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=1275673955-30267-2-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=akpm@linux-foundation.org \
    --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 \
    --cc=linux@arm.linux.org.uk \
    /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®