Skip to content

Commit 23c8a50

Browse files
Ard Biesheuvelwildea01
authored andcommitted
arm64: kernel: use ordinary return/argument register for el2_setup()
The function el2_setup() passes its return value in register w20, and in the two cases where the caller actually cares about this return value, it is passed into set_cpu_boot_mode_flag() [almost] directly, which expects its input in w20 as well. So there is no reason to use a 'special' callee saved register here, but we can simply follow the PCS for return value and first argument, respectively. Reviewed-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent b5fe242 commit 23c8a50

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arch/arm64/kernel/head.S

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ efi_header_end:
210210

211211
ENTRY(stext)
212212
bl preserve_boot_args
213-
bl el2_setup // Drop to EL1, w20=cpu_boot_mode
213+
bl el2_setup // Drop to EL1, w0=cpu_boot_mode
214214
adrp x24, __PHYS_OFFSET
215215
and x23, x24, MIN_KIMG_ALIGN - 1 // KASLR offset, defaults to 0
216216
bl set_cpu_boot_mode_flag
@@ -488,7 +488,7 @@ CPU_LE( bic x0, x0, #(1 << 25) ) // Clear the EE bit for EL2
488488
CPU_BE( orr x0, x0, #(3 << 24) ) // Set the EE and E0E bits for EL1
489489
CPU_LE( bic x0, x0, #(3 << 24) ) // Clear the EE and E0E bits for EL1
490490
msr sctlr_el1, x0
491-
mov w20, #BOOT_CPU_MODE_EL1 // This cpu booted in EL1
491+
mov w0, #BOOT_CPU_MODE_EL1 // This cpu booted in EL1
492492
isb
493493
ret
494494

@@ -584,7 +584,7 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems
584584

585585
cbz x2, install_el2_stub
586586

587-
mov w20, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2
587+
mov w0, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2
588588
isb
589589
ret
590590

@@ -599,7 +599,7 @@ install_el2_stub:
599599
PSR_MODE_EL1h)
600600
msr spsr_el2, x0
601601
msr elr_el2, lr
602-
mov w20, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2
602+
mov w0, #BOOT_CPU_MODE_EL2 // This CPU booted in EL2
603603
eret
604604
ENDPROC(el2_setup)
605605

@@ -609,10 +609,10 @@ ENDPROC(el2_setup)
609609
*/
610610
set_cpu_boot_mode_flag:
611611
adr_l x1, __boot_cpu_mode
612-
cmp w20, #BOOT_CPU_MODE_EL2
612+
cmp w0, #BOOT_CPU_MODE_EL2
613613
b.ne 1f
614614
add x1, x1, #4
615-
1: str w20, [x1] // This CPU has booted in EL1
615+
1: str w0, [x1] // This CPU has booted in EL1
616616
dmb sy
617617
dc ivac, x1 // Invalidate potentially stale cache line
618618
ret
@@ -649,7 +649,7 @@ ENTRY(__early_cpu_boot_status)
649649
* cores are held until we're ready for them to initialise.
650650
*/
651651
ENTRY(secondary_holding_pen)
652-
bl el2_setup // Drop to EL1, w20=cpu_boot_mode
652+
bl el2_setup // Drop to EL1, w0=cpu_boot_mode
653653
bl set_cpu_boot_mode_flag
654654
mrs x0, mpidr_el1
655655
mov_q x1, MPIDR_HWID_BITMASK

0 commit comments

Comments
 (0)