mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Clement Leger <cleger@kalray.eu>
To: Sascha Hauer <s.hauer@pengutronix.de>, barebox@lists.infradead.org
Cc: Clement Leger <cleger@kalray.eu>
Subject: [PATCH 3/4] kvx: add D-cache inval and I-cache sync
Date: Tue, 23 Jun 2020 21:35:05 +0200	[thread overview]
Message-ID: <20200623193506.13716-4-cleger@kalray.eu> (raw)
In-Reply-To: <20200623193506.13716-1-cleger@kalray.eu>

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. Moreover add a D-cache invalidation
routine to cleanup cache before booting.

Signed-off-by: Clement Leger <cleger@kalray.eu>
---
 arch/kvx/include/asm/cache.h | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 arch/kvx/include/asm/cache.h

diff --git a/arch/kvx/include/asm/cache.h b/arch/kvx/include/asm/cache.h
new file mode 100644
index 000000000..efda37ebd
--- /dev/null
+++ b/arch/kvx/include/asm/cache.h
@@ -0,0 +1,24 @@
+/* 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_dcache_icache(void)
+{
+	__builtin_kvx_fence();
+	__builtin_kvx_iinval();
+	__builtin_kvx_barrier();
+}
+
+static inline void dcache_inval(void)
+{
+	__builtin_kvx_fence();
+	__builtin_kvx_dinval();
+}
+
+#endif /* __KVX_CACHE_H */
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-06-23 19:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 19:35 [PATCH 0/4] kvx: add elf bootm support Clement Leger
2020-06-23 19:35 ` [PATCH 1/4] common: bootm: allow letting IH_ARCH undefined Clement Leger
2020-06-23 19:35 ` [PATCH 2/4] common: Kconfig: remove MIPS dependency Clement Leger
2020-06-24  6:06   ` Ahmad Fatoum
2020-06-23 19:35 ` Clement Leger [this message]
2020-06-24  6:12   ` [PATCH 3/4] kvx: add D-cache inval and I-cache sync Ahmad Fatoum
2020-06-23 19:35 ` [PATCH 4/4] kvx: add support for elf loading using bootm Clement Leger
2020-06-24  6:17   ` Ahmad Fatoum
2020-06-24  7:15     ` Clément Leger
2020-06-29  8:15       ` Ahmad Fatoum
2020-06-29  8:23         ` Clément Leger
2020-06-29  8:29           ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200623193506.13716-4-cleger@kalray.eu \
    --to=cleger@kalray.eu \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox