// SPDX-License-Identifier: GPL-2.0-only1/*2* Copyright (C) 2017 ARM Ltd.3*/45#include <linux/uaccess.h>6#include <asm/barrier.h>7#include <asm/cacheflush.h>89void memcpy_flushcache(void *dst, const void *src, size_t cnt)10{11/*12* We assume this should not be called with @dst pointing to13* non-cacheable memory, such that we don't need an explicit14* barrier to order the cache maintenance against the memcpy.15*/16memcpy(dst, src, cnt);17dcache_clean_pop((unsigned long)dst, (unsigned long)dst + cnt);18}19EXPORT_SYMBOL_GPL(memcpy_flushcache);2021unsigned long __copy_user_flushcache(void *to, const void __user *from,22unsigned long n)23{24unsigned long rc;2526rc = raw_copy_from_user(to, from, n);2728/* See above */29dcache_clean_pop((unsigned long)to, (unsigned long)to + n - rc);30return rc;31}323334