And we also replace the 'dma_capable' with iommu_sw->dma_capable
to abstract the functionality of that function.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
lib/swiotlb.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 688965d..4da8151 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -253,10 +253,18 @@ static int is_swiotlb_buffer(struct swiotlb_engine
*iommu_sw,
paddr < virt_to_phys(iommu_sw->end);
}
+static bool swiotlb_dma_capable(struct device *hwdev, dma_addr_t dma_addr,
+ phys_addr_t phys, size_t size)
+{
+ /* Phys is not neccessary in this case. */
+ return dma_capable(hwdev, dma_addr, size);
+}
+
static struct swiotlb_engine swiotlb_ops = {
.name = "software IO TLB",
.overflow = 32 * 1024,
.release = swiotlb_release,
+ .dma_capable = swiotlb_dma_capable,
.is_swiotlb_buffer = is_swiotlb_buffer,
.phys_to_bus = phys_to_dma,
.bus_to_phys = dma_to_phys,
@@ -725,7 +733,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page
*page,
* we can safely return the device addr and not worry about bounce
* buffering it.
*/
- if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
+ if (iommu_sw->dma_capable(dev, dev_addr, phys, size) && !swiotlb_force)
return dev_addr;
/*
@@ -742,7 +750,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page
*page,
/*
* Ensure that the address returned is DMA'ble
*/
- if (!dma_capable(dev, dev_addr, size))
+ if (!iommu_sw->dma_capable(dev, dev_addr, phys, size))
panic("map_single: bounce buffer is not DMA'ble");
return dev_addr;
@@ -895,7 +903,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct
scatterlist *sgl, int nelems,
dma_addr_t dev_addr = phys_to_dma(hwdev, paddr);
if (swiotlb_force ||
- !dma_capable(hwdev, dev_addr, sg->length)) {
+ !iommu_sw->dma_capable(hwdev, dev_addr, paddr, sg->length))
{
void *map = map_single(hwdev, sg_phys(sg),
sg->length, dir);
if (!map) {
--
1.6.2.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|