]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
6 days agotarget/riscv: Fix size of vector CSRs
Anton Johansson [Wed, 20 May 2026 12:53:40 +0000 (14:53 +0200)] 
target/riscv: Fix size of vector CSRs

According to version 20250508 of the unprivileged specification:
- vtype: bits 0..7 used, bit XLEN-1 illegal, rest reserved
  => fix to 64-bits.

- vxsat: bit 0 used, vxrm which would occupy bits 1..2 is stored
  separately, and bits 3..31 are set to 0
  => fix to 8-bits.

- vxrm: 2 lowest bits are used for rounding mode, rest set to 0
  => fix to 8-bits.

- vstart: maximum value of VLMAX-1, where VLMAX is at most 2^16
  => fix to 32-bits as vstart is mapped to a TCG global.

- vl: maximum value of VLEN which is at most 2^16
  => fix to 32-bits as vl is mapped to a TCG global.

Fields are shuffled for reduced padding.

Note, the cpu/vector VMSTATE version is bumped, breaking migration from
older versions.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260520125406.28693-3-anjo@rev.ng>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv: Fix size of gpr and gprh
Anton Johansson [Wed, 20 May 2026 12:53:39 +0000 (14:53 +0200)] 
target/riscv: Fix size of gpr and gprh

gprh is only needed for TARGET_RISCV64 when modeling 128-bit registers,
fixing their size to 64 bits makes sense.

gpr is also fixed to 64 bits since all direct uses of env->gpr
correctly zero extend/truncate to/from target_ulong, meaning
!TARGET_RISCV64 will behave as expected.

We do however need to be a bit careful when mapping 64-bit fields to
32-bit TCGv globals on big endian hosts.

Note, the cpu/rv128 VMSTATE version is bumped, breaking migration from
older versions.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-ID: <20260520125406.28693-2-anjo@rev.ng>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv/cpu_helper.c: allow LOAD_ADDR_MIS promotion to AMO fault
Daniel Henrique Barboza [Fri, 22 May 2026 18:13:53 +0000 (15:13 -0300)] 
target/riscv/cpu_helper.c: allow LOAD_ADDR_MIS promotion to AMO fault

promote_load_fault() is missing the promotion of misaligned AMO load
addresses, i.e. RISCV_EXCP_LOAD_ADDR_MIS should be promoted to
RISCV_EXCP_STORE_AMO_ADDR_MIS when RISCV_UW2_ALWAYS_STORE_AMO (i.e.
always_storeamo is true).

All other load AMO faults are already being covered.

Cc: qemu-stable@nongnu.org
Fixes: 98f21c30f5 ("target/riscv: AMO operations always raise store/AMO fault")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3503
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260522181353.429782-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv/cpu_helper.c: fault with reserved PTE.PBMT val
Daniel Henrique Barboza [Thu, 21 May 2026 13:07:27 +0000 (10:07 -0300)] 
target/riscv/cpu_helper.c: fault with reserved PTE.PBMT val

We need to fault during any access done while PTE bits 62-61 are both
set, according to the RISC-V priv spec.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3494
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260521130727.2311629-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv/insn_trans/trans_rvzicbo.c.inc: save opcode before helpers
Daniel Henrique Barboza [Wed, 20 May 2026 21:47:04 +0000 (18:47 -0300)] 
target/riscv/insn_trans/trans_rvzicbo.c.inc: save opcode before helpers

All helpers from this file can trigger ILLEGAL_INSN exceptions via
check_zicbo_envcfg() directly, bypassing the usual exception code from
translate.c.   If we don't save the opcode before each helper,
riscv_raise_exception() is triggered and env->bins won't be unwind during
cpu_loop_exit_restore() (code path cpu_restore_state ->
cpu_restore_state_from_tb() -> restore_state_to_opc()).

And finally, in riscv_cpu_do_interrupt(), we will set (m)tval = 0 when we can,
instead, set it to the cbo opcode that generated the exception.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3380
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260520214704.1943652-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv: Reject Svinval instructions in U-mode
Zephyr Li [Fri, 22 May 2026 03:31:44 +0000 (11:31 +0800)] 
target/riscv: Reject Svinval instructions in U-mode

The RISC-V privileged specification requires SFENCE.W.INVAL and
SFENCE.INVAL.IR to raise an illegal instruction exception when executed
in U-mode. Check the current privilege mode during translation and reject these
instructions in U-mode, so they are reported as illegal instructions.

Add a helper to reject these instructions in U-mode during translation.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3493

Suggested-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Signed-off-by: Zephyr Li <fritchleybohrer@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Message-ID: <20260522033145.17850-1-fritchleybohrer@gmail.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv: Do not hide Sstc CSRs from gdbstub
Zephyr Li [Mon, 25 May 2026 02:42:20 +0000 (10:42 +0800)] 
target/riscv: Do not hide Sstc CSRs from gdbstub

The Sstc predicate currently checks both ext_sstc and rdtime_fn. This
causes the gdbstub CSR XML generation to skip Sstc CSRs when rdtime_fn
has not been initialized yet, even if the CPU supports Sstc.

As a result, GDB reports $stimecmp as void with a CPU that exposes the
sstc extension.

Only use ext_sstc for the early existence check, and keep the rdtime_fn
check for non-debugger accesses.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3496
Signed-off-by: Zephyr Li <fritchleybohrer@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260525024220.39027-1-fritchleybohrer@gmail.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agodisas/riscv.c: add 'cbo' insns to disassembler
Daniel Henrique Barboza [Tue, 19 May 2026 20:47:14 +0000 (17:47 -0300)] 
disas/riscv.c: add 'cbo' insns to disassembler

We forgot to add 'cbo' insns to disas/riscv.c.  The result is that the
disassembler recognizes all of them as 'lq', an insn that happens to
share the same opcode space.

While we're at it reorder cbo_* entries in insn32.decode using opcode
order instead of insn name.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3480
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260519204714.1376551-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv/csr.c: fix mstatus.UXL reserved value
Daniel Henrique Barboza [Thu, 14 May 2026 19:45:37 +0000 (16:45 -0300)] 
target/riscv/csr.c: fix mstatus.UXL reserved value

By the priv spec the value "3" is marked as 'Reserved' for mstatus.UXL.
Handle a mstatus.UXL = 3 write by writing the current 'xl' instead.

Fixes: https://gitlab.com/qemu-project/qemu/-/work_items/3367
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260514194537.2416243-3-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv/csr.c: do not allow mstatus MPV/GVA writes
Daniel Henrique Barboza [Thu, 14 May 2026 19:45:36 +0000 (16:45 -0300)] 
target/riscv/csr.c: do not allow mstatus MPV/GVA writes

The priv spec states the following about mstatus.MPV:

"The MPV bit (Machine Previous Virtualization Mode) is written by the
implementation whenever a trap is taken into M-mode."

And, about mstatus.GVA:

"Field GVA (Guest Virtual Address) is written by the implementation
whenever a trap is taken into M-mode."

Both are written during riscv_cpu_do_interrupt().  They're not supposed
to be written by userspace.  As far as write_mstatus goes these fields
are read only.  The same applies for mstatush.MPV/mstatush.GVA.

Fixes: 03dd405dd5 ("target/riscv: Support MSTATUS.MPV/GVA only when RVH is enabled")
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20260514194537.2416243-2-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv: Improve PMP address alignment readability
Jay Chang [Wed, 20 May 2026 06:36:06 +0000 (14:36 +0800)] 
target/riscv: Improve PMP address alignment readability

Replace manual bit manipulation for better readability:

- TOR: Use ROUND_DOWN() to clear lower bits
- NAPOT: Use deposit64() to set lower bits

Signed-off-by: Jay Chang <jay.chang@sifive.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260520063606.36600-3-jay.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv: Align pmp size to pmp-granularity
Jay Chang [Wed, 20 May 2026 06:36:05 +0000 (14:36 +0800)] 
target/riscv: Align pmp size to pmp-granularity

When configuring pmpcfg (TOR, NA4, or NAPOT) and pmpaddr, if the
value is smaller than the PMP granularity, it needs to be aligned
to the PMP granularity.

Signed-off-by: Jay Chang <jay.chang@sifive.com>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260520063606.36600-2-jay.chang@sifive.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
6 days agotarget/riscv/tcg: disable svpbmt if satp_mode < sv39
Daniel Henrique Barboza [Tue, 19 May 2026 11:48:58 +0000 (08:48 -0300)] 
target/riscv/tcg: disable svpbmt if satp_mode < sv39

Priv spec chapter "Svpbmt Extension for Page-Based Memory Types, Version
1.0" mentions that "The Svpbmt extension depends on the Sv39
extension.".

We're not doing any satp checks when enabling svpbmt.  This causes
problems with the riscv32 'max' CPU that happens to be enabling svpbmt
even though it doesn't support the required satp mode.  In fact all rv32
CPUs are allowing menvcfg.PBMTE writes, which doesn't make sense for
them in any circunstance since svpbmt is not possible for rv32 at this
moment [1].

This also impacts rv64 CPUs that are running in satp 'bare' mode and are
reporting svpbmt in the riscv,isa.

All these problems can be solved by disabling svpbmt if satp_mode is not
at least sv39.  The problem reported in [1] goes away because we'll
never enable MENVCFG_PBMTE write mask in write_menvcfgh().  We're also
become consistent with how svpbmt is enabled for rv64.

In case the user enables svpbmt in the command line using an invalid setup,
not just disable svpbmt but also throw a warning:

$ ./build/qemu-system-riscv64 -M virt,dumpdtb=fdt.dtb \
    -cpu max,sv39=off,sv48=off,sv57=off,sv64=off,svpbmt=on
qemu-system-riscv64: warning: svpbmt requires at least satp sv39, current satp mode: none

[1] https://gitlab.com/qemu-project/qemu/-/work_items/3473

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3473
Signed-off-by: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Message-ID: <20260519114858.316532-1-daniel.barboza@oss.qualcomm.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
8 days agoMerge tag 'pull-tcg-20260612' of https://gitlab.com/rth7680/qemu into staging
Stefan Hajnoczi [Sat, 13 Jun 2026 18:02:34 +0000 (14:02 -0400)] 
Merge tag 'pull-tcg-20260612' of https://gitlab.com/rth7680/qemu into staging

tcg: Silence ubsan error on tcg_splitwx_diff causing overflow

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmosK3gdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/emAgAo4Pmyr1WXEr8o/MY
# xN3PJldSWsDdtsAUJcca06/KBv07gZzMKge6+fpKexzuYQMbDN7kxoaAh/CQPrtD
# 4jy3W9z84U8EGPetk8e8HoBIYyqKBfdTv838+LYorvZZiyyTJzBfvULe4Fgcbon4
# NUQ/brL5ObLcuAsjUw5jpFaIfhPihnKaAaxzDYASh4CJc4xt1AKAHpzSZ7aywXz0
# g+Y217g4Kv/RjQulab/EkcH0OUzVKgMFJ7RhUq2Ldx8MQLfoJj7foJ37276OcFal
# 6FcDKmyYjEHGSypicfTq2i7DAmSD0Z2Fa6izSyobP5IlzwTBiwhyaK+ZlIE2iaXD
# a/4OqQ==
# =zcQQ
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 12 Jun 2026 11:53:28 EDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-tcg-20260612' of https://gitlab.com/rth7680/qemu:
  tcg: Silence ubsan error on tcg_splitwx_diff causing overflow

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 days agoMerge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
Stefan Hajnoczi [Sat, 13 Jun 2026 18:02:07 +0000 (14:02 -0400)] 
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging

trivial patches for 2026-06-12

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmosOqUACgkQgqpKJDse
# lHi4ng/9FmaFMx383U6vPWBbw/Q8IsqOD35yr71vJ6iaI3UL2ALoPHD7DUzSXf39
# 815jx1fuiFUIjC9GgTIYDpi7ArahNLiyHWcosKfXPNO/W/6vqKfDEwlVkBgLgbRm
# dSF+ds2v+1sxSoarrnrVZL+FLcX3hEJ2I1MDp+6oLDqt9SScIADZ4RFVZq3eNVZT
# z8FLXyLQDlhO4YNBUTZ7UwqD2PcPSfaxAFxGCuBD5WdHepi1spJvg2RrznqDnbf0
# keG2Zn1lfJNdqRD5K98k04eFKTIPUCWp/2uQpb4J6A0khJB+LT6CYm0oZpSkKbgT
# hHVmi6GGZSDNipDFpOvj97DBqdaPUeWNlOQFE0WfA9jVllC4MPBI7rOUHYzoqVFj
# iRXNVZkOpTKfznZzvkZv60sxoKZ+CiCqx9qCXqk0plhX3ycMni/ml8jTVLtXZc4F
# tWo3YxSaBjMAOe5Kx7J5r7+Sk9FiA/YuRUL5LjpTAIDFv7yQftR4hHwdURl0oCHJ
# UTEiOvVJae1fZTmtUUzqXl4+JVuyBpn3padc5ivq+yszhFbdmUryQA+s0q/qnDi+
# vaHtE4AKu7ENFiNmksGOsj5t9SWwf7s7J+Z2rBJVCcvpPgRuEMWajqrc1xlGNPz5
# fZ9P6rlOSWqtsv8laYfCTeWVQywgFdgBmUUnlGLt7OLw9Kxu644=
# =nFAH
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 12 Jun 2026 12:58:13 EDT
# 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:
  qemu-options: fix typo in spelling of 'scheduler'
  igvm: spit out region size on error
  hw/xtensa: replace calloc with g_new0 in mx_pic
  block/io: Use QEMU_LOCK_GUARD to simplify mutex handling
  net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling
  system/rtc: Fix a possible year-2038 integer overflow problem
  hw/display/vga: Fix debug message
  net/slirp: allow hostfwd socket paths with dashes

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
8 days agoMerge tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa into...
Stefan Hajnoczi [Sat, 13 Jun 2026 18:00:45 +0000 (14:00 -0400)] 
Merge tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa into staging

linux-user patches

Add preadv2/preadv2 syscalls, fix FP registers across signals on xtensa, and
add emulation for /proc/cpuinfo for ppc CPUs

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCaiwqxgAKCRD3ErUQojoP
# XxmZAP9iBF5wk2mDxxOZxhJ5vTwCKMAeOi2uZSfNzyGewYMw4gEAtQjRmpnAWOxs
# 2XwGM8hzu+/kdgDu7nRfWViWkQuBfw0=
# =7lvQ
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 12 Jun 2026 11:50:30 EDT
# gpg:                using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F
# gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown]
# gpg:                 aka "Helge Deller <deller@kernel.org>" [unknown]
# gpg:                 aka "Helge Deller <deller@debian.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: 4544 8228 2CD9 10DB EF3D  25F8 3E5F 3D04 A7A2 4603
#      Subkey fingerprint: BCE9 123E 1AD2 9F07 C049  BBDE F712 B510 A23A 0F5F

* tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa:
  linux-user/xtensa: save/restore FP registers across signal delivery
  target/xtensa: add cpu_set_fcr/fsr helpers to sync fp_status
  linux-user: Implement /proc/cpuinfo for ppc cpus
  linux-user: add preadv2/preadv2

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 days agoqemu-options: fix typo in spelling of 'scheduler'
Fiona Ebner [Thu, 11 Jun 2026 11:34:24 +0000 (13:34 +0200)] 
qemu-options: fix typo in spelling of 'scheduler'

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agotcg: Silence ubsan error on tcg_splitwx_diff causing overflow
Fabiano Rosas [Fri, 5 Jun 2026 13:25:39 +0000 (10:25 -0300)] 
tcg: Silence ubsan error on tcg_splitwx_diff causing overflow

UBSAN complains:
runtime error: addition of unsigned offset to 0x7bc06e1f5000
overflowed to 0x7bc02e1f5000

Change tcg_splitwx_diff to ptrdiff_t and silence the error.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260605132539.2775364-1-farosas@suse.de>

9 days agolinux-user/xtensa: save/restore FP registers across signal delivery
Matt Turner [Fri, 12 Jun 2026 14:14:06 +0000 (10:14 -0400)] 
linux-user/xtensa: save/restore FP registers across signal delivery

Add support for saving and restoring f0-f15 across signal delivery.
The target_xtensa_xtregs_fp struct carries 32-bit f-regs for cores
with XTENSA_OPTION_FP_COPROCESSOR; target_xtensa_xtregs_dfp carries
64-bit f-regs for cores with XTENSA_OPTION_DFP_COPROCESSOR.

Lock the xtregs region via lock_user before reading on sigreturn,
since sc_xtregs is a user-space pointer that may lie outside the
locked sigframe.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
9 days agotarget/xtensa: add cpu_set_fcr/fsr helpers to sync fp_status
Matt Turner [Wed, 10 Jun 2026 15:25:36 +0000 (11:25 -0400)] 
target/xtensa: add cpu_set_fcr/fsr helpers to sync fp_status

Factor FCR→fp_status and FSR→fp_status synchronisation out of the
wur_fpu{2k,}_fcr/wur_fpu_fsr helpers into cpu_set_fcr(), cpu_set_fsr(),
and cpu_get_fsr(). Signal delivery code needs to restore the FP rounding
mode and exception flags without duplicating the flag-mapping tables.

cpu_set_fcr() applies the union mask 0xfffff07f (superset of the
wur_fpu_fcr mask 0x0000007f and the wur_fpu2k_fcr mask 0xfffff07f) so
that FCR bits valid only on fpu2k configs are preserved while MBZ bits
7-11 are always cleared.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
9 days agolinux-user: Implement /proc/cpuinfo for ppc cpus
Helge Deller [Thu, 11 Jun 2026 21:26:33 +0000 (23:26 +0200)] 
linux-user: Implement /proc/cpuinfo for ppc cpus

Mimic the entries for /proc/cpuinfo to what can be seen on two debian
porterboxes (ppc64 and ppc64le), which are running via KVM/QEMU.

The "timebase" value in /proc/cpuinfo is used by glibc on power, but only if
the __kernel_get_tbfreq vdso call isn't implemented. So switch
cpu_ppc_load_tbl() for linux-user to get_clock(), as suggested by Richard, and
report timebase = 1GHz in /proc/cpuinfo, which will make the vdso
implementation simple too.

v4: change timebase to 1GHz and use get_clock()
v3: drop another colon, indenting fixes
v2: drop colon, add clock output, refine pvr calculation

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
9 days agolinux-user: add preadv2/preadv2
Dominique Martinet [Wed, 10 Jun 2026 07:54:52 +0000 (07:54 +0000)] 
linux-user: add preadv2/preadv2

Some programs apparently use these, like the python test suite.

The flags argument (rwf_t) is an int, with values shared on all arches
and does not need translating.

This was tested manually with the following python script:
```
import os
fd = os.open('test', os.O_RDWR|os.O_CREAT)
os.pwritev(fd, [b'test', b'ok'], 0, os.RWF_HIPRI)
buf = [bytearray(3), bytearray(10)]
os.preadv(fd, buf, 0, os.RWF_HIPRI)
print(buf[0])
print(buf[1])
```

Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
9 days agoigvm: spit out region size on error
Ani Sinha [Sun, 7 Jun 2026 14:41:44 +0000 (20:11 +0530)] 
igvm: spit out region size on error

This change makes the error message provide more details on the values that
caused the error. Cosmetic, no functional change. Only useful for debugging
purpose.

CC: qemu-trivial@nongnu.org
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@mailo.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agohw/xtensa: replace calloc with g_new0 in mx_pic
Ajinkya Udgirkar [Thu, 4 Jun 2026 16:28:49 +0000 (21:58 +0530)] 
hw/xtensa: replace calloc with g_new0 in mx_pic

Replace libc calloc() with GLib g_new0() for consistency with the
rest of the QEMU codebase. g_new0() aborts on allocation failure
rather than returning NULL, which matches QEMU's allocation policy.

Signed-off-by: Ajinkya Udgirkar <audgirka@redhat.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agoblock/io: Use QEMU_LOCK_GUARD to simplify mutex handling
Evgeny Kolmakov [Fri, 22 May 2026 08:06:44 +0000 (11:06 +0300)] 
block/io: Use QEMU_LOCK_GUARD to simplify mutex handling

Replace qemu_mutex_(un)lock() calls with QEMU_LOCK_GUARD().

Signed-off-by: Evgeny Kolmakov <randomjack94dev@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhang Chen <zhangckid@gmail.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agonet/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling
Evgeny Kolmakov [Fri, 22 May 2026 08:06:43 +0000 (11:06 +0300)] 
net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling

Replace qemu_mutex_(un)lock() calls with the QEMU_LOCK_GUARD().

Signed-off-by: Evgeny Kolmakov <randomjack94dev@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Zhang Chen <zhangckid@gmail.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agosystem/rtc: Fix a possible year-2038 integer overflow problem
Thomas Huth [Mon, 18 May 2026 16:34:08 +0000 (18:34 +0200)] 
system/rtc: Fix a possible year-2038 integer overflow problem

rtc_realtime_clock_offset is initialized with:

  rtc_realtime_clock_offset = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000;

And QEMU_CLOCK_REALTIME might be based on gettimeofday() in certain
cases (see get_clock_realtime() in include/qemu/timer.h). So this
counter will exceed 32 bits in the year 2038, thus we should not
store this value in a normal integer variable. Change it to a time_t
to fix the problem.
And while we're at it, also adjust the nearby rtc_host_datetime_offset
variable to be on the safe side in the related code.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agohw/display/vga: Fix debug message
BALATON Zoltan [Mon, 30 Mar 2026 14:06:56 +0000 (16:06 +0200)] 
hw/display/vga: Fix debug message

Fixes: f9b925fd41 vga: introduce VGADisplayParams
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agonet/slirp: allow hostfwd socket paths with dashes
Michael Tokarev [Tue, 17 Mar 2026 08:27:18 +0000 (11:27 +0300)] 
net/slirp: allow hostfwd socket paths with dashes

The format of hostfwd parameter is:
  hostfwd=hostpart-guestaddr:guestport
so a minus sign can not be part of the hostpart.
If hostpart specifies a unix socket path, this becomes problematic.

To solve this, look for the LAST minus/dash char in the string,
not first.

Unfortunately, [-guestaddr] is optional (defaults to 10.0.0.15),
so we still can't parse the thing in an uniform way.

