Commit 28148a17 authored by Jann Horn's avatar Jann Horn Committed by Stafford Horne

openrisc: Fix pagewalk usage in arch_dma_{clear, set}_uncached

Since commit 8782fb61 ("mm: pagewalk: Fix race between unmap and page
walker"), walk_page_range() on kernel ranges won't work anymore,
walk_page_range_novma() must be used instead.

Note: I don't have an openrisc development setup, so this is completely
untested.

Fixes: 8782fb61 ("mm: pagewalk: Fix race between unmap and page walker")
Signed-off-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarStafford Horne <shorne@gmail.com>
parent f76349cf
...@@ -74,10 +74,10 @@ void *arch_dma_set_uncached(void *cpu_addr, size_t size) ...@@ -74,10 +74,10 @@ void *arch_dma_set_uncached(void *cpu_addr, size_t size)
* 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.
*/ */
mmap_read_lock(&init_mm); mmap_write_lock(&init_mm);
error = walk_page_range(&init_mm, va, va + size, &set_nocache_walk_ops, error = walk_page_range_novma(&init_mm, va, va + size,
NULL); &set_nocache_walk_ops, NULL, NULL);
mmap_read_unlock(&init_mm); mmap_write_unlock(&init_mm);
if (error) if (error)
return ERR_PTR(error); return ERR_PTR(error);
...@@ -88,11 +88,11 @@ void arch_dma_clear_uncached(void *cpu_addr, size_t size) ...@@ -88,11 +88,11 @@ void arch_dma_clear_uncached(void *cpu_addr, size_t size)
{ {
unsigned long va = (unsigned long)cpu_addr; unsigned long va = (unsigned long)cpu_addr;
mmap_read_lock(&init_mm); mmap_write_lock(&init_mm);
/* 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(&init_mm, va, va + size, WARN_ON(walk_page_range_novma(&init_mm, va, va + size,
&clear_nocache_walk_ops, NULL)); &clear_nocache_walk_ops, NULL, NULL));
mmap_read_unlock(&init_mm); mmap_write_unlock(&init_mm);
} }
void arch_sync_dma_for_device(phys_addr_t addr, size_t size, void arch_sync_dma_for_device(phys_addr_t addr, size_t size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment