diff mbox series

riscv: alternative: proceed one more instruction for auipc/jalr pair

Message ID 20230115162811.3146-1-jszhang@kernel.org (mailing list archive)
State Accepted
Commit 91612cfb173619b38087449cd3811f9cb4420d94
Delegated to: Palmer Dabbelt
Headers show
Series riscv: alternative: proceed one more instruction for auipc/jalr pair | expand

Checks

Context Check Description
conchuod/tree_selection fail Failed to apply to next/pending-fixes or riscv/for-next

Commit Message

Jisheng Zhang Jan. 15, 2023, 4:28 p.m. UTC
If we patched auipc + jalr pair, we'd better proceed one more
instruction. Andrew pointed out "There's not a problem now, since
we're only adding a fixup for jal, not jalr, but we should
future-proof this and there's no reason to revisit an already fixed-up
instruction anyway."

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Suggested-by: Andrew Jones <ajones@ventanamicro.com>
---
 arch/riscv/kernel/alternative.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrew Jones Jan. 19, 2023, 8:45 a.m. UTC | #1
On Mon, Jan 16, 2023 at 12:28:11AM +0800, Jisheng Zhang wrote:
> If we patched auipc + jalr pair, we'd better proceed one more
> instruction. Andrew pointed out "There's not a problem now, since
> we're only adding a fixup for jal, not jalr, but we should
> future-proof this and there's no reason to revisit an already fixed-up
> instruction anyway."
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Suggested-by: Andrew Jones <ajones@ventanamicro.com>
> ---
>  arch/riscv/kernel/alternative.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/riscv/kernel/alternative.c b/arch/riscv/kernel/alternative.c
> index fc341b69bf62..2354c69dc7d1 100644
> --- a/arch/riscv/kernel/alternative.c
> +++ b/arch/riscv/kernel/alternative.c
> @@ -122,6 +122,7 @@ void riscv_alternative_fix_offsets(void *alt_ptr, unsigned int len,
>  
>  			riscv_alternative_fix_auipc_jalr(alt_ptr + i * sizeof(u32),
>  							 insn, insn2, patch_offset);
> +			i++;
>  		}
>  
>  		if (riscv_insn_is_jal(insn)) {
> -- 
> 2.38.1
>

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Heiko Stübner Jan. 19, 2023, 5:21 p.m. UTC | #2
Am Sonntag, 15. Januar 2023, 17:28:11 CET schrieb Jisheng Zhang:
> If we patched auipc + jalr pair, we'd better proceed one more
> instruction. Andrew pointed out "There's not a problem now, since
> we're only adding a fixup for jal, not jalr, but we should
> future-proof this and there's no reason to revisit an already fixed-up
> instruction anyway."
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Suggested-by: Andrew Jones <ajones@ventanamicro.com>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>
patchwork-bot+linux-riscv@kernel.org Feb. 22, 2023, 3 p.m. UTC | #3
Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Mon, 16 Jan 2023 00:28:11 +0800 you wrote:
> If we patched auipc + jalr pair, we'd better proceed one more
> instruction. Andrew pointed out "There's not a problem now, since
> we're only adding a fixup for jal, not jalr, but we should
> future-proof this and there's no reason to revisit an already fixed-up
> instruction anyway."
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Suggested-by: Andrew Jones <ajones@ventanamicro.com>
> 
> [...]

Here is the summary with links:
  - riscv: alternative: proceed one more instruction for auipc/jalr pair
    https://git.kernel.org/riscv/c/91612cfb1736

You are awesome, thank you!
diff mbox series

Patch

diff --git a/arch/riscv/kernel/alternative.c b/arch/riscv/kernel/alternative.c
index fc341b69bf62..2354c69dc7d1 100644
--- a/arch/riscv/kernel/alternative.c
+++ b/arch/riscv/kernel/alternative.c
@@ -122,6 +122,7 @@  void riscv_alternative_fix_offsets(void *alt_ptr, unsigned int len,
 
 			riscv_alternative_fix_auipc_jalr(alt_ptr + i * sizeof(u32),
 							 insn, insn2, patch_offset);
+			i++;
 		}
 
 		if (riscv_insn_is_jal(insn)) {