]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
6 weeks agobsd-user: Add do_ioctl_unsupported function
Stacey Son [Sat, 14 Mar 2026 17:30:33 +0000 (11:30 -0600)] 
bsd-user: Add do_ioctl_unsupported function

Add handler function for unsupported ioctl commands that returns
TARGET_ENXIO.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add log_unsupported_ioctl function
Stacey Son [Sat, 14 Mar 2026 17:28:24 +0000 (11:28 -0600)] 
bsd-user: Add log_unsupported_ioctl function

Add helper function to log detailed information about unsupported
ioctl commands, including direction, group, and parameter length.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add bsd-ioctl.c infrastructure and termios conversion
Stacey Son [Sat, 14 Mar 2026 17:26:01 +0000 (11:26 -0600)] 
bsd-user: Add bsd-ioctl.c infrastructure and termios conversion

Add initial bsd-ioctl.c file with termios conversion functions,
structure type definitions, and ioctl table infrastructure.
Includes target_to_host_termios and host_to_target_termios for
terminal I/O control conversion, along with the ioctl dispatch
table framework.

Style complains about STRUCT and STRUCT_SPECIAL defines:
  ● checkpatch.pl: 197: ERROR: Macros with complex values should be enclosed in parenthesis
  ● checkpatch.pl: 198: ERROR: Macros with complex values should be enclosed in parenthesis
but that's fine. We are doing weird things with macros, and it's fine.
We can't put parens or do while (0) around these since they are table
building macros for files that are included multiple times.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Sean Bruno <sbruno@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h
Stacey Son [Sat, 14 Mar 2026 04:15:34 +0000 (22:15 -0600)] 
bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h

Add struct target_sockaddr and target_in_addr definitions for socket
address handling and safe_ioctl macro for safe ioctl system calls.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add bsd-ioctl.h header
Stacey Son [Sat, 14 Mar 2026 04:13:18 +0000 (22:13 -0600)] 
bsd-user: Add bsd-ioctl.h header

Add bsd-ioctl.h header declaring the public ioctl emulation API:
do_bsd_ioctl() for processing ioctl system calls and init_bsd_ioctl()
for initialization.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD ioctl command table
Stacey Son [Sat, 14 Mar 2026 04:13:02 +0000 (22:13 -0600)] 
bsd-user: Add FreeBSD ioctl command table

Add os-ioctl-cmds.h containing the complete ioctl command table
mapping TARGET_* ioctl commands to their handlers. Uses IOCTL and
IOCTL_SPECIAL macros for table generation.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Alexander Kabaev <kan@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD ioctl type definitions
Stacey Son [Sat, 14 Mar 2026 04:12:59 +0000 (22:12 -0600)] 
bsd-user: Add FreeBSD ioctl type definitions

Add os-ioctl-types.h with STRUCT macro definitions for ioctl type
registration. This header uses multiple inclusion with different
STRUCT macro definitions to generate both enums and type definitions.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD IPv6 ioctl definitions
Stacey Son [Sat, 14 Mar 2026 04:12:53 +0000 (22:12 -0600)] 
bsd-user: Add FreeBSD IPv6 ioctl definitions

Add os-ioctl-in6_var.h with IPv6 network interface ioctl definitions
including SIOCAIFADDR_IN6, SIOCDIFADDR_IN6, and related IPv6
configuration ioctls with target_in6_* structure definitions.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD disk ioctl definitions
Stacey Son [Sat, 14 Mar 2026 04:12:29 +0000 (22:12 -0600)] 
bsd-user: Add FreeBSD disk ioctl definitions

Add os-ioctl-disk.h with disk and storage device ioctl definitions
including DIOCGMEDIASIZE, DIOCGSECTORSIZE, and related disk
management ioctls.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD cryptodev ioctl definitions
Stacey Son [Sat, 14 Mar 2026 04:12:15 +0000 (22:12 -0600)] 
bsd-user: Add FreeBSD cryptodev ioctl definitions

Add os-ioctl-cryptodev.h with /dev/crypto ioctl definitions including
CIOCGSESSION, CIOCCRYPT, and related cryptographic device control
ioctls.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD socket ioctl definitions
Stacey Son [Sat, 14 Mar 2026 04:11:56 +0000 (22:11 -0600)] 
bsd-user: Add FreeBSD socket ioctl definitions

Add os-ioctl-sockio.h with network socket and interface control ioctl
definitions including SIOCGIFADDR, SIOCSIFADDR, SIOCGIFCONF, and
related network interface ioctls with target_ structure definitions.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD file I/O ioctl definitions
Stacey Son [Sat, 14 Mar 2026 04:11:45 +0000 (22:11 -0600)] 
bsd-user: Add FreeBSD file I/O ioctl definitions

Add os-ioctl-filio.h with file I/O control ioctl definitions including
FIONREAD, FIONBIO, FIOASYNC, and FIOSETOWN for file descriptor control.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add FreeBSD tty ioctl definitions
Stacey Son [Sat, 14 Mar 2026 04:11:23 +0000 (22:11 -0600)] 
bsd-user: Add FreeBSD tty ioctl definitions

Add os-ioctl-ttycom.h with terminal control ioctl definitions including
TARGET_TIOCGETA, TARGET_TIOCSETA, window size ioctls, and the
target_termios structure for terminal I/O control.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: ioctl: add common definitions
Stacey Son [Fri, 1 May 2026 02:36:46 +0000 (20:36 -0600)] 
bsd-user: ioctl: add common definitions

Modeled on sys/ioccom.h.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Copy linux-user/thunk.c to bsd-user
Warner Losh [Fri, 13 Mar 2026 19:04:52 +0000 (13:04 -0600)] 
bsd-user: Copy linux-user/thunk.c to bsd-user

bsd-user's blitz branch has used this file verbatim for a while. Copy it
verbatim, but update to the new QEMU standards.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Switch to generated syscall_nr.h
Warner Losh [Mon, 13 Apr 2026 14:39:38 +0000 (08:39 -0600)] 
bsd-user: Switch to generated syscall_nr.h

Now that this will build and work, remove the old syscall_nr.h and
switch the include over to the generated file in syscall_defs.h.

To do this, I had to delete the old, wrong definition of time_t for
FreeBSD on amd64 since it stumbled over the fact that TARGET_i386 is
defined for both 32-bit and 64-bit builds (the new os-syscall.h had the
rigth definition). Rather than modify this file twice to fix it, rolled
the fix into using os-syscall.h since it's still easy enough to review.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Create os-syscall.h
Warner Losh [Mon, 13 Apr 2026 14:54:47 +0000 (08:54 -0600)] 
bsd-user: Create os-syscall.h

Create os-syscall.h. The purpose of this file is to define anything
that's different among the BSDs, like system call numbers and
time_t. While there's a lot more different between the BSDs, this is at
least a start at capturing it.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Delete sbrk and sstk system calls.
Warner Losh [Mon, 13 Apr 2026 14:36:31 +0000 (08:36 -0600)] 
bsd-user: Delete sbrk and sstk system calls.

sbrk and sstk were an experimental system call introduced in 4.2BSD, but
with an blank implementation. They remained in subsequent 4BSD releases
doing nothing (with 4.3-Reno and later returning not supported). FreeBSD
1.x imported this. They were removed in 2023. Remove them from here
because no real, non-contrived program on FreeBSD ever had them.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Add syscall header generator for FreeBSD
Warner Losh [Mon, 13 Apr 2026 14:20:40 +0000 (08:20 -0600)] 
bsd-user: Add syscall header generator for FreeBSD

Generate the syscall numbers from the installed header that has them.
Ideally, we'd use FreeBSD's lua infra for this, but that requires that
we have those files installed, and they aren't quite the same across
supported versions yet, so use this simple, but effective hack. Add to
meson build, but unused.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agobsd-user: Switch to SPDX-License-Expression
Warner Losh [Tue, 3 Mar 2026 03:48:22 +0000 (20:48 -0700)] 
bsd-user: Switch to SPDX-License-Expression

