Commit Graph

126326 Commits

Author SHA1 Message Date
Philippe Mathieu-Daudé
a2290fa210 dump: Build stubs once for non-x86 targets
Rather than compiling the same content for all targets (unused
most of the time, i.e. qemu-system-avr ...), extract the non
x86 specific parts to a stub file and build it once for all
non-x86 targets.

Add a Kconfig symbol to only select the target-specific file
with the x86 target (rename this file with '-x86' suffix).

Since Kconfig symbols aren't evaluated for user emulation,
the file unit is only built for system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260121215622.92966-3-philmd@linaro.org>
2026-01-22 10:48:46 +01:00
Philippe Mathieu-Daudé
40b51dd9b4 dump: Abort in create_win_dump() on non-x86 guests
qmp_dump_guest_memory() checks win_dump_available()
before calling create_win_dump(). On non-x86 targets
calling it would be a programming error, so abort.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260121215622.92966-2-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
da38740554 configs/targets: Forbid s390x to use legacy native endianness APIs
All s390x-related binaries are buildable without a single
use of the legacy "native endian" API. Set the transitional
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API definition to forbid
further uses of the legacy API.

Preliminary commits allowing this final change:

 . f0853c2586 target/s390x: Inline translator_lduw() and translator_ldl()
 . ee4dae6a33 target/s390x: Use big-endian variant of cpu_ld/st_data*()
 . 381a1fda5b target/s390x: Inline cpu_ld{uw, l}_code() calls in EX opcode helper
 . 69da23130f target/s390x: Replace MO_TE -> MO_BE
 . 0fb6ad781c target/s390x: Replace gdb_get_regl() -> gdb_get_reg64()
 . 409cbb1a61 target/s390x: Use explicit big-endian LD/ST API
 . 6d9dad7126 target/s390x: Replace HOST_BIG_ENDIAN #ifdef with if() check

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251224162036.90404-9-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
a68b332fc8 configs/targets: Forbid Renesas RX to use legacy native endianness API
The qemu-system-rx binary is buildable without a single
use of the legacy "native endian" API. Set the transitional
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API definition to forbid
further uses of the legacy API.

Preliminary commits allowing this final change:

 . b0afb81271 target/rx: Inline translator_lduw() and translator_ldl()
 . 41a1b46c3b target/rx: Use explicit little-endian LD/ST API
 . de1f3d628e target/rx: Use little-endian variant of cpu_ld/st_data*()
 . 0f4af4e267 target/rx: Use MemOp type in gen_ld[u]() and gen_st()
 . 2062fa663c target/rx: Propagate DisasContext to generated helpers
 . 8b71fd6ffe target/rx: Propagate DisasContext to push() / pop()
 . 363fff6d1b target/rx: Propagate DisasContext to gen_ld[u]() and gen_st()
 . cb8e4556d5 target/rx: Factor mo_endian() helper out
 . f9903a8a23 target/rx: Replace MO_TE -> MO_LE

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251224163304.91384-5-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
8790da3161 configs/targets: Forbid TriCore to use legacy native endianness API
The qemu-system-tricore binary is buildable without a single
use of the legacy "native endian" API. Set the transitional
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API definition to forbid
further uses of the legacy API.

Preliminary commits allowing this final change:

 . 8075a0a547 target/tricore: Inline translator_lduw()
 . 4a4b272ae8 target/tricore: Use little-endian variant of cpu_ld/st_data*()
 . cd08bcaa36 target/tricore: Expand TCGv type for 32-bit target
 . 8a2235dd07 target/tricore: Un-inline various helpers
 . e843ef2bba target/tricore: Pass DisasContext as first argument
 . 4f08815467 target/tricore: Expand TCG helpers for 32-bit target
 . f30c8aa229 target/tricore: Inline tcg_gen_ld32u_tl()
 . 6b2e4fcb83 target/tricore: Declare registers as TCGv_i32
 . c558aa9421 target/tricore: Replace target_ulong -> uint32_t in op_helper.c
 . 30257dcd2b target/tricore: Remove unnecessary cast to target_ulong
 . 44e2b68d27 target/tricore: Remove target_ulong use in gen_addi_d()
 . a15e899626 target/tricore: Remove target_ulong use in translate_insn() handler
 . 0d5f954256 target/tricore: Replace target_ulong -> vaddr with tlb_fill() callees
 . 809b460f30 target/tricore: Remove target_ulong use in gen_goto_tb()

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251224163005.91137-4-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
f2a334c5f5 configs/targets: Forbid OpenRISC to use legacy native endianness APIs
All OpenRISC-related binaries are buildable without a single
use of the legacy "native endian" API. Set the transitional
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API definition to forbid
further uses of the legacy API.

