Commit b34e9b0d authored by Tom Murphy's avatar Tom Murphy Committed by Joerg Roedel
Browse files

iommu/dma: Handle init_iova_flush_queue() failure in dma-iommu path



The init_iova_flush_queue() function can fail if we run out of memory. Fall
back to noflush queue if it fails.

Signed-off-by: default avatarTom Murphy <murphyt7@tcd.ie>
Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20200910122539.3662-1-murphyt7@tcd.ie


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent ba328f82
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -343,8 +343,11 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,

	if (!cookie->fq_domain && !iommu_domain_get_attr(domain,
			DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE, &attr) && attr) {
		if (init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all,
					NULL))
			pr_warn("iova flush queue initialization failed\n");
		else
			cookie->fq_domain = domain;
		init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
	}

	if (!dev)