diff options
author | Clement Leger <cleger@kalray.eu> | 2020-06-30 22:44:01 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-07-01 07:23:14 +0200 |
commit | b6bc2e84031e2d8859277982c18f8fdc75a81035 (patch) | |
tree | c47522f97b092c6b06bcd298e5c966656fd01072 /arch/kvx | |
parent | 3952867f075b0ff610519fe28a331be79222937d (diff) | |
download | barebox-b6bc2e84031e2d8859277982c18f8fdc75a81035.tar.gz barebox-b6bc2e84031e2d8859277982c18f8fdc75a81035.tar.xz |
kvx: add I-cache and D-cache synchronisation
Before booting, we must make sure the I-cache is synchronized with the
D-cache to execute loaded instructions. In order to do that, add a
function which execute a fence to ensure every memory accesses have
been committed out of processor pipeline to memory and then invalidate
I-cache to reload from memory.
Signed-off-by: Clement Leger <cleger@kalray.eu>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/kvx')
-rw-r--r-- | arch/kvx/include/asm/cache.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/kvx/include/asm/cache.h b/arch/kvx/include/asm/cache.h new file mode 100644 index 0000000000..3be1767250 --- /dev/null +++ b/arch/kvx/include/asm/cache.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2019 Kalray Inc. + */ + +#ifndef __KVX_CACHE_H +#define __KVX_CACHE_H + +#include <linux/types.h> + +static inline void sync_caches_for_execution(void) +{ + __builtin_kvx_fence(); + __builtin_kvx_iinval(); + __builtin_kvx_barrier(); +} + +#endif /* __KVX_CACHE_H */ |