Merge branch 'stable/for-linus-5.15' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / xen / swiotlb-xen.c
index 24d1186..643fe44 100644 (file)
@@ -100,7 +100,7 @@ static int is_xen_swiotlb_buffer(struct device *dev, dma_addr_t dma_addr)
         * in our domain. Therefore _only_ check address within our domain.
         */
        if (pfn_valid(PFN_DOWN(paddr)))
-               return is_swiotlb_buffer(paddr);
+               return is_swiotlb_buffer(dev, paddr);
        return 0;
 }
 
@@ -164,7 +164,7 @@ int __ref xen_swiotlb_init(void)
        int rc = -ENOMEM;
        char *start;
 
-       if (io_tlb_default_mem != NULL) {
+       if (io_tlb_default_mem.nslabs) {
                pr_warn("swiotlb buffer already initialized\n");
                return -EEXIST;
        }
@@ -374,7 +374,7 @@ static dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
        if (dma_capable(dev, dev_addr, size, true) &&
            !range_straddles_page_boundary(phys, size) &&
                !xen_arch_need_swiotlb(dev, phys, dev_addr) &&
-               swiotlb_force != SWIOTLB_FORCE)
+               !is_swiotlb_force_bounce(dev))
                goto done;
 
        /*
@@ -509,7 +509,7 @@ xen_swiotlb_map_sg(struct device *dev, struct scatterlist *sgl, int nelems,
 out_unmap:
        xen_swiotlb_unmap_sg(dev, sgl, i, dir, attrs | DMA_ATTR_SKIP_CPU_SYNC);
        sg_dma_len(sgl) = 0;
-       return 0;
+       return -EIO;
 }
 
 static void
@@ -547,7 +547,7 @@ xen_swiotlb_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
 static int
 xen_swiotlb_dma_supported(struct device *hwdev, u64 mask)
 {
-       return xen_phys_to_dma(hwdev, io_tlb_default_mem->end - 1) <= mask;
+       return xen_phys_to_dma(hwdev, io_tlb_default_mem.end - 1) <= mask;
 }
 
 const struct dma_map_ops xen_swiotlb_dma_ops = {