@@ -12,6 +12,8 @@
#include <asm/memory.h>
#include <asm/cacheflush.h>
+#include <xen/xen.h>
+
#define DMA_ERROR_CODE (~0)
extern struct dma_map_ops *dma_ops;
extern struct dma_map_ops arm_dma_ops;
@@ -19,7 +21,7 @@ extern struct dma_map_ops arm_coherent_dma_ops;
static inline struct dma_map_ops *get_dma_ops(struct device *dev)
{
- if (dev && dev->archdata.dma_ops)
+ if (!xen_domain() && dev && dev->archdata.dma_ops)
return dev->archdata.dma_ops;
return dma_ops;
}
@@ -9,6 +9,8 @@ static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flags,
struct dma_attrs *attrs)
{
+ if (hwdev && hwdev->archdata.dma_ops)
+ return hwdev->archdata.dma_ops->alloc(hwdev, size, dma_handle, flags, attrs);
return arm_dma_ops.alloc(hwdev, size, dma_handle, flags, attrs);
}
@@ -16,6 +18,8 @@ static inline void xen_free_coherent_pages(struct device *hwdev, size_t size,
void *cpu_addr, dma_addr_t dma_handle,
struct dma_attrs *attrs)
{
+ if (hwdev && hwdev->archdata.dma_ops)
+ return hwdev->archdata.dma_ops->free(hwdev, size, cpu_addr, dma_handle, attrs);
return arm_dma_ops.free(hwdev, size, cpu_addr, dma_handle, attrs);
}