Preliminary commits allowing this final change:

 . 52392f95e6 target/openrisc: Inline translator_ldl()
 . 16c0efb5a7 target/openrisc: Use explicit big-endian LD/ST API
 . 5b67dbf1dc target/openrisc: Replace target_ulong -> uint32_t
 . 500708331e target/openrisc: Inline tcg_gen_trunc_i64_tl()
 . 4f6c60683f target/openrisc: Replace MO_TE -> MO_BE
 . 73cd283e58 target/openrisc: Introduce mo_endian() helper
 . 2f737e19a4 target/openrisc: Conceal MO_TE within do_store()
 . 22c36c0a20 target/openrisc: Conceal MO_TE within do_load()
 . ef797ac002 target/openrisc: Explode MO_TExx -> MO_TE | MO_xx
 . 81e2fb236b target/openrisc: Remove 'TARGET_LONG_BITS != 32' dead code
 . 9dc4862dc4 target/openrisc: Use vaddr type for $pc jumps
 . 2367c94cbb target/openrisc: Remove target_ulong use in raise_mmu_exception()
 . 1843e89bec target/openrisc: Remove unused cpu_openrisc_map_address_*() handlers
 . a3c4facd39 target/openrisc: Do not use target_ulong for @mr in MTSPR helper
 . 2795bc52af target/openrisc: Replace VMSTATE_UINTTL() -> VMSTATE_UINT32()

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251224161804.90064-5-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
c6056f9812 configs/targets: Forbid LoongArch to use legacy native endianness APIs
All LoongArch-related binaries are buildable without a single
use of the legacy "native endian" API. Set the transitional
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API definition to forbid
further uses of the legacy API.

Preliminary commits allowing this final change:

 . 6b4c30465c target/loongarch: Inline translator_ldl()
 . f9a03787c7 target/loongarch: Use explicit little-endian LD/ST API
 . 91312a6d04 target/loongarch: Inline cpu_ldl_code() call in cpu_do_interrupt()
 . 492b2799c6 target/loongarch: Replace MO_TE -> MO_LE

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Message-Id: <20251224161456.89707-9-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
403959d0f6 configs/targets: Forbid HPPA to use legacy native endianness APIs
All HPPA-related binaries are buildable without a single use
of the legacy "native endian" API. Set the transitional
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API definition to
forbid further uses of the legacy API.

Preliminary commits allowing this final change:

 . c77d0e9009 target/hppa: Use big-endian variant of cpu_ld/st_data*()
 . 75498b3f7b target/hppa: Use explicit big-endian LD/ST API
 . bcf5e5d3e3 target/hppa: Inline translator_ldl()
 . 7307ff9558 target/hppa: Replace MO_TE -> MO_BE
 . 6c1c734f78 target/hppa: Introduce mo_endian() helper
 . 64d1c17851 target/hppa: Conceal MO_TE within do_store_32/64()
 . 0807994a0c target/hppa: Conceal MO_TE within do_store()
 . e3da436711 target/hppa: Conceal MO_TE within do_load_32/64()
 . 4eef4dab50 target/hppa: Conceal MO_TE within do_load()
 . 714dd08fed target/hppa: Explode MO_TExx -> MO_TE | MO_xx

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251229225517.45078-6-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
d78a07fb21 configs/targets: Forbid Hexagon to use legacy native endianness API
The qemu-hexagon binary is buildable without a single use
of the legacy "native endian" API. Set the transitional
TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API definition to
forbid further uses of the legacy API.

