From: Konrad Rzeszutek Wilk on
We are sheding the usage of the overflow buffer and returning
the value of zero (DMA_ERROR_CODE), following the lead of the
Intel and AMD IOMMU code.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
---
lib/swiotlb-xen.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/swiotlb-xen.c b/lib/swiotlb-xen.c
index d457f7e..e0f944e 100644
--- a/lib/swiotlb-xen.c
+++ b/lib/swiotlb-xen.c
@@ -50,8 +50,6 @@ void
xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
int nelems, enum dma_data_direction dir,
struct dma_attrs *attrs);
-#define swiotlb_full(dev, size, dir, panic)
-#define io_tlb_overflow_buffer DMA_ERROR_CODE

static dma_addr_t xen_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
{
@@ -209,10 +207,8 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
* Oh well, have to allocate and map a bounce buffer.
*/
map = xen_map_single(dev, phys, size, dir);
- if (!map) {
- swiotlb_full(dev, size, dir, 1);
- map = io_tlb_overflow_buffer;
- }
+ if (!map)
+ return DMA_ERROR_CODE;

dev_addr = xen_virt_to_bus(dev, map);

@@ -353,11 +349,10 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
if (!map) {
/* Don't panic here, we expect map_sg users
to do proper error handling. */
- swiotlb_full(hwdev, sg->length, dir, 0);
xen_swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir,
attrs);
sgl[0].dma_length = 0;
- return 0;
+ return DMA_ERROR_CODE;
}
sg->dma_address = xen_virt_to_bus(hwdev, map);
} else
@@ -443,7 +438,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_sync_sg_for_device);
int
xen_swiotlb_dma_mapping_error(struct device *hwdev, dma_addr_t dma_addr)
{
- return (dma_addr == xen_virt_to_bus(hwdev, io_tlb_overflow_buffer));
+ return !dma_addr;
}
EXPORT_SYMBOL_GPL(xen_swiotlb_dma_mapping_error);

--
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/