Commit Graph

126301 Commits

Author SHA1 Message Date
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
Bernhard Beschow
c12125d26f hw/sd/sdhci: Consolidate eSDHC constants
Drop the "IMX_" part of the names since these are actually {E,U}SDHC
specific and apply for PowerPC-based SoCs as well. While at it
consolidate all ESDHC constants into the ESDHC section.

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-7-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
94f3a4d190 Revert "hw/sd/sdhci: Rename ESDHC_* defines to USDHC_*"
This reverts commit 1e76667f7a.

Unaware that the constants were named after Linux and U-Boot code,
commit 1e76667f7a ("hw/sd/sdhci: Rename ESDHC_* defines to USDHC_*")
changed the naming to be consistent with the function names. Fix the
constant naming to be consistent with Linux and U-Boot again. In the
next step, the function names will be renamed according to Linux and
U-Boot code as well.

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-6-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
37d65400b9 hw/arm/fsl-imx25: Apply missing reset quirk
Just like the Freescale MPC8569E SoC the i.MX25 features an eSDHC but
as little-endian variant. According to the datasheet TYPE_FSL_IMX25 requires
the same reset quirk as the e500 machines. The quirk was introduced in
d060b2789f ("hw/sd/sdhci: Set reset value of interrupt registers") for the
e500 machines, so reuse it now in TYPE_FSL_IMX25.

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-5-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
c8145636be hw/arm/fsl-imx6: Fix naming of SDHCI related constants and attributes
The i.MX 6 SoC features uSDHC controllers which are the successors of eSDHC.
Fix the naming to make this clear.

Fixes: ec46eaa83a ("i.MX: Add i.MX6 SOC implementation.")
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-4-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
0c135c2f05 hw/arm/fsl-imx6: Remove now redundant setting of "sd-spec-version" property
Now that TYPE_IMX_USDHC sets this property internally it is not needed
on the SoC level any longer.

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-3-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Bernhard Beschow
214f79fdfb hw/sd/sdhci: Fix TYPE_IMX_USDHC to implement sd-spec-version 3 by default
Fixes TYPE_FSL_IMX6UL, TYPE_FSL_IMX7, and TYPE_FSL_IMX8MP to implement
version 3 of the SD specification.

Note that TYPE_FSL_IMX6 already had "sd-spec-version" set accordingly and
that TYPE_FSL_IMX25 correctly sets the same property to version 2 since the
real hardware is an eSDHC which is the uSDHC's predecessor.

Fixes: fd1e5c8179 ("sdhci: Add i.MX specific subtype of SDHCI")
cc: qemu-stable
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-2-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Tao Tang
d8d19c31b2 tests/qtest: Add SMMUv3 bare-metal test using iommu-testdev
Add a qtest suite that validates ARM SMMUv3 translation without guest
firmware or OS. The tests leverage iommu-testdev to trigger DMA
operations and the qos-smmuv3 library to configure IOMMU translation
structures.

This test suite targets the virt machine and covers:
- Stage 1 only translation (VA -> PA via CD page tables)
- Stage 2 only translation (IPA -> PA via STE S2 tables)
- Nested translation (VA -> IPA -> PA, Stage 1 + Stage 2)
- Design to extended to support multiple security spaces
    (Non-Secure, Secure, Root, Realm)

Each test case follows this sequence:
1. Initialize SMMUv3 with appropriate command/event queues
2. Build translation tables (STE/CD/PTE) for the target scenario
3. Configure iommu-testdev with IOVA and DMA attributes via MMIO
4. Trigger DMA and validate successful translation
5. Verify data integrity through a deterministic write-read pattern

This bare-metal approach provides deterministic IOMMU testing with
minimal dependencies, making failures directly attributable to the SMMU
translation path.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20260119161112.3841386-9-tangtao1634@phytium.com.cn>
[PMD: Cover tests/qtest/iommu-smmuv3-test.c in MAINTAINERS]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Tao Tang
489812e32d tests/qtest/libqos: Add SMMUv3 helper library
Introduce qos-smmuv3, a reusable library for SMMUv3-related qtest
operations. This module encapsulates common tasks like:

- SMMUv3 initialization (enabling, configuring command/event queues)
- Stream Table Entry (STE) and Context Descriptor (CD) setup
- Multi-level page table construction (L0-L3 for 4KB granules)
- Support for Stage 1, Stage 2, and nested translation modes
- Could be easily extended to support multi-space testing infrastructure
    (Non-Secure, Secure, Root, Realm)

The library provides high-level abstractions that allow test code to
focus on IOMMU behavior validation rather than low-level register
manipulation and page table encoding. Key features include:

- Provide memory allocation for translation structures with proper
    alignment
- Helper functions to build valid STEs/CDs for different translation
    scenarios
- Page table walkers that handle address offset calculations per
    security space

This infrastructure is designed to be used by iommu-testdev-based tests
and future SMMUv3 test suites, reducing code duplication and improving
test maintainability.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-ID: <20260119161112.3841386-8-tangtao1634@phytium.com.cn>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Tao Tang
a68650098a tests/qtest: Add libqos iommu-testdev helpers
Introduce a libqos helper module for the iommu-testdev
device used by qtests. This module provides some common functions to
all IOMMU test cases using iommu-testdev.

Wire the new sources into tests/qtest/libqos/meson.build so
they are built as part of the qtest support library.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Message-ID: <20260119161112.3841386-7-tangtao1634@phytium.com.cn>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Tao Tang
59a6b74aeb hw/arm/smmuv3-common: Add STE/CD set helpers for repeated field setup
This change introduces STE_SET_* and CD_SET_* helpers to centralize and
simplify repeated field setting logic.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-ID: <20260119161112.3841386-6-tangtao1634@phytium.com.cn>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Tao Tang
ee1c84ded1 hw/arm/smmuv3-common: Add NSCFG bit definition for CD
Add NSCFG bit definition for CD structure. This allows proper
configuration of non-secure access settings in CD.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-ID: <20260119161112.3841386-5-tangtao1634@phytium.com.cn>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Tao Tang
6ce361b02c hw/misc: Introduce iommu-testdev for bare-metal IOMMU testing
Add a minimal PCI test device designed to exercise IOMMU translation
(such as ARM SMMUv3) without requiring guest firmware or OS. The device
provides MMIO registers to configure and trigger DMA operations with
controllable attributes (security state, address space), enabling
deterministic IOMMU testing.

Key features:
- Bare-metal IOMMU testing via simple MMIO interface
- Configurable DMA attributes for security states and address spaces
- Write-then-read verification pattern with automatic result checking

The device performs a deterministic DMA test pattern: write a known
value (0x12345678) to a configured GVA, read it back, and verify data
integrity. Results are reported through a dedicated result register,
eliminating the need for complex interrupt handling or driver
infrastructure in tests.

This is purely a test device and not intended for production use or
machine realism. It complements existing test infrastructure like
pci-testdev but focuses specifically on IOMMU translation path
validation.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Clément Mathieu--Drif <clement.mathieu--drif@eviden.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-ID: <20260119161112.3841386-4-tangtao1634@phytium.com.cn>
[PMD: Add SPDX-License-Identifier: GPL-2.0-or-later tag]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:51:36 +01:00
Tao Tang
0a50d06fa1 hw/arm/smmuv3-common: Define STE/CD fields via registerfields
Switch STE/CD bitfield definitions and accessors to the
'registerfields.h' REG/FIELD API.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-ID: <20260119161112.3841386-3-tangtao1634@phytium.com.cn>
[PMD: Updated STE::CTXPTR_HI, STE::S2TTB_HI and CD:TTBx_HI lengths]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 19:50:28 +01:00
Tao Tang
81ee3206f0 hw/arm/smmuv3: Extract common definitions to smmuv3-common.h
Move register definitions, command enums, and Stream Table Entry (STE) /
Context Descriptor (CD) structure definitions from the internal header
hw/arm/smmuv3-internal.h to a new common header
include/hw/arm/smmuv3-common.h.

This allows other components, such as generic SMMUv3 tests or test devices,
to utilize these definitions without including the specific SMMUv3 device
internal state.

Signed-off-by: Tao Tang <tangtao1634@phytium.com.cn>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-ID: <20260119161112.3841386-2-tangtao1634@phytium.com.cn>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 18:23:05 +01:00
Pierrick Bouvier
f0de58ccf6 bsd-user/syscall_defs.h: define STAT_TIME_T_EXT only for 32 bits
Commit 369c1ba2b changed the wrong conditional "#if defined(__i386__)" to
"#if defined(TARGET_I386)".
However, TARGET_I386 is defined for target x86_64 also.

This commit fixes it by identifying correctly 32 bits target.

Found with:
$ ./build/qemu-x86_64 \
  -plugin ./build/contrib/plugins/libstoptrigger,icount=1000000 \
  -plugin ./build/tests/tcg/plugins/libinsn \
  -d plugin \
  ./build/qemu-system-x86_64 --version
ld-elf.so.1: /lib/libz.so.6: invalid file format
cpu 0 insns: 59746
total insns: 59746

Fixes: 369c1ba2b ("Fix __i386__ test for TARGET_HAS_STAT_TIME_T_EXT")
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 15:28:21 +03:00
Pierrick Bouvier
83017c4aaa linux-user/aarch64/target_fcntl.h: add missing TARGET_O_LARGEFILE definition
This caused a failure with program using openat2, where O_LARGEFILE was
replaced by O_NOFOLLOW.
This issue is only visible when QEMU is compiled with musl libc, where
O_LARGEFILE is different from 0 (vs glibc).

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3262
Cc: qemu-stable@nongnu.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 15:21:08 +03:00
Florian Hofhammer
0f825b502f configure: add ppc target back to container tests
Commit 2ff8c9a298 removed support for 32-bit PPC hosts from the build
system. Unfortunately, the patch also removed the 32-bit PPC target for
containerized tests, which leads to an error when trying to run tests,
e.g., with "make check-tcg":
"make[1]: *** No rule to make target 'docker-image-debian-ppc-cross',
needed by 'build-tcg-tests-ppc-linux-user'.  Stop."

This patch adds the PPC target back for containerized tests.

Fixes: 2ff8c9a298 ("buildsys: Remove support for 32-bit PPC hosts")
Signed-off-by: Florian Hofhammer <florian.hofhammer@fhofhammer.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
[Mjt: specify commit subject in Fixes tag)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 14:26:33 +03:00
Thomas Huth
64dfb49535 MAINTAINERS: Add docs/system/i386/ to the general x86 architecture section
We've got a section for generic x86 architecture support in our
MAINTAINERS file - this should cover the docs/system/i386/ folder, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 14:25:17 +03:00
Thomas Huth
28e8b25f7d tests/qemu-iotests: Use "gsed" for expressions that require GNU sed
A bunch of tests are currently failing e.g. on FreeBSD like this:

 082   fail       [13:38:58] [13:38:59]   0.5s                 output
  mismatch (see .../build/tests/qemu-iotests/scratch/qcow2-file-082/082.out.bad)
 --- .../src/tests/qemu-iotests/082.out
 +++ .../build/tests/qemu-iotests/scratch/qcow2-file-082/082.out.bad
 @@ -17,7 +17,7 @@
  cluster_size: 4096
  Format specific information:
      compat: 1.1
 -    compression type: COMPRESSION_TYPE
 +    compression type: zlib
      lazy refcounts: true
      refcount bits: 16
      corrupt: false

This happens because the sed statements require GNU sed. Let's use
gsed in these spots to get it fixed.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 14:23:16 +03:00
Thomas Huth
47f43690fb configure: Set $PYTHON in the configuration of the optionroms
pc-bios/optionrom/Makefile uses $(PYTHON) for running a Python script,
but this variable is never initialized here. So the script gets run
via its shebang line - which fails if the "python3" binary is not
available on the system. To fix this, write the PYTHON configuration
to the config.mak file of the optionroms.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 14:21:42 +03:00
Julian Ganz
f0cd0c7c7e tests: fix comment declaring runtime in rv64 interruptedmemory test
The test attempts to trigger a regression for arount 30s. However, a
comment just before the computation of the target wall clock time falsly
declares the run time to be around 60s.

