|
@@ -303,6 +303,9 @@ xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
|
|
|
*/
|
|
|
flags &= ~(__GFP_DMA | __GFP_HIGHMEM);
|
|
|
|
|
|
+ /* Convert the size to actually allocated. */
|
|
|
+ size = 1UL << (order + XEN_PAGE_SHIFT);
|
|
|
+
|
|
|
/* On ARM this function returns an ioremap'ped virtual address for
|
|
|
* which virt_to_phys doesn't return the corresponding physical
|
|
|
* address. In fact on ARM virt_to_phys only works for kernel direct
|
|
@@ -351,6 +354,9 @@ xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
|
|
|
* physical address */
|
|
|
phys = xen_bus_to_phys(dev_addr);
|
|
|
|
|
|
+ /* Convert the size to actually allocated. */
|
|
|
+ size = 1UL << (order + XEN_PAGE_SHIFT);
|
|
|
+
|
|
|
if (((dev_addr + size - 1 <= dma_mask)) ||
|
|
|
range_straddles_page_boundary(phys, size))
|
|
|
xen_destroy_contiguous_region(phys, order);
|