blob: f64b415f6fdef98cf759c23e8d71fd6265c990bb [file] [log] [blame]
Guo Ren00a97302018-09-05 14:25:10 +08001// SPDX-License-Identifier: GPL-2.0
2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3
4#include <linux/cache.h>
5#include <linux/highmem.h>
6#include <linux/mm.h>
7#include <asm/cache.h>
8
Guo Ren00a97302018-09-05 14:25:10 +08009void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
10 pte_t *pte)
11{
12 unsigned long addr, pfn;
13 struct page *page;
Guo Ren00a97302018-09-05 14:25:10 +080014
15 pfn = pte_pfn(*pte);
16 if (unlikely(!pfn_valid(pfn)))
17 return;
18
19 page = pfn_to_page(pfn);
20 if (page == ZERO_PAGE(0))
21 return;
22
Guo Ren981bbf22019-04-10 10:55:07 +080023 addr = (unsigned long) kmap_atomic(page);
Guo Ren00a97302018-09-05 14:25:10 +080024
25 cache_wbinv_range(addr, addr + PAGE_SIZE);
26
Guo Ren981bbf22019-04-10 10:55:07 +080027 kunmap_atomic((void *) addr);
Guo Ren00a97302018-09-05 14:25:10 +080028}