static bool hypercall_cflush = false;
 
 /* buffers in highmem or foreign pages cannot cross page boundaries */
-static void dma_cache_maint(dma_addr_t handle, size_t size, u32 op)
+static void dma_cache_maint(struct device *dev, dma_addr_t handle,
+                           size_t size, u32 op)
 {
        struct gnttab_cache_flush cflush;
 
-       cflush.a.dev_bus_addr = handle & XEN_PAGE_MASK;
        cflush.offset = xen_offset_in_page(handle);
        cflush.op = op;
+       handle &= XEN_PAGE_MASK;
 
        do {
+               cflush.a.dev_bus_addr = dma_to_phys(dev, handle);
+
                if (size + cflush.offset > XEN_PAGE_SIZE)
                        cflush.length = XEN_PAGE_SIZE - cflush.offset;
                else
                HYPERVISOR_grant_table_op(GNTTABOP_cache_flush, &cflush, 1);
 
                cflush.offset = 0;
-               cflush.a.dev_bus_addr += cflush.length;
+               handle += cflush.length;
                size -= cflush.length;
        } while (size);
 }
                          size_t size, enum dma_data_direction dir)
 {
        if (dir != DMA_TO_DEVICE)
-               dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL);
+               dma_cache_maint(dev, handle, size, GNTTAB_CACHE_INVAL);
 }
 
 void xen_dma_sync_for_device(struct device *dev, dma_addr_t handle,
                             size_t size, enum dma_data_direction dir)
 {
        if (dir == DMA_FROM_DEVICE)
-               dma_cache_maint(handle, size, GNTTAB_CACHE_INVAL);
+               dma_cache_maint(dev, handle, size, GNTTAB_CACHE_INVAL);
        else
-               dma_cache_maint(handle, size, GNTTAB_CACHE_CLEAN);
+               dma_cache_maint(dev, handle, size, GNTTAB_CACHE_CLEAN);
 }
 
 bool xen_arch_need_swiotlb(struct device *dev,