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