Re: [PATCH v7 13/15] dma-direct: Allocate memory from restricted DMA pool if available

From
Christoph Hellwig <hch@lst.de>
Date
2021-05-27 13:30:57
Also in
intel-gfx, linux-devicetree, linux-iommu, linux-pci, lkml, xen-devel
Reply to
Claire Chang, 2021-05-18
quoted hunk ↗ jump to hunk
+#ifdef CONFIG_DMA_RESTRICTED_POOL
+	if (swiotlb_free(dev, page, size))
+		return;
+#endif
Please avoid the ifdefs by either stubbing out the function to be a no-op
or by using IS_ENABLED.
quoted hunk ↗ jump to hunk
+#ifdef CONFIG_DMA_RESTRICTED_POOL
+	page = swiotlb_alloc(dev, size);
+	if (page && !dma_coherent_ok(dev, page_to_phys(page), size)) {
+		__dma_direct_free_pages(dev, page, size);
+		page = NULL;
+	}
+#endif
Same here, for the stub it would just return NULL.
Thread (51 messages) 51 messages, 6 authors, last reply 2021-05-31
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help