Two minor changes to the copyright and license marking for these files:
(1) Stacey D Son is used instead of variations of his name.
(2) The GPL boilerplate is replaced by SPDX markings. No change to the
terms of the license are intended, and this matches current QEMU practice.

There's no changes to the license or additional claims to any IP that
others may hold in these files. All the S-o-bs in this commit have given
me permission to do this to the extent they may hold rights. git blame
over multiple repos and branches suggests that only minimal other
material is present (much of it likely not subject to copyright
protection). The project's long and complex history as well as tooling
limitations make it hard to be 100% sure. Any omissions are
unintentional and I will correct them as they come to light.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Sean Bruno <sbruno@FreeBSD.org>
Signed-off-by: Mikaël Urankar <mikael.urankar@gmail.com>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Guy Yur <guyyur@gmail.com>
Signed-off-by: Alexander Kabaev <kan@FreeBSD.org>
Signed-off-by: Michal Meloun <mmel@FreeBSD.org>
Signed-off-by: Ed Schouten <ed@nuxi.nl>
Signed-off-by: Karim Taha <kariem.taha2.7@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
6 weeks agoMerge tag 'single-binary-20260506' of https://github.com/philmd/qemu into staging
Stefan Hajnoczi [Wed, 6 May 2026 14:45:02 +0000 (10:45 -0400)] 
Merge tag 'single-binary-20260506' of https://github.com/philmd/qemu into staging

Various patches related to single binary effort:

- Reduce "exec/cpu-defs.h" inclusions
- Build various target specific files once
- Remove need of per-target monitor handlers
- Reduce target_ulong uses in migration code
- Reduce uses of legacy native endianness & ld/st_phys APIs
- Removed MIPSCPU::mvp memory leak
- Clear dangling GLib event source tag
- Remove pointless variable initialization in *FOREACH*() macro uses
- Few checkpatch.pl updates

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmn7S/EACgkQ4+MsLN6t
# wN5bCBAAu05saLnGWy3s9aJ7mrrs2yqSOHRMskrV8/ULr9beJhqLCH7xobuHoSO0
# c3o6BSU9QnBB04Ps3uM2SKcWx2JrhN0em09CjxUW6QRk7pLhvyRWD+JK/JBc8mU+
# kew5ul9udpPeRo8JjyQQzB8qI8ZZZtFQl5iRp4vLxWWjaf3qHOtgnfl+86L9OLCy
# KLuzt2ppppwBOQuOl/i/yZ5JXyx+2cy21m9CmYIX0ApWYC8FngmNTtSgFCTFVu5a
# BZ21EaPGwvvw7OiE0pzY1424BvYKcR6EFQ5NOS1WNl1YvYsq8XeTONRFAFlVR6XC
# OVsaLnQpIMOhi5V7kTCsS5/OH5iNJNK5LVPF2R3e6F9ShcWiNVhR0RONkjpu3e/5
# OIXBfw4swO7rCDZvHg5dSW/up1KRs3XN+jGgvj0CONzxEcXJ/2VJTVdVdv6TqQUn
# dg8q0yfwxHbQZ/lfNH8wRhOmQw35gI3sZk/rGtV+0dTwK2ohQFBewCq6x5aLTKkY
# gMrZ5UvFntpTUBJUEw6L+56qLp3yQk3t5Wn43oQ04iRO6rAeGmHEw9IiVbF/jkxo
# ohe5DzZiUNErd8jbuFNgd/xMRvjKvLgxfwdqnos8yT0wyhhNa88pBUDcFP0diE0j
# sJGFjziBhfLhmrs+2VEsknY1I/Y0yJGN7ENyA5/+VnrW3Hlaa8A=
# =rwvm
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 06 May 2026 10:10:57 EDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'single-binary-20260506' of https://github.com/philmd/qemu: (110 commits)
  system/vl: inline qemu_opts_parse_noisily() result checks
  scripts/checkpatch: Avoid false positive on empty blocks
  cocci: Do not initialize variable used by RAMBLOCK_FOREACH* macro
  cocci: Do not initialize variable used by QTAILQ_FOREACH macro
  cocci: Do not initialize variable used by QSIMPLEQ_FOREACH macro
  cocci: Do not initialize variable used by QSLIST_FOREACH macro
  cocci: Do not initialize variable used by QLIST_FOREACH macro
  scripts/checkpatch: Reject another license boilerplate pattern
  io: use g_clear_handle_id() for GSource cleanup
  io: Clear dangling GLib event source tag
  target/xtensa/core: register types using type_init
  target/s390x: Do not compile KVM stubs for linux-user binary
  target/mips: Do not initialize variable used by CPU_FOREACH macro
  target/mips: Reduce CPUState scope when used with CPU_FOREACH()
  target/riscv: Iterate vCPUs using CPU_FOREACH() macro
  target/s390x: Replace cpu_stb_data_ra -> cpu_stb_mmu in STFLE opcode
  target/s390x: Compile crypto_helper.c as common unit
  target/s390x: Have MSA helper pass a mmu_idx argument
  target/s390x: Compile vec_helper.c as common unit
  target/s390x: Compile translate.c as common unit
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agoMerge tag 'pbouvier/pr/docs-20260505' of https://gitlab.com/p-b-o/qemu into staging
Stefan Hajnoczi [Wed, 6 May 2026 14:44:06 +0000 (10:44 -0400)] 
Merge tag 'pbouvier/pr/docs-20260505' of https://gitlab.com/p-b-o/qemu into staging

Changes:
- [PATCH] docs/devel/codebase: add link to rev.ng video series (Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>)
Link: https://lore.kernel.org/qemu-devel/20260423213557.780112-1-pierrick.bouvier@oss.qualcomm.com
# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEN8FWlNi6l2Sxlz/btEQ30ZwoYt8FAmn6eKkACgkQtEQ30Zwo
# Yt+rnQv+PHi2mV1JvYqvS2sY3fa2KXtuooYFY/LcFf2ohtj5TdQZOMUB8pCodVv/
# 7yNdw6jGjsPByJJDYA5nS6bq6Oz8goyOv5lGwLfczR8c7cINFA8Hqn90IuhCChUn
# oL5s6fZHfaMYa7RMGgYDTBxzMhIGLFN7Mk44kPXDOxIyxH5vb3DHZEhFnaTH/Xz8
# iefR0JXr+RSgYFhjprJOBWcqMDi3zWFW9r25VtktwJHm1/DQGW03/A/w3cpInMZT
# qoSjRnUPoGqgEwmbBwBmYqoRgFaG4Zve0Ig9yG3ObDR3HiqTq1nTjATirmR3TWj/
# Votyyiu6PDFXroR/ijRb4qUe3+IykgUd+dydX/Z8F8T96GE+E5X5jqAYUnZ2wazT
# yU05UC7NT1Zuxiftx09MpmJhCsF/pDoICnVx1qGV01ND7xSRFEdMbbqhYXbczbOp
# 51k8i7Ql0t1/YkZ0Wt4TLroCW42G5TePfGnZAVCWsVm/RagceK25Zup1nltyoHba
# W5O3qTXb
# =ZXTI
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 05 May 2026 19:09:29 EDT
# gpg:                using RSA key 37C15694D8BA9764B1973FDBB44437D19C2862DF
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.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: 37C1 5694 D8BA 9764 B197  3FDB B444 37D1 9C28 62DF

* tag 'pbouvier/pr/docs-20260505' of https://gitlab.com/p-b-o/qemu:
  docs/devel/codebase: add link to rev.ng video series

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agoMerge tag 'next-pull-request' of https://gitlab.com/peterx/qemu into staging
Stefan Hajnoczi [Wed, 6 May 2026 14:31:51 +0000 (10:31 -0400)] 
Merge tag 'next-pull-request' of https://gitlab.com/peterx/qemu into staging

Migration and mem pull request

- Fabiano's fix on migrate_set_parameter crash with multifd & zerocopy
- Pranav's fix on postcopy stucking at device state when ack lost
- Samuel's new migration parameter x-rdma-chunk-size for RDMA
- PeterX's vfio/migration series to report remaining data and fix downtime calc
- PeterM's MemoryRegionOps .impl cleanup series
- Fabiano's fix to build a-b migration bootfiles for all archs

# -----BEGIN PGP SIGNATURE-----
#
# iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCafpSQxIccGV0ZXJ4QHJl
# ZGhhdC5jb20ACgkQO1/MzfOr1wZgygEAuuUARI33fSQ1t3xJr9BllwHp79R5A3ud
# DywPLgtaLVEA/061/96QYiHoBx/9u+y/7yCHilFqQo3pNLk6NEsp47gI
# =EW25
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 05 May 2026 16:25:39 EDT
# gpg:                using EDDSA key B9184DC20CC457DACF7DD1A93B5FCCCDF3ABD706
# gpg:                issuer "peterx@redhat.com"
# gpg: Good signature from "Peter Xu <xzpeter@gmail.com>" [full]
# gpg:                 aka "Peter Xu <peterx@redhat.com>" [full]
# Primary key fingerprint: B918 4DC2 0CC4 57DA CF7D  D1A9 3B5F CCCD F3AB D706

* tag 'next-pull-request' of https://gitlab.com/peterx/qemu: (23 commits)
  tests/qtest/migration: Fix A-B file build
  system/memory: assert on invalid MemoryRegionOps .unaligned combo
  hw/xtensa/mx_pic: Specify xtensa_mx_pic_ops .impl settings
  hw/npcm7xx_fiu: Specify .impl for npcm7xx_fiu_flash_ops
  hw/riscv: iommu-trap: remove .impl.unaligned = true
  vfio/migration: Add tracepoints for precopy/stopcopy query ioctls
  migration/qapi: Update unit for avail-switchover-bandwidth
  migration/qapi: Introduce system-wide "remaining" reports
  migration: Remember total dirty bytes in mig_stats
  migration: Fix calculation of expected_downtime to take VFIO info
  migration: Calculate expected downtime on demand
  migration: Introduce a helper to return switchover bw estimate
  migration: Move iteration counter out of RAM
  vfio/migration: Fix incorrect reporting for VFIO pending data
  migration: Introduce stopcopy_bytes in save_query_pending()
  migration: Use the new save_query_pending() API directly
  migration/treewide: Merge @state_pending_{exact|estimate} APIs
  vfio/migration: Cache stop size in VFIOMigration
  migration/qapi: Rename MigrationStats to MigrationRAMStats
  migration: Fix low possibility downtime violation
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agoMerge tag 'or1k-maint-20260505' of https://github.com/stffrdhrn/qemu into staging
Stefan Hajnoczi [Wed, 6 May 2026 14:30:03 +0000 (10:30 -0400)] 
Merge tag 'or1k-maint-20260505' of https://github.com/stffrdhrn/qemu into staging

OpenRISC board maintainer updates for 2026-05-05

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEE2cRzVK74bBA6Je/xw7McLV5mJ+QFAmn6JL0ACgkQw7McLV5m
# J+TQGg//bqg5NQQP9VdM6EHqeHsy8RykKFotHU6hNDML+Gj5+4mnUvqLFwZBR9Rr
# AWizrCl9wHvP/RGDSZuM9QWSVsN3CUni60R5KIV/vkwEUTRhnRReHukYmGKItHbO
# pI+8KcYfD1/nflDXvAgtz+YaDLGruIUIvL651OMElAYoDrQxN+x4XilPHQRRNLfo
# ugJjHXaikXBLFwoEhEHzbNK8qeEtJQyN7GHOyigy+R5vrfBqqXYwNZQBUI/9rUrk
# VHKo9G25BjxgJC7mvBRJynzVpIu8McX9xqc4HmNepR4D9WCtR7Cndsh7cRPTgyju
# r5CjLvZahuzqdM/xluyMrApQQ8Qe4yChdNCsxhue83KZdOriGFzwz8aPyXKllMw3
# S7UyVkf1ZL1Th+Z4lBSzu+w2+5+Lz6xyQdUjUF9HR8x7QXD7Ouuofo+aUHweU2/N
# mnZvSvUa/zaq/ixUiHq21uqKASQxtIsF0aD5TGKIpYbWX181VpC1Xjh7KgmikzUF
# Yu93PvqvYN4KlzXU9o4uGuP4TmmI0AUSzGLrjTWCjWUwXOUYPwcWWxqAFZEIZToE
# MTIaWrvw5avzZI+CLuC3ZS9MJ+wpp/96QiUt7JJRI1PBO/Odf3SyQ+iu4F1dMSCp
# 6vRu9kj7+mjfW1avkUP4AzoVaD+DfKzNGtSJ1PqcC9e3rFVjqog=
# =uEyH
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 05 May 2026 13:11:25 EDT
# gpg:                using RSA key D9C47354AEF86C103A25EFF1C3B31C2D5E6627E4
# gpg: Good signature from "Stafford Horne <shorne@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: D9C4 7354 AEF8 6C10 3A25  EFF1 C3B3 1C2D 5E66 27E4

* tag 'or1k-maint-20260505' of https://github.com/stffrdhrn/qemu:
  MAINTAINERS: Add myself as the OpenRISC virt maintainer
  MAINTAINERS: Add myself as maintainer for or1k-sim

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agosystem/vl: inline qemu_opts_parse_noisily() result checks
Bin Guo [Wed, 29 Apr 2026 06:20:04 +0000 (14:20 +0800)] 
system/vl: inline qemu_opts_parse_noisily() result checks

In qemu_init()'s option parsing switch, several cases assigned the
return value of qemu_opts_parse_noisily() to the shared 'opts'
variable solely to check for NULL, without using the pointer
afterwards.  Inline the call directly into the if-condition, matching
the style already used by QEMU_OPTION_action.

This affects the following options:
  -drive, -numa, -iscsi, -m, -mon, -chardev, -fsdev, -fwcfg

Cases where the returned QemuOpts* is subsequently used (e.g.
-acpitable, -smbios, -virtfs) are left unchanged.

Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260429062004.36582-4-guobin@linux.alibaba.com>
[PMD: Reduce @opts declaration to innermost block]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6 weeks agoscripts/checkpatch: Avoid false positive on empty blocks
Akihiko Odaki [Fri, 24 Apr 2026 09:27:11 +0000 (18:27 +0900)] 
scripts/checkpatch: Avoid false positive on empty blocks

SUSPECT_CODE_INDENT checks the first line after a conditional statement.
When the block is empty, the first line after the conditional is the
closing brace at the same indentation level, so checkpatch reports a
bogus indentation error.

Ignore same-indented braces and else statements, matching with:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f6950a735f29e782bc219ece22bb91d6e1ab7bbc

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-ID: <20260424-force_rcu-v4-6-feccfaca0568@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6 weeks agococci: Do not initialize variable used by RAMBLOCK_FOREACH* macro
Philippe Mathieu-Daudé [Wed, 15 Apr 2026 21:14:55 +0000 (23:14 +0200)] 
cocci: Do not initialize variable used by RAMBLOCK_FOREACH* macro

The RAMBLOCK_FOREACH_MIGRATABLE() macro, defined in
migration/ram.h, ends up calling QLIST_FOREACH_RCU()
which always assigns its iterator variable when entering
the loop. Remove the pointless and possibly misleading
assignment.

Mechanical patch using the following coccinelle spatch:

  @@
  type T;
  identifier e;
  iterator FOREACH_MACRO =~ ".*_FOREACH.*";
  statement S;
  @@
  -    T *e = ...;
  +    T *e;
       ... when != e
       FOREACH_MACRO(e, ...) S

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-6-philmd@linaro.org>

6 weeks agococci: Do not initialize variable used by QTAILQ_FOREACH macro
Philippe Mathieu-Daudé [Wed, 15 Apr 2026 21:11:08 +0000 (23:11 +0200)] 
cocci: Do not initialize variable used by QTAILQ_FOREACH macro

The QTAILQ_FOREACH() macro, defined in "qemu/queue.h",
always assigns its iterator variable when entering the
loop. Remove the pointless and possibly misleading
assignment.

Mechanical patch using the following coccinelle spatch:

  @@
  type T;
  identifier e;
  iterator FOREACH_MACRO =~ ".*_FOREACH.*";
  statement S;
  @@
  -    T *e = ...;
  +    T *e;
       ... when != e
       FOREACH_MACRO(e, ...) S

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-5-philmd@linaro.org>

6 weeks agococci: Do not initialize variable used by QSIMPLEQ_FOREACH macro
Philippe Mathieu-Daudé [Wed, 15 Apr 2026 21:07:09 +0000 (23:07 +0200)] 
cocci: Do not initialize variable used by QSIMPLEQ_FOREACH macro

The QSIMPLEQ_FOREACH() macro, defined in "qemu/queue.h",
always assigns its iterator variable when entering the
loop. Remove the pointless and possibly misleading
assignment.

Mechanical patch using the following coccinelle spatch:

  @@
  type T;
  identifier e;
  iterator FOREACH_MACRO =~ ".*_FOREACH.*";
  statement S;
  @@
  -    T *e = ...;
  +    T *e;
       ... when != e
       FOREACH_MACRO(e, ...) S

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-4-philmd@linaro.org>

6 weeks agococci: Do not initialize variable used by QSLIST_FOREACH macro
Philippe Mathieu-Daudé [Wed, 15 Apr 2026 21:05:55 +0000 (23:05 +0200)] 
cocci: Do not initialize variable used by QSLIST_FOREACH macro

The QSLIST_FOREACH() macro, defined in "qemu/queue.h",
always assigns its iterator variable when entering the
loop. Remove the pointless and possibly misleading
assignment.

Mechanical patch using the following coccinelle spatch:

  @@
  type T;
  identifier e;
  iterator FOREACH_MACRO =~ ".*_FOREACH.*";
  statement S;
  @@
  -    T *e = ...;
  +    T *e;
       ... when != e
       FOREACH_MACRO(e, ...) S

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-3-philmd@linaro.org>

6 weeks agococci: Do not initialize variable used by QLIST_FOREACH macro
Philippe Mathieu-Daudé [Wed, 15 Apr 2026 21:09:57 +0000 (23:09 +0200)] 
cocci: Do not initialize variable used by QLIST_FOREACH macro

The QLIST_FOREACH() macro, defined in "qemu/queue.h",
always assigns its iterator variable when entering the
loop. Remove the pointless and possibly misleading
assignment.

Mechanical patch using the following coccinelle spatch:

  @@
  type T;
  identifier e;
  iterator FOREACH_MACRO =~ ".*_FOREACH.*";
  statement S;
  @@
  -    T *e = ...;
  +    T *e;
       ... when != e
       FOREACH_MACRO(e, ...) S

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-2-philmd@linaro.org>

6 weeks agoscripts/checkpatch: Reject another license boilerplate pattern
Bernhard Beschow [Tue, 14 Apr 2026 13:50:18 +0000 (15:50 +0200)] 
scripts/checkpatch: Reject another license boilerplate pattern

The pattern us used 56 times in QEMU.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Matyas Bobek <matyas.bobek@gmail.com>
Message-ID: <20260414135018.13585-1-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6 weeks agoio: use g_clear_handle_id() for GSource cleanup
Philippe Mathieu-Daudé [Wed, 8 Apr 2026 09:52:26 +0000 (11:52 +0200)] 
io: use g_clear_handle_id() for GSource cleanup

Use g_clear_handle_id() instead of g_source_remove() with
manual ID checking and zeroing.

This simplifies the code and ensures consistent handling of
GSource IDs, since g_clear_handle_id() checks for a non-zero
ID before calling the cleanup function and zeros it afterwards.

No functional change intended.

Mechanical change using the following Coccinelle spatch script:

  @@
  expression TAG;
  @@
  -    if (TAG > 0) {
  +    if (TAG) {
           g_source_remove(TAG);
           <... when != TAG
           TAG = 0;
           ...>
       }

  @@
  expression TAG;
  @@
  -    g_source_remove(TAG);
  -    TAG = 0;
  +    g_clear_handle_id(&TAG, g_source_remove);

  @@
  expression TAG;
  @@
  -    if (TAG) {
           g_clear_handle_id(&TAG, g_source_remove);
  -    }

Inspired-by: Matthew Penney <matt@matthewpenney.net>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Matthew Penney <matt@matthewpenney.net>
Message-Id: <20260408100605.66795-3-philmd@linaro.org>

6 weeks agoio: Clear dangling GLib event source tag
Philippe Mathieu-Daudé [Wed, 8 Apr 2026 09:50:18 +0000 (11:50 +0200)] 
io: Clear dangling GLib event source tag

Following commit 34aad589019 ("hw/char/virtio-console: clear
dangling GLib event source tag"), prevent stale tags from
being reused by clearing dangling GLib event source tag during
the cleanup phase (finalize, unrealize).

Inspired-by: Matthew Penney <matt@matthewpenney.net>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Matthew Penney <matt@matthewpenney.net>
Message-Id: <20260408100605.66795-2-philmd@linaro.org>

6 weeks agotarget/xtensa/core: register types using type_init
Pierrick Bouvier [Wed, 29 Apr 2026 23:56:45 +0000 (01:56 +0200)] 
target/xtensa/core: register types using type_init

Instead of using a static constructor, delay registering those types
until we call module_init(MODULE_INIT_QOM).

This is not yet a problem, but since we will start initializing
target-info types before any other, without this patch
qemu-system-xtensa* fails with:
Type 'dsp3400-xtensa-cpu' is missing its parent 'xtensa-cpu'

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260430203842.29156-4-pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6 weeks agotarget/s390x: Do not compile KVM stubs for linux-user binary
Philippe Mathieu-Daudé [Wed, 22 Apr 2026 19:31:10 +0000 (21:31 +0200)] 
target/s390x: Do not compile KVM stubs for linux-user binary

None of these KVM symbols should be used in the qemu-s390x
linux-user binary. Do not build the stub there, prefer a
real linker failure.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-3-philmd@linaro.org>

6 weeks agotarget/mips: Do not initialize variable used by CPU_FOREACH macro
Philippe Mathieu-Daudé [Wed, 6 May 2026 12:42:54 +0000 (14:42 +0200)] 
target/mips: Do not initialize variable used by CPU_FOREACH macro

The CPU_FOREACH() macro, defined in "hw/core/cpu.h",
ends up calling QTAILQ_FOREACH_RCU() which always
assigns its iterator variable when entering the loop.
Remove the pointless and possibly misleading assignment.

Mechanical patch using the following coccinelle spatch:

  @@
  type T;
  identifier e;
  iterator FOREACH_MACRO =~ ".*_FOREACH.*";
  statement S;
  @@
  -    T *e = ...;
  +    T *e;
       ... when != e
       FOREACH_MACRO(e, ...) S

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-7-philmd@linaro.org>

6 weeks agotarget/mips: Reduce CPUState scope when used with CPU_FOREACH()
Philippe Mathieu-Daudé [Wed, 6 May 2026 12:37:24 +0000 (14:37 +0200)] 
target/mips: Reduce CPUState scope when used with CPU_FOREACH()

When possible, reduce CPUState variable scope.
Prefer cpu_env(cpu) over &cpu->env.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-8-philmd@linaro.org>

6 weeks agotarget/riscv: Iterate vCPUs using CPU_FOREACH() macro
Philippe Mathieu-Daudé [Tue, 14 Apr 2026 11:12:16 +0000 (13:12 +0200)] 
target/riscv: Iterate vCPUs using CPU_FOREACH() macro

Most code iterates over vCPUs using the CPU_FOREACH()
macro. Prefer cpu_env(cpu) over &cpu->env.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260415215539.92629-9-philmd@linaro.org>

6 weeks agotarget/s390x: Replace cpu_stb_data_ra -> cpu_stb_mmu in STFLE opcode
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 10:22:15 +0000 (12:22 +0200)] 
target/s390x: Replace cpu_stb_data_ra -> cpu_stb_mmu in STFLE opcode

In preparation of building misc_helper.c as a common unit, update
the cpu_ld/st_be_data_ra() API by cpu_ld/st_mmu() one and replace
"accel/tcg/cpu-ldst.h" by "accel/tcg/cpu-ldst-common.h".

For now we are blocked by the CONFIG_DEVICES use so keep the file
in s390x_ss[].

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-10-philmd@linaro.org>

6 weeks agotarget/s390x: Compile crypto_helper.c as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 10:23:39 +0000 (12:23 +0200)] 
target/s390x: Compile crypto_helper.c as common unit

In order do build crypto_helper.c as a common unit we need to
replace:

  "accel/tcg/cpu-ldst.h" -> "accel/tcg/cpu-ldst-common.h"

and update the cpu_ld/st_be_data_ra() API by cpu_ld/st_mmu() one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-9-philmd@linaro.org>

6 weeks agotarget/s390x: Have MSA helper pass a mmu_idx argument
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 10:25:55 +0000 (12:25 +0200)] 
target/s390x: Have MSA helper pass a mmu_idx argument

Next commit will use the cpu_ld/st_mmu() API and thus
will also use a @mmu_idx. In order to keep it simple to
review, propate @mmu_idx in a preliminary step.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-8-philmd@linaro.org>

6 weeks agotarget/s390x: Compile vec_helper.c as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 10:48:42 +0000 (12:48 +0200)] 
target/s390x: Compile vec_helper.c as common unit

In order do build vec_helper.c as a common unit we need to
replace:

  "accel/tcg/cpu-ldst.h" -> "accel/tcg/cpu-ldst-common.h"

and update the cpu_ld/st_be_data_ra() API by cpu_ld/st_mmu() one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-7-philmd@linaro.org>

6 weeks agotarget/s390x: Compile translate.c as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 10:28:02 +0000 (12:28 +0200)] 
target/s390x: Compile translate.c as common unit

In order do build translate.c as a common unit we need to
replace:

  #include "tcg/tcg-op.h" -> #include "tcg/tcg-op-common.h"
                          -> #include "tcg/tcg-op-mem.h"

and:

  "accel/tcg/tcg-op-gvec.h" -> "accel/tcg/tcg-op-gvec-common.h"

taking care to define TCG_ADDRESS_BITS, which is fixed
for this 64-bit target.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-6-philmd@linaro.org>

6 weeks agotarget/s390x: Compile few files as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 10:41:13 +0000 (12:41 +0200)] 
target/s390x: Compile few files as common unit

Nothing in these files prevents it to be built as common unit:

 - cc_helper.c
 - excp_helper.c
 - fpu_helper.c
 - vec_fpu_helper.c
 - vec_int_helper.c
 - vec_string_helper.c

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-5-philmd@linaro.org>

6 weeks agotarget/s390x: Introduce common system/user meson source set
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 10:38:33 +0000 (12:38 +0200)] 
target/s390x: Introduce common system/user meson source set

Introduce a source set common to system / user. Start it
with the files built in both sets: 'cpu_models_user.c'
and 'gdbstub.c' No logical change intended.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-4-philmd@linaro.org>

6 weeks agotarget/microblaze: Compile translate.c as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 09:12:54 +0000 (11:12 +0200)] 
target/microblaze: Compile translate.c as common unit

In order do build translate.c as a common unit we need to
replace:

  "accel/tcg/cpu-ldst.h" -> "accel/tcg/cpu-ldst-common.h"

and:

  #include "tcg/tcg-op.h" -> #include "tcg/tcg-op-common.h"
                          -> #include "tcg/tcg-op-mem.h"

taking care to define TCG_ADDRESS_BITS, which is fixed
for these 32-bit targets.

Remove the now empty microblaze_ss[] source set.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-10-philmd@linaro.org>

6 weeks agotarget/microblaze: Include missing cpu-mmu-index.h header in translate.c
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 09:53:21 +0000 (11:53 +0200)] 
target/microblaze: Include missing cpu-mmu-index.h header in translate.c

translate.c calls cpu_mmu_index(), itself defined in
"accel/tcg/cpu-mmu-index.h". This header is pulled in
indirectly via "accel/tcg/cpu-ldst.h", but since we'll
remove the latter in the next commit, make the inclusion
explicit, otherwise we'd get:

  ../target/microblaze/translate.c:1620:21: error: call to undeclared function 'cpu_mmu_index'
   1620 |     dc->mem_index = cpu_mmu_index(cs, false);
        |                     ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-9-philmd@linaro.org>

6 weeks agotarget/microblaze: Compile cpu.c as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 08:54:29 +0000 (10:54 +0200)] 
target/microblaze: Compile cpu.c as common unit

In order do build cpu.c as a common unit we simply need
to use the common version of "accel/tcg/cpu-ldst.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-8-philmd@linaro.org>

6 weeks agotarget/microblaze: Compile op_helper.c as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 08:54:23 +0000 (10:54 +0200)] 
target/microblaze: Compile op_helper.c as common unit

In order do build op_helper.c as a common unit we simply
need to use the common version of "accel/tcg/cpu-ldst.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-7-philmd@linaro.org>

6 weeks agotarget/microblaze: Compile helper.c as common unit
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 09:10:37 +0000 (11:10 +0200)] 
target/microblaze: Compile helper.c as common unit

Nothing in helper.c prevents it to be built as common unit.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-6-philmd@linaro.org>

6 weeks agotarget/microblaze: Introduce common system/user meson source set
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 08:50:49 +0000 (10:50 +0200)] 
target/microblaze: Introduce common system/user meson source set

Introduce a source set common to system / user.
No logical change intended.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-5-philmd@linaro.org>

6 weeks agotarget/microblaze: Replace translator_ldl_swap() -> translator_ldl_end()
Philippe Mathieu-Daudé [Thu, 27 Nov 2025 16:01:40 +0000 (17:01 +0100)] 
target/microblaze: Replace translator_ldl_swap() -> translator_ldl_end()

In preparation of removing the translator_ld[uw,l,q]() methods,
inline them for the microblaze targets, using mo_endian(ctx) --
which we introduced in commit 2c9e8ddd7699 -- instead of MO_TE.
Remove mb_cpu_is_big_endian() which is now unused.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-4-philmd@linaro.org>

6 weeks agotarget/microblaze: Fix endianness used to disassemble
Philippe Mathieu-Daudé [Wed, 10 Dec 2025 17:48:42 +0000 (18:48 +0100)] 
target/microblaze: Fix endianness used to disassemble

