[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    nds32: Flush the cache of the page at vmaddr instead of kaddr in flush_anon_page
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2018-05-28 12:29:32
Message-ID: 20180528122932.7E16721B2F () pdx-korg-gitolite-1 ! ci ! codeaurora ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/5b9f95699b2166e06b7d7820c8173fdbff0ddf35
Commit:     5b9f95699b2166e06b7d7820c8173fdbff0ddf35
Parent:     efcc4ea872edaeded28245d9b2ca8b9d8181b7cf
Refname:    refs/heads/master
Author:     Vincent Chen <vincentc@andestech.com>
AuthorDate: Mon May 14 16:56:53 2018 +0800
Committer:  Greentime Hu <greentime@andestech.com>
CommitDate: Wed May 23 13:26:22 2018 +0800

    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 <vincentc@andestech.com>
    Reviewed-by: Greentime Hu <greentime@andestech.com>
    Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/mm/cacheflush.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c
index 02f25ee39c1d..ae31cd2c21be 100644
--- a/arch/nds32/mm/cacheflush.c
+++ b/arch/nds32/mm/cacheflush.c
@@ -274,7 +274,7 @@ void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
 void flush_anon_page(struct vm_area_struct *vma,
 		     struct page *page, unsigned long vaddr)
 {
-	unsigned long flags;
+	unsigned long kaddr, flags, ktmp;
 	if (!PageAnon(page))
 		return;
 
@@ -284,7 +284,12 @@ void flush_anon_page(struct vm_area_struct *vma,
 	local_irq_save(flags);
 	if (vma->vm_flags & VM_EXEC)
 		cpu_icache_inval_page(vaddr & PAGE_MASK);
-	cpu_dcache_wbinval_page((unsigned long)page_address(page));
+	kaddr = (unsigned long)page_address(page);
+	if (aliasing(vaddr, kaddr)) {
+		ktmp = kremap0(vaddr, page_to_phys(page));
+		cpu_dcache_wbinval_page(ktmp);
+		kunmap01(ktmp);
+	}
 	local_irq_restore(flags);
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic