Skip to contentSkip to conversation

ARM: kexec: fix kexec for Keystone 2

PATCH New [email protected] 1 participant 1 message Aug 2, 2016 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 83/111 ARM: kexec: fix kexec for Keystone 2

From: Russell King <[email protected]>
Subject: ARM: kexec: fix kexec for Keystone 2

Provide kexec with the boot view of memory by overriding the normal kexec translation functions added in a previous patch. We also need to fix a call to memblock in machine_kexec_prepare() so that we provide it with a running-view physical address rather than a boot- view physical address.

Cc Keerthy <[email protected]>
Cc Pratyush Anand <[email protected]>
Cc Vitaly Andrianov <[email protected]>
Cc Eric Biederman <[email protected]>
Cc Dave Young <[email protected]>
Cc Baoquan He <[email protected]>
Cc Vivek Goyal <[email protected]>
Cc Simon Horman <[email protected]>

---

 arch/arm/include/asm/kexec.h    |   24 ++++++++++++++++++++++++
 arch/arm/kernel/machine_kexec.c |    2 +-
 2 files changed, 25 insertions(+), 1 deletion(-)
arch/arm/include/asm/kexec.h renamed from arch/arm/include/asm/kexec.h~arm-kexec-fix-kexec-for-keystone-2 +24 -0
diff -puN arch/arm/include/asm/kexec.h~arm-kexec-fix-kexec-for-keystone-2 arch/arm/include/asm/kexec.h
@@ -53,6 +53,30 @@ static inline void crash_setup_regs(stru
 /* Function pointer to optional machine-specific reinitialization */
 extern void (*kexec_reinit)(void);
 
+static inline unsigned long phys_to_boot_phys(phys_addr_t phys)
+{
+	return phys_to_idmap(phys);
+}
+#define phys_to_boot_phys phys_to_boot_phys
+
+static inline phys_addr_t boot_phys_to_phys(unsigned long entry)
+{
+	return idmap_to_phys(entry);
+}
+#define boot_phys_to_phys boot_phys_to_phys
+
+static inline unsigned long page_to_boot_pfn(struct page *page)
+{
+	return page_to_pfn(page) + (arch_phys_to_idmap_offset >> PAGE_SHIFT);
+}
+#define page_to_boot_pfn page_to_boot_pfn
+
+static inline struct page *boot_pfn_to_page(unsigned long boot_pfn)
+{
+	return pfn_to_page(boot_pfn - (arch_phys_to_idmap_offset >> PAGE_SHIFT));
+}
+#define boot_pfn_to_page boot_pfn_to_page
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* CONFIG_KEXEC */
arch/arm/kernel/machine_kexec.c renamed from arch/arm/kernel/machine_kexec.c~arm-kexec-fix-kexec-for-keystone-2 +1 -1
diff -puN arch/arm/kernel/machine_kexec.c~arm-kexec-fix-kexec-for-keystone-2 arch/arm/kernel/machine_kexec.c
@@ -57,7 +57,7 @@ int machine_kexec_prepare(struct kimage
 	for (i = 0; i < image->nr_segments; i++) {
 		current_segment = &image->segment[i];
 
-		if (!memblock_is_region_memory(current_segment->mem,
+		if (!memblock_is_region_memory(idmap_to_phys(current_segment->mem),
 					       current_segment->memsz))
 			return -EINVAL;
 

_