Extend get_str_sep() to accept negative separator to indicate searching
from the end of buffer, to find the last occurence.  Update slirp_hostfwd
to search for the last separator when parsing unix domain socket path.

Inspired-by: Christopher Palmer-Richez <crichez@pm.me>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/347
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
9 days agoMerge tag 'pull-ufs-20260612' of https://gitlab.com/jeuk20.kim/qemu into staging
Stefan Hajnoczi [Fri, 12 Jun 2026 13:01:07 +0000 (09:01 -0400)] 
Merge tag 'pull-ufs-20260612' of https://gitlab.com/jeuk20.kim/qemu into staging

ufs queue

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEUBfYMVl8eKPZB+73EuIgTA5dtgIFAmorUfAACgkQEuIgTA5d
# tgIQWA/+MkEs+rKdSTQbFOgR4LoK8YEDO0M1cxF3x8NVcWYxwyNrotOk+4dRiSWH
# zy+PaiCmibHgqgtluPkFc1Zzo6iFD/5h6/wb3yJiNfiOTiCbYIzLrIEn/LUqwXtp
# YKNBEKaQSnWFjYF0oRGOeblMQ+KOTmna7vR/zsoLx7S3N9IC0tJB/AUIXBcpW2ur
# d7Qg+YTl/mGlOYQcZ3njBAjf0k2LVuG1TUuMAyBfEcz2fjC6fgR2plKURRjuEL3R
# aGENupphIomHTxIJUZIw+PyOCJ0sdV4/rwUbQGcM5hQni+6dny8ywAZj7obXmAGJ
# esRP2WVV3GVRyNNKUqlEuiD+ReUKJHkmCpzGYcaI41YKC097GEMsJzdk/KpiU5Gl
# e4L6KMvDuwk8HXM5cfK+hvBz279vY30l9+s3Oa3ConZdQC4wXN9OJBNJkboP23HL
# +yLsiSxYaBIbA8/RNNOZmI8VauAMuMmlTG0ukZsVvpk5FUOVeo9c4sDf+2bLrOyG
# YTCTL9fqrWZZCWLXava69+rGQTrPmAA8UvKO5unGz4Wf1yZyYhDD4SWnbFye0U+V
# FCqNXvtg7IAV0spxIhGx0D3Ypdb1AbROEXI4kU7kdiNgsie53HsENLCY/fCv6PY+
# HNxGCx9HpadKVG+pm8lEJgFH/R7vf4qWB9K/TZ08KFr2txXjUwg=
# =NmLP
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 11 Jun 2026 20:25:20 EDT
# gpg:                using RSA key 5017D831597C78A3D907EEF712E2204C0E5DB602
# gpg: Good signature from "Jeuk Kim <jeuk20.kim@samsung.com>" [unknown]
# gpg:                 aka "Jeuk Kim <jeuk20.kim@gmail.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: 5017 D831 597C 78A3 D907  EEF7 12E2 204C 0E5D B602

* tag 'pull-ufs-20260612' of https://gitlab.com/jeuk20.kim/qemu:
  tests/qtest: Add UFS HID qtest
  hw/ufs: Add Host Initiated Defragmentation (HID) support

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9 days agotests/qtest: Add UFS HID qtest
Keoseong Park [Tue, 9 Jun 2026 04:12:28 +0000 (13:12 +0900)] 
tests/qtest: Add UFS HID qtest

Cover the HID attribute permission table, the disable / analysis /
defrag state transitions, partial defrag bounded by dHIDSize, and
the terminal auto-reset behaviors.

Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
9 days agohw/ufs: Add Host Initiated Defragmentation (HID) support
Keoseong Park [Tue, 9 Jun 2026 04:06:46 +0000 (13:06 +0900)] 
hw/ufs: Add Host Initiated Defragmentation (HID) support

Emulate the UFS HID extended feature. Host interacts via five
attributes (IDN 0x35-0x39):

  bDefragOperation   trigger: Disable / Analysis / Defrag
  dHIDAvailableSize  fragmented 4KB units (published by analysis)
  dHIDSize           host-requested defrag target (4KB units)
  bHIDProgressRatio  0-100%; reading 100 resets HID
  bHIDState          current state; terminal-state read resets HID

Successful user-data SCSI WRITE commands increment an internal
fragment counter; HID analysis publishes the counter through
dHIDAvailableSize. Defrag operates on min(dHIDSize,
dHIDAvailableSize), so a small dHIDSize yields a partial defrag.
bDefragOperation auto-clears on terminal state. The state machine
advances from ufs_process_idle(); transitions occur only while the
device is idle.

Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
10 days agoMerge tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa into...
Stefan Hajnoczi [Thu, 11 Jun 2026 17:22:49 +0000 (13:22 -0400)] 
Merge tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa into staging

linux-user patches for alpha, sparc and sh4

Various linux-user related patches from Matt Turner with coredump support for
alpha and sparc, as well as some fixes for the signal handler in sparc.

The patches from Xinhui Yang add the missing fsmount series syscalls support
for systemd.

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCaimUqgAKCRD3ErUQojoP
# X82/APsHNDNgLBaVZpddfYs3HxFbIVyn+i2BBvVzPNopJYdciQD+NmjnXo+9NC1O
# ld6wztNGYQSx2t09tpctYpPeaBchUQY=
# =43TP
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 10 Jun 2026 12:45:30 EDT
# gpg:                using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F
# gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown]
# gpg:                 aka "Helge Deller <deller@kernel.org>" [unknown]
# gpg:                 aka "Helge Deller <deller@debian.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: 4544 8228 2CD9 10DB EF3D  25F8 3E5F 3D04 A7A2 4603
#      Subkey fingerprint: BCE9 123E 1AD2 9F07 C049  BBDE F712 B510 A23A 0F5F

* tag 'linux-user-pull-request' of https://github.com/hdeller/qemu-hppa:
  target/sh4: decode_gusa: recognize add#imm with prior mov Rm, Rn
  linux-user/sparc: flush register windows before core dump
  linux-user/sparc: call block_signals() before set_sigmask() in setcontext
  linux-user/sparc: restore L/I registers from RSA in sparc64_set_context
  linux-user/sparc: add coredump support
  linux-user/alpha: add coredump support
  linux-user/strace: add fsmount series of syscalls
  linux-user: implement fsmount(2) series of syscalls

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 days agoMerge tag 'pull-target-arm-20260610' of https://gitlab.com/pm215/qemu into staging
Stefan Hajnoczi [Thu, 11 Jun 2026 17:22:33 +0000 (13:22 -0400)] 
Merge tag 'pull-target-arm-20260610' of https://gitlab.com/pm215/qemu into staging