MicroBlaze CPU model has a "little-endian" property, pointing to
the @endi internal field. Commit c36ec3a9655 ("hw/microblaze:
Explicit CPU endianness") took care of having all MicroBlaze
boards with an explicit default endianness (similarly with
commit 91fc6d8101d for linux-user binaries), so later commit
415aae543ed ("target/microblaze: Consider endianness while
translating code") could infer the endianness at runtime from
the @endi field, and not a compile time via the TARGET_BIG_ENDIAN
definition. Doing so, we forgot to propagate that runtime change
to the disassemble_info structure. Do it now to display the
opcodes in correct endianness order.

Cc: qemu-stable@nongnu.org
Fixes: 415aae543ed ("target/microblaze: Consider endianness while translating code")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260423100612.27278-3-philmd@linaro.org>

6 weeks agotarget/arm: define stub library
Pierrick Bouvier [Thu, 9 Apr 2026 21:37:12 +0000 (14:37 -0700)] 
target/arm: define stub library

We use the mechanic introduced in previous commit to define a arm stubs
library. With this, we are able to eliminate symbol conflicts when
linking arm and aarch64 targets, and get one step closer to having a
single-binary.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20260424230103.1579600-3-pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6 weeks agotcg: Include missing 'tcg/tcg-op-common.h' header in 'tcg-op-mem.h'
Philippe Mathieu-Daudé [Thu, 23 Apr 2026 08:02:56 +0000 (10:02 +0200)] 
tcg: Include missing 'tcg/tcg-op-common.h' header in 'tcg-op-mem.h'

"tcg-op-mem.h" uses methods declared in "tcg/tcg-op-common.h".
Include the latter to avoid when including the former:

  include/tcg/tcg-op-mem.h:34:5: error: call to undeclared function 'tcg_gen_qemu_ld_i32_chk'
   34 |     tcg_gen_qemu_ld_i32_chk(v, tcgv_va_temp(a), i, m, TCG_TYPE_VA);
      |     ^

  $ git grep -w tcg_gen_qemu_ld_i32_chk
  include/tcg/tcg-op-common.h:328:void tcg_gen_qemu_ld_i32_chk(TCGv_i32, TCGTemp *, TCGArg, MemOp, TCGType);
  include/tcg/tcg-op-mem.h:35:    tcg_gen_qemu_ld_i32_chk(v, tcgv_va_temp(a), i, m, TCG_TYPE_VA);
  tcg/tcg-op-ldst.c:286:void tcg_gen_qemu_ld_i32_chk(TCGv_i32 val, TCGTemp *addr, TCGArg idx,

Cc: qemu-stable@nongnu.org
Fixes: a8af0fb24da ("include/tcg/tcg-op: extract memory operations to tcg-op-mem.h")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20260423135035.50126-2-philmd@linaro.org>

6 weeks agomeson.build: define stubs library per target base architecture
Pierrick Bouvier [Thu, 9 Apr 2026 21:37:02 +0000 (14:37 -0700)] 
meson.build: define stubs library per target base architecture

QEMU stubs (from stubs folder) have a unique feature: they emulate weak
symbols. Weak symbols are not supported on Windows with gcc. This is
achieved by defining a static library, so the linker can pick a file
only when one of its symbol is needed.

The problem is that common stubs are embedded in qemuutil, which is
defined and created before any target code. Thus, to benefit from the
same feature for target code, we need to create stub static libraries
for each target architecture.

To keep things simple, we declare one library per target base
architecture. This implies that stubs are compiled only once, and we
choose them to be system common files. This is not a big issue, since
stubs definition have no specific behaviour, out of returning a default
value, or stopping execution, which makes this safe to link them in user
binaries also.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20260424230103.1579600-2-pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6 weeks agomeson: Allow building with empty target_arch[] source set
Philippe Mathieu-Daudé [Thu, 2 Apr 2026 17:34:19 +0000 (19:34 +0200)] 
meson: Allow building with empty target_arch[] source set

Complete commit 83d5db95d38 ("meson: Allow system binaries
to not have target-specific units") with yet another guard,
allowing empty target_arch[] source sets for some targets.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-Id: <20260506133216.18730-1-philmd@linaro.org>

6 weeks agotarget/mips: Remove last MO_TE use
Philippe Mathieu-Daudé [Fri, 10 Oct 2025 06:29:27 +0000 (08:29 +0200)] 
target/mips: Remove last MO_TE use

Unfortunately commit 54821ff6e90 ("target/mips: Convert mips16e
decr_and_load/store() macros to functions") got rebased on top
of commit 2803e24694c ("target/mips: Replace MO_TE by mo_endian")
and we missed the replacement. Fix that.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417042620.35329-5-philmd@linaro.org>

6 weeks agotarget/mips: Inline translator_ld[uw,l,q]() calls
Philippe Mathieu-Daudé [Thu, 27 Nov 2025 16:00:49 +0000 (17:00 +0100)] 
target/mips: Inline translator_ld[uw,l,q]() calls

In preparation of removing the translator_ld[uw,l,q]() methods,
inline them for the MIPS target, expanding MO_TE by a runtime
check on mo_endian(ctx).

Mechanical change using the following Coccinelle 'spatch' script:

  @@
  expression env, db, pc;
  @@
  (
  - translator_lduw(env, db, pc)
  + translator_lduw_end(env, db, pc, mo_endian(ctx))
  |
  - translator_ldl(env, db, pc)
  + translator_ldl_end(env, db, pc, mo_endian(ctx))
  |
  - translator_ldq(env, db, pc)
  + translator_ldq_end(env, db, pc, mo_endian(ctx))
  )

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417042620.35329-4-philmd@linaro.org>

6 weeks agotarget/mips: Inline cpu_ld/st_mmuidx_ra() calls in Atomic LD/ST helpers
Philippe Mathieu-Daudé [Thu, 16 Apr 2026 14:25:45 +0000 (16:25 +0200)] 
target/mips: Inline cpu_ld/st_mmuidx_ra() calls in Atomic LD/ST helpers

Have callers set MO_ALIGN in the MemOp bits.

Perform the access first, filling the TLB in the process.
If the tlb cannot be filled, access is not permitted, and
an exception is raised. Thus remove the now unnecessary
do_raise_exception() call.

Since the TLB is filled, use probe_access() to get CP0_LLAddr.

Move env->CP0_LLAddr and env->lladdr assignments so we
don't update them when an alignment fault occurs.

Since we have a handy MemOpIdx, replace the legacy
cpu_ld*_mmuidx_ra() calls by cpu_ld*_mmu() equivalent.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417042620.35329-3-philmd@linaro.org>

6 weeks agotarget/mips: Pass MemOpIdx argument to Linked Load/Store helpers
Philippe Mathieu-Daudé [Thu, 16 Apr 2026 13:29:56 +0000 (15:29 +0200)] 
target/mips: Pass MemOpIdx argument to Linked Load/Store helpers

In preparation of using the MemOp content in the next commit
(thus stopping ignoring it), pass it as MemOpIdx.

The helper prototype declaration always took a TCGv_i32 as
last argument, correct that.

Rename the ignored 'mem_idx' argument on user emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417042620.35329-2-philmd@linaro.org>

6 weeks agotarget/mips: Expand TCGv type for 64-bit extensions
Philippe Mathieu-Daudé [Wed, 1 Apr 2026 14:26:14 +0000 (16:26 +0200)] 
target/mips: Expand TCGv type for 64-bit extensions

These TX79, Octeon and Loongarch extensions are only built
as 64-bit, so TCGv expands to TCGv_i64. Use the latter which
is more explicit. Mechanical changes.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260401144503.80510-3-philmd@linaro.org>

6 weeks agotarget/mips: Expand TCGv type as 32-bit for XBurst MXU
Philippe Mathieu-Daudé [Wed, 1 Apr 2026 14:25:47 +0000 (16:25 +0200)] 
target/mips: Expand TCGv type as 32-bit for XBurst MXU

The MXU extension is only built as 32-bit, so TCGv expands
to TCGv_i32. Use the latter which is more explicit.

In gen_mxu_s32madd_sub() directly expand:

 - tcg_gen_ext[u]_tl_i64 -> tcg_gen_ext[u]_i32_i64
 - tcg_gen_concat_tl_i64 -> tcg_gen_concat_i32_i64

the rest being mechanical changes.

Cc: Siarhei Volkau <lis8215@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260401144503.80510-2-philmd@linaro.org>

6 weeks agoaccel/tcg: Remove non-explicit endian cpu_ld*_code() wrappers
Philippe Mathieu-Daudé [Thu, 27 Nov 2025 04:19:13 +0000 (05:19 +0100)] 
accel/tcg: Remove non-explicit endian cpu_ld*_code() wrappers

All uses were converted to the cpu_ld*_code_mmu() helpers:
remove them. Update the documentation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260320074555.33974-3-philmd@linaro.org>

6 weeks agotarget/mips: Inline cpu_ld{uw,l}_code() calls in set_badinstr_registers
Philippe Mathieu-Daudé [Fri, 21 Nov 2025 08:16:32 +0000 (09:16 +0100)] 
target/mips: Inline cpu_ld{uw,l}_code() calls in set_badinstr_registers

In preparation of removing the cpu_lduw_code() and cpu_ldl_code()
wrappers, inline them. Directly replace MO_TE by mo_endian_env(env).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260320074555.33974-2-philmd@linaro.org>

6 weeks agomonitor: Remove hmp_info_pic() left-over declaration
Philippe Mathieu-Daudé [Tue, 14 Apr 2026 10:39:35 +0000 (12:39 +0200)] 
monitor: Remove hmp_info_pic() left-over declaration

When converting 'info pic' to QMP in commit 795eaa62fa6 ("hw/intc:
Introduce x-query-interrupt-controllers QMP command"), we forgot
to remove the hmp_info_pic() declaration. Do it now.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-33-philmd@linaro.org>

6 weeks agomonitor: Merge hmp-target.c code within hmp-cmds.c
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 14:14:57 +0000 (16:14 +0200)] 
monitor: Merge hmp-target.c code within hmp-cmds.c

hmp-target.c doesn't contain any target-specific code anymore.
Merge it within hmp-cmds.c (which is already built once).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-32-philmd@linaro.org>

6 weeks agomonitor: Remove target_monitor_defs()
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 13:14:51 +0000 (14:14 +0100)] 
monitor: Remove target_monitor_defs()

target_monitor_defs() is now only a dead stub. Remove as pointless.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-31-philmd@linaro.org>

6 weeks agotarget/sparc: Replace target_monitor_defs -> SysemuCPUOps::monitor_defs
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 13:14:13 +0000 (14:14 +0100)] 
target/sparc: Replace target_monitor_defs -> SysemuCPUOps::monitor_defs

Restrict sparc64_monitor_defs[] to cpu.c, register it
as SysemuCPUOps::monitor_defs hook (taking care to not
register it on 32-bit SPARC target), allowing to remove
the target_monitor_defs() method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-30-philmd@linaro.org>

6 weeks agotarget/m68k: Replace target_monitor_defs -> SysemuCPUOps::monitor_defs
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 13:14:01 +0000 (14:14 +0100)] 
target/m68k: Replace target_monitor_defs -> SysemuCPUOps::monitor_defs

Restrict m68k_monitor_defs[] to cpu.c, register it as
SysemuCPUOps::monitor_defs hook, allowing to remove
the target_monitor_defs() method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-29-philmd@linaro.org>

6 weeks agotarget/i386: Replace target_monitor_defs -> SysemuCPUOps::monitor_defs
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 13:13:51 +0000 (14:13 +0100)] 
target/i386: Replace target_monitor_defs -> SysemuCPUOps::monitor_defs

Restrict x86_monitor_defs[] to cpu.c, register it as
SysemuCPUOps::monitor_defs hook, allowing to remove
the target_monitor_defs() method.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-28-philmd@linaro.org>

6 weeks agocpus: Introduce SysemuCPUOps::monitor_defs hook
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 13:13:08 +0000 (14:13 +0100)] 
cpus: Introduce SysemuCPUOps::monitor_defs hook

