aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/riscv/mm
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmerdabbelt@google.com>2020-04-14 13:43:24 +0900
committerPalmer Dabbelt <palmerdabbelt@google.com>2020-05-18 11:38:05 -0700
commit2d2682512f0faf4d09a696184bf3c0bb6838baca (patch)
tree31d238d63d671ff6b8ade87e521186d30afec7e7 /arch/riscv/mm
parentLinux 5.7-rc6 (diff)
downloadwireguard-linux-2d2682512f0faf4d09a696184bf3c0bb6838baca.tar.xz
wireguard-linux-2d2682512f0faf4d09a696184bf3c0bb6838baca.zip
riscv: Allow device trees to be built into the kernel
Some systems don't provide a useful device tree to the kernel on boot. Chasing around bootloaders for these systems is a headache, so instead le't's just keep a device tree table in the kernel, keyed by the SOC's unique identifier, that contains the relevant DTB. This is only implemented for M mode right now. While we could implement this via the SBI calls that allow access to these identifiers, we don't have any systems that need this right now. Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/mm')
-rw-r--r--arch/riscv/mm/init.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 27a334106708..c18b3db4c507 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -17,6 +17,7 @@
#include <asm/fixmap.h>
#include <asm/tlbflush.h>
#include <asm/sections.h>
+#include <asm/soc.h>
#include <asm/pgtable.h>
#include <asm/io.h>
@@ -493,7 +494,15 @@ void free_initmem(void)
#else
asmlinkage void __init setup_vm(uintptr_t dtb_pa)
{
+#ifdef CONFIG_BUILTIN_DTB
+ dtb_early_va = soc_lookup_builtin_dtb();
+ if (!dtb_early_va) {
+ /* Fallback to first available DTS */
+ dtb_early_va = (void *) __dtb_start;
+ }
+#else
dtb_early_va = (void *)dtb_pa;
+#endif
}
static inline void setup_vm_final(void)