target-arm queue:
 * Emulate various FP8 related features: FEAT_F8F16MM, FEAT_F8F32MM,
   FEAT_FP8DOT2, FEAT_SSVE_FP8DOT2, FEAT_FP8DOT4, FEAT_SSVE_FP8DOT4,
   FEAT_FP8FMA, FEAT_SSVE_FP8FMA, FEAT_SME_LUTv2, FEAT_FP8, FEAT_LUT
 * Emulate MTE4 features: FEAT_MTE_CANONICAL_TAGS,
   FEAT_MTE_NO_ADDRESS_TAGS, FEAT_MTE_PERM,FEAT_MTE_STORE_ONLY,
   FEAT_MTE_TAGGED_FAR
 * target/arm: fix WFET typo in syndrome
 * target/arm: Preparatory patches for implementing WFE
 * hw/dma/pl080: Don't use hw_error() for unimplemented features
 * hw/intc/exynos4210_combiner: Avoid hw_error for guest errors
 * hw/usb/hcd-ohci: Clean up USBPacket before freeing ISO TD packet
 * hw/core/qdev-clock: Fix potential null pointer dereference

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmopiZkZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3vsMD/9+KuhMU13uZvmHrg3WVq2/
# BY1c0Z8mfB6fm0YfOtI9a4GpBKakwdJrsPcleKsJ8YIQHuaHcaSToqMAzZ97Iih8
# NmbPFtUmMWoMBA4CwpuiKkQdm7RgVbG0kafu6qcYBOP1f87jPQavjGC68zSijhEW
# toRBEJtKRpPYl4ngbDtdmHbA3y4WA6ynNrCIvQHRFbqUX+GxRjPPNFpdHptEj+qo
# cZiXQ0U2xNcCdtcio8hjWNtdyJ8fDt+4SvmTVa+6dwnmXx7Q4uC34YJ0619yN4JE
# Ru2iLQnIAJvyhNtF+M2F0sitwMZA2CJ1VWZRmnRDbH9l7QwP2z/1raqaGIgm6E2s
# Oia4QVGGuZTOxGJyJr/e9qUZZLhKZptLY/340QD7NpCQGkeefgmtKkoEcga93qnW
# wYQD3t/tIG4xS8pdnbld4W1y5cCJ2Lg4kSDLxMbwrBv18gmsRxZdEHx4G1iVPnT6
# 5dGHEP81webn3sGgviPGGt4Bvp+1MQW0H4f53o0GVgdUN0rX4y1Z1AZa0j9tl9v1
# ifG6LWc09qsDkCsJB//xJ0ATT0ppWtbdIr7U5BJQjIaN5FNCXtZC2m3wDkKkfeqD
# fBFAL+xYb9NoYXvDjTLZdBOvcXGZdeVJ0if4FPqHQuTD8DRq+Isbkmf/2pHteVPA
# jjGHJKtkFAHXKCYAdgmXDg==
# =q0nq
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 10 Jun 2026 11:58:17 EDT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full]
# gpg:                 aka "Peter Maydell <peter@archaic.org.uk>" [unknown]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20260610' of https://gitlab.com/pm215/qemu: (71 commits)
  target/arm: Enable FEAT_F8F16MM for -cpu max
  target/arm: Implement FMMLA (FP8 to FP16) for SVE
  target/arm: Implement FMMLA (FP8 to FP16) for AdvSIMD
  target/arm: Enable FEAT_F8F32MM for -cpu max
  target/arm: Implement FMMLA (FP8 to FP32) for SVE
  target/arm: Implement FMMLA (FP8 to FP32) for AdvSIMD
  target/arm: Enable FEAT_FP8DOT2, FEAT_SSVE_FP8DOT2 for -cpu max
  target/arm: Implement FDOT (FP8 to FP16) for SVE
  target/arm: Implement FDOT (FP8 to FP16) for AdvSIMD
  target/arm: Enable FEAT_FP8DOT4, FEAT_SSVE_FP8DOT4 for -cpu max
  target/arm: Implement FDOT (FP8 to FP32) for SVE
  target/arm: Implement FDOT (FP8 to FP32) for AdvSIMD
  target/arm: Enable FEAT_FP8FMA, FEAT_SSVE_FP8FMA for -cpu max
  target/arm: Implement FMLALL{BB,BT,TB,TT} for SVE
  target/arm: Implement FMLALL{BB, BT, TB, TT} for AdvSIMD
  target/arm: Implement FMLALB, FMLALT (FP8 to FP16) for SVE
  target/arm: Implement FMLALB, FMLALT for AdvSIMD
  target/arm: Enable FEAT_SME_LUTv2 for -cpu max
  target/arm: Implement LUTI4 (four registers, 8-bit)
  target/arm: Implement MOVT (vector to table)
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 days agotarget/sh4: decode_gusa: recognize add#imm with prior mov Rm, Rn
Matt Turner [Mon, 25 May 2026 15:27:39 +0000 (11:27 -0400)] 
target/sh4: decode_gusa: recognize add#imm with prior mov Rm, Rn

The gUSA pattern matcher rejected `add #imm, Rn` whenever any prior
`mov Rm, Rn` appeared (mv_src >= 0), forcing a fallback to
cpu_exec_step_atomic for sequences like:

  mov.l  @r2, r3      ; load
  mov    r3, r7       ; save old value (mv_src == ld_dst)
  add    #1, r7       ; increment copy
  mov.l  r7, @r2      ; store

When mv_src == ld_dst the move merely copies the loaded value to
preserve it -- exactly the situation already accepted for the
`add Rm, Rn` form. The immediate form can be handled identically with
tcg_gen_atomic_fetch_add_i32 + tcg_gen_add_i32, so translate it inline
instead of taking the slower single-step atomic fallback.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: Yoshinori Sato <yoshinori.sato@nifty.com>
Cc: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Helge Deller <deller@gmx.de>
11 days agolinux-user/sparc: flush register windows before core dump
Matt Turner [Thu, 4 Jun 2026 00:30:59 +0000 (20:30 -0400)] 
linux-user/sparc: flush register windows before core dump

Without this, only the crash frame's window is spilled to the
stack; all deeper call frames remain in the register file and
are absent from the core's memory segments. Stack unwinding
fails past the first DWARF step because the callers' register
save areas contain stale/garbage data.

The real kernel calls flush_all_user_windows() at the top of
do_coredump(). Mirror that via a weak target_flush_windows()
hook called from dump_core_and_abort(), with the SPARC override
calling the existing flush_windows() in cpu_loop.c.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Helge Deller <deller@gmx.de>
11 days agolinux-user/sparc: call block_signals() before set_sigmask() in setcontext
Matt Turner [Wed, 3 Jun 2026 16:18:51 +0000 (12:18 -0400)] 
linux-user/sparc: call block_signals() before set_sigmask() in setcontext

sparc64_set_context() emulates the kernel's `ta 0x6f` trap by calling
set_sigmask() to install the mask supplied via the user's ucontext_t.
The contract of set_sigmask() (see its comment in linux-user/signal.c)
is that the caller must have first called block_signals(), which sets
TaskState::signal_pending.

Without block_signals(), if a guest signal is pending-and-blocked at
the time setcontext is invoked and the new mask unblocks it,
signal_pending stays 0 and the post-trap process_pending_signals()
call in linux-user/sparc/cpu_loop.c never enters its while loop, so
the now-deliverable signal is left undelivered indefinitely.

This affects programs that use getcontext/setcontext to swap signal
masks, including libunwind's unw_resume() out of a signal handler:
without this fix, the test program below loops forever printing
"calling setcontext" instead of delivering the pending SIGUSR2.

  #define _GNU_SOURCE
  #include <ucontext.h>
  #include <signal.h>
  #include <stdio.h>
  #include <unistd.h>
  static int got;
  static void h(int s) { got = 1; }
  int main(void) {
      signal(SIGUSR2, h);
      sigset_t m; sigemptyset(&m); sigaddset(&m, SIGUSR2);
      sigprocmask(SIG_BLOCK, &m, NULL);
      kill(getpid(), SIGUSR2);
      ucontext_t uc;
      getcontext(&uc);
      if (got) return 0;
      uc.uc_sigmask.__val[0] = 0;
      setcontext(&uc);
      return 1;
  }

