Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64: head.S: rename el2_setup -> init_kernel_el

For a while now el2_setup has performed some basic initialization of EL1
even when the kernel is booted at EL1, so the name is a little
misleading. Further, some comments are stale as with VHE it doesn't drop
the CPU to EL1.

To clarify things, rename el2_setup to init_kernel_el, and update
comments to be clearer as to the function's purpose.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20201113124937.20574-4-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>

authored by

Mark Rutland and committed by
Catalin Marinas
ecbb11ab 515d5c8a

+9 -8
+8 -7
arch/arm64/kernel/head.S
··· 104 104 */ 105 105 SYM_CODE_START(primary_entry) 106 106 bl preserve_boot_args 107 - bl el2_setup // Drop to EL1, w0=cpu_boot_mode 107 + bl init_kernel_el // w0=cpu_boot_mode 108 108 adrp x23, __PHYS_OFFSET 109 109 and x23, x23, MIN_KIMG_ALIGN - 1 // KASLR offset, defaults to 0 110 110 bl set_cpu_boot_mode_flag ··· 482 482 .section ".idmap.text","awx" 483 483 484 484 /* 485 - * If we're fortunate enough to boot at EL2, ensure that the world is 486 - * sane before dropping to EL1. 485 + * Starting from EL2 or EL1, configure the CPU to execute at the highest 486 + * reachable EL supported by the kernel in a chosen default state. If dropping 487 + * from EL2 to EL1, configure EL2 before configuring EL1. 487 488 * 488 489 * Returns either BOOT_CPU_MODE_EL1 or BOOT_CPU_MODE_EL2 in w0 if 489 490 * booted in EL1 or EL2 respectively. 490 491 */ 491 - SYM_FUNC_START(el2_setup) 492 + SYM_FUNC_START(init_kernel_el) 492 493 msr SPsel, #1 // We want to use SP_EL{1,2} 493 494 mrs x0, CurrentEL 494 495 cmp x0, #CurrentEL_EL2 ··· 650 649 msr elr_el2, lr 651 650 mov w0, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2 652 651 eret 653 - SYM_FUNC_END(el2_setup) 652 + SYM_FUNC_END(init_kernel_el) 654 653 655 654 /* 656 655 * Sets the __boot_cpu_mode flag depending on the CPU boot mode passed ··· 700 699 * cores are held until we're ready for them to initialise. 701 700 */ 702 701 SYM_FUNC_START(secondary_holding_pen) 703 - bl el2_setup // Drop to EL1, w0=cpu_boot_mode 702 + bl init_kernel_el // w0=cpu_boot_mode 704 703 bl set_cpu_boot_mode_flag 705 704 mrs x0, mpidr_el1 706 705 mov_q x1, MPIDR_HWID_BITMASK ··· 718 717 * be used where CPUs are brought online dynamically by the kernel. 719 718 */ 720 719 SYM_FUNC_START(secondary_entry) 721 - bl el2_setup // Drop to EL1 720 + bl init_kernel_el // w0=cpu_boot_mode 722 721 bl set_cpu_boot_mode_flag 723 722 b secondary_startup 724 723 SYM_FUNC_END(secondary_entry)
+1 -1
arch/arm64/kernel/sleep.S
··· 99 99 100 100 .pushsection ".idmap.text", "awx" 101 101 SYM_CODE_START(cpu_resume) 102 - bl el2_setup // if in EL2 drop to EL1 cleanly 102 + bl init_kernel_el 103 103 bl __cpu_setup 104 104 /* enable the MMU early - so we can access sleep_save_stash by va */ 105 105 adrp x1, swapper_pg_dir