armv8: aarch64: Fix the warning about x1-x3 nonzero issue
Subsystems (3)
PATCH v2 1/1 armv8: aarch64: Fix the warning about x1-x3 nonzero issue
For 64-bit kernel, there is a warning about x1-x3 nonzero in violation of boot protocol. To fix this issue, input argument 4 is added for armv8_switch_to_el2 and armv8_switch_to_el1. The input argument 4 will be set to the right value, such as zero.
---
Changes in v2:
- Add another input argument 4 for armv8_switch_to_el2 and armv8_switch_to_el1.
- Give up the previous way to adjust the parameters to transfer and make sure x3 is zero.
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S | 28 ++++++++++++++-------------- arch/arm/cpu/armv8/sec_firmware_asm.S | 5 +++-- arch/arm/cpu/armv8/start.S | 8 ++++---- arch/arm/cpu/armv8/transition.S | 22 +++++++++++----------- arch/arm/include/asm/system.h | 8 +++++--- arch/arm/lib/bootm.c | 10 +++++----- arch/arm/mach-rmobile/lowlevel_init_gen3.S | 8 ++++---- cmd/bootefi.c | 2 +- 8 files changed, 47 insertions(+), 44 deletions(-)
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S +14 -14
@@ -378,29 +378,29 @@ cpu_is_le: b.eq 1f #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 - ldr x4, =ES_TO_AARCH64 + adr x4, secondary_switch_to_el1 + ldr x5, =ES_TO_AARCH64 #else - ldr x3, [x11] - ldr x4, =ES_TO_AARCH32 + ldr x4, [x11] + ldr x5, =ES_TO_AARCH32 #endif bl secondary_switch_to_el2 1: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 + adr x4, secondary_switch_to_el1 #else - ldr x3, [x11] + ldr x4, [x11] #endif - ldr x4, =ES_TO_AARCH64 + ldr x5, =ES_TO_AARCH64 bl secondary_switch_to_el2 ENDPROC(secondary_boot_func) ENTRY(secondary_switch_to_el2) - switch_el x5, 1f, 0f, 0f + switch_el x6, 1f, 0f, 0f 0: ret -1: armv8_switch_to_el2_m x3, x4, x5 +1: armv8_switch_to_el2_m x4, x5, x6 ENDPROC(secondary_switch_to_el2) ENTRY(secondary_switch_to_el1)
@@ -414,22 +414,22 @@ ENTRY(secondary_switch_to_el1) /* physical address of this cpus spin table element */ add x11, x1, x0 - ldr x3, [x11] + ldr x4, [x11] ldr x5, [x11, #24] ldr x6, =IH_ARCH_DEFAULT cmp x6, x5 b.eq 2f - ldr x4, =ES_TO_AARCH32 + ldr x5, =ES_TO_AARCH32 bl switch_to_el1 -2: ldr x4, =ES_TO_AARCH64 +2: ldr x5, =ES_TO_AARCH64 switch_to_el1: - switch_el x5, 0f, 1f, 0f + switch_el x6, 0f, 1f, 0f 0: ret -1: armv8_switch_to_el1_m x3, x4, x5 +1: armv8_switch_to_el1_m x4, x5, x6 ENDPROC(secondary_switch_to_el1) /* Ensure that the literals used by the secondary boot code are
arch/arm/cpu/armv8/sec_firmware_asm.S +3 -2
@@ -57,7 +57,8 @@ ENDPROC(_sec_firmware_support_psci_version) * x0: argument, zero * x1: machine nr * x2: fdt address - * x3: kernel entry point + * x3: input argument + * x4: kernel entry point * @param outputs for secure firmware: * x0: function id * x1: kernel entry point
@@ -65,7 +66,7 @@ ENDPROC(_sec_firmware_support_psci_version) * x3: fdt address */ ENTRY(armv8_el2_to_aarch32) - mov x0, x3 + mov x0, x4 mov x3, x2 mov x2, x1 mov x1, x0
arch/arm/cpu/armv8/start.S +4 -4
@@ -250,14 +250,14 @@ WEAK(lowlevel_init) /* * All slaves will enter EL2 and optionally EL1. */ - adr x3, lowlevel_in_el2 - ldr x4, =ES_TO_AARCH64 + adr x4, lowlevel_in_el2 + ldr x5, =ES_TO_AARCH64 bl armv8_switch_to_el2 lowlevel_in_el2: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, lowlevel_in_el1 - ldr x4, =ES_TO_AARCH64 + adr x4, lowlevel_in_el1 + ldr x5, =ES_TO_AARCH64 bl armv8_switch_to_el1 lowlevel_in_el1:
arch/arm/cpu/armv8/transition.S +11 -11
@@ -11,9 +11,9 @@ #include <asm/macro.h> ENTRY(armv8_switch_to_el2) - switch_el x5, 1f, 0f, 0f + switch_el x6, 1f, 0f, 0f 0: - cmp x4, #ES_TO_AARCH64 + cmp x5, #ES_TO_AARCH64 b.eq 2f /* * When loading 32-bit kernel, it will jump
@@ -22,23 +22,23 @@ ENTRY(armv8_switch_to_el2) bl armv8_el2_to_aarch32 2: /* - * x3 is kernel entry point or switch_to_el1 + * x4 is kernel entry point or switch_to_el1 * if CONFIG_ARMV8_SWITCH_TO_EL1 is defined. * When running in EL2 now, jump to the - * address saved in x3. + * address saved in x4. */ - br x3 -1: armv8_switch_to_el2_m x3, x4, x5 + br x4 +1: armv8_switch_to_el2_m x4, x5, x6 ENDPROC(armv8_switch_to_el2) ENTRY(armv8_switch_to_el1) - switch_el x5, 0f, 1f, 0f + switch_el x6, 0f, 1f, 0f 0: - /* x3 is kernel entry point. When running in EL1 - * now, jump to the address saved in x3. + /* x4 is kernel entry point. When running in EL1 + * now, jump to the address saved in x4. */ - br x3 -1: armv8_switch_to_el1_m x3, x4, x5 + br x4 +1: armv8_switch_to_el1_m x4, x5, x6 ENDPROC(armv8_switch_to_el1) WEAK(armv8_el2_to_aarch32)
arch/arm/include/asm/system.h +5 -3
@@ -196,11 +196,12 @@ void __asm_switch_ttbr(u64 new_ttbr);* For loading 32-bit OS, machine nr * @fdt_addr: For loading 64-bit OS, zero. * For loading 32-bit OS, fdt address. +* @arg4: Input argument. * @entry_point: kernel entry point * @es_flag: execution state flag, ES_TO_AARCH64 or ES_TO_AARCH32 */ void armv8_switch_to_el2 (u64 args,u64 mach_nr,u64 fdt_addr, -u64 entry_point,u64 es_flag); +u64 arg4,u64 entry_point,u64 es_flag);/* * Switch from EL2 to EL1 for ARMv8 *
@@ -210,13 +211,14 @@ void armv8_switch_to_el2(u64 args, u64 mach_nr, u64 fdt_addr,* For loading 32-bit OS, machine nr * @fdt_addr: For loading 64-bit OS, zero. * For loading 32-bit OS, fdt address. +* @arg4: Input argument. * @entry_point: kernel entry point * @es_flag: execution state flag, ES_TO_AARCH64 or ES_TO_AARCH32 */ void armv8_switch_to_el1 (u64 args,u64 mach_nr,u64 fdt_addr, -u64 entry_point,u64 es_flag); +u64 arg4,u64 entry_point,u64 es_flag);void armv8_el2_to_aarch32 (u64 args,u64 mach_nr,u64 fdt_addr, -u64 entry_point); +u64 arg4,u64 entry_point);void gic_init (void );void gic_send_sgi (unsigned long sgino);void wait_for_wakeup (void );
arch/arm/lib/bootm.c +5 -5
@@ -287,11 +287,11 @@ static void switch_to_el1(void)if ((IH_ARCH_DEFAULT ==IH_ARCH_ARM64 ) && (images.os.arch ==IH_ARCH_ARM ))armv8_switch_to_el1 (0 , (u64 )gd->bd->bi_arch_number, - (u64 )images.ft_addr, + (u64 )images.ft_addr,0 , (u64 )images.ep,ES_TO_AARCH32 );else -armv8_switch_to_el1 ((u64 )images.ft_addr,0 ,0 , +armv8_switch_to_el1 ((u64 )images.ft_addr,0 ,0 ,0 , images.ep,ES_TO_AARCH64 ); }
@@ -324,17 +324,17 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)update_os_arch_secondary_cores (images->os.arch);#ifdef CONFIG_ARMV8_SWITCH_TO_EL1 -armv8_switch_to_el2 ((u64 )images->ft_addr,0 ,0 , +armv8_switch_to_el2 ((u64 )images->ft_addr,0 ,0 ,0 , (u64 )switch_to_el1,ES_TO_AARCH64 );#else if ((IH_ARCH_DEFAULT ==IH_ARCH_ARM64 ) && (images->os.arch ==IH_ARCH_ARM ))armv8_switch_to_el2 (0 , (u64 )gd->bd->bi_arch_number, - (u64 )images->ft_addr, + (u64 )images->ft_addr,0 , (u64 )images->ep,ES_TO_AARCH32 );else -armv8_switch_to_el2 ((u64 )images->ft_addr,0 ,0 , +armv8_switch_to_el2 ((u64 )images->ft_addr,0 ,0 ,0 , images->ep,ES_TO_AARCH64 );#endif
arch/arm/mach-rmobile/lowlevel_init_gen3.S +4 -4
@@ -61,14 +61,14 @@ ENTRY(lowlevel_init) /* * All slaves will enter EL2 and optionally EL1. */ - adr x3, lowlevel_in_el2 - ldr x4, =ES_TO_AARCH64 + adr x4, lowlevel_in_el2 + ldr x5, =ES_TO_AARCH64 bl armv8_switch_to_el2 lowlevel_in_el2: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, lowlevel_in_el1 - ldr x4, =ES_TO_AARCH64 + adr x4, lowlevel_in_el1 + ldr x5, =ES_TO_AARCH64 bl armv8_switch_to_el1 lowlevel_in_el1:
cmd/bootefi.c +1 -1
@@ -246,7 +246,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)/* Move into EL2 and keep running there */ armv8_switch_to_el2 ((ulong )entry, (ulong)&loaded_image_info, - (ulong)&systab, (ulong )efi_run_in_el2, + (ulong)&systab,0 , (ulong )efi_run_in_el2,ES_TO_AARCH64 );/* Should never reach here, efi exits with longjmp */
Signature · 1 line
2.1.0.27.g96db324
PATCH v2 1/1 armv8: aarch64: Fix the warning about x1-x3 nonzero issue
Quoted 107 lines · Alison Wang
For 64-bit kernel, there is a warning about x1-x3 nonzero in violation of boot protocol. To fix this issue, input argument 4 is added for
armv8_switch_to_el2andarmv8_switch_to_el1. The input argument 4 will be set to the right value, such as zero.Signed-off-by Alison Wang <[email protected]>---
Changes in v2:
- Add another input argument 4 forarmv8_switch_to_el2andarmv8_switch_to_el1.
- Give up the previous way to adjust the parameters to transfer and make sure x3 is zero.arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S | 28 ++++++++++++++-------------- arch/arm/cpu/armv8/sec_firmware_asm.S | 5 +++-- arch/arm/cpu/armv8/start.S | 8 ++++---- arch/arm/cpu/armv8/transition.S | 22 +++++++++++----------- arch/arm/include/asm/system.h | 8 +++++--- arch/arm/lib/bootm.c | 10 +++++----- arch/arm/mach-rmobile/lowlevel_init_gen3.S | 8 ++++---- cmd/bootefi.c | 2 +- 8 files changed, 47 insertions(+), 44 deletions(-)arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S +14
-14@@ -378,29 +378,29 @@ cpu_is_le: b.eq 1f #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 - ldr x4, =ES_TO_AARCH64 + adr x4, secondary_switch_to_el1 + ldr x5, =ES_TO_AARCH64 #else - ldr x3, [x11] - ldr x4, =ES_TO_AARCH32 + ldr x4, [x11] + ldr x5, =ES_TO_AARCH32 #endif bl secondary_switch_to_el2 1: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 + adr x4, secondary_switch_to_el1 #else - ldr x3, [x11] + ldr x4, [x11] #endif - ldr x4, =ES_TO_AARCH64 + ldr x5, =ES_TO_AARCH64 bl secondary_switch_to_el2 ENDPROC(secondary_boot_func) ENTRY(secondary_switch_to_el2) - switch_el x5, 1f, 0f, 0f + switch_el x6, 1f, 0f, 0f 0: ret -1: armv8_switch_to_el2_m x3, x4, x5 +1: armv8_switch_to_el2_m x4, x5, x6 ENDPROC(secondary_switch_to_el2) ENTRY(secondary_switch_to_el1)@@ -414,22 +414,22 @@ ENTRY(secondary_switch_to_el1) /* physical address of this cpus spin table element */ add x11, x1, x0 - ldr x3, [x11] + ldr x4, [x11] ldr x5, [x11, #24] ldr x6, =IH_ARCH_DEFAULT cmp x6, x5 b.eq 2f - ldr x4, =ES_TO_AARCH32 + ldr x5, =ES_TO_AARCH32 bl switch_to_el1 -2: ldr x4, =ES_TO_AARCH64 +2: ldr x5, =ES_TO_AARCH64 switch_to_el1: - switch_el x5, 0f, 1f, 0f + switch_el x6, 0f, 1f, 0f 0: ret -1: armv8_switch_to_el1_m x3, x4, x5 +1: armv8_switch_to_el1_m x4, x5, x6 ENDPROC(secondary_switch_to_el1) /* Ensure that the literals used by the secondary boot code arearch/arm/cpu/armv8/sec_firmware_asm.S +2
-1@@ -57,7 +57,8 @@ ENDPROC(_sec_firmware_support_psci_version) * x0: argument, zero * x1: machine nr * x2: fdt address - * x3: kernel entry point + * x3: input argument + * x4: kernel entry point * @param outputs for secure firmware: * x0: function id * x1: kernel entry point
arch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 69
Quoted 5 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +1
-1@@ -65,7 +66,7 @@ ENDPROC(_sec_firmware_support_psci_version) * x3: fdt address */ ENTRY(armv8_el2_to_aarch32) - mov x0, x3 + mov x0, x4
You no longer need x0 as scratch register. Just write ...
arch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 72
Quoted 3 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +0
-0mov x3, x2 mov x2, x1 mov x1, x0
... x4 directly into x1 here.
Otherwise looks good to me. So with the change above you can add my
tag in the next version.
Alex
PATCH v2 1/1 armv8: aarch64: Fix the warning about x1-x3 nonzero issue
Quoted 10 lines · Alexander Graf
Quoted 7 lines · Alison Wang
For 64-bit kernel, there is a warning about x1-x3 nonzero in violation of boot protocol. To fix this issue, input argument 4 is added for
armv8_switch_to_el2andarmv8_switch_to_el1. The input argument 4 will be set to the right value, such as zero.Signed-off-by Alison Wang <[email protected]>
Thanks Alison, this removes the warning for me now and still boots fine. I tested with Juno R0/1/2 and FVP Foundation and AEMv8 models.
Quoted 131 lines
Quoted 106 lines
---
Changes in v2:
- Add another input argument 4 forarmv8_switch_to_el2andarmv8_switch_to_el1.
- Give up the previous way to adjust the parameters to transfer and make sure x3 is zero.arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S | 28 ++++++++++++++-------------- arch/arm/cpu/armv8/sec_firmware_asm.S | 5 +++-- arch/arm/cpu/armv8/start.S | 8 ++++---- arch/arm/cpu/armv8/transition.S | 22 +++++++++++----------- arch/arm/include/asm/system.h | 8 +++++--- arch/arm/lib/bootm.c | 10 +++++----- arch/arm/mach-rmobile/lowlevel_init_gen3.S | 8 ++++---- cmd/bootefi.c | 2 +- 8 files changed, 47 insertions(+), 44 deletions(-)arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S +14
-14@@ -378,29 +378,29 @@ cpu_is_le: b.eq 1f #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 - ldr x4, =ES_TO_AARCH64 + adr x4, secondary_switch_to_el1 + ldr x5, =ES_TO_AARCH64 #else - ldr x3, [x11] - ldr x4, =ES_TO_AARCH32 + ldr x4, [x11] + ldr x5, =ES_TO_AARCH32 #endif bl secondary_switch_to_el2 1: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 + adr x4, secondary_switch_to_el1 #else - ldr x3, [x11] + ldr x4, [x11] #endif - ldr x4, =ES_TO_AARCH64 + ldr x5, =ES_TO_AARCH64 bl secondary_switch_to_el2 ENDPROC(secondary_boot_func) ENTRY(secondary_switch_to_el2) - switch_el x5, 1f, 0f, 0f + switch_el x6, 1f, 0f, 0f 0: ret -1: armv8_switch_to_el2_m x3, x4, x5 +1: armv8_switch_to_el2_m x4, x5, x6 ENDPROC(secondary_switch_to_el2) ENTRY(secondary_switch_to_el1)@@ -414,22 +414,22 @@ ENTRY(secondary_switch_to_el1) /* physical address of this cpus spin table element */ add x11, x1, x0 - ldr x3, [x11] + ldr x4, [x11] ldr x5, [x11, #24] ldr x6, =IH_ARCH_DEFAULT cmp x6, x5 b.eq 2f - ldr x4, =ES_TO_AARCH32 + ldr x5, =ES_TO_AARCH32 bl switch_to_el1 -2: ldr x4, =ES_TO_AARCH64 +2: ldr x5, =ES_TO_AARCH64 switch_to_el1: - switch_el x5, 0f, 1f, 0f + switch_el x6, 0f, 1f, 0f 0: ret -1: armv8_switch_to_el1_m x3, x4, x5 +1: armv8_switch_to_el1_m x4, x5, x6 ENDPROC(secondary_switch_to_el1) /* Ensure that the literals used by the secondary boot code arearch/arm/cpu/armv8/sec_firmware_asm.S +2
-1@@ -57,7 +57,8 @@ ENDPROC(_sec_firmware_support_psci_version) * x0: argument, zero * x1: machine nr * x2: fdt address - * x3: kernel entry point + * x3: input argument + * x4: kernel entry point * @param outputs for secure firmware: * x0: function id * x1: kernel entry pointarch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 69
Quoted 5 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +1
-1@@ -65,7 +66,7 @@ ENDPROC(_sec_firmware_support_psci_version) * x3: fdt address */ ENTRY(armv8_el2_to_aarch32) - mov x0, x3 + mov x0, x4You no longer need x0 as scratch register. Just write ...
arch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 72
Quoted 3 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +0
-0mov x3, x2 mov x2, x1 mov x1, x0... x4 directly into x1 here.
Otherwise looks good to me. So with the change above you can add my
Reviewed-by Alexander Graf <[email protected]>tag in the next version.
Alex
PATCH v2 1/1 armv8: aarch64: Fix the warning about x1-x3 nonzero issue
Quoted 11 lines · Alexander Graf
Quoted 10 lines · Alison Wang
Quoted 7 lines
For 64-bit kernel, there is a warning about x1-x3 nonzero in violation of boot protocol. To fix this issue, input argument 4 is added for
armv8_switch_to_el2andarmv8_switch_to_el1. The input argument 4 will be set to the right value, such as zero.
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Signed-off-by Alison Wang <[email protected]>Thanks Alison, this removes the warning for me now and still boots fine. I tested with Juno R0/1/2 and FVP Foundation and AEMv8 models.
Tested-by Ryan Harkin <[email protected]>
[Alison Wang] Ryan, thanks for your test. :)
Best Regards,
Alison Wang
Quoted 134 lines
Quoted 9 lines
Quoted 9 lines
---
Changes in v2:
- Add another input argument 4 forarmv8_switch_to_el2andarmv8_switch_to_el1.
- Give up the previous way to adjust the parameters to transfer and make sure x3 is zero.Quoted 5 lines
Quoted 5 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S | 28 ++++++++++++++-------------- arch/arm/cpu/armv8/sec_firmware_asm.S | 5 +++-- arch/arm/cpu/armv8/start.S | 8 ++++---- arch/arm/cpu/armv8/transition.S | 22 +++++++++++-----------
Quoted 119 lines
Quoted 94 lines
arch/arm/include/asm/system.h | 8 +++++--- arch/arm/lib/bootm.c | 10 +++++----- arch/arm/mach-rmobile/lowlevel_init_gen3.S | 8 ++++---- cmd/bootefi.c | 2 +- 8 files changed, 47 insertions(+), 44 deletions(-)arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S +14
-14@@ -378,29 +378,29 @@ cpu_is_le: b.eq 1f #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 - ldr x4, =ES_TO_AARCH64 + adr x4, secondary_switch_to_el1 + ldr x5, =ES_TO_AARCH64 #else - ldr x3, [x11] - ldr x4, =ES_TO_AARCH32 + ldr x4, [x11] + ldr x5, =ES_TO_AARCH32 #endif bl secondary_switch_to_el2 1: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 + adr x4, secondary_switch_to_el1 #else - ldr x3, [x11] + ldr x4, [x11] #endif - ldr x4, =ES_TO_AARCH64 + ldr x5, =ES_TO_AARCH64 bl secondary_switch_to_el2 ENDPROC(secondary_boot_func) ENTRY(secondary_switch_to_el2) - switch_el x5, 1f, 0f, 0f + switch_el x6, 1f, 0f, 0f 0: ret -1: armv8_switch_to_el2_m x3, x4, x5 +1: armv8_switch_to_el2_m x4, x5, x6 ENDPROC(secondary_switch_to_el2) ENTRY(secondary_switch_to_el1)@@ -414,22 +414,22 @@ ENTRY(secondary_switch_to_el1) /* physical address of this cpus spin table element */ add x11, x1, x0 - ldr x3, [x11] + ldr x4, [x11] ldr x5, [x11, #24] ldr x6, =IH_ARCH_DEFAULT cmp x6, x5 b.eq 2f - ldr x4, =ES_TO_AARCH32 + ldr x5, =ES_TO_AARCH32 bl switch_to_el1 -2: ldr x4, =ES_TO_AARCH64 +2: ldr x5, =ES_TO_AARCH64 switch_to_el1: - switch_el x5, 0f, 1f, 0f + switch_el x6, 0f, 1f, 0f 0: ret -1: armv8_switch_to_el1_m x3, x4, x5 +1: armv8_switch_to_el1_m x4, x5, x6 ENDPROC(secondary_switch_to_el1) /* Ensure that the literals used by the secondary boot codeare diff --git
a/arch/arm/cpu/armv8/sec_firmware_asm.Sb/arch/arm/cpu/armv8/sec_firmware_asm.S
index 903195d..747b53f 100644arch/arm/cpu/armv8/sec_firmware_asm.S +2
-1@@ -57,7 +57,8 @@ ENDPROC(_sec_firmware_support_psci_version) * x0: argument, zero * x1: machine nr * x2: fdt address - * x3: kernel entry point + * x3: input argument + * x4: kernel entry point * @param outputs for secure firmware: * x0: function id * x1: kernel entry pointarch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 69
Quoted 5 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +1
-1@@ -65,7 +66,7 @@ ENDPROC(_sec_firmware_support_psci_version) * x3: fdt address */ ENTRY(armv8_el2_to_aarch32) - mov x0, x3 + mov x0, x4You no longer need x0 as scratch register. Just write ...
arch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 72
Quoted 3 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +0
-0mov x3, x2 mov x2, x1 mov x1, x0... x4 directly into x1 here.
Otherwise looks good to me. So with the change above you can add my
Reviewed-by Alexander Graf <[email protected]>tag in the next version.
Alex
PATCH v2 1/1 armv8: aarch64: Fix the warning about x1-x3 nonzero issue
In reply to Alexander GrafQuoted 129 lines · Alison Wang
Quoted 1 line
For 64-bit kernel, there is a warning about x1-x3 nonzero in
violation
Quoted 2 lines
of boot protocol. To fix this issue, input argument 4 is added for
armv8_switch_to_el2andarmv8_switch_to_el1. The input argument 4will
Quoted 6 lines
be set to the right value, such as zero.
Signed-off-by Alison Wang <[email protected]>---
Changes in v2:
- Add another input argument 4 forarmv8_switch_to_el2and
armv8_switch_to_el1.Quoted 1 line
- Give up the previous way to adjust the parameters to transfer and
make sure x3 is zero.
Quoted 2 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S | 28 ++++++++++++++--------------
Quoted 3 lines
arch/arm/cpu/armv8/sec_firmware_asm.S | 5 +++-- arch/arm/cpu/armv8/start.S | 8 ++++---- arch/arm/cpu/armv8/transition.S | 22 +++++++++++-----------
Quoted 68 lines
arch/arm/include/asm/system.h | 8 +++++--- arch/arm/lib/bootm.c | 10 +++++----- arch/arm/mach-rmobile/lowlevel_init_gen3.S | 8 ++++---- cmd/bootefi.c | 2 +- 8 files changed, 47 insertions(+), 44 deletions(-)arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S +12
-12@@ -378,29 +378,29 @@ cpu_is_le: b.eq 1f #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 - ldr x4, =ES_TO_AARCH64 + adr x4, secondary_switch_to_el1 + ldr x5, =ES_TO_AARCH64 #else - ldr x3, [x11] - ldr x4, =ES_TO_AARCH32 + ldr x4, [x11] + ldr x5, =ES_TO_AARCH32 #endif bl secondary_switch_to_el2 1: #ifdef CONFIG_ARMV8_SWITCH_TO_EL1 - adr x3, secondary_switch_to_el1 + adr x4, secondary_switch_to_el1 #else - ldr x3, [x11] + ldr x4, [x11] #endif - ldr x4, =ES_TO_AARCH64 + ldr x5, =ES_TO_AARCH64 bl secondary_switch_to_el2 ENDPROC(secondary_boot_func) ENTRY(secondary_switch_to_el2) - switch_el x5, 1f, 0f, 0f + switch_el x6, 1f, 0f, 0f 0: ret -1: armv8_switch_to_el2_m x3, x4, x5 +1: armv8_switch_to_el2_m x4, x5, x6 ENDPROC(secondary_switch_to_el2) ENTRY(secondary_switch_to_el1)@@ -414,22 +414,22 @@ ENTRY(secondary_switch_to_el1) /* physical address of this cpus spin table element */ add x11, x1, x0 - ldr x3, [x11] + ldr x4, [x11] ldr x5, [x11, #24] ldr x6, =IH_ARCH_DEFAULT cmp x6, x5 b.eq 2f - ldr x4, =ES_TO_AARCH32 + ldr x5, =ES_TO_AARCH32 bl switch_to_el1 -2: ldr x4, =ES_TO_AARCH64 +2: ldr x5, =ES_TO_AARCH64arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S ENTRY(secondary_switch_to_el1) · line 435
Quoted 10 lines
arch/arm/cpu/armv8/fsl-layerscape/lowlevel.S +2
-2switch_to_el1: - switch_el x5, 0f, 1f, 0f + switch_el x6, 0f, 1f, 0f 0: ret -1: armv8_switch_to_el1_m x3, x4, x5 +1: armv8_switch_to_el1_m x4, x5, x6 ENDPROC(secondary_switch_to_el1) /* Ensure that the literals used by the secondary boot code arediff
Quoted 16 lines
--git
a/arch/arm/cpu/armv8/sec_firmware_asm.Sb/arch/arm/cpu/armv8/sec_firmware_asm.S
index 903195d..747b53f 100644arch/arm/cpu/armv8/sec_firmware_asm.S +2
-1@@ -57,7 +57,8 @@ ENDPROC(_sec_firmware_support_psci_version) * x0: argument, zero * x1: machine nr * x2: fdt address - * x3: kernel entry point + * x3: input argument + * x4: kernel entry point * @param outputs for secure firmware: * x0: function id * x1: kernel entry pointarch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 69
Quoted 5 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +1
-1@@ -65,7 +66,7 @@ ENDPROC(_sec_firmware_support_psci_version) * x3: fdt address */ ENTRY(armv8_el2_to_aarch32) - mov x0, x3 + mov x0, x4You no longer need x0 as scratch register. Just write ...
arch/arm/cpu/armv8/sec_firmware_asm.S ENDPROC(_sec_firmware_support_psci_version) · line 72
Quoted 3 lines
arch/arm/cpu/armv8/sec_firmware_asm.S +0
-0mov x3, x2 mov x2, x1 mov x1, x0
Quoted 9 lines
... x4 directly into x1 here.
Otherwise looks good to me. So with the change above you can add my
Reviewed-by Alexander Graf <[email protected]>tag in the next version.
[Alison Wang] Alex, thanks for your detail comment. I will change it in v3.
Best Regards,
Alison Wang