The 32-bit sparc do_sigreturn / do_rt_sigreturn paths already get
block_signals() from the rt_sigreturn syscall wrapper in
linux-user/syscall.c, so only sparc64_set_context (invoked directly
from cpu_loop) needs the addition.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Helge Deller <deller@gmx.de>
11 days agolinux-user/sparc: restore L/I registers from RSA in sparc64_set_context
Matt Turner [Wed, 3 Jun 2026 16:18:50 +0000 (12:18 -0400)] 
linux-user/sparc: restore L/I registers from RSA in sparc64_set_context

The kernel's do_rt_sigreturn loads L and I registers from the register
save area (RSA) at the restored O6+STACK_BIAS.  QEMU lacks the kernel's
window-fill path, so restore L0-L7 and I0-I5 explicitly from the RSA.
I6 and I7 are already restored from mc_fp/mc_i7.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Helge Deller <deller@gmx.de>
11 days agolinux-user/sparc: add coredump support
Matt Turner [Wed, 3 Jun 2026 16:18:49 +0000 (12:18 -0400)] 
linux-user/sparc: add coredump support

Define HAVE_ELF_CORE_DUMP and target_elf_gregset_t in target_elf.h
sized to match the kernel's elf_gregset_t:

  sparc32/sparc32plus (ELF_NGREG = 38):
    [0]      PSR
    [1]      PC
    [2]      NPC
    [3]      Y
    [4..11]  G0-G7
    [12..19] O0-O7
    [20..27] L0-L7
    [28..35] I0-I7
    [36..37] reserved (stack_check)

  sparc64 (ELF_NGREG = 36):
    [0..7]   G0-G7
    [8..15]  O0-O7
    [16..23] L0-L7
    [24..31] I0-I7
    [32]     TSTATE
    [33]     TPC
    [34]     TNPC
    [35]     Y

Also define ELF_MACHINE as EM_SPARC32PLUS for TARGET_ABI32 builds,
matching the kernel and ensuring the correct machine type appears in
the core file.

Implement elf_core_copy_regs() in elfload.c to populate the gregset
from CPUSPARCState, including L0-L7 and I0-I7 from env->regwptr.
A memset() at entry zeros the trailing reserved slots.

Without this, bprm->core_dump is NULL for SPARC targets.  When a
guest signal goes unhandled, dump_core_and_abort() skips the core
write and falls through to die_with_signal(), which re-raises the
signal to the host.  The host kernel then writes an x86-64 core file
for the qemu-sparc process instead of a SPARC guest core.

Populating the full register layout is required for tools like
libunwind-coredump, which reads pr_reg[33] for the trap PC and
pr_reg[16..31] for the windowed registers.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Helge Deller <deller@gmx.de>
11 days agolinux-user/alpha: add coredump support
Matt Turner [Mon, 25 May 2026 21:53:08 +0000 (17:53 -0400)] 
linux-user/alpha: add coredump support

Define HAVE_ELF_CORE_DUMP and target_elf_gregset_t in target_elf.h,
mirroring the kernel's elf_gregset_t (ELF_NGREG = 66): r0-r31
[0..31], f0-f31 [32..63], pc [64], unique [65].  Implement
elf_core_copy_regs() in elfload.c to populate the gregset from
CPUAlphaState.

Without this, bprm->core_dump is NULL for Alpha targets.  When a
guest signal goes unhandled, dump_core_and_abort() skips the core
write and falls through to die_with_signal(), which re-raises the
signal to the host.  The host kernel then writes an x86-64 core file
for the qemu-alpha process instead of an Alpha guest core.

v2: Store thread unique field, same as in Linux kernel. Added by Helge &
suggested by Richard.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11 days agolinux-user/strace: add fsmount series of syscalls
Xinhui Yang [Fri, 29 May 2026 06:53:21 +0000 (14:53 +0800)] 
linux-user/strace: add fsmount series of syscalls

Following the addition of fsmount(2) series of syscalls in the syscall
handler, strace support is added, with a dedicated function to print the
parameters of fsconfig(2), which contains parameters that can be
interpreted as multiple types.

Snippet of the strace dump when running `mount -t tmpfs tmpfs /media`:

18 fsopen(tmpfs,1) = 3
18 read(3,0x407fcf1c,8191) = -1 errno=61 (No data available)
18 fsconfig(3,FSCONFIG_SET_STRING,"source","tmpfs",0) = 0
18 read(3,0x407fce3c,8191) = -1 errno=61 (No data available)
18 fsconfig(3,FSCONFIG_CMD_CREATE,NULL,NULL,0) = 0
18 read(3,0x407fce3c,8191) = -1 errno=61 (No data available)
18 fsmount(3,1,0) = 4
18 read(3,0x407fce3c,8191) = -1 errno=61 (No data available)
18 statx(4,"",AT_EMPTY_PATH|AT_STATX_SYNC_AS_STAT,0x1000,0x407fee98) = 0
18 move_mount(4,,-100,/media,4) = 0
18 read(3,0x407fcfcc,8191) = -1 errno=61 (No data available)
18 close(3) = 0
18 close(4) = 0

v2: Fixed build on RHEL9 due to missing syscalls (Helge)

Signed-off-by: Xinhui Yang <cyan@cyano.uk>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Helge Deller <deller@gmx.de>
11 days agolinux-user: implement fsmount(2) series of syscalls
Xinhui Yang [Fri, 29 May 2026 06:53:20 +0000 (14:53 +0800)] 
linux-user: implement fsmount(2) series of syscalls

This series of syscalls replaces the old mount(2) syscall with a series
of syscalls that operates around a filesystem context. This series of
syscalls is available since Linux 5.2 and glibc 2.36+.

Their users include systemd since v259 and libmount from util-linux, and
possibly other widely used projects.

Preliminary checks are implemented to ensure the validity of the
interface.

v2: Add syscall wrappers in case the build machine does not
support the fsmount() syscalls. (added by Helge Deller)

Signed-off-by: Xinhui Yang <cyan@cyano.uk>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Helge Deller <deller@gmx.de>
11 days agotarget/arm: Enable FEAT_F8F16MM for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:21:09 +0000 (12:21 -0700)] 
target/arm: Enable FEAT_F8F16MM for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-46-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMMLA (FP8 to FP16) for SVE
Richard Henderson [Tue, 9 Jun 2026 19:21:08 +0000 (12:21 -0700)] 
target/arm: Implement FMMLA (FP8 to FP16) for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-45-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMMLA (FP8 to FP16) for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:21:07 +0000 (12:21 -0700)] 
target/arm: Implement FMMLA (FP8 to FP16) for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-44-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Enable FEAT_F8F32MM for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:21:06 +0000 (12:21 -0700)] 
target/arm: Enable FEAT_F8F32MM for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-43-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMMLA (FP8 to FP32) for SVE
Richard Henderson [Tue, 9 Jun 2026 19:21:05 +0000 (12:21 -0700)] 
target/arm: Implement FMMLA (FP8 to FP32) for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-42-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMMLA (FP8 to FP32) for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:21:04 +0000 (12:21 -0700)] 
target/arm: Implement FMMLA (FP8 to FP32) for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-41-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Enable FEAT_FP8DOT2, FEAT_SSVE_FP8DOT2 for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:21:03 +0000 (12:21 -0700)] 
target/arm: Enable FEAT_FP8DOT2, FEAT_SSVE_FP8DOT2 for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-40-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FDOT (FP8 to FP16) for SVE
Richard Henderson [Tue, 9 Jun 2026 19:21:02 +0000 (12:21 -0700)] 
target/arm: Implement FDOT (FP8 to FP16) for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-39-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FDOT (FP8 to FP16) for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:21:01 +0000 (12:21 -0700)] 
target/arm: Implement FDOT (FP8 to FP16) for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-38-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Enable FEAT_FP8DOT4, FEAT_SSVE_FP8DOT4 for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:21:00 +0000 (12:21 -0700)] 
target/arm: Enable FEAT_FP8DOT4, FEAT_SSVE_FP8DOT4 for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-37-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FDOT (FP8 to FP32) for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:59 +0000 (12:20 -0700)] 
target/arm: Implement FDOT (FP8 to FP32) for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-36-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FDOT (FP8 to FP32) for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:58 +0000 (12:20 -0700)] 
target/arm: Implement FDOT (FP8 to FP32) for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-35-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Enable FEAT_FP8FMA, FEAT_SSVE_FP8FMA for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:20:57 +0000 (12:20 -0700)] 
target/arm: Enable FEAT_FP8FMA, FEAT_SSVE_FP8FMA for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-34-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMLALL{BB,BT,TB,TT} for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:56 +0000 (12:20 -0700)] 
target/arm: Implement FMLALL{BB,BT,TB,TT} for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-33-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMLALL{BB, BT, TB, TT} for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:55 +0000 (12:20 -0700)] 
target/arm: Implement FMLALL{BB, BT, TB, TT} for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-32-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMLALB, FMLALT (FP8 to FP16) for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:54 +0000 (12:20 -0700)] 
target/arm: Implement FMLALB, FMLALT (FP8 to FP16) for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-31-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FMLALB, FMLALT for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:53 +0000 (12:20 -0700)] 
target/arm: Implement FMLALB, FMLALT for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-30-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Enable FEAT_SME_LUTv2 for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:20:52 +0000 (12:20 -0700)] 
target/arm: Enable FEAT_SME_LUTv2 for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-29-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement LUTI4 (four registers, 8-bit)
Richard Henderson [Tue, 9 Jun 2026 19:20:51 +0000 (12:20 -0700)] 
target/arm: Implement LUTI4 (four registers, 8-bit)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-28-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement MOVT (vector to table)
Richard Henderson [Tue, 9 Jun 2026 19:20:50 +0000 (12:20 -0700)] 
target/arm: Implement MOVT (vector to table)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-27-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Update ID_AA64SMFR0_EL1 fields to ARM M.b
Richard Henderson [Tue, 9 Jun 2026 19:20:49 +0000 (12:20 -0700)] 
target/arm: Update ID_AA64SMFR0_EL1 fields to ARM M.b

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-26-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Enable FEAT_FP8 for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:20:48 +0000 (12:20 -0700)] 
target/arm: Enable FEAT_FP8 for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-25-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Enable FEAT_LUT for -cpu max
Richard Henderson [Tue, 9 Jun 2026 19:20:47 +0000 (12:20 -0700)] 
target/arm: Enable FEAT_LUT for -cpu max

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-24-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement LUTI2, LUTI4 for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:46 +0000 (12:20 -0700)] 
target/arm: Implement LUTI2, LUTI4 for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-23-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement LUTI2, LUTI4 for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:45 +0000 (12:20 -0700)] 
target/arm: Implement LUTI2, LUTI4 for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-22-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FCVT, FCVTN (FP32 to FP8) for SME
Richard Henderson [Tue, 9 Jun 2026 19:20:44 +0000 (12:20 -0700)] 
target/arm: Implement FCVT, FCVTN (FP32 to FP8) for SME

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-21-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FCVT (FP16 to FP8) for SME
Richard Henderson [Tue, 9 Jun 2026 19:20:43 +0000 (12:20 -0700)] 
target/arm: Implement FCVT (FP16 to FP8) for SME

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-20-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FCVTNB, FCVTNT for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:42 +0000 (12:20 -0700)] 
target/arm: Implement FCVTNB, FCVTNT for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-19-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FCVTN (16- to 8-bit fp) for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:41 +0000 (12:20 -0700)] 
target/arm: Implement FCVTN (16- to 8-bit fp) for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-18-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FCVTN, FCVTN2 (32- to 8-bit fp) for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:40 +0000 (12:20 -0700)] 
target/arm: Implement FCVTN, FCVTN2 (32- to 8-bit fp) for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-17-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement FCVTN (16- to 8-bit fp) for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:39 +0000 (12:20 -0700)] 
target/arm: Implement FCVTN (16- to 8-bit fp) for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-16-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement BFCVTN for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:38 +0000 (12:20 -0700)] 
target/arm: Implement BFCVTN for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement F1CVT, F1CVTL, F2CVT, F2CVTL for SME
Richard Henderson [Tue, 9 Jun 2026 19:20:37 +0000 (12:20 -0700)] 
target/arm: Implement F1CVT, F1CVTL, F2CVT, F2CVTL for SME

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-14-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement F1CVT, F1CVTLT, F2CVT, F2CVTLT for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:36 +0000 (12:20 -0700)] 
target/arm: Implement F1CVT, F1CVTLT, F2CVT, F2CVTLT for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-13-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement F1CVTL, F1CVTL2, F2CVTL, F2CVTL2 for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:35 +0000 (12:20 -0700)] 
target/arm: Implement F1CVTL, F1CVTL2, F2CVTL, F2CVTL2 for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement BF1CVT, BF1CVTL, BF2CVT, BF2CVTL for SME
Richard Henderson [Tue, 9 Jun 2026 19:20:34 +0000 (12:20 -0700)] 
target/arm: Implement BF1CVT, BF1CVTL, BF2CVT, BF2CVTL for SME

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Rename SME BFCVT patterns to BFCVT_hs
Richard Henderson [Tue, 9 Jun 2026 19:20:33 +0000 (12:20 -0700)] 
target/arm: Rename SME BFCVT patterns to BFCVT_hs

The existing pattern is BFCVT (single-precision to BFloat16).
In preparation for introducing more insns of the same name,
append the operand sizes.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-10-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement BF1CVT, BF1CVTLT, BF2CVT, BF2CVTLT for SVE
Richard Henderson [Tue, 9 Jun 2026 19:20:32 +0000 (12:20 -0700)] 
target/arm: Implement BF1CVT, BF1CVTLT, BF2CVT, BF2CVTLT for SVE

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-9-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Implement BF1CVTL, BF1CVTL2, BF2CVTL, BF2CVTL2 for AdvSIMD
Richard Henderson [Tue, 9 Jun 2026 19:20:31 +0000 (12:20 -0700)] 
target/arm: Implement BF1CVTL, BF1CVTL2, BF2CVTL, BF2CVTL2 for AdvSIMD

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-8-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Set e4m3_nan_is_snan
Richard Henderson [Tue, 9 Jun 2026 19:20:30 +0000 (12:20 -0700)] 
target/arm: Set e4m3_nan_is_snan

The unique e4m3 nan encoding is SNaN for Arm.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Introduce arm_init_fp_status
Richard Henderson [Tue, 9 Jun 2026 19:20:29 +0000 (12:20 -0700)] 
target/arm: Introduce arm_init_fp_status

Create a function to set all default controls for a float_status.
Other settings for specific FPST will be set afterward.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Generalize TRANS_FEAT_STREAMING_SME2
Richard Henderson [Tue, 9 Jun 2026 19:20:28 +0000 (12:20 -0700)] 
target/arm: Generalize TRANS_FEAT_STREAMING_SME2

Rename to TRANS_FEAT_STREAMING_IF and add a new parameter.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Use FloatParts64 in f16_dotadd
Richard Henderson [Tue, 9 Jun 2026 19:20:27 +0000 (12:20 -0700)] 
target/arm: Use FloatParts64 in f16_dotadd

Use softfloat-parts.h so that we can more naturally
perform the required operations witha single rounding step.
This happens to also simplify the NaN detection step.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260609192110.752384-4-richard.henderson@linaro.org
Message-Id: <20260517002550.321291-11-richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Drop oddstatus from is_ebf and bfdotadd_ebf
Richard Henderson [Tue, 9 Jun 2026 19:20:26 +0000 (12:20 -0700)] 
target/arm: Drop oddstatus from is_ebf and bfdotadd_ebf

This argument is no longer used.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260609192110.752384-3-richard.henderson@linaro.org
Message-Id: <20260517002550.321291-10-richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: Use FloatParts64 in bfdotadd_ebf
Richard Henderson [Tue, 9 Jun 2026 19:20:25 +0000 (12:20 -0700)] 
target/arm: Use FloatParts64 in bfdotadd_ebf

Use softfloat-parts.h so that we can more naturally
perform the required operations witha single rounding step.
This happens to also simplify the NaN detection step.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260609192110.752384-2-richard.henderson@linaro.org
Message-Id: <20260517002550.321291-9-richard.henderson@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agofpu: Handle all rounding modes in partsN_round_to_int_normal
Richard Henderson [Mon, 8 Jun 2026 19:01:55 +0000 (12:01 -0700)] 
fpu: Handle all rounding modes in partsN_round_to_int_normal

Missed float_round_nearest_even_max and float_round_to_odd_inf
in both switch statements.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-id: 20260608190155.637067-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agofpu: Handle all rounding modes in partsN_uncanon_normal
Richard Henderson [Mon, 8 Jun 2026 19:01:54 +0000 (12:01 -0700)] 
fpu: Handle all rounding modes in partsN_uncanon_normal

Missed float_round_nearest_even_max when recomputing round.

CC: qemu-stable@nongnu.org
Fixes: 72330260cdb ("softfloat: Add float_round_nearest_even_max")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Message-id: 20260608190155.637067-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agohw/dma/pl080: Don't use hw_error() for unimplemented features
Peter Maydell [Fri, 29 May 2026 14:36:24 +0000 (15:36 +0100)] 
hw/dma/pl080: Don't use hw_error() for unimplemented features

In the pl080 device, we don't implement "peripheral flow control",
which is where the DMA engine can be programmed to transfer data
until a source or destination peripheral tells it to stop.  We
currently call hw_error() if the guest tries to use this missing
feature, which prints a register dump and aborts QEMU.

Change the hw_error() call to the LOG_UNIMP log-and-continue,
which is how we prefer to report guest attempts to use
unimplemented features these days.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3409
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260529143624.158935-3-peter.maydell@linaro.org

11 days agohw/intc/exynos4210_combiner: Avoid hw_error for guest errors
Peter Maydell [Fri, 29 May 2026 14:36:23 +0000 (15:36 +0100)] 
hw/intc/exynos4210_combiner: Avoid hw_error for guest errors

In the exynos4210_combiner device, several cases of bad register
offsets passed by the guest are handled by calling hw_error().  This
causes QEMU to abort with a guest register dump.  These days we
prefer to handle "guest does something wrong" by logging it and
continuing.

Update the hw_error() calls to qemu_log_mask(LOG_GUEST_ERROR).

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3396
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260529143624.158935-2-peter.maydell@linaro.org

11 days agotarget/arm: ensure aarch64 DISAS_WFE will exit
Alex Bennée [Fri, 29 May 2026 08:29:43 +0000 (09:29 +0100)] 
target/arm: ensure aarch64 DISAS_WFE will exit

This mirrors the logic for DISAS_WFE in 32 bit world. As the WFE/WFI
have similar behaviours shuffle the case statements around a little
and update the commentary to cover both.

Fixes: 252ec405768 (target-arm: implement WFE/YIELD as a yield for AArch64)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20260529082948.363931-5-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: redefine event stream fields
Alex Bennée [Fri, 29 May 2026 08:29:42 +0000 (09:29 +0100)] 
target/arm: redefine event stream fields

The event stream control bits are the same for both CNTHCTL and
CNTKCTL so rather than duplicating the definitions rename them to be
useful in both cases.

We will need these in a later commit when we start implementing event
streams.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20260529082948.363931-4-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: teach arm_cpu_has_work about halting reasons
Alex Bennée [Fri, 29 May 2026 08:29:41 +0000 (09:29 +0100)] 
target/arm: teach arm_cpu_has_work about halting reasons

With the advent of WFE and WFI we need to pay closer attention to the
reason why the vCPU may be sleeping to figure out if we should wake
it up.

Create env->halt_reason to track this and then re-order the tests so
we:

  - ignore everything is the vCPU is powered off
  - wake up if the event_register is set and we were in a WFE
  - otherwise any IRQ event does wake the vCPU up.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20260529082948.363931-3-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotarget/arm: fix WFET typo in syndrome
Alex Bennée [Fri, 29 May 2026 08:29:40 +0000 (09:29 +0100)] 
target/arm: fix WFET typo in syndrome

A stray x slipped in and we didn't notice! Fortunately we haven't
implemented WFET yet so nothing is affected. But we are about to so
lets fix it.

Fixes: 4575da5ecb7 (target/arm: report register in WFIT syndromes)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20260529082948.363931-2-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agohw/usb/hcd-ohci: Clean up USBPacket before freeing ISO TD packet
Munkhbaatar Enkhbaatar [Wed, 6 May 2026 15:22:47 +0000 (23:22 +0800)] 
hw/usb/hcd-ohci: Clean up USBPacket before freeing ISO TD packet

ohci_service_iso_td() allocates a USBPacket and frees it after synchronous
completion, but it does not call usb_packet_cleanup() first.

Call usb_packet_cleanup() before g_free() so resources owned by USBPacket
are released.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3463

Signed-off-by: Munkhbaatar Enkhbaatar <munkhuu0825@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agohw/usb/hcd-ohci: Assert isochronous TDs are never deferred
Munkhbaatar Enkhbaatar [Wed, 6 May 2026 15:22:46 +0000 (23:22 +0800)] 
hw/usb/hcd-ohci: Assert isochronous TDs are never deferred

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Munkhbaatar Enkhbaatar <munkhuu0825@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotests/tcg: add test for MTE_STORE_ONLY
Gabriel Brookman [Fri, 29 May 2026 19:52:55 +0000 (12:52 -0700)] 
tests/tcg: add test for MTE_STORE_ONLY

Added a test that checks that MTE checks are not performed on loads when
MTE_STORE_ONLY is enabled.

Signed-off-by: Gabriel Brookman <brookmangabriel@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260529-feat-mte4-v7-15-ccbd3c14eb3c@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agotests/tcg: add test for MTE FAR
Gabriel Brookman [Fri, 29 May 2026 19:52:54 +0000 (12:52 -0700)] 
tests/tcg: add test for MTE FAR

This functionality was previously enabled but not advertised or tested.
This commit adds a new test, mte-9, that tests the code for proper
full-address reporting. FEAT_MTE_TAGGED_FAR requires that FAR_ELx
report the full logical address, including tag bits.

Signed-off-by: Gabriel Brookman <brookmangabriel@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260529-feat-mte4-v7-14-ccbd3c14eb3c@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 days agodocs: add MTE4 features to docs
Gabriel Brookman [Fri, 29 May 2026 19:52:53 +0000 (12:52 -0700)] 
docs: add MTE4 features to docs

The implemented MTE4 features are now present in
docs/system/arm/emulation.rst

Signed-off-by: Gabriel Brookman <brookmangabriel@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260529-feat-mte4-v7-13-ccbd3c14eb3c@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>