Skip to content

Commit 5b9f956

Browse files
Vincent ChenGreentime Hu
authored andcommitted
nds32: Flush the cache of the page at vmaddr instead of kaddr in flush_anon_page
According to Documentation/cachetlb.txt, the cache of the page at vmaddr shall be flushed in flush_anon_page instead of the cache of the page at page_address(page). Signed-off-by: Vincent Chen <[email protected]> Reviewed-by: Greentime Hu <[email protected]> Signed-off-by: Greentime Hu <[email protected]>
1 parent efcc4ea commit 5b9f956

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/nds32/mm/cacheflush.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
274274
void flush_anon_page(struct vm_area_struct *vma,
275275
struct page *page, unsigned long vaddr)
276276
{
277-
unsigned long flags;
277+
unsigned long kaddr, flags, ktmp;
278278
if (!PageAnon(page))
279279
return;
280280

@@ -284,7 +284,12 @@ void flush_anon_page(struct vm_area_struct *vma,
284284
local_irq_save(flags);
285285
if (vma->vm_flags & VM_EXEC)
286286
cpu_icache_inval_page(vaddr & PAGE_MASK);
287-
cpu_dcache_wbinval_page((unsigned long)page_address(page));
287+
kaddr = (unsigned long)page_address(page);
288+
if (aliasing(vaddr, kaddr)) {
289+
ktmp = kremap0(vaddr, page_to_phys(page));
290+
cpu_dcache_wbinval_page(ktmp);
291+
kunmap01(ktmp);
292+
}
288293
local_irq_restore(flags);
289294
}
290295

0 commit comments

Comments
 (0)