57 lines
1.6 KiB
Diff
57 lines
1.6 KiB
Diff
From ee347a1886b11729f2a5d9bc7bc1016471efb9bb Mon Sep 17 00:00:00 2001
|
|
From: Fedora Kernel Team <kernel-team@fedoraproject.org>
|
|
Date: Mon, 14 Oct 2019 13:11:03 +0000
|
|
Subject: [PATCH] [v2] riscv: Fix memblock reservation for device tree blob
|
|
|
|
---
|
|
arch/riscv/mm/init.c | 12 +++++++++++-
|
|
1 file changed, 11 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
|
|
index 42bf939..ed9cd99 100644
|
|
--- a/arch/riscv/mm/init.c
|
|
+++ b/arch/riscv/mm/init.c
|
|
@@ -11,6 +11,7 @@
|
|
#include <linux/swap.h>
|
|
#include <linux/sizes.h>
|
|
#include <linux/of_fdt.h>
|
|
+#include <linux/libfdt.h>
|
|
|
|
#include <asm/fixmap.h>
|
|
#include <asm/tlbflush.h>
|
|
@@ -82,6 +83,8 @@ static void __init setup_initrd(void)
|
|
}
|
|
#endif /* CONFIG_BLK_DEV_INITRD */
|
|
|
|
+static phys_addr_t dtb_early_pa __initdata;
|
|
+
|
|
void __init setup_bootmem(void)
|
|
{
|
|
struct memblock_region *reg;
|
|
@@ -117,7 +120,12 @@ void __init setup_bootmem(void)
|
|
setup_initrd();
|
|
#endif /* CONFIG_BLK_DEV_INITRD */
|
|
|
|
- early_init_fdt_reserve_self();
|
|
+ /*
|
|
+ * Avoid using early_init_fdt_reserve_self() since __pa() does
|
|
+ * not work for DTB pointers that are fixmap addresses
|
|
+ */
|
|
+ memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
|
|
+
|
|
early_init_fdt_scan_reserved_mem();
|
|
memblock_allow_resize();
|
|
memblock_dump_all();
|
|
@@ -393,6 +401,8 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
|
|
|
|
/* Save pointer to DTB for early FDT parsing */
|
|
dtb_early_va = (void *)fix_to_virt(FIX_FDT) + (dtb_pa & ~PAGE_MASK);
|
|
+ /* Save physical address for memblock reservation */
|
|
+ dtb_early_pa = dtb_pa;
|
|
}
|
|
|
|
static void __init setup_vm_final(void)
|
|
--
|
|
2.23.0
|
|
|