2018-09-05 14:25:10 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
|
|
|
|
|
|
|
|
#include <linux/cache.h>
|
|
|
|
#include <linux/highmem.h>
|
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <asm/cache.h>
|
|
|
|
|
|
|
|
void update_mmu_cache(struct vm_area_struct *vma, unsigned long address,
|
|
|
|
pte_t *pte)
|
|
|
|
{
|
2020-01-27 01:20:36 +08:00
|
|
|
unsigned long addr;
|
2018-09-05 14:25:10 +08:00
|
|
|
struct page *page;
|
|
|
|
|
2020-01-27 01:20:36 +08:00
|
|
|
page = pfn_to_page(pte_pfn(*pte));
|
|
|
|
if (page == ZERO_PAGE(0))
|
2018-09-05 14:25:10 +08:00
|
|
|
return;
|
|
|
|
|
2020-01-27 01:20:36 +08:00
|
|
|
if (test_and_set_bit(PG_dcache_clean, &page->flags))
|
2018-09-05 14:25:10 +08:00
|
|
|
return;
|
|
|
|
|
2019-04-10 10:55:07 +08:00
|
|
|
addr = (unsigned long) kmap_atomic(page);
|
2018-09-05 14:25:10 +08:00
|
|
|
|
2020-01-27 01:20:36 +08:00
|
|
|
dcache_wb_range(addr, addr + PAGE_SIZE);
|
|
|
|
|
|
|
|
if (vma->vm_flags & VM_EXEC)
|
|
|
|
icache_inv_range(addr, addr + PAGE_SIZE);
|
2018-09-05 14:25:10 +08:00
|
|
|
|
2019-04-10 10:55:07 +08:00
|
|
|
kunmap_atomic((void *) addr);
|
2018-09-05 14:25:10 +08:00
|
|
|
}
|