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/syscalls.h>
|
|
|
|
#include <asm/page.h>
|
2020-01-31 20:33:10 +08:00
|
|
|
#include <asm/cacheflush.h>
|
2018-09-05 14:25:10 +08:00
|
|
|
#include <asm/cachectl.h>
|
|
|
|
|
|
|
|
SYSCALL_DEFINE3(cacheflush,
|
|
|
|
void __user *, addr,
|
|
|
|
unsigned long, bytes,
|
|
|
|
int, cache)
|
|
|
|
{
|
|
|
|
switch (cache) {
|
|
|
|
case ICACHE:
|
2020-01-31 20:33:10 +08:00
|
|
|
case BCACHE:
|
|
|
|
flush_icache_mm_range(current->mm,
|
|
|
|
(unsigned long)addr,
|
|
|
|
(unsigned long)addr + bytes);
|
2018-09-05 14:25:10 +08:00
|
|
|
case DCACHE:
|
|
|
|
dcache_wb_range((unsigned long)addr,
|
|
|
|
(unsigned long)addr + bytes);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|