]> asedeno.scripts.mit.edu Git - linux.git/blob - arch/csky/mm/syscache.c
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
[linux.git] / arch / csky / mm / syscache.c
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3
4 #include <linux/syscalls.h>
5 #include <asm/page.h>
6 #include <asm/cacheflush.h>
7 #include <asm/cachectl.h>
8
9 SYSCALL_DEFINE3(cacheflush,
10                 void __user *, addr,
11                 unsigned long, bytes,
12                 int, cache)
13 {
14         switch (cache) {
15         case ICACHE:
16         case BCACHE:
17                 flush_icache_mm_range(current->mm,
18                                 (unsigned long)addr,
19                                 (unsigned long)addr + bytes);
20         case DCACHE:
21                 dcache_wb_range((unsigned long)addr,
22                                 (unsigned long)addr + bytes);
23                 break;
24         default:
25                 return -EINVAL;
26         }
27
28         return 0;
29 }