Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / arch / arm64 / lib / uaccess_flushcache.c
blob7510d1a23124965050743a059058e571af2ebd33
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2017 ARM Ltd.
4 */
6 #include <linux/uaccess.h>
7 #include <asm/barrier.h>
8 #include <asm/cacheflush.h>
10 void memcpy_flushcache(void *dst, const void *src, size_t cnt)
13 * We assume this should not be called with @dst pointing to
14 * non-cacheable memory, such that we don't need an explicit
15 * barrier to order the cache maintenance against the memcpy.
17 memcpy(dst, src, cnt);
18 dcache_clean_pop((unsigned long)dst, (unsigned long)dst + cnt);
20 EXPORT_SYMBOL_GPL(memcpy_flushcache);
22 unsigned long __copy_user_flushcache(void *to, const void __user *from,
23 unsigned long n)
25 unsigned long rc;
27 rc = raw_copy_from_user(to, from, n);
29 /* See above */
30 dcache_clean_pop((unsigned long)to, (unsigned long)to + n - rc);
31 return rc;