openrisc: remove the partial DMA_ATTR_NON_CONSISTENT support

The openrisc DMA code supports DMA_ATTR_NON_CONSISTENT allocations, but
does not provide a cache_sync operation.  This means any user of it
will never be able to actually transfer cache ownership and thus cause
coherency bugs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Stafford Horne <shorne@gmail.com>
This commit is contained in:
Christoph Hellwig 2019-06-03 12:54:13 +02:00
parent 80e61fcd23
commit 961729bfc7
1 changed files with 9 additions and 13 deletions

View File

@ -98,15 +98,13 @@ arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
va = (unsigned long)page; va = (unsigned long)page;
if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0) { /*
/* * We need to iterate through the pages, clearing the dcache for
* We need to iterate through the pages, clearing the dcache for * them and setting the cache-inhibit bit.
* them and setting the cache-inhibit bit. */
*/ if (walk_page_range(va, va + size, &walk)) {
if (walk_page_range(va, va + size, &walk)) { free_pages_exact(page, size);
free_pages_exact(page, size); return NULL;
return NULL;
}
} }
return (void *)va; return (void *)va;
@ -122,10 +120,8 @@ arch_dma_free(struct device *dev, size_t size, void *vaddr,
.mm = &init_mm .mm = &init_mm
}; };
if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0) { /* walk_page_range shouldn't be able to fail here */
/* walk_page_range shouldn't be able to fail here */ WARN_ON(walk_page_range(va, va + size, &walk));
WARN_ON(walk_page_range(va, va + size, &walk));
}
free_pages_exact(vaddr, size); free_pages_exact(vaddr, size);
} }