From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/7] MIPS: Allow to prefetch and lock instructions into cache
Date: Tue, 9 Oct 2018 13:58:33 +0200 [thread overview]
Message-ID: <20181009115838.21795-3-gregory.clement@bootlin.com> (raw)
In-Reply-To: <20181009115838.21795-1-gregory.clement@bootlin.com>
This path add a new helper allowing to prefetch and lock instructions
into cache. This is useful very early in the boot when no RAM is
available yet.
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
---
arch/mips/include/asm/cacheops.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/arch/mips/include/asm/cacheops.h b/arch/mips/include/asm/cacheops.h
index 3161875441..98b67ccc8e 100644
--- a/arch/mips/include/asm/cacheops.h
+++ b/arch/mips/include/asm/cacheops.h
@@ -19,6 +19,25 @@ static inline void mips_cache(int op, const volatile void *addr)
#endif
}
+#define MIPS32_WHICH_ICACHE 0x0
+#define MIPS32_FETCH_AND_LOCK 0x7
+
+#define ICACHE_LOAD_LOCK (MIPS32_WHICH_ICACHE | (MIPS32_FETCH_AND_LOCK << 2))
+
+/* Prefetch and lock instructions into cache */
+static inline void icache_lock(void *func, size_t len)
+{
+ int i, lines = ((len - 1) / ARCH_DMA_MINALIGN) + 1;
+
+ for (i = 0; i < lines; i++) {
+ asm volatile (" cache %0, %1(%2)"
+ : /* No Output */
+ : "I" ICACHE_LOAD_LOCK,
+ "n" (i * ARCH_DMA_MINALIGN),
+ "r" (func)
+ : /* No Clobbers */);
+ }
+}
#endif /* !__ASSEMBLY__ */
/*
--
2.19.1
next prev parent reply other threads:[~2018-10-09 11:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 11:58 [U-Boot] [PATCH v2 0/7] Add support for the SoCs found in Microsemi switches Gregory CLEMENT
2018-10-09 11:58 ` [U-Boot] [PATCH v2 1/7] MIPS: move create_tlb() in an proper header: mipsregs.h Gregory CLEMENT
2018-10-09 11:58 ` Gregory CLEMENT [this message]
2018-10-09 11:58 ` [U-Boot] [PATCH v2 3/7] MSCC: add support for Ocelot SoCs Gregory CLEMENT
2018-10-28 18:50 ` Daniel Schwierzeck
2018-11-30 14:48 ` Gregory CLEMENT
2018-10-09 11:58 ` [U-Boot] [PATCH v2 4/7] MSCC: add support for Luton SoCs Gregory CLEMENT
2018-10-09 11:58 ` [U-Boot] [PATCH v2 5/7] MSCC: add board support for the Ocelots based evaluation boards Gregory CLEMENT
2018-10-09 11:58 ` [U-Boot] [PATCH v2 6/7] MSCC: add board support for the Luton based evaluation board Gregory CLEMENT
2018-10-09 11:58 ` [U-Boot] [PATCH v2 7/7] MIPS: bootm: Add support for Vcore III linux kernel Gregory CLEMENT
2018-10-28 17:54 ` Daniel Schwierzeck
2018-11-30 14:16 ` Gregory CLEMENT
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=20181009115838.21795-3-gregory.clement@bootlin.com \
--to=gregory.clement@bootlin.com \
--cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.