Preliminary commits allowing this final change:

 . dffb3938aa target/hexagon: Use little-endian variant of cpu_ld/st_data*()
 . 989b25c73b target/hexagon: Inline translator_ldl()
 . beb38fda0f target/hexagon: Replace MO_TE -> MO_LE
 . fdcb7483ae target/hexagon: Explode MO_TExx -> MO_TE | MO_xx

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-ID: <20251224160708.89085-4-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
8b2f859063 system: Allow restricting the legacy DEVICE_NATIVE_ENDIAN definition
Guard the native endian definition we want to remove by surrounding
it with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.
Assign values to the enumerators so they stay unchanged.

Once a target gets cleaned we'll set the definition in the target
config, then the target won't be able to use the legacy API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-21-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
a9c39c7083 system: Allow restricting the legacy MO_TE* 'native-endian' definitions
Guard the native endian definitions we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-20-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
f9e68a2c82 system: Allow restricting the legacy tswap() 'native-endian' API
Guard the native endian APIs we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-19-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
0fca27a4d5 system: Allow restricting the legacy translator_ld() 'native-endian' API
Guard the native endian APIs we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-18-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
2c9429d213 system: Allow restricting the legacy cpu_ld/st() 'native-endian' API
Guard the native endian APIs we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-17-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
5d267f5b85 system: Allow restricting legacy address_space_ldst() native-endian API
Guard the native endian APIs we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-16-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
23b34de6df system: Allow restricting the legacy ld/st_phys() 'native-endian' API
Guard the native endian APIs we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Since all targets can check the definition, do not poison it.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-15-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
d5461ff4eb system/memory: Directly call address_space_ldst[M]_internal() helper
Inline internal address_space_ld/st[L,D,Q] helpers,
directly calling address_space_ldst[M]_internal().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-14-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
dd1b3aaa05 system/memory: Use ldm_p() and stm_p() helpers
address_space_{ld,st}m_internal() take a MemOp argument
so can directly use the {ld,st}m_p() helpers.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-13-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
c790e17de2 system/memory: Pass device_endian argument as MemOp bit
Use the MemOp argument to hold both the access size and
its endianness.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20251217143150.94463-14-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
9c2ed58b6d system/memory: Factor address_space_ldst[M]_internal() helper out
All the LD/ST[W,L,Q] variants use the same template, only
modifying the access size used. Unify as a single pair of
LD/ST methods taking a MemOp argument. Thus use the 'm'
suffix for MemOp.

Keep the pre-existing "warning: addr must be aligned" comment.

We leave the wonder about why we aren't asserting alignment
for later.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-11-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
99989213a2 system/memory: Define address_space_ldst[Q] endian variants via template
Define address_space_ldst[Q] endian variants via template.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-10-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
2cdca569bd system/memory: Define address_space_ldst[L] endian variants via template
Define address_space_ldst[L] endian variants via template.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-9-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
08bcb64bce system/memory: Define address_space_ldst[W] endian variants via template
Like we do for other LD/ST APIs, use one template to declare and
define all endianness variants of the address_space_ldst[W] methods.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-8-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
cfb88b2ce3 system/memory: Introduce ldm_p() and stm_p() load/store helpers
Introduce load/store helpers which take a MemOp argument.

