From: Anders Berg <anders.b...@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.b...@lsi.com>
Signed-off-by: Fredrik Markström <fredrik.markst...@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

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to