All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target/mips: enable LBX/LWX/* instructions for Octeon
@ 2022-11-01  5:29 Pavel Dovgalyuk
  2022-11-07 23:13 ` Philippe Mathieu-Daudé
  2022-11-07 23:22 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Dovgalyuk @ 2022-11-01  5:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: pavel.dovgalyuk, richard.henderson, philmd, jiaxun.yang

This patch changes condition and function name for enabling
indexed load instructions for Octeon vCPUs. Octeons do not
have DSP extension, but implement LBX-and-others.

Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
---
 target/mips/tcg/translate.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
index c3f92ea652..6248143c62 100644
--- a/target/mips/tcg/translate.c
+++ b/target/mips/tcg/translate.c
@@ -12173,12 +12173,16 @@ enum {
 #include "nanomips_translate.c.inc"
 
 /* MIPSDSP functions. */
-static void gen_mipsdsp_ld(DisasContext *ctx, uint32_t opc,
+
+/* Indexed load is not for DSP only */
+static void gen_mips_lx(DisasContext *ctx, uint32_t opc,
                            int rd, int base, int offset)
 {
     TCGv t0;
 
-    check_dsp(ctx);
+    if (!(ctx->insn_flags & INSN_OCTEON)) {
+        check_dsp(ctx);
+    }
     t0 = tcg_temp_new();
 
     if (base == 0) {
@@ -14523,7 +14527,7 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx)
         case OPC_LBUX:
         case OPC_LHX:
         case OPC_LWX:
-            gen_mipsdsp_ld(ctx, op2, rd, rs, rt);
+            gen_mips_lx(ctx, op2, rd, rs, rt);
             break;
         default:            /* Invalid */
             MIPS_INVAL("MASK LX");



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

* Re: [PATCH] target/mips: enable LBX/LWX/* instructions for Octeon
  2022-11-01  5:29 [PATCH] target/mips: enable LBX/LWX/* instructions for Octeon Pavel Dovgalyuk
@ 2022-11-07 23:13 ` Philippe Mathieu-Daudé
  2022-11-07 23:22 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-07 23:13 UTC (permalink / raw)
  To: Pavel Dovgalyuk, qemu-devel; +Cc: richard.henderson, jiaxun.yang

On 1/11/22 06:29, Pavel Dovgalyuk wrote:
> This patch changes condition and function name for enabling
> indexed load instructions for Octeon vCPUs. Octeons do not
> have DSP extension, but implement LBX-and-others.
> 
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
> ---
>   target/mips/tcg/translate.c |   10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
> index c3f92ea652..6248143c62 100644
> --- a/target/mips/tcg/translate.c
> +++ b/target/mips/tcg/translate.c
> @@ -12173,12 +12173,16 @@ enum {
>   #include "nanomips_translate.c.inc"
>   
>   /* MIPSDSP functions. */
> -static void gen_mipsdsp_ld(DisasContext *ctx, uint32_t opc,
> +
> +/* Indexed load is not for DSP only */
> +static void gen_mips_lx(DisasContext *ctx, uint32_t opc,
>                              int rd, int base, int offset)
>   {
>       TCGv t0;
>   
> -    check_dsp(ctx);
> +    if (!(ctx->insn_flags & INSN_OCTEON)) {

Ideally we'd need to check CP0 reg 9 select 7 bit 12 (USEUN in
Cavium Control) is set, otherwise these instrs are a NOP.

I presume QEMU Octeon emulation expects CvmCtl[USEUN] to be set
to be more useful; therefore:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +        check_dsp(ctx);
> +    }
>       t0 = tcg_temp_new();
>   
>       if (base == 0) {
> @@ -14523,7 +14527,7 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx)
>           case OPC_LBUX:
>           case OPC_LHX:
>           case OPC_LWX:
> -            gen_mipsdsp_ld(ctx, op2, rd, rs, rt);
> +            gen_mips_lx(ctx, op2, rd, rs, rt);
>               break;
>           default:            /* Invalid */
>               MIPS_INVAL("MASK LX");
> 



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

* Re: [PATCH] target/mips: enable LBX/LWX/* instructions for Octeon
  2022-11-01  5:29 [PATCH] target/mips: enable LBX/LWX/* instructions for Octeon Pavel Dovgalyuk
  2022-11-07 23:13 ` Philippe Mathieu-Daudé
@ 2022-11-07 23:22 ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-11-07 23:22 UTC (permalink / raw)
  To: Pavel Dovgalyuk, qemu-devel; +Cc: richard.henderson, jiaxun.yang

On 1/11/22 06:29, Pavel Dovgalyuk wrote:
> This patch changes condition and function name for enabling
> indexed load instructions for Octeon vCPUs. Octeons do not
> have DSP extension, but implement LBX-and-others.
> 
> Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
> ---
>   target/mips/tcg/translate.c |   10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)

Queued to mips-fixes, thanks.


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

end of thread, other threads:[~2022-11-07 23:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01  5:29 [PATCH] target/mips: enable LBX/LWX/* instructions for Octeon Pavel Dovgalyuk
2022-11-07 23:13 ` Philippe Mathieu-Daudé
2022-11-07 23:22 ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.