Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bc934cd authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu: iommu-debug: Fix functional_fast_dma test"

parents 1af87d2d 21a037a4
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -942,6 +942,24 @@ static int __full_va_sweep(struct device *dev, struct seq_file *s,
	}
	phys = virt_to_phys(virt);

	/*
	 * A previous test might have made it so that the next IOVA that we
	 * start to search from is not 0, so map the entire IOVA space, and
	 * then unmap it to reset the starting IOVA to search from to address
	 * 0.
	 */
	dma_addr = dma_map_single_attrs(dev, virt, SZ_1G * 4ULL, DMA_TO_DEVICE,
					DMA_ATTR_SKIP_CPU_SYNC);
	if (dma_mapping_error(dev, dma_addr)) {
		dev_err_ratelimited(dev,
				    "Failed to map all of the IOVA space\n");
		ret = -ENOMEM;
		goto out_free_pages;
	}

	dma_unmap_single_attrs(dev, dma_addr, SZ_1G * 4ULL, DMA_TO_DEVICE,
			       DMA_ATTR_SKIP_CPU_SYNC);

	for (iova = 0, i = 0; iova < max; iova += size, ++i) {
		unsigned long expected = iova;

@@ -993,6 +1011,7 @@ static int __full_va_sweep(struct device *dev, struct seq_file *s,
	for (iova = 0; iova < max; iova += size)
		dma_unmap_single(dev, (dma_addr_t)iova, size, DMA_TO_DEVICE);

out_free_pages:
	free_pages((unsigned long)virt, get_order(size));
	return ret;
}