Allow targets to register their legacy target_monitor_defs()
in SysemuCPUOps; check it first in get_monitor_def() otherwise
fall back to previous per-target helper.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-27-philmd@linaro.org>

6 weeks agomonitor: Forward-declare the MonitorDef type
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 11:10:51 +0000 (12:10 +0100)] 
monitor: Forward-declare the MonitorDef type

Rather than having core header forced to include "monitor/hmp.h"
to get the MonitorDef type declaration, forward-declare it in
"qemu/typedefs.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-26-philmd@linaro.org>

6 weeks agomonitor: Remove 'monitor/hmp-target.h' header
Philippe Mathieu-Daudé [Thu, 29 Jan 2026 13:18:36 +0000 (14:18 +0100)] 
monitor: Remove 'monitor/hmp-target.h' header

The "monitor/hmp-target.h" header doesn't contain any
target-specific declarations anymore. Merge it with
"monitor/hmp.h", its target-agnostic counterpart.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260427080738.77138-25-philmd@linaro.org>

6 weeks agomonitor: Reduce target-specific methods further
Philippe Mathieu-Daudé [Fri, 16 Jan 2026 13:59:56 +0000 (14:59 +0100)] 
monitor: Reduce target-specific methods further

get_monitor_def() doesn't use any target-specific declaration
anymore, move it to hmp.c to compile it once.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260427080738.77138-24-philmd@linaro.org>

6 weeks agomonitor: Have MonitorDef::get_value() always return int64_t type
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 08:23:05 +0000 (09:23 +0100)] 
monitor: Have MonitorDef::get_value() always return int64_t type

Simplify MonitorDef::get_value() handler by having it always
return a int64_t type.

Let the single caller (x86 targets) sign-extend the returned
value, directly handling 64-bit CPUs in 32-bit or 16-bit mode.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260427080738.77138-23-philmd@linaro.org>

6 weeks agomonitor: Remove target_get_monitor_def()
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 08:33:04 +0000 (09:33 +0100)] 
monitor: Remove target_get_monitor_def()

target_get_monitor_def() is now only a dead stub. Remove as pointless.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-22-philmd@linaro.org>

6 weeks agotarget/riscv: Register target_get_monitor_def in SysemuCPUOps
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 13:17:34 +0000 (14:17 +0100)] 
target/riscv: Register target_get_monitor_def in SysemuCPUOps

Rename target_get_monitor_def() as riscv_monitor_get_register_legacy()
and register it as SysemuCPUOps::monitor_get_register() handler.
Take care to sign-extend values for 32-bit HARTs.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20260427080738.77138-21-philmd@linaro.org>

6 weeks agocpus: Introduce SysemuCPUOps::monitor_get_register() hook
Philippe Mathieu-Daudé [Fri, 20 Mar 2026 13:17:18 +0000 (14:17 +0100)] 
cpus: Introduce SysemuCPUOps::monitor_get_register() hook

Allow targets to register their legacy target_get_monitor_def()
in SysemuCPUOps; check it first in get_monitor_def() otherwise
fall back to previous per-target helper.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-20-philmd@linaro.org>

6 weeks agomonitor: Do not check multiple TARGET_* to build 'info tlb' command
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 17:09:57 +0000 (19:09 +0200)] 
monitor: Do not check multiple TARGET_* to build 'info tlb' command

This command is filtered at build-time for a selection of binaries.
By using the recently introduced HMPCommand::arch_bitmask flag we
can filter them at runtime, making it possible to compile
hmp-commands-info.hx once.

Since the method depends on a pair of distinct targets,
define it in its own stub file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-19-philmd@linaro.org>

6 weeks agomonitor: Do not check TARGET_I386/RISCV to build 'info mem' command
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 17:10:53 +0000 (19:10 +0200)] 
monitor: Do not check TARGET_I386/RISCV to build 'info mem' command

This command is filtered at build-time for i386/x86_64 and
riscv32/riscv64 binaries. By using the recently introduced
HMPCommand::arch_bitmask flag we can filter it at runtime,
making it possible to compile hmp-commands-info.hx once.

Since the method depends on a pair of distinct targets,
define it in its own stub file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20260427080738.77138-18-philmd@linaro.org>

6 weeks agomonitor: Do not check TARGET_I386 to build 'info sev' command
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 17:42:30 +0000 (19:42 +0200)] 
monitor: Do not check TARGET_I386 to build 'info sev' command

This command is filtered at build-time for i386/x86_64 binaries.
By using the recently introduced HMPCommand::arch_bitmask flag
we can filter it at runtime, making it possible to compile
hmp-commands-info.hx once.

Since the method depends on the CONFIG_SEV definition, define it
in its own stub file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-17-philmd@linaro.org>

6 weeks agomonitor: Do not check TARGET_I386 to build 'info sgx' command
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 17:37:47 +0000 (19:37 +0200)] 
monitor: Do not check TARGET_I386 to build 'info sgx' command

This command is filtered at build-time for i386/x86_64 binaries.
By using the recently introduced HMPCommand::arch_bitmask flag
we can filter it at runtime, making it possible to compile
hmp-commands-info.hx once.

