mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH] MIPS: reloc: make flush_cache_all() usable
Date: Fri, 21 Jun 2019 08:15:07 +0300	[thread overview]
Message-ID: <20190621051507.11700-1-antonynpavlov@gmail.com> (raw)

flush_cache_all() uses 'struct cpuinfo_mips current_cpu_data' data fields.
These data fields are initialized in r4k_cache_init().

However in the current implementation the r4k_cache_init() function
is called __AFTER__ relocate_code().

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/mips/lib/reloc.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index 14ba6167dd..6f1cd6d82f 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -37,6 +37,7 @@
 #include <asm/mipsregs.h>
 #include <asm/relocs.h>
 #include <asm/sections.h>
+#include <asm/cpu-features.h>
 #include <linux/sizes.h>
 #include <asm-generic/memory_layout.h>
 
@@ -157,6 +158,17 @@ void relocate_code(void *fdt, u32 fdt_size, u32 ram_size)
 		apply_reloc(type, (void *)addr, off);
 	}
 
+	/* clear the BSS first */
+	memset(__bss_start, 0x00, bss_len);
+
+	cpu_probe();
+
+	if (cpu_has_4k_cache) {
+		extern void r4k_cache_init(void);
+
+		r4k_cache_init();
+	}
+
 	/* Ensure the icache is coherent */
 	flush_cache_all();
 
-- 
2.20.1


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

             reply	other threads:[~2019-06-21  5:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21  5:15 Antony Pavlov [this message]
2019-06-26  6:53 ` Sascha Hauer
2019-06-28  8:35   ` Antony Pavlov
2019-07-01  7:41     ` Sascha Hauer

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=20190621051507.11700-1-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=o.rempel@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