Skip to contentSkip to conversation

riscv: remove redundant mv instructions

PATCH Applied Nam Cao 4 participants 4 messages Jul 25, 2023 – Aug 30, 2023 RISC-V

lore
Share & tools
lore

Nam Cao

author
#0 lore raw

PATCH 1/1 riscv: remove redundant mv instructions

Some mv instructions were useful when first introduced to preserve a0 and a1 before function calls. However the code has changed and they are now redundant. Remove them.

---
 arch/riscv/kernel/head.S | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
arch/riscv/kernel/head.S +1 -5
index 11c3b94c4534..3710ea5d160f 100644
@@ -289,10 +289,6 @@ clear_bss:
 	blt a3, a4, clear_bss
 clear_bss_done:
 #endif
-	/* Save hart ID and DTB physical address */
-	mv s0, a0
-	mv s1, a1
-
 	la a2, boot_cpu_hartid
 	XIP_FIXUP_OFFSET a2
 	REG_S a0, (a2)
@@ -306,7 +302,7 @@ clear_bss_done:
 	la a0, __dtb_start
 	XIP_FIXUP_OFFSET a0
 #else
-	mv a0, s1
+	mv a0, a1
 #endif /* CONFIG_BUILTIN_DTB */
 	call setup_vm
 #ifdef CONFIG_MMU
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw

Hi Nam,

Quoted 25 lines · Nam Cao

Some mv instructions were useful when first introduced to preserve a0 and a1 before function calls. However the code has changed and they are now redundant. Remove them.

---
  arch/riscv/kernel/head.S | 6 +-----
  1 file changed, 1 insertion(+), 5 deletions(-)
arch/riscv/kernel/head.S +0 -4
index 11c3b94c4534..3710ea5d160f 100644
@@ -289,10 +289,6 @@ clear_bss:
  	blt a3, a4, clear_bss
  clear_bss_done:
  #endif
-	/* Save hart ID and DTB physical address */
-	mv s0, a0
-	mv s1, a1
-
  	la a2, boot_cpu_hartid
  	XIP_FIXUP_OFFSET a2
  	REG_S a0, (a2)

arch/riscv/kernel/head.S clear_bss_done: · line 308

Quoted 8 lines
arch/riscv/kernel/head.S +1 -1
@@ -306,7 +302,7 @@ clear_bss_done:
  	la a0, __dtb_start
  	XIP_FIXUP_OFFSET a0
  #else
-	mv a0, s1
+	mv a0, a1
  #endif /* CONFIG_BUILTIN_DTB */
  	call setup_vm
  #ifdef CONFIG_MMU

You can add:

Thanks,

Alex

#2 lore raw
In reply to Nam Cao
This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Hello:

This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <[email protected]>:

Quoted 8 lines · On Tue, 25 Jul 2023 07:38:35 +0200 you wrote:

Some mv instructions were useful when first introduced to preserve a0 and a1 before function calls. However the code has changed and they are now redundant. Remove them.

---
 arch/riscv/kernel/head.S | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Here is the summary with links:
- riscv: remove redundant mv instructions

    https://git.kernel.org/riscv/c/10f763532d58

You are awesome, thank you!

Signature · 9 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#3 lore raw
In reply to Nam Cao
Quoted 5 lines · Nam Cao

Some mv instructions were useful when first introduced to preserve a0 and a1 before function calls. However the code has changed and they are now redundant. Remove them.

Applied, thanks!

[1/1] riscv: remove redundant mv instructions

      https://git.kernel.org/palmer/c/10f763532d58

Best regards,

Signature · 7 lines
Palmer Dabbelt <[email protected]>


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv