Commit Graph

135066 Commits

Author SHA1 Message Date
Philippe Mathieu-Daudé
e364bb625f tests/tcg/mips: Group MSA bit-move tests
Build the 11 per-opcode bit-move tests as a single executable,
test_msa_bit_move.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-17-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
1410403c82 tests/tcg/mips: Group MSA bit-count tests
Build the 12 per-opcode bit-count tests as a single executable,
test_msa_bit_count.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Prefix the per-instruction summary of test_utils_128.h with '# '
so TAP parsers treat it as a comment.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-16-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
b6718e3d22 tests/tcg/mips: Group Release 6 shift tests
Build the 6 per-opcode shift tests as a single executable,
test_mips64r6_shift.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

All Release 6 tests now emit TAP: select it in the meson setup.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-15-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
36d43113b6 tests/tcg/mips: Group Release 6 multiply tests
Build the 8 per-opcode multiply tests as a single executable,
test_mips64r6_multiply.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-14-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
b96ec49e81 tests/tcg/mips: Group Release 6 logic tests
Build the 4 per-opcode logic tests as a single executable,
test_mips64r6_logic.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-13-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
47ae50dd34 tests/tcg/mips: Group Release 6 crc tests
Build the 8 per-opcode crc tests as a single executable,
test_mips64r6_crc.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-12-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
7743c517a6 tests/tcg/mips: Group Release 6 bitops tests
Build the 6 per-opcode bitops tests as a single executable,
test_mips64r6_bitops.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Prefix the per-case output of test_utils_64.h with '# ' so TAP
parsers treat it as a comment.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-11-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
26f5b445c9 tests/tcg/mips: Group DSP shift tests
Build the 22 per-opcode shift tests as a single executable,
test_dsp_shift.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

All DSP tests now emit TAP: select it in the meson setup.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-10-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
a29ccc2be6 tests/tcg/mips: Group DSP pack tests
Build the 27 per-opcode pack tests as a single executable,
test_dsp_pack.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-9-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
386761a932 tests/tcg/mips: Group DSP mul tests
Build the 10 per-opcode mul tests as a single executable,
test_dsp_mul.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-8-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
0d2f700331 tests/tcg/mips: Group DSP dot tests
Build the 28 per-opcode dot tests as a single executable,
test_dsp_dot.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-7-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
f88b7bb864 tests/tcg/mips: Group DSP ctrl tests
Build the 6 per-opcode ctrl tests as a single executable,
test_dsp_ctrl.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-6-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
9dad3e995a tests/tcg/mips: Group DSP cmp tests
Build the 14 per-opcode cmp tests as a single executable,
test_dsp_cmp.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-5-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
667d36ce1b tests/tcg/mips: Group DSP arith tests
Build the 33 per-opcode arith tests as a single executable,
test_dsp_arith.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-4-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
3ea3314a99 tests/tcg/mips: Group DSP acc tests
Build the 19 per-opcode acc tests as a single executable,
test_dsp_acc.c, to reduce the number of test binaries.
Each opcode reports one TAP line.

Add test_dsp_runner.h: assert() only counts failures, and
RUN_TEST() resets DSPControl and reports each test in TAP.
Drop the unused hello-world test.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-3-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
aad5e8f9d6 tests/tcg/mips: Remove unused test_utils_32.h
The 32-bit test utilities header added in 26b3256392 is not
included by any test, and check_results_32() is never called.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030175357.99684-2-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
38140f4428 tests/tcg/mips64: Test the Octeon POP instruction
Check that POP counts the bits of the low 32 bits only, unlike DPOP.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030174856.98759-5-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
caf01b298a tests/tcg/mips64: Report Octeon test results with TAP
Replace assert() by TAP_CHECK(): one TAP line per check, so a
failure no longer aborts the remaining ones. Call TAP_START()
and return tap_done() from main(). Select the TAP protocol in
the meson setup.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030174856.98759-4-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
7d8259677e tests/tcg: Allow tests to report results with TAP
Add an optional 'protocol' setup entry, passed to meson's test().
The default stays 'exitcode'; skipped tests (exit 77) are forced
back to it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261030174856.98759-3-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
5fe62302dc tests/tcg: Add minimal TAP helper header
Add a small header to report test results using the Test Anything
Protocol, which meson parses when the test declares the 'tap'
protocol:

 - TAP_START() prints the TAP version line.
 - tap_report() prints one numbered "ok" / "not ok" line, with a
   printf-style description.
 - TAP_CHECK() reports a condition, using its text as description.
 - tap_info() prints a printf-style diagnostic line prefixed with '# ',
   exposed as TAP_INFO(). It is not a test result: it neither prints a
   number nor counts towards the plan or the exit status.
 - tap_assert() is a non-fatal assert: it prints a '# FAIL' TAP
   diagnostic (via TAP_INFO()) and counts the failure in
   tap_assert_failures, for tests grouping several asserts into a
   single reported result.
 - tap_done() prints the plan and returns the exit status for main().

