xref: /kernel/linux/linux-5.10/arch/csky/mm/syscache.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/arch/csky/mm/
18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#include <linux/syscalls.h>
58c2ecf20Sopenharmony_ci#include <asm/page.h>
68c2ecf20Sopenharmony_ci#include <asm/cacheflush.h>
78c2ecf20Sopenharmony_ci#include <asm/cachectl.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciSYSCALL_DEFINE3(cacheflush,
108c2ecf20Sopenharmony_ci		void __user *, addr,
118c2ecf20Sopenharmony_ci		unsigned long, bytes,
128c2ecf20Sopenharmony_ci		int, cache)
138c2ecf20Sopenharmony_ci{
148c2ecf20Sopenharmony_ci	switch (cache) {
158c2ecf20Sopenharmony_ci	case BCACHE:
168c2ecf20Sopenharmony_ci	case DCACHE:
178c2ecf20Sopenharmony_ci		dcache_wb_range((unsigned long)addr,
188c2ecf20Sopenharmony_ci				(unsigned long)addr + bytes);
198c2ecf20Sopenharmony_ci		if (cache != BCACHE)
208c2ecf20Sopenharmony_ci			break;
218c2ecf20Sopenharmony_ci		fallthrough;
228c2ecf20Sopenharmony_ci	case ICACHE:
238c2ecf20Sopenharmony_ci		flush_icache_mm_range(current->mm,
248c2ecf20Sopenharmony_ci				(unsigned long)addr,
258c2ecf20Sopenharmony_ci				(unsigned long)addr + bytes);
268c2ecf20Sopenharmony_ci		break;
278c2ecf20Sopenharmony_ci	default:
288c2ecf20Sopenharmony_ci		return -EINVAL;
298c2ecf20Sopenharmony_ci	}
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	return 0;
328c2ecf20Sopenharmony_ci}
33

Indexes created Thu Nov 07 10:32:03 CST 2024