This was the case already when we introduced the test in

    5241645c47
    (tests: add test with interrupted memory accesses on rv64)

Signed-off-by: Julian Ganz <neither@nut.email>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 14:21:07 +03:00
Michael Tokarev
9ae46975cf qemu-options.hx: use KiB, MiB, GiB for power-of-2 units
Use MiB &Co instead of MB &Co when the talk is about
power-of-two-based sizes, in qemu-options.hx.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3222
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-01-20 14:21:06 +03:00
Michael Tokarev
e916f8b3b6 gdbstub: unlink the unix socket before bind()
This is another variant of doing what v9.2.0-1561-gfccb744f41c6
"gdbstub: Try unlinking the unix socket before binding" did, but
that commit introduced dependency on qemu-sockets.c which is
more problematic for statically-linked qemu-user binaries.

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 14:21:06 +03:00
Michael Tokarev
a2b429b114 Revert "gdbstub: Try unlinking the unix socket before binding"
This reverts commit fccb744f41.

This commit introduced dependency of linux-user on qemu-sockets.c.
The latter includes handling of various socket types, while gdbstub
only needs unix sockets.  Including different kinds of sockets
makes it more problematic to build linux-user statically.

The original issue - the need to unlink unix socket before binding -
will be addressed in the next change.

Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-20 14:21:06 +03:00
Richard Henderson
38879a667f Merge tag 'pull-tcg-20260119' of https://gitlab.com/rth7680/qemu into staging
Remove support for 32-bit hosts.

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmltWH8dHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/ERwgAjYEp0OOEGoHQG0Tj
# MWymeQXRgtslspQtkhlIC5IiC8vWOeJVXVvb+sWV4fckkv/v4BK2R903IuHrRiYu
# MeJSDMI6tCWDRzP2U2jbeFlxQ0BGAQUjpi7oRkJEZv9qgWxodek6o+2HLM0iqcDM
# 7NciQwWwlMpkizx45qD+rpulvictLWjYczSpQPrkXEvqVT7dut20MKP/06FvqGsa
# E+1WoZAq0UfkT8xbqcLXgX5QyVPFpC0ZIcHBzXiUip6G4rY5rVnBeuiYCKojl2CI
# M0l9UEwG1KP9aaP6Lx2lg0qnXKT6ITukoPIzlEUDoNorGDwdXklYjd/ChmknQv3K
# fG0zWg==
# =LRWj
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 19 Jan 2026 09:02:39 AM AEDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate]

* tag 'pull-tcg-20260119' of https://gitlab.com/rth7680/qemu: (54 commits)
  include/qemu/atomic: Drop aligned_{u}int64_t
  meson: Remove CONFIG_ATOMIC64
  include/qemu/atomic: Drop qatomic_{read,set}_[iu]64
  util: Remove stats64
  block: Drop use of Stat64
  migration: Drop use of Stat64
  target/s390x: Simplify atomicity check in do_csst
  target/s390x: Drop CONFIG_ATOMIC64 tests
  target/m68k: Drop CONFIG_ATOMIC64 tests
  target/hppa: Drop CONFIG_ATOMIC64 test
  target/arm: Drop CONFIG_ATOMIC64 tests
  linux-user/hppa: Drop CONFIG_ATOMIC64 test
  linux-user/arm: Drop CONFIG_ATOMIC64 test
  accel/tcg: Drop CONFIG_ATOMIC64 test from translator.c
  accel/tcg: Drop CONFIG_ATOMIC64 checks from ldst_atomicicy.c.inc
  tcg: Unconditionally define atomic64 helpers
  accel/tcg/runtime: Remove helper_nonatomic_cmpxchgo
  accel/tcg/runtime: Remove 64-bit shift helpers
  target/riscv: Drop TCG_TARGET_REG_BITS test
  target/i386/tcg: Drop TCG_TARGET_REG_BITS test
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-01-19 09:04:31 +11:00