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: Tom Murphy <murphyt7@tcd.ie>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20200910122539.3662-1-murphyt7@tcd.ie
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
Tom Murphy 2020-09-10 13:25:38 +01:00 committed by Joerg Roedel
parent ba328f8261
commit b34e9b0de3

View File

@ -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) {
cookie->fq_domain = domain;
init_iova_flush_queue(iovad, iommu_dma_flush_iotlb_all, NULL);
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;
}
if (!dev)