Prev: [PATCH 02/19] xen: Allow unprivileged Xen domains to create iomap pages
Next: [PATCH 10/19] swiotlb-xen: Make 'xen_swiotlb_[map|unmap]_page' work.
From: Konrad Rzeszutek Wilk on 22 Jun 2010 15:50 See "swiotlb-xen: Make 'xen_swiotlb_free_coherent' work." for detailed description. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com> --- lib/swiotlb-xen.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/swiotlb-xen.c b/lib/swiotlb-xen.c index 2ebfcbd..2640052 100644 --- a/lib/swiotlb-xen.c +++ b/lib/swiotlb-xen.c @@ -169,14 +169,13 @@ void xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dev_addr) { - phys_addr_t paddr = dma_to_phys(hwdev, dev_addr); + int order = get_order(size); + + if (dma_release_from_coherent(hwdev, order, vaddr)) + return; - WARN_ON(irqs_disabled()); - if (!is_xen_swiotlb_buffer(paddr)) - free_pages((unsigned long)vaddr, get_order(size)); - else - /* DMA_TO_DEVICE to avoid memcpy in swiotlb_tbl_unmap_single */ - swiotlb_tbl_unmap_single(hwdev, vaddr, size, DMA_TO_DEVICE); + xen_destroy_contiguous_region((unsigned long)vaddr, order); + free_pages((unsigned long)vaddr, order); } EXPORT_SYMBOL_GPL(xen_swiotlb_free_coherent); -- 1.7.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |