Skip to contentSkip to conversation

ARM: kexec: backup the machine id reported by boot loader

PATCH New Andreas Fenkart 1 participant 1 message Nov 13, 2015 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: kexec: backup the machine id reported by boot loader

Starting a non-devicetree kernel via kexec from a devicetree kernel, fails since the machine id as received from the bootloader has been overwritten.

---
 arch/arm/include/asm/setup.h    | 1 +
 arch/arm/kernel/machine_kexec.c | 4 ++--
 arch/arm/kernel/setup.c         | 5 +++++
 3 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/include/asm/setup.h +1 -0
index e0adb9f..a26165b 100644
@@ -16,6 +16,7 @@
 
 #include <uapi/asm/setup.h>
 
+extern unsigned int __machine_arch_type_bootloader;
 
 #define __tag __used __attribute__((__section__(".taglist.init")))
 #define __tagtable(tag, fn) \
arch/arm/kernel/machine_kexec.c +2 -2
index 8bf3b7c..d602b6f 100644
@@ -15,7 +15,7 @@
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
 #include <asm/fncpy.h>
-#include <asm/mach-types.h>
+#include <asm/setup.h>
 #include <asm/smp_plat.h>
 #include <asm/system_misc.h>
 
@@ -168,7 +168,7 @@ void machine_kexec(struct kimage *image)
 	set_kernel_text_rw();
 	kexec_start_address = image->start;
 	kexec_indirection_page = page_list;
-	kexec_mach_type = machine_arch_type;
+	kexec_mach_type = __machine_arch_type_bootloader;
 	kexec_boot_atags = dt_mem ?: image->start - KEXEC_ARM_ZIMAGE_OFFSET
 				     + KEXEC_ARM_ATAGS_OFFSET;
 
arch/arm/kernel/setup.c +5 -0
index 6c777e9..8314e76 100644
@@ -83,6 +83,8 @@ extern void setup_dma_zone(const struct machine_desc *desc);
 
 unsigned int processor_id;
 EXPORT_SYMBOL(processor_id);
+unsigned int __machine_arch_type_bootloader __read_mostly;
+EXPORT_SYMBOL(__machine_arch_type_bootloader);
 unsigned int __machine_arch_type __read_mostly;
 EXPORT_SYMBOL(__machine_arch_type);
 unsigned int cacheid __read_mostly;
@@ -914,6 +916,9 @@ void __init setup_arch(char **cmdline_p)
 {
 	const struct machine_desc *mdesc;
 
+	/* save machine type as received by the boot loader */
+	__machine_arch_type_bootloader = __machine_arch_type;
+
 	setup_processor();
 	mdesc = setup_machine_fdt(__atags_pointer);
 	if (!mdesc)
Signature · 1 line
2.6.1