Since the method depends on the CONFIG_SGX definition, define it
in its own stub file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-16-philmd@linaro.org>

6 weeks agomonitor: Do not check TARGET_I386 to build target/i386/ commands
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 17:57:31 +0000 (19:57 +0200)] 
monitor: Do not check TARGET_I386 to build target/i386/ commands

These commands are filtered at build-time for i386/x86_64 binaries.
By using the recently introduced HMPCommand::arch_bitmask flag
we can filter them at runtime, making it possible to compile
hmp-commands[-info].hx files once.

Since these methods are used inconditionally within target/i386/,
define them in the same stub file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-15-philmd@linaro.org>

6 weeks agomonitor: Do not check TARGET_S390X to build s390x commands
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 17:25:13 +0000 (19:25 +0200)] 
monitor: Do not check TARGET_S390X to build s390x commands

These commands are filtered at build-time for s390x binary.
By using the recently introduced HMPCommand::arch_bitmask flag
we can filter them at runtime, making it possible to compile
hmp-commands[-info].hx files once.

Since the methods are used inconditionally within hw/s390x/,
define them in the same stub file.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20260427080738.77138-14-philmd@linaro.org>

6 weeks agohw/s390x: Reduce 'monitor/monitor.h' inclusions
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 13:49:27 +0000 (15:49 +0200)] 
hw/s390x: Reduce 'monitor/monitor.h' inclusions

We want to make the HMP commands available for all targets,
move the declarations to "monitor/hmp.h" where all other
are, and only include the monitor headers in the source files.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20260427080738.77138-13-philmd@linaro.org>

6 weeks agomonitor: Introduce HMPCommand::arch_bitmask field
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 14:09:02 +0000 (16:09 +0200)] 
monitor: Introduce HMPCommand::arch_bitmask field

Add the @arch_bitmask field to the HMPCommand structure,
allowing to restrict a command to a set of target
architectures (represented by the QEMU_ARCH_* enum constants).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-12-philmd@linaro.org>

6 weeks agosystem: Expose 'arch_init.h' as 'qemu/base-arch-defs.h'
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 14:00:19 +0000 (16:00 +0200)] 
system: Expose 'arch_init.h' as 'qemu/base-arch-defs.h'

We already have a file unit outside of the local system'
folder which include "system/arch_init.h". We want more files
to use it, so make it official it is a generic header by moving
it under include. Rename as "qemu/base-arch-defs.h" which is
more descriptive.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-11-philmd@linaro.org>

6 weeks agomonitor: Make Xen emulation commands generic ones
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 11:30:17 +0000 (13:30 +0200)] 
monitor: Make Xen emulation commands generic ones

In order to build hmp-commands.hx once we need to stop using
device target-specific check. Use the generic pattern to make
the command available on all targets, providing a stub with
kind error message when the feature is not available.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-10-philmd@linaro.org>

6 weeks agomonitor: Make 'info via' a generic command
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 13:47:47 +0000 (15:47 +0200)] 
monitor: Make 'info via' a generic command

In order to build hmp-commands-info.hx once we need to stop
using device target-specific check. Use the generic pattern
to make the command available on all targets, providing a
stub with kind error message when the device is not available.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-9-philmd@linaro.org>

6 weeks agomonitor: Restrict monitor_set_cpu() method scope
Philippe Mathieu-Daudé [Mon, 13 Apr 2026 11:00:57 +0000 (13:00 +0200)] 
monitor: Restrict monitor_set_cpu() method scope

As mentioned in commit 755f196898e ("qapi: Convert the cpu
command") 15 years ago, the monitor_set_cpu() method is a
temporary bridge between QMP -> HMP and shouldn't be used
elsewhere. Make its scope internal to monitor/.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-8-philmd@linaro.org>

6 weeks agomonitor/meson: Use SPICE with migration HMP commands
Philippe Mathieu-Daudé [Thu, 9 Apr 2026 23:09:01 +0000 (01:09 +0200)] 
monitor/meson: Use SPICE with migration HMP commands

When moving code around in commit 27be86351ec ("migration: Move
the QMP command from monitor/ to migration/") we forgot to update
the meson rule about SPICE pkg-config flags.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260427080738.77138-7-philmd@linaro.org>

6 weeks agostubs: Rename monitor* -> qmp* files
Philippe Mathieu-Daudé [Fri, 10 Apr 2026 17:24:17 +0000 (19:24 +0200)] 
stubs: Rename monitor* -> qmp* files

We use 'HMP' for Human monitor and 'QMP' for 'Machine protocol'.
These files aren't about human monitor but QMP, so rename them
for clarity using the 'qmp-' prefix instead of 'monitor-'.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Eric Farman <farman@linux.ibm.com>
Message-Id: <20260427080738.77138-6-philmd@linaro.org>

6 weeks agotarget/mips: Check alignment for microMIPS pre-R6 LD/ST multiple
Philippe Mathieu-Daudé [Thu, 16 Apr 2026 20:40:30 +0000 (22:40 +0200)] 
target/mips: Check alignment for microMIPS pre-R6 LD/ST multiple

Pre-REL6 microMIPS requires alignment while REL6 microMIPS does not.
Use @default_tcg_memop_mask in gen_ldst_multiple(), it is set to
MO_UNALN for REL6 but MO_ALIGN for pre-REL6.

Fixes: 3c824109da0 ("target-mips: microMIPS ASE support")
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417035734.32334-5-philmd@linaro.org>

6 weeks agotarget/mips: Inline cpu_ld/st_mmuidx_ra() calls in LD/ST Multiple
Philippe Mathieu-Daudé [Thu, 16 Apr 2026 20:31:42 +0000 (22:31 +0200)] 
target/mips: Inline cpu_ld/st_mmuidx_ra() calls in LD/ST Multiple

In preparation of removing the cpu_ld*_mmuidx_ra() and
cpu_st*_mmuidx_ra() calls, inline them. Expand MO_TE to
mo_endian_env(env) in gen_ldst_multiple().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417035734.32334-4-philmd@linaro.org>

6 weeks agotarget/mips: Remove unnecessary target_ulong uses in LD/ST Multiple
Philippe Mathieu-Daudé [Thu, 16 Apr 2026 20:53:58 +0000 (22:53 +0200)] 
target/mips: Remove unnecessary target_ulong uses in LD/ST Multiple

@do_r31 is a boolean, @base_reglist an unsigned size
and @i an unsigned index.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417035734.32334-3-philmd@linaro.org>

6 weeks agotarget/mips: Pass MemOpIdx argument to Load/Store Multiple helpers
Philippe Mathieu-Daudé [Thu, 16 Apr 2026 20:28:12 +0000 (22:28 +0200)] 
target/mips: Pass MemOpIdx argument to Load/Store Multiple helpers

In preparation of using the MemOp content in the next commit,
pass it as MemOpIdx. Include the access size.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260417035734.32334-2-philmd@linaro.org>

6 weeks agotarget/i386: Replace target_ulong -> uint64_t for TARGET_X86_64
Philippe Mathieu-Daudé [Sun, 15 Mar 2026 14:33:55 +0000 (15:33 +0100)] 
target/i386: Replace target_ulong -> uint64_t for TARGET_X86_64

These registers are only available on 64-bit builds, thus
always handled as 64-bit. This isn't even a migration break
because they are migrated as 64-bit since the beginning
(see commit 02536f8b1f9 "x86_64 save/restore").

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20260315165319.39727-1-philmd@linaro.org>

6 weeks agocpus: Remove CPUClass::init_accel_cpu() left-over hook
Philippe Mathieu-Daudé [Sun, 12 Apr 2026 21:19:58 +0000 (23:19 +0200)] 
cpus: Remove CPUClass::init_accel_cpu() left-over hook

Commits f50d0f335a6 and a522b04bb9c ("target/riscv,i386: Remove
AccelCPUClass::cpu_class_init need") removed the last uses of
the CPUClass::init_accel_cpu hook. Remove it as unused.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260412212547.29645-1-philmd@linaro.org>