[linux-yocto] [PATCH 14/15] ARM: axxia: Fix release of CPUs with booted via kexec

Charlie Paul cpaul.windriver at gmail.com
Mon Apr 28 17:13:49 PDT 2014


From: Anders Berg <anders.berg at lsi.com>

When booting a crash kernel via kexec, the memory specified by the
cpu-release-addr property is not valid physical memory (not part of
the crash kernel reserved memory area). In this case the memory needs an
ioremap to be written.

Signed-off-by: Anders Berg <anders.berg at lsi.com>
Signed-off-by: Fredrik Markström <fredrik.markstrom at gmail.com>
---
 arch/arm/mach-axxia/platsmp.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-axxia/platsmp.c b/arch/arm/mach-axxia/platsmp.c
index 7975c44..0ee417e 100644
--- a/arch/arm/mach-axxia/platsmp.c
+++ b/arch/arm/mach-axxia/platsmp.c
@@ -205,8 +205,8 @@ static void __init axxia_smp_prepare_cpus(unsigned int max_cpus)
 		 * from reset in hyp mode.
 		 */
 		if (!is_hyp_mode_available()) {
-			u32 phys_cpu = cpu_logical_map(cpu);
-			if (phys_cpu != 0) {
+			if (cpu != 0) {
+				u32 phys_cpu = cpu_logical_map(cpu);
 				u32 tmp = readl(syscon + 0x1010);
 				writel(0xab, syscon + 0x1000);
 				tmp &= ~(1 << phys_cpu);
@@ -225,10 +225,16 @@ static void __init axxia_smp_prepare_cpus(unsigned int max_cpus)
 		 * "holding pen".
 		 */
 		if (release_phys != 0) {
-			release_virt = (u32 *)phys_to_virt(release_phys);
+			int is_kmapped = pfn_valid(__phys_to_pfn(release_phys));
+			if (is_kmapped)
+				release_virt = phys_to_virt(release_phys);
+			else
+				release_virt = ioremap(release_phys, PAGE_SIZE);
 			*release_virt = virt_to_phys(axxia_secondary_startup);
 			smp_wmb();
 			__cpuc_flush_dcache_area(release_virt, sizeof(u32));
+			if (!is_kmapped)
+				iounmap(release_virt);
 		}
 	}
 
-- 
1.7.9.5



More information about the linux-yocto mailing list