The counters are static, so each test must be a single translation
unit.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261030174856.98759-2-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
e0e8a85f26 accel/tcg: Remove non-explicit endian cpu_ld/st*_data*() helpers
All uses were converted to the explicit cpu_ld/st*_{be,le}_data*()
helpers, no need for the non-explicit versions anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261029151317.19170-7-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
1f7fe57fce target/mips: Convert MSA LD/ST.D (Doubleword Vector)
Replace runtime helpers by translation.
BE LD.D/ST.D now uses MO_BE with exchanged half handles;
no explicit D swaps or store-copy temporaries.

Replace the legacy cpu_ld/st*_data_ra() calls by tcg_gen_qemu_ld/st()
which allow to respect atomicity.

Remove the ensure_writable_pages() hack and MSALDST_PROTO macro.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261029151317.19170-6-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
a19240bdf0 target/mips: Convert MSA LD/ST.W (Word Vector)
Replace runtime helpers by translation.

Replace the legacy cpu_ld/st*_data_ra() calls by
tcg_gen_qemu_ld/st() which allow to respect atomicity.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261029151317.19170-5-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
4e33820ed6 target/mips: Convert MSA LD/ST.H (Halfword Vector)
Replace runtime helpers by translation.

Replace the legacy cpu_ld/st*_data_ra() calls by
tcg_gen_qemu_ld/st() which allow to respect atomicity.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261029151317.19170-4-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
735c3ff272 target/mips: Convert MSA LD/ST.B (Byte Vector)
Replace runtime helpers by translation.

Replace the legacy cpu_ld/st*_data_ra() calls by
tcg_gen_qemu_ld/st() which allow to respect atomicity.

Consider the host endianness.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261029151317.19170-3-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
dfa162309c target/mips: Expand TRANS_DF_iv() macro for MSA Load/Store
In order to ease the conversion of MSA Load/Store runtime
helpers to translated code, expand the TRANS_DF_iv() macro.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261029151317.19170-2-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
0926db9ded target/mips: Use CPU endianness in MSA LD.D / ST.D helpers
helper_msa_ld_d() and helper_msa_st_d() use the legacy
cpu_ldq_data_ra() / cpu_stq_data_ra() accessors, whose endianness
is fixed at build time by TARGET_BIG_ENDIAN. All other MSA load
and store helpers check the vCPU endianness at runtime via
mips_env_is_bigendian().

Do the same for the doubleword variants, so they keep working
when the vCPU endianness differs from the build-time default.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261028180040.22848-6-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
7abb1a9933 target/mips: Do not use TARGET_BIG_ENDIAN in cpu.c
Use the vCPU endianness (CP0_Config0.BE) to select the disassembler.
Default the "big-endian" property from target_big_endian() in
instance_init(), as the endianness might only be known at runtime
once user emulation selects it from the guest binary.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261028180040.22848-5-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
651ed27ac4 target/mips: Constify read-only CPUMIPSState arguments
cpu_rddsp(), exception_resume_pc(), cpu_mips_get_random(),
mips_env_is_bigendian(), mo_endian_env() and sync_c0_status()
only read the CPU state passed as CPUMIPSState argument, make
it const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261028180040.22848-4-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
0955dc9de8 target/mips: Constify get_physical_address()
get_physical_address() and its static helpers only read the
CPU state, make their CPUMIPSState argument const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261028180040.22848-3-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
a7bef76596 target/mips: Constify CPUMIPSTLBContext::map_address() handlers
The map_address() handlers only read the CPU state, make
their CPUMIPSState argument const.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261028180040.22848-2-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
df476add03 target/mips: Convert nanoMIPS LI opcodes to decodetree
Convert LI[16] and LI[48]. LI[16] decodes its 3-bit register
with gpr3() and its immediate with s_eu() (0x7f encodes -1).
LI[48] takes a 32-bit immediate and is not available in NMS
cores; handle it in trans_LI_nnms(), which checks NMS before
calling trans_LI(). Expose check_nms() for that purpose.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261026162034.32711-15-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
19f580067e target/mips: Convert MIPS16e LI opcodes to decodetree
Convert both the 16-bit RI and the extended EXT-RI forms.
Decode the destination with xlat(); both immediates are
zero-extended (8-bit and 16-bit).

The legacy decoder ignored EXT-RI bits [7:5]; the pattern
requires them to be zero, as specified. Other encodings
now raise a Reserved Instruction exception.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261026162034.32711-14-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
7f07b10b0a target/mips: Convert microMIPS LI opcode to decodetree
Decode the destination with xlat(), and the immediate
with li16_imm7() (0x7f encodes -1), then call gen_li().

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261026162034.32711-13-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
809ff916c4 target/mips: Add gen_li() helper
Add gen_li() to load an immediate into a GPR, ignoring
writes to $zero.  It will be shared by the microMIPS,
MIPS16e and nanoMIPS LI decodetree conversions.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261026162034.32711-12-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
5dffb28d79 target/mips: Share MIPS16e/microMIPS 3-bit GPR xlat mapping
The 3-bit register fields of MIPS16e and microMIPS 16-bit
encodings map to the same 8 GPRs. The map is duplicated,
and we want to re-use it for nanoMIPS. Rename as common
gpr3_m16() helper, using the decodetree !function signature
so both the legacy and the decodetree decoders can call it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261026162034.32711-11-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
30c7390cf4 target/mips: Convert nanoMIPS LSA opcode to decodetree
Call the generic gen_lsa(). Unlike MIPS R6, the nanoMIPS
shift amount is encoded as is, without +1 bias.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20261026162034.32711-10-philmd@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
eed414fde9 target/mips: Convert microMIPS LSA opcode to decodetree
Call the generic gen_lsa(), using plus_1() to add 1 to
the shift amount. LSA is a Release 6 instruction: add it
to micromips32_r6.decode, which is only called on R6 CPUs.

The legacy decoder only matched bits [5:0]; the pattern
also requires bits [8:6] to be zero, as specified. Other
encodings now raise a Reserved Instruction exception.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20261026162034.32711-9-philmd@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
f281619cec target/mips: Introduce decode tree bindings for nanoMIPS ISA
Add empty decodetree files for the nanoMIPS 16-bit, 32-bit
and 48-bit instructions.

The instruction size is known from the first halfword: 16-bit
major opcodes have bit 12 set, and the P48I major opcode is
the only 48-bit one. Call the matching decoder, reading only
the halfwords needed.  Unmatched opcodes fall back to the
legacy decoder.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Aleksandar Rikalo <arikalo@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261026162034.32711-8-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
81828ea4c9 scripts/decodetree: Add support for 48-bit instructions
Some nanoMIPS instructions are 48-bit wide.
Accept --insnwidth=48, holding the instruction in a uint64_t.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261026162034.32711-7-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
1b341533b3 target/mips: Introduce decodetree bindings for microMIPS ISA
Add empty decodetree files for the microMIPS 16-bit and 32-bit
instructions, and micromips32_r6.decode for the 32-bit encodings
only valid on Release 6.

Select the 16-bit or 32-bit decoder from the instruction size,
loading the second halfword only for 32-bit instructions. The R6
decoder is only called on R6 CPUs, like decode_isa_rel6() in
decode_opc(), so its patterns need no check_insn(ISA_MIPS_R6).
Unmatched opcodes fall back to the legacy decoder.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261026162034.32711-6-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
2dc0b76aa9 target/mips: Determine microMIPS insn size before delay slot check
Compute whether the instruction is 16-bit or 32-bit unconditionally,
then use the result for the delay slot size check. The default case
is unreachable. No functional change.

The size will be used to select the 16-bit or 32-bit decodetree
decoder in the next commit.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261026162034.32711-5-philmd@oss.qualcomm.com>
2026-11-02 17:05:34 +01:00
Philippe Mathieu-Daudé
c9c20ec889 target/mips: Introduce decode tree bindings for MIPS16e ASE
Introduce the MIPS16e decodetree configs for the 16-bit
and 32-bit instructions.

EXTEND-prefixed and JAL/JALX instructions are 32-bit, all
others are 16-bit. Call the matching decoder, loading the
second halfword only for 32-bit instructions. Unmatched
opcodes fall back to the legacy decoder.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20261026162034.32711-4-philmd@oss.qualcomm.com>
2026-11-02 17:05:33 +01:00
Philippe Mathieu-Daudé
26c747b3ac target/mips: Decode LSA shift amount using decodetree function
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20261026162034.32711-3-philmd@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-11-02 17:05:33 +01:00
Philippe Mathieu-Daudé
0436899862 target/mips: Call translator_ld() in translate_insn() callees
Historically we were only calling decode_opc() from the MIPS
translate_insn() handler. Then variable instruction length
ISAs were added, we kept using the same pattern but call
yet more translator_ld() in the callees when necessary.

This is cumbersome and bug prone, so better move all
translator_ld() calls to the callees where it is more
logical.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-ID: <20261026162034.32711-2-philmd@oss.qualcomm.com>
2026-11-02 17:05:33 +01:00
Richard Henderson
ca5da0ab43 Merge tag 'qga-pull-2026-11-02' of https://github.com/kostyanf14/qemu into staging
qga-pull-2026-11-02

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEwsLBCepDxjwUI+uE711egWG6hOcFAmrodkgACgkQ711egWG6
# hOf72Q/+MCFGtqqVlDhHsPYpJgF1p8gZxe3zZEkgQJJc4rTXKtyq0WaJZcXWPHK1
# ZohSMf8JHB1S7NbP/smjWdQrWSAcyrB1eJHv+O2g2AEEeJopHUXqu3oZ5C4ETBqr
# 3wKgUwqtsA2pBjC9+BVb1p9ANkP1nK38TbcVcC4t7hBKzJnG7y8Y2BtqbVONQO0G
# 7yYm7EzY+3KI7mJanWhUAtKR6alTAUQM1kIdceSaYxKEEMH9IgwXZc3l1nRo0yHo
# qvVKcz70E2LE3En6ml+vqAq+ANWCrKAgX3nqJlyPhveeGaLQ4qxuDehqyqUI4TiQ
# 2TKCwLpooiTPa3Zrvz6SojQgfc9l2kkQB4YdLsxpD0yUfdB8mfG54CBS0RmGrj0b
# xnRbHrCd04Xs0gYsK26JlBmxTrd+gCEvmhR8Tvdt8R/c1PbxdFj8kPMkb2FBiJLl
# Y7ByzuUGrccYToCIQ5hAmmIE1cufN/7Xvug6QmnGA+ogT0SP47xpKI1wvUl3H1dN
# 84bGrD7ThnuzuqZI2Gs0YBmCzggw3fzKgQm2PfFbVgiR5TvQr59+sCCDpojuT3ip
# ZjfpLmJeqm/JZJyHa0NV2Yqle7J4yYr4Dzcfqlx0i9aOWL7S1whjM9gg3dd3CF07
# gUCYbYs96cZ6XNypUg3RP/fL6Fi9rjg+4PN5UiBnXB1APs6lZBE=
# =FQSw
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 02 Nov 2026 03:38:48 AM PST
# gpg:                using RSA key C2C2C109EA43C63C1423EB84EF5D5E8161BA84E7
# gpg: Good signature from "Kostiantyn Kostiuk (Upstream PR sign) <kkostiuk@redhat.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: C2C2 C109 EA43 C63C 1423  EB84 EF5D 5E81 61BA 84E7

* tag 'qga-pull-2026-11-02' of https://github.com/kostyanf14/qemu:
  qga: set FreeBSD virtio-serial channel to raw mode

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-11-02 06:47:27 -08:00
Richard Henderson
06fbd15ea5 Merge tag 'pull-ppc-for-11.2-sf-20261102' of https://gitlab.com/harshpb/qemu into staging
PPC PR for 11.2 Soft Freeze

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEa4EM1tK+EPOIPSFCRUTplPnWj7sFAmrocFsACgkQRUTplPnW
# j7sIWg/8C1FVTFJYm+gFZs1rb9drL4khMMoy0HcpHvBwDMFtnknK7I6Ul33edLHy
# nZBQq/9FPVgy9iBBTbG9oo1POA7wY/J55LAyxh31CW5fATZvjNZZ+58xjTtj5ji+
# BuyW9jDMcpbt0zF4yyY53QQ9tUXIym8QU0SkzOc1sQOBaY+zGXsSel75yXwR9eJU
# gpfZ+Lw4AieCX+6FWc8jK0m65CpNcNn9SMmENa9y/fYjDjyEX4bJ20YFuMMLwtG6
# J/vDY1gqNKXToIR3lEvwJyJQfWai9n6f/gW6lNBFOa2U6OPK7UBer5vE7OB+RRfV
# 5Sv2Jy/hOu1rWWSFaxrJ+Pw9zuk5iVEKpLJnoYFrDJlbDexUsDZw8YR+Rpkcn64+
# lN4C6BEjb7TaY/pJS7agDQ85SiScDif7/dkG2qV9i0k3RR/YbZEnkbKVhWHzcjIv
# I6eqDTSs11Lb7Xc9DR/xn+Lkt1KfBYZzKYDXqy6veM0hqA1YwD+jT/K+KUMbldFe
# AeI8MPauMVifY5oI2vnXC5dFsr+O7hxAp6raMQci0m6KdUUM1wN5Gz9ghPRdjjyV
# f4C4rPzhpk0dy7X14qccfVVquhz0UFHjwwfwFewg1IoSSvh9vl46FGa1bO+MJGNu
# dJUk0Q2wW/VgJ2S7Dt04SoGlE+PqBLwJoMvnDCQEOmBYZaUI010=
# =rVvI
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 02 Nov 2026 03:13:31 AM PST
# gpg:                using RSA key 6B810CD6D2BE10F3883D21424544E994F9D68FBB
# gpg: Good signature from "Harsh Prateek Bora <harsh.prateek.bora@gmail.com>" [undefined]
# gpg:                 aka "Harsh Prateek Bora <harshpb@linux.ibm.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6B81 0CD6 D2BE 10F3 883D  2142 4544 E994 F9D6 8FBB

* tag 'pull-ppc-for-11.2-sf-20261102' of https://gitlab.com/harshpb/qemu:
  pnv/phb5: Mask off LSI Source-ID based on number of interrupts
  pnv/phb5: Implement IODA PCT table
  pnv/phb5: Set link speed and width in the DLP training control register
  pnv/phb5: Set link-active status in HPSTAT and LMR registers
  pnv/phb5: Implement write-clear and return 1's on unimplemented reg read
  pnv/phb5: Implement read-only and write-only bits of registers
  pnv/phb5: Implement sticky reset logic in PHB5
  pnv/phb5: Add reset logic to PHB5
  qtest/phb5: Add testbench for PHB

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-11-02 06:46:55 -08:00
Oleksij Samorukov
03efcb7cfd qga: set FreeBSD virtio-serial channel to raw mode
On FreeBSD the virtio-console port is a tty, unlike Linux's
/dev/virtio-ports which is a character device.  It defaults to canonical
mode with echo and software flow control enabled, so the QGA stream
protocol does not work: the initial guest-sync handshake is held in the
line discipline and the host eventually times out.

The existing FreeBSD-specific code only clears ECHO.  Configure the port
the same way as the ISA serial path: disable canonical mode, echo and
software flow control, and set VMIN/VTIME.  Use TCSANOW instead of
TCSAFLUSH so a handshake that arrives between open() and tcsetattr() is
not discarded.

Tested on FreeBSD 15.1 aarch64 under UTM/QEMU.  Before the change
utmctl ip-address timed out and the guest received zero bytes; after the
change QGA commands and guest-set-time work.

Cc: qemu-stable@nongnu.org
Fixes: c6cd588bb3 ("qga: Add initial FreeBSD support")
Signed-off-by: Oleksij Samorukov <samm@net-art.cz>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Tested-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Link: https://lore.kernel.org/qemu-devel/20261017201905.12211-1-samm@net-art.cz
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
2026-11-02 13:06:30 +02:00
Saif Abrar
9e0dff1dca pnv/phb5: Mask off LSI Source-ID based on number of interrupts
Add a method to reset the value of LSI Source-ID.
Mask off LSI source-id based on number of interrupts in the big/small PHB.

Signed-off-by: Saif Abrar <saif.abrar@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Caleb Schlossin <calebs@linux.ibm.com>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: Michael Kowal <kowal@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20261029171047.3862430-10-saif.abrar@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-11-02 12:44:37 +05:30
Saif Abrar
b58bda29d8 pnv/phb5: Implement IODA PCT table
IODA PCT table is implemented
without any functionality, being a debug table.

Signed-off-by: Saif Abrar <saif.abrar@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Caleb Schlossin <calebs@linux.ibm.com>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Reviewed-by: Michael Kowal <kowal@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20261029171047.3862430-9-saif.abrar@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
2026-11-02 12:44:36 +05:30