Inspired-by: Paolo Bonzini <pbonzini@redhat.com>
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260118193509.42923-5-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
e3bf323f53 bswap: Remove unnecessary 'qemu/bswap.h'
"qemu/host-utils.h" and "qemu/int128.h" are included a lot in
the tree, and don't use any definition from "qemu/bswap.h"...
Since it contains a lot of inlined functions, remove it to
reduce pointless compilation cycles.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260118193509.42923-4-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
e44dc42f3a bswap: Use 'qemu/bswap.h' instead of 'qemu/host-utils.h'
These files only require "qemu/bswap.h", not "qemu/host-utils.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109163730.57087-2-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
3115691855 bswap: Include missing 'qemu/bswap.h' header
All these files indirectly include the "qemu/bswap.h" header.
Make this inclusion explicit to avoid build errors when
refactoring unrelated headers.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109164742.58041-4-philmd@linaro.org>
2026-01-22 10:48:45 +01:00
Philippe Mathieu-Daudé
81c389fd6f target/ppc: Simplify endianness handling in Altivec opcodes
Access the memory in big-endian order,
swap bytes when MSR.LE is set.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251126202200.23100-22-philmd@linaro.org>
2026-01-22 10:46:36 +01:00
Philippe Mathieu-Daudé
ff9359fca2 target/sh4: Replace cpu_stl_data() call in OCBI helper
In preparation of removing the cpu_stl_data() call,
inline it. Set the return address argument.

See commit 852d481faf ("SH: Improve movca.l/ocbi
emulation") for more context on this code.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251126202200.23100-11-philmd@linaro.org>
2026-01-22 10:42:19 +01:00
Philippe Mathieu-Daudé
4cc30fe59f target/sparc: Use big-endian variant of cpu_ld/st_data*()
We only build the SPARC targets using big endianness order,
therefore the cpu_ld/st_data*() definitions expand to the big
endian declarations. Use the explicit big-endian variants.

Mechanical change running:

  $ tgt=sparc; \
    end=be; \
    for op in data mmuidx_ra; do \
      for ac in uw sw l q; do \
        sed -i -e "s/cpu_ld${ac}_${op}/cpu_ld${ac}_${end}_${op}/" \
                  $(git grep -l cpu_ target/${tgt}/); \
      done;
      for ac in w l q; do \
        sed -i -e "s/cpu_st${ac}_${op}/cpu_st${ac}_${end}_${op}/" \
                  $(git grep -l cpu_ target/${tgt}/); \
      done;
    done

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251126202200.23100-10-philmd@linaro.org>
2026-01-22 10:42:05 +01:00
Philippe Mathieu-Daudé
9668079d8b target/m68k: Use big-endian variant of cpu_ld/st_data*()
We only build the M68k target using big endianness order,
therefore the cpu_ld/st_data*() definitions expand to the
big endian declarations. Use the explicit big-endian variants.

Mechanical change running:

  $ tgt=m68k; \
    end=be; \
    for op in data mmuidx_ra; do \
      for ac in uw sw l q; do \
        sed -i -e "s/cpu_ld${ac}_${op}/cpu_ld${ac}_${end}_${op}/" \
                  $(git grep -l cpu_ target/${tgt}/); \
      done;
      for ac in w l q; do \
        sed -i -e "s/cpu_st${ac}_${op}/cpu_st${ac}_${end}_${op}/" \
                  $(git grep -l cpu_ target/${tgt}/); \
      done;
    done

Then adapting indentation in do_stack_frame() to pass checkpatch.pl.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251126202200.23100-8-philmd@linaro.org>
2026-01-22 10:41:49 +01:00
Philippe Mathieu-Daudé
b7f18d2980 target/riscv: Use little-endian variant of cpu_ld/st_data*() for vector
RISC-V vector "elements are simply packed in order from
the least-signicant to most-signicant bits of the vector
register" [*] which is little endianness, therefore the
cpu_ld/st_data*() definitions expand to the little endian
declarations. Use the explicit little-endian variants.

[*] RISC-V "V" Vector Extension v1.0

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-Id: <20251126202200.23100-4-philmd@linaro.org>
2026-01-22 10:41:37 +01:00
Philippe Mathieu-Daudé
3c8f525e93 target/i386: Use little-endian variant of cpu_ld/st_data*()
We only build the X86 targets using little endianness order,
therefore the cpu_ld/st_data*() definitions expand to the little
endian declarations. Use the explicit little-endian variants.

Mechanical change running:

  $ tgt=i386; \
    end=le; \
    for op in data mmuidx_ra; do \
      for ac in uw sw l q; do \
        sed -i -e "s/cpu_ld${ac}_${op}/cpu_ld${ac}_${end}_${op}/" \
                  $(git grep -l cpu_ target/${tgt}/); \
      done;
      for ac in w l q; do \
        sed -i -e "s/cpu_st${ac}_${op}/cpu_st${ac}_${end}_${op}/" \
                  $(git grep -l cpu_ target/${tgt}/); \
      done;
    done

Then adapting indentation in helper_vmload() to pass checkpatch.pl.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20251126202200.23100-3-philmd@linaro.org>
2026-01-22 10:41:18 +01:00
Richard Henderson
2339d0a1cf Merge tag 'hw-misc-20260120' of https://github.com/philmd/qemu into staging
Misc HW patches

- Generalized IOMMU test framework
- Fix Freescale SDHCI endianness issues
- Support for zboot images compressed with Zstd
- Pcap support to analyze UEFI firmware traffic

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmlvzsUACgkQ4+MsLN6t
# wN5G4BAAzpNnhYe09TMrn/pUBMbXqmYGXTpOXxkkes922X1Xt/qpo1LGSgcMnW8j
# p1ju7rWa3r3TIqkPPzHlyxaZrcMMUBTEdJ/u5tOeD19aNzQHQTTWKErqIucZOLZl
# /DElbpNGakEDHyqX4BMZW+zfIkjIou0ZWh95hyHPnDPK7aJrbLvWrz2tcaOsqfDI
# WYNf8BrCEwbKTvnBis7/IYOGH2sK8ZUgMwXShLbhnAIdFoVLwlBwGbosH/wR/qW0
# Ql/hPEovXfBN7J1w9cYM8gfSOanZ5Hs1fC9K/FXHA9/TDkF3xYOwp9ky85y6fJO3
# lbD9wzAsNIdzOgj8s90AihTr5FFa+XK1SUTHR5xcTyou5zR73N4cGjmwJT6xvu0W
# Noy89Jsg+DhFXYWBcnNr0XxUgNnPe0zRV1YZJNEwJm+ODiY9o/St7cKtcM1wYPKZ
# y1vgRT7nxbI41F7cAJH/sEFigNWDkDdP3QSqHCwWpJG2urPtT/7iaFH4k4VoNUab
# YfplDcoXGTljGEHI0l4hqauSelo5VyDcMCajXfqkgXawSdMTWxFxhpr68zRoY2//
# KaIu4czG82iSAN4hFj8KySzwHT5dQizCGa98CrMHhf4JLwYkd7g80KRjNvFxWNhk
# JJ6ciqpN+M7pZUihLd222Oz5/Jjf/qXpkRPIYO/kaDvzZ2uL7/c=
# =uody
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 21 Jan 2026 05:51:49 AM AEDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [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: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'hw-misc-20260120' of https://github.com/philmd/qemu: (29 commits)
  meson: Do not try to build module for empty per-target hw/ directory
  hw/virtio-nsm: include qemu/osdep.h
  hw/uefi: add pcap support
  hw: move pcap structs to header file
  hw/loader: Add support for zboot images compressed with zstd
  hw/loader: Use g_autofree in unpack_efi_zboot_image()
  hw/loader: Rename UBOOT_MAX _GUNZIP_BYTES to _DECOMPRESSED_BYTES
  hw/loader: Rename LOAD_IMAGE_MAX _GUNZIP_BYTES to _DECOMPRESSED_BYTES
  hw/sd/trace-events: Remove redundant "SWITCH " command name
  hw/sd/sdhci: Remove vendor property
  hw/sd/sdhci: Remove endianness property
  hw/arm/fsl-imx25: Extract TYPE_FSL_ESDHC_LE
  hw/ppc/e500: Use TYPE_FSL_ESDHC_BE
  hw/sd/sdhci: Add TYPE_FSL_ESDHC_BE
  hw/sd/sdhci: Rename usdhc_ functions
  hw/sd/sdhci: Consolidate eSDHC constants
  Revert "hw/sd/sdhci: Rename ESDHC_* defines to USDHC_*"
  hw/arm/fsl-imx25: Apply missing reset quirk
  hw/arm/fsl-imx6: Fix naming of SDHCI related constants and attributes
  hw/arm/fsl-imx6: Remove now redundant setting of "sd-spec-version" property
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-01-21 07:39:57 +11:00
Richard Henderson
464f49bf90 Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
trivial patches for 2026-01-20

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmlvdRoACgkQgqpKJDse
# lHilOw//fdYjk7Ls+M2F0zgIKHbtQj/ACeIXtYr9mLwgUHCVnYByMbaqVVvyuCfZ
# 6n7unTRC6UyhmAgVz5F9RElUBxrRucqgXHXo9QcbvIBBZoWsnWAXjNWmV6kqBF4s
# L8cDniWRLwwkRaGTf1jjOEHJz8ilVwpXfvbQRkU9KJNelFkoh1rprxj3hkw1hF9C
# TpGda15ho7EaplRdfpN+qjOlHpShgbF2qMPUz1zZAWcpomZK8U5/xiHcuE9Y19/L
# tLC6lEkt1nR+xW/5JRptCAke8jLgLlYUHGsXdZuahpXwfK++ITCtM95X2Ra44gMR
# M3xC8hmcpaO5aF/2JoMkLS7LnuenJ093oBIwyhC9LM+MYt/NWIwLIItu22V25qRj
# bEuD2avDSiR0tWDikzxezj5J7riYsDQCt004Ycw7roBZeEI7yngXD2YTkkurSDjb
# wPvzg+qW8WM9n5K9Mxi66F0C7dFU0lru817nJO3dj4ayPJ7B6Elr47n5NpcfAEpP
# dn7j4+nj2puvAyXcfGwLQyU/o/ayJxkEvAZja1Q5sONwMqf0GHIZ9fDu63njkClQ
# rvzKyIKhRv3inmr65nO8RvnZe/j4ONhJ07IwMEBFjUMqW7aXu0GYPx0no7rtWZvQ
# NXypCGE+ag+PYetcOu2tHjaOLQG5/43eBEWSFCgns5UJcrB6vJ4=
# =u20D
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 20 Jan 2026 11:29:14 PM AEDT
# gpg:                using RSA key 64AA2AB531D56903366BFEF982AA4A243B1E9478
# gpg: Good signature from "Michael Tokarev <mjt@debian.org>" [unknown]
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>" [unknown]
# gpg:                 aka "Michael Tokarev <mjt@tls.msk.ru>" [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: 9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
#      Subkey fingerprint: 64AA 2AB5 31D5 6903 366B  FEF9 82AA 4A24 3B1E 9478

* tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu:
  bsd-user/syscall_defs.h: define STAT_TIME_T_EXT only for 32 bits
  linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
  configure: add ppc target back to container tests
  MAINTAINERS: Add docs/system/i386/ to the general x86 architecture section
  tests/qemu-iotests: Use "gsed" for expressions that require GNU sed
  configure: Set $PYTHON in the configuration of the optionroms
  tests: fix comment declaring runtime in rv64 interruptedmemory test
  qemu-options.hx: use KiB, MiB, GiB for power-of-2 units
  gdbstub: unlink the unix socket before bind()
  Revert "gdbstub: Try unlinking the unix socket before binding"

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-01-21 07:38:12 +11:00
Philippe Mathieu-Daudé
e8efe5ff4a meson: Do not try to build module for empty per-target hw/ directory
In commit 83d5db95d3 ("meson: Allow system binaries to not
have target-specific units") we allowed targets with empty
target_system_arch[] source set, but missed hw_arch[] could
also be empty when building modules.

Skip such case, otherwise due to commit a1ced48754
("hw/microblaze: Build files once"), building with
--enable-modules triggers:

  ../meson.build:4034:14: ERROR: Key microblaze is not in the dictionary.

Fixes: a1ced48754 ("hw/microblaze: Build files once")
Reported-by: Frederic Bezies <fredbezies@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3272
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260116131817.38009-1-philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Paolo Bonzini
b248ca4670 hw/virtio-nsm: include qemu/osdep.h
The file hw/virtio/cbor-helpers.c does not include our standard
qemu/osdep.h header, add it.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dorjoy Chowdhury <dorjoychy111@gmail.com>
Message-ID: <20260119120402.284985-1-pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Gerd Hoffmann
41e047ad66 hw/uefi: add pcap support
Add pcapfile property to uevi-vars-* devices, allowing to write out a
capture of the communication traffic between uefi firmware and qemu.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260114110406.3500357-3-kraxel@redhat.com>
[PMD: Wrap long line to avoid checkpatch.pl warning]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Gerd Hoffmann
9aac42720c hw: move pcap structs to header file
Allow reusing them elsewhere in qemu.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260114110406.3500357-2-kraxel@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Daan De Meyer
3a18e8a259 hw/loader: Add support for zboot images compressed with zstd
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Message-ID: <20251124123521.1058183-5-daan.j.demeyer@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Daan De Meyer
3fd0734cb3 hw/loader: Use g_autofree in unpack_efi_zboot_image()
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Message-ID: <20251124123521.1058183-4-daan.j.demeyer@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Daan De Meyer
f9e1dcb7d3 hw/loader: Rename UBOOT_MAX _GUNZIP_BYTES to _DECOMPRESSED_BYTES
For consistency with LOAD_IMAGE_MAX_DECOMPRESSED_BYTES.

Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20251124123521.1058183-3-daan.j.demeyer@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Daan De Meyer
0d0ba24909 hw/loader: Rename LOAD_IMAGE_MAX _GUNZIP_BYTES to _DECOMPRESSED_BYTES
Preparation for adding support for zstd compressed efi zboot kernel
images.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Message-ID: <20251124123521.1058183-2-daan.j.demeyer@gmail.com>
[PMD: Wrap long line to avoid checkpatch.pl warning]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
4395c14a45 hw/sd/trace-events: Remove redundant "SWITCH " command name
"switch" is already part of the function name. No need to repeat it.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20260112145418.220506-15-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
7980909d65 hw/sd/sdhci: Remove vendor property
Now that there are dedicated eSDHC device models it is possible to replace
the "vendor" property (which is really a device-specific property) with a
dynamic cast, "fishing" out only the device models which shall have the
quirk applied.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20260112145418.220506-14-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
ab49b0ac04 hw/sd/sdhci: Remove endianness property
The endianness property was only explicitly set in the e500 machine which
now instantiates TYPE_FSL_ESDHC_BE. The property could also not be used
meaningfully in a hypothetical, common TYPE_FSL_ESDHC device model since
sdhci_common_realize() would fail in that case or it would need to know
all MMIO implementations upfront. Remove the property in favor of dedicated
device models.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20260112145418.220506-12-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
ca35f8cc4d hw/arm/fsl-imx25: Extract TYPE_FSL_ESDHC_LE
Extract an eSDHC (little endian) device model since the uSDHC device model
will get an uSDHC-specific MMIO quirk.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20260112145418.220506-11-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
3b8ea2c193 hw/ppc/e500: Use TYPE_FSL_ESDHC_BE
TYPE_FSL_ESDHC_BE maches real hardware more closely by reusing code of
TYPE_IMX_USDHC. For example, it fixes Linux to flood the guest console with
"mmc0: Internal clock never stabilised" messages in the QEMU advent calendar
2018 day 19 image.

Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20260112145418.220506-10-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
75e98bc4f8 hw/sd/sdhci: Add TYPE_FSL_ESDHC_BE
For now, TYPE_FSL_ESDHC_BE is basically a big-endian variant of
TYPE_IMX_USDHC. It will be used in the e500 machines in the next step which
prevents Linux to flood the console with "mmc0: Internal clock never
stabilised" messages.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20260112145418.220506-9-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
f8f1f5917c hw/sd/sdhci: Rename usdhc_ functions
The next patches will introduce eSDHC device models (big and little endian).
Prepare for that by renaming the functions. Also, this makes the code have
similar conventions as in Linux and U-Boot.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-ID: <20260112145418.220506-8-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00