Commit 578e72e0d0 for qemu.org

commit 578e72e0d0e7fbf52ee7cf5600e3667ad794d430
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date:   Thu Nov 12 22:03:39 2026 +0100

    target/mips: Enforce alignment and 64-bit CPU for the DSP LX loads

    The DSP LHX, LWX and LDX loads require a naturally aligned address
    and raise Address Error otherwise (MD00374 r3.01 p.130-131, MD00375
    r3.02 p.145). Use the default memop alignment mask for them (strict,
    except under linux-user FIXADE); LBUX is a byte access.
    The Octeon LX forms share gen_lx() and are unchanged.

    LDX belongs to the MIPS64 DSP module only, but was decoded on any DSP
    CPU in a 64-bit build, including 32-bit ones such as the 24KE or 74K.
    Call check_mips_64() after the DSP Disabled check to raise Reserved
    Instruction there.

    Fixes: 9b1a1d68d041 ("target-mips: Add ASE DSP load instructions")
    Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-ID: <20261113161158.25811-6-philmd@oss.qualcomm.com>

diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
index c434da714b..55dd69353e 100644
--- a/target/mips/tcg/translate.c
+++ b/target/mips/tcg/translate.c
@@ -13649,17 +13649,18 @@ static void decode_opc_special3_legacy(CPUMIPSState *env, DisasContext *ctx)
         switch (op2) {
 #if defined(TARGET_MIPS64)
         case OPC_LDX:
-            gen_lx(ctx, rd, rs, rt, MO_UQ);
+            check_mips_64(ctx);
+            gen_lx(ctx, rd, rs, rt, MO_UQ | ctx->default_tcg_memop_mask);
             break;
 #endif
         case OPC_LBUX:
             gen_lx(ctx, rd, rs, rt, MO_UB);
             break;
         case OPC_LHX:
-            gen_lx(ctx, rd, rs, rt, MO_SW);
+            gen_lx(ctx, rd, rs, rt, MO_SW | ctx->default_tcg_memop_mask);
             break;
         case OPC_LWX:
-            gen_lx(ctx, rd, rs, rt, MO_SL);
+            gen_lx(ctx, rd, rs, rt, MO_SL | ctx->default_tcg_memop_mask);
             break;
         default:            /* Invalid */
             MIPS_INVAL("MASK LX");