qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/riscv: do not use translator_ldl in opcode_at
@ 2025-08-15 14:06 Vladimir Isaev
  2025-08-27  4:51 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Isaev @ 2025-08-15 14:06 UTC (permalink / raw)
  To: richard.henderson, palmer, alistair.francis, bmeng.cn, liwei1518,
	dbarboza, zhiwei_liu
  Cc: qemu-riscv, qemu-devel, Vladimir Isaev

opcode_at is used only in semihosting checks to match opcodes with expected pattern.

This is not a translator and if we got following assert if page is not in TLB:
qemu-system-riscv64: ../accel/tcg/translator.c:363: record_save: Assertion `offset == db->record_start + db->record_len' failed.

Fixes: 1f9c4462334f ("target/riscv: Use translator_ld* for everything")
Signed-off-by: Vladimir Isaev <vladimir.isaev@syntacore.com>
---
 target/riscv/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/riscv/translate.c b/target/riscv/translate.c
index b1e41cdbf1f6..980a67ea855e 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -25,6 +25,7 @@
 #include "exec/helper-gen.h"
 
 #include "exec/translator.h"
+#include "exec/cpu_ldst.h"
 #include "exec/log.h"
 #include "semihosting/semihost.h"
 
@@ -1143,7 +1144,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
     CPUState *cpu = ctx->cs;
     CPURISCVState *env = cpu_env(cpu);
 
-    return translator_ldl(env, &ctx->base, pc);
+    return cpu_ldl_code(env, pc);
 }
 
 #define SS_MMU_INDEX(ctx) (ctx->mem_idx | MMU_IDX_SS_WRITE)
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/riscv: do not use translator_ldl in opcode_at
  2025-08-15 14:06 [PATCH] target/riscv: do not use translator_ldl in opcode_at Vladimir Isaev
@ 2025-08-27  4:51 ` Richard Henderson
  2025-09-29  0:42 ` Alistair Francis
  2025-10-04  7:29 ` Michael Tokarev
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2025-08-27  4:51 UTC (permalink / raw)
  To: Vladimir Isaev, palmer, alistair.francis, bmeng.cn, liwei1518,
	dbarboza, zhiwei_liu
  Cc: qemu-riscv, qemu-devel

On 8/16/25 00:06, Vladimir Isaev wrote:
> opcode_at is used only in semihosting checks to match opcodes with expected pattern.
> 
> This is not a translator and if we got following assert if page is not in TLB:
> qemu-system-riscv64: ../accel/tcg/translator.c:363: record_save: Assertion `offset == db->record_start + db->record_len' failed.
> 
> Fixes: 1f9c4462334f ("target/riscv: Use translator_ld* for everything")
> Signed-off-by: Vladimir Isaev <vladimir.isaev@syntacore.com>
> ---
>   target/riscv/translate.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/riscv/translate.c b/target/riscv/translate.c
> index b1e41cdbf1f6..980a67ea855e 100644
> --- a/target/riscv/translate.c
> +++ b/target/riscv/translate.c
> @@ -25,6 +25,7 @@
>   #include "exec/helper-gen.h"
>   
>   #include "exec/translator.h"
> +#include "exec/cpu_ldst.h"
>   #include "exec/log.h"
>   #include "semihosting/semihost.h"
>   
> @@ -1143,7 +1144,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
>       CPUState *cpu = ctx->cs;
>       CPURISCVState *env = cpu_env(cpu);
>   
> -    return translator_ldl(env, &ctx->base, pc);
> +    return cpu_ldl_code(env, pc);
>   }
>   
>   #define SS_MMU_INDEX(ctx) (ctx->mem_idx | MMU_IDX_SS_WRITE)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/riscv: do not use translator_ldl in opcode_at
  2025-08-15 14:06 [PATCH] target/riscv: do not use translator_ldl in opcode_at Vladimir Isaev
  2025-08-27  4:51 ` Richard Henderson
@ 2025-09-29  0:42 ` Alistair Francis
  2025-10-04  7:29 ` Michael Tokarev
  2 siblings, 0 replies; 4+ messages in thread
From: Alistair Francis @ 2025-09-29  0:42 UTC (permalink / raw)
  To: Vladimir Isaev
  Cc: richard.henderson, palmer, alistair.francis, bmeng.cn, liwei1518,
	dbarboza, zhiwei_liu, qemu-riscv, qemu-devel

On Sat, Aug 16, 2025 at 12:08 AM Vladimir Isaev
<vladimir.isaev@syntacore.com> wrote:
>
> opcode_at is used only in semihosting checks to match opcodes with expected pattern.
>
> This is not a translator and if we got following assert if page is not in TLB:
> qemu-system-riscv64: ../accel/tcg/translator.c:363: record_save: Assertion `offset == db->record_start + db->record_len' failed.
>
> Fixes: 1f9c4462334f ("target/riscv: Use translator_ld* for everything")
> Signed-off-by: Vladimir Isaev <vladimir.isaev@syntacore.com>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  target/riscv/translate.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/riscv/translate.c b/target/riscv/translate.c
> index b1e41cdbf1f6..980a67ea855e 100644
> --- a/target/riscv/translate.c
> +++ b/target/riscv/translate.c
> @@ -25,6 +25,7 @@
>  #include "exec/helper-gen.h"
>
>  #include "exec/translator.h"
> +#include "exec/cpu_ldst.h"
>  #include "exec/log.h"
>  #include "semihosting/semihost.h"
>
> @@ -1143,7 +1144,7 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
>      CPUState *cpu = ctx->cs;
>      CPURISCVState *env = cpu_env(cpu);
>
> -    return translator_ldl(env, &ctx->base, pc);
> +    return cpu_ldl_code(env, pc);
>  }
>
>  #define SS_MMU_INDEX(ctx) (ctx->mem_idx | MMU_IDX_SS_WRITE)
> --
> 2.50.1
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target/riscv: do not use translator_ldl in opcode_at
  2025-08-15 14:06 [PATCH] target/riscv: do not use translator_ldl in opcode_at Vladimir Isaev
  2025-08-27  4:51 ` Richard Henderson
  2025-09-29  0:42 ` Alistair Francis
@ 2025-10-04  7:29 ` Michael Tokarev
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Tokarev @ 2025-10-04  7:29 UTC (permalink / raw)
  To: Vladimir Isaev, richard.henderson, palmer, alistair.francis,
	bmeng.cn, liwei1518, dbarboza, zhiwei_liu
  Cc: qemu-riscv, qemu-devel, qemu-stable

On 8/15/25 17:06, Vladimir Isaev wrote:
> opcode_at is used only in semihosting checks to match opcodes with expected pattern.
> 
> This is not a translator and if we got following assert if page is not in TLB:
> qemu-system-riscv64: ../accel/tcg/translator.c:363: record_save: Assertion `offset == db->record_start + db->record_len' failed.
> 
> Fixes: 1f9c4462334f ("target/riscv: Use translator_ld* for everything")
> Signed-off-by: Vladimir Isaev <vladimir.isaev@syntacore.com>

This seems like a qemu-stable material (for 10.0.x and 10.1.x series).
Please let me know if it is not.

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-04  7:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15 14:06 [PATCH] target/riscv: do not use translator_ldl in opcode_at Vladimir Isaev
2025-08-27  4:51 ` Richard Henderson
2025-09-29  0:42 ` Alistair Francis
2025-10-04  7:29 ` Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).