Thread (26 messages) 26 messages, 4 authors, 2019-07-03

Re: [PATCH 5/7] MIPS: use the generic uncached segment support in dma-direct

From: Paul Burton <hidden>
Date: 2019-04-30 20:10:49
Also in: linux-iommu, linux-mips, lkml

Hi Christoph,

On Tue, Apr 30, 2019 at 07:00:30AM -0400, Christoph Hellwig wrote:
quoted hunk ↗ jump to hunk
diff --git a/arch/mips/mm/dma-noncoherent.c b/arch/mips/mm/dma-noncoherent.c
index f9549d2fbea3..f739f42c9d3c 100644
--- a/arch/mips/mm/dma-noncoherent.c
+++ b/arch/mips/mm/dma-noncoherent.c
@@ -44,33 +44,26 @@ static inline bool cpu_needs_post_dma_flush(struct device *dev)
 	}
 }
 
-void *arch_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void arch_dma_prep_coherent(struct page *page, size_t size)
 {
-	void *ret;
-
-	ret = dma_direct_alloc_pages(dev, size, dma_handle, gfp, attrs);
-	if (ret && !(attrs & DMA_ATTR_NON_CONSISTENT)) {
-		dma_cache_wback_inv((unsigned long) ret, size);
-		ret = (void *)UNCAC_ADDR(ret);
-	}
+	if (!PageHighMem(page))
+		dma_cache_wback_inv((unsigned long)page_address(page), size);
+}
This series looks like a nice cleanup to me - the one thing that puzzles
me is the !PageHighMem check above.

As far as I can see arch_dma_prep_coherent() should never be called with
a highmem page, so would it make more sense to either drop this check or
perhaps wrap it in a WARN_ON()?

Thanks,
    Paul
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help