aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel/head.S')
-rw-r--r--arch/arm64/kernel/head.S34
1 files changed, 32 insertions, 2 deletions
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 8cfd5ab37743..9c2e1564e9a7 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -36,6 +36,7 @@
36#include <asm/pgtable-hwdef.h> 36#include <asm/pgtable-hwdef.h>
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/page.h> 38#include <asm/page.h>
39#include <asm/smp.h>
39#include <asm/sysreg.h> 40#include <asm/sysreg.h>
40#include <asm/thread_info.h> 41#include <asm/thread_info.h>
41#include <asm/virt.h> 42#include <asm/virt.h>
@@ -643,7 +644,8 @@ __secondary_switched:
643 msr vbar_el1, x5 644 msr vbar_el1, x5
644 isb 645 isb
645 646
646 ldr_l x0, secondary_data // get secondary_data.stack 647 adr_l x0, secondary_data
648 ldr x0, [x0, #CPU_BOOT_STACK] // get secondary_data.stack
647 mov sp, x0 649 mov sp, x0
648 and x0, x0, #~(THREAD_SIZE - 1) 650 and x0, x0, #~(THREAD_SIZE - 1)
649 msr sp_el0, x0 // save thread_info 651 msr sp_el0, x0 // save thread_info
@@ -652,6 +654,29 @@ __secondary_switched:
652ENDPROC(__secondary_switched) 654ENDPROC(__secondary_switched)
653 655
654/* 656/*
657 * The booting CPU updates the failed status @__early_cpu_boot_status,
658 * with MMU turned off.
659 *
660 * update_early_cpu_boot_status tmp, status
661 * - Corrupts tmp1, tmp2
662 * - Writes 'status' to __early_cpu_boot_status and makes sure
663 * it is committed to memory.
664 */
665
666 .macro update_early_cpu_boot_status status, tmp1, tmp2
667 mov \tmp2, #\status
668 str_l \tmp2, __early_cpu_boot_status, \tmp1
669 dmb sy
670 dc ivac, \tmp1 // Invalidate potentially stale cache line
671 .endm
672
673 .pushsection .data..cacheline_aligned
674 .align L1_CACHE_SHIFT
675ENTRY(__early_cpu_boot_status)
676 .long 0
677 .popsection
678
679/*
655 * Enable the MMU. 680 * Enable the MMU.
656 * 681 *
657 * x0 = SCTLR_EL1 value for turning on the MMU. 682 * x0 = SCTLR_EL1 value for turning on the MMU.
@@ -669,6 +694,7 @@ ENTRY(__enable_mmu)
669 ubfx x2, x1, #ID_AA64MMFR0_TGRAN_SHIFT, 4 694 ubfx x2, x1, #ID_AA64MMFR0_TGRAN_SHIFT, 4
670 cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED 695 cmp x2, #ID_AA64MMFR0_TGRAN_SUPPORTED
671 b.ne __no_granule_support 696 b.ne __no_granule_support
697 update_early_cpu_boot_status 0, x1, x2
672 msr ttbr0_el1, x25 // load TTBR0 698 msr ttbr0_el1, x25 // load TTBR0
673 msr ttbr1_el1, x26 // load TTBR1 699 msr ttbr1_el1, x26 // load TTBR1
674 isb 700 isb
@@ -708,8 +734,12 @@ ENTRY(__enable_mmu)
708ENDPROC(__enable_mmu) 734ENDPROC(__enable_mmu)
709 735
710__no_granule_support: 736__no_granule_support:
737 /* Indicate that this CPU can't boot and is stuck in the kernel */
738 update_early_cpu_boot_status CPU_STUCK_IN_KERNEL, x1, x2
7391:
711 wfe 740 wfe
712 b __no_granule_support 741 wfi
742 b 1b
713ENDPROC(__no_granule_support) 743ENDPROC(__no_granule_support)
714 744
715__primary_switch: 745__primary_switch: