WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 06/15] [swiotlb] In 'swiotlb_init' take advantage of

To: fujita.tomonori@xxxxxxxxxxxxx, alex.williamson@xxxxxx, joerg.roedel@xxxxxxx, dwmw2@xxxxxxxxxxxxx, chrisw@xxxxxxxxxxxx, iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 06/15] [swiotlb] In 'swiotlb_init' take advantage of the default swiotlb_engine support.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Thu, 14 Jan 2010 18:00:55 -0500
Cc: Ian.Campbell@xxxxxxxxxxxxx, jeremy@xxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Thu, 14 Jan 2010 15:16:16 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1263510064-16788-6-git-send-email-konrad.wilk@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1263510064-16788-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-3-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-4-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-5-git-send-email-konrad.wilk@xxxxxxxxxx> <1263510064-16788-6-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
For baselevel support we define required functions and fill out
variables.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 lib/swiotlb.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index cf29f03..3c7bd4e 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -132,6 +132,11 @@ static dma_addr_t swiotlb_virt_to_bus(struct device *hwdev,
        return phys_to_dma(hwdev, virt_to_phys(address));
 }
 
+static void *swiotlb_bus_to_virt(struct device *hwdev, dma_addr_t dev_addr)
+{
+       return phys_to_virt(dma_to_phys(hwdev, dev_addr));
+};
+
 /*
  * Register a software IO TLB engine.
  *
@@ -236,9 +241,26 @@ swiotlb_init_with_default_size(size_t default_size, int 
verbose)
                swiotlb_print_info();
 }
 
+static int swiotlb_release(struct swiotlb_engine *iotlb)
+{
+       swiotlb_free();
+       return 0;
+}
+
+static struct swiotlb_engine swiotlb_ops = {
+       .name = "software IO TLB",
+       .overflow = 32 * 1024,
+       .release = swiotlb_release,
+       .phys_to_bus =  phys_to_dma,
+       .bus_to_phys = dma_to_phys,
+       .virt_to_bus = swiotlb_virt_to_bus,
+       .bus_to_virt = swiotlb_bus_to_virt,
+};
+
 void __init
 swiotlb_init(int verbose)
 {
+       swiotlb_register_engine(&swiotlb_ops);
        swiotlb_init_with_default_size(64 * (1<<20), verbose);  /* default to 
64MB */
 }
 
-- 
1.6.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>