Commit 7e9ab144 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/mem: Use kmap_local_page() in flushing functions

Flushing functions don't rely on preemption being disabled, so
use kmap_local_page() instead of kmap_atomic().
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/b6a880ea0ec7886b51edbb4979c188be549231c0.1617895813.git.christophe.leroy@csgroup.eu
parent 6c960208
...@@ -152,16 +152,16 @@ static void flush_dcache_icache_hugepage(struct page *page) ...@@ -152,16 +152,16 @@ static void flush_dcache_icache_hugepage(struct page *page)
{ {
int i; int i;
int nr = compound_nr(page); int nr = compound_nr(page);
void *start;
if (!PageHighMem(page)) { if (!PageHighMem(page)) {
for (i = 0; i < nr; i++) for (i = 0; i < nr; i++)
__flush_dcache_icache(lowmem_page_address(page + i)); __flush_dcache_icache(lowmem_page_address(page + i));
} else { } else {
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
start = kmap_atomic(page+i); void *start = kmap_local_page(page + i);
__flush_dcache_icache(start); __flush_dcache_icache(start);
kunmap_atomic(start); kunmap_local(start);
} }
} }
} }
...@@ -177,9 +177,10 @@ void flush_dcache_icache_page(struct page *page) ...@@ -177,9 +177,10 @@ void flush_dcache_icache_page(struct page *page)
if (!PageHighMem(page)) { if (!PageHighMem(page)) {
__flush_dcache_icache(lowmem_page_address(page)); __flush_dcache_icache(lowmem_page_address(page));
} else if (IS_ENABLED(CONFIG_BOOKE) || sizeof(phys_addr_t) > sizeof(void *)) { } else if (IS_ENABLED(CONFIG_BOOKE) || sizeof(phys_addr_t) > sizeof(void *)) {
void *start = kmap_atomic(page); void *start = kmap_local_page(page);
__flush_dcache_icache(start); __flush_dcache_icache(start);
kunmap_atomic(start); kunmap_local(start);
} else { } else {
flush_dcache_icache_phys(page_to_phys(page)); flush_dcache_icache_phys(page_to_phys(page));
} }
...@@ -225,9 +226,9 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, ...@@ -225,9 +226,9 @@ void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
void flush_icache_user_page(struct vm_area_struct *vma, struct page *page, void flush_icache_user_page(struct vm_area_struct *vma, struct page *page,
unsigned long addr, int len) unsigned long addr, int len)
{ {
unsigned long maddr; void *maddr;
maddr = (unsigned long) kmap(page) + (addr & ~PAGE_MASK); maddr = kmap_local_page(page) + (addr & ~PAGE_MASK);
flush_icache_range(maddr, maddr + len); flush_icache_range((unsigned long)maddr, (unsigned long)maddr + len);
kunmap(page); kunmap_local(maddr);
} }
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