Commit graph

2151 commits

Author SHA1 Message Date
Richard Henderson
f57fc2f7ce * dockerfiles: cleanup, update CentOS 9 container to Python 3.11
* rust: fix issues in bits crate
 * rust: replace bilge dependency with bitfield-struct
 * rust: update build system for Meson 1.12.0
 * serial: fix hot-unplug issue
 * target/i386: emulate: simplify flags conversion and storage
 * target/i386: tcg: small fixes
 * target/i386: mshv: complete migration support
 * target/i386: sev: add support for SEV features
 * target/i386: whpx: bugfixes
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmqGq8wUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroPWBwf6A4w91Tr+mxm3fjcbr/KjVqFnX45k
 qG8l8+60WlA+YY4lUUCJHc4CtPPH9hinOKgm8yGjPdbFrpdcJgQPor4IUgIHnTGu
 Bjceu5k6wlqR7DRetF0TD+NWC2BCkTtbmFcivLd5Ua/vqZVP5j+CITP3t7v5AiuG
 +jEHPTqdk/RMhPdsXcFBl+WditIGNz1/R+pxMKGYfOxF9rQ86sSLd/y2cWrAYNnc
 bO5s8vBxxoNNSxt8qt48aU4gGKvBajpvVQy4/6bPoSs1Z9fwCyCWkQleYSBcBAyn
 3VTRAoift8j/xEgyOtXVdsviIeaUCE4S0aUGso+TMlA+SwEwSi20P917pg==
 =OXwa
 -----END PGP SIGNATURE-----

Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* dockerfiles: cleanup, update CentOS 9 container to Python 3.11
* rust: fix issues in bits crate
* rust: replace bilge dependency with bitfield-struct
* rust: update build system for Meson 1.12.0
* serial: fix hot-unplug issue
* target/i386: emulate: simplify flags conversion and storage
* target/i386: tcg: small fixes
* target/i386: mshv: complete migration support
* target/i386: sev: add support for SEV features
* target/i386: whpx: bugfixes

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmqGq8wUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroPWBwf6A4w91Tr+mxm3fjcbr/KjVqFnX45k
# qG8l8+60WlA+YY4lUUCJHc4CtPPH9hinOKgm8yGjPdbFrpdcJgQPor4IUgIHnTGu
# Bjceu5k6wlqR7DRetF0TD+NWC2BCkTtbmFcivLd5Ua/vqZVP5j+CITP3t7v5AiuG
# +jEHPTqdk/RMhPdsXcFBl+WditIGNz1/R+pxMKGYfOxF9rQ86sSLd/y2cWrAYNnc
# bO5s8vBxxoNNSxt8qt48aU4gGKvBajpvVQy4/6bPoSs1Z9fwCyCWkQleYSBcBAyn
# 3VTRAoift8j/xEgyOtXVdsviIeaUCE4S0aUGso+TMlA+SwEwSi20P917pg==
# =OXwa
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 20 Aug 2026 12:25:00 AM PDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [unknown]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (53 commits)
  rust: remove bilge crate
  rust: pl011: switch from bilge to bitfield-struct
  rust: update Cargo dependencies
  scripts: remove now dead parts of rustc_args.py
  docs: rust: update for new-style build rules
  rust: use meson automatic parsing of Cargo.toml
  meson: use compiler_target() to get rustc target
  rust: switch to autogenerated meson rules
  rust: switch to cargo subprojects
  rust: update Cargo.lock
  rust/bits: Use checked_ilog2() in Binary::format to avoid panic
  rust/bits: Align SubAssign behavior with Sub
  python, meson: update meson required for Rust to 1.12.0
  dockerfiles: update CentOS Stream 9 to Python 3.11, Meson to 1.12
  dockerfiles: remove packages required by Avocado
  meson: make linker warnings non-fatal on Linux
  serial: clear transmit retry callback on unrealize
  whpx: i386: inject back db
  whpx: i386: work around Hyper-V FP state oddities
  whpx: i386: synchronise PAT too
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-08-20 16:01:59 -07:00
Denis V. Lunev
59ecd8a1ac block/monitor: reject persistent bitmap add on a read-only node
qmp_block_dirty_bitmap_add() marks a new bitmap persistent without
checking write access to its node. bdrv_create_dirty_bitmap() always
creates bitmaps writable, so a persistent bitmap added to an
already read-only node stays writable in memory on a node that can
never store it, and the next global inactivation fails:

  Lost persistent bitmaps during inactivation of node '<node>': No write access
  migration_block_inactivate: bdrv_inactivate_all() failed: -22

Forcing it read-only instead does not help: it was never stored,
so it stays unpromotable on the next reopen to read-write and can
trip bdrv_set_dirty()'s readonly assert on the first write. Reject
the add instead, for both read-only and inactive nodes -- an
already-inactive node skips qcow2_inactivate() on close, so a
bitmap added during that window would never get stored either.
Wrapped in a transaction, this denies the whole transaction, since
qmp_transaction() is already all-or-none.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Eric Blake <eblake@redhat.com>
CC: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
CC: John Snow <jsnow@redhat.com>
CC: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
Message-ID: <20260716112242.3000035-2-den@openvz.org>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
2026-08-17 18:32:44 +03:00
Naveen N Rao (AMD)
f79c89c296 target/i386: SEV: Add support for setting TSC frequency for Secure TSC
Add support for configuring the TSC frequency when Secure TSC is enabled
in SEV-SNP guests through a new "tsc-frequency" property on SEV-SNP
guest objects, similar to the vCPU-specific property used by regular
guests and TDX. A new property is needed since SEV-SNP guests require
the TSC frequency to be specified during early SNP_LAUNCH_START command
before any vCPUs are created.

The user-provided TSC frequency is set through KVM_SET_TSC_KHZ before
issuing KVM_SEV_SNP_LAUNCH_START.

Attempts to set TSC frequency on both the SEV_SNP object and the cpu
object result in an error from KVM (on the vCPU ioctl), so do not add
separate checks for the same.

Sample command-line:
  -machine q35,confidential-guest-support=sev0 \
  -object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1,secure-tsc=on,tsc-frequency=2500000000

Co-developed-by: Ketan Chaturvedi <Ketan.Chaturvedi@amd.com>
Signed-off-by: Ketan Chaturvedi <Ketan.Chaturvedi@amd.com>
Co-developed-by: Nikunj A Dadhania <nikunj@amd.com>
Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
Link: https://lore.kernel.org/r/af688610978f213a456a7753e1d9fe7d3a51e80a.1779281646.git.naveen@kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-08-17 16:51:54 +02:00
Naveen N Rao (AMD)
a26f9b975d target/i386: SEV: Add support for enabling Secure TSC SEV feature
Add support for enabling Secure TSC VMSA SEV feature in SEV-SNP guests
through a new "secure-tsc" boolean property on SEV-SNP guest objects. By
default, KVM uses the host TSC frequency for Secure TSC.

Sample command-line:
  -machine q35,confidential-guest-support=sev0 \
  -object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1,secure-tsc=on

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Co-developed-by: Ketan Chaturvedi <Ketan.Chaturvedi@amd.com>
Signed-off-by: Ketan Chaturvedi <Ketan.Chaturvedi@amd.com>
Co-developed-by: Nikunj A Dadhania <nikunj@amd.com>
Signed-off-by: Nikunj A Dadhania <nikunj@amd.com>
Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
Link: https://lore.kernel.org/r/9f58b92a173f319b3ef725f5ed8a2a173eed55b1.1779281646.git.naveen@kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-08-17 16:51:54 +02:00
Naveen N Rao (AMD)
51ac358fde target/i386: SEV: Add support for enabling debug-swap SEV feature
Add support for enabling debug-swap VMSA SEV feature in SEV-ES and
SEV-SNP guests through a new "debug-swap" boolean property on SEV guest
objects. Though the boolean property is available for plain SEV guests,
check_sev_features() has a check that rejects attempts to enable any SEV
feature for a plain SEV guest.

Though this SEV feature is called "Debug virtualization" in the APM, KVM
calls this "debug swap" so use the same name for consistency.

Sample command-line:
  -machine q35,confidential-guest-support=sev0 \
  -object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1,debug-swap=on

Restrict debug-swap to SEV-SNP guests at this time due to a
compatibility issue with SEV-ES pflash devices.

Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
Link: https://lore.kernel.org/r/416e7b156e49f95958f8c5c8549b48a88c1995fc.1779281646.git.naveen@kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-08-17 16:51:54 +02:00
Philippe Mathieu-Daudé
977d5b5018 qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h'
qmp-dispatch.c calls aio_wait_kick() and monitor_cur(). Include the
header declaring them in order to avoid the following build failure
when refactoring unrelated headers:

  ../qapi/qmp-dispatch.c:126:12: error: call to undeclared function 'monitor_cur'
    126 |     assert(monitor_cur() == NULL);
        |            ^
  ../qapi/qmp-dispatch.c:141:5: error: call to undeclared function 'aio_wait_kick'
    141 |     aio_wait_kick();
        |     ^

Fixes: 41725fa7ed ("qmp: Call monitor_set_cur() only in qmp_dispatch()")
Fixes: fc1a2ec7da ("monitor: Fix deadlock in monitor_cleanup")
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260812211708.92824-5-philmd@oss.qualcomm.com>
2026-08-16 16:32:42 +02:00
Philippe Mathieu-Daudé
c489b04fbc hw/s390x/virtio-ccw: Always inject NMI to first CPU
We can trigger NMI from HMP or QMP.

QEMU maps the NMI to the s390x per-CPU 'RESTART' interrupt.
Linux guests usually setup this interrupt to trigger kdump
or crash. Such crashdump can be triggered in QEMU by HMP
"nmi" or QMP "inject-nmi" commands.

Using QMP, since we can not select a particular CPU, the first
CPU is used (CPU#0). See the documentation from commit 795dc6e4
("watchdog: Add new Virtual Watchdog action INJECT-NMI"):

  @inject-nmi: a non-maskable interrupt is injected into the
               first VCPU (all VCPUS on x86) (since 2.4)

While we can select a particular CPU on HMP, the guest behavior
is expected to be the same if using CPU #N or CPU #0. Since
always using CPU#0 simplifies API maintenance , update s390_nmi()
to inject NMI to the first CPU.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260812121232.71958-3-philmd@oss.qualcomm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-08-16 16:32:42 +02:00
Jamin Lin
b781906fcc crypto/cipher: Add GCM to QCryptoCipherMode
Introduce the GCM cipher mode so authenticated encryption can be built
on top of the existing qcrypto_cipher API. GCM is an IV-based mode, so
register it in mode_need_iv. No backend advertises it yet, so it stays
unsupported until a backend and the AAD/tag helpers are added in the
following patches.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260811060115.1849266-8-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-08-11 18:25:58 +02:00
Denis V. Lunev
dd272c8c87 qapi/dump: add allowed-by-guest feature to win-dmp
Commit 1c0e259c5a ("dump: make win_dump_available() check vmcoreinfo
for a Windows dump header") changed two things in a way that is visible
to QMP clients but not to introspection:
query-dump-guest-memory-capability now lists win-dmp only for a guest
that has published a Windows dump header through the vmcoreinfo device,
and dump-guest-memory, which shares win_dump_available(), rejects the
format otherwise. Before that, both accepted win-dmp on any x86
machine.

A client that wants to select win-dmp automatically therefore cannot
trust the capability query on its own: on an older QEMU it reports
win-dmp for every x86 guest, Linux ones included, where the resulting
dump is useless. libvirt ran into exactly this while picking a format
for on_crash and watchdog triggered dumps, and has no way to tell the
two behaviours apart.

Add an 'allowed-by-guest' feature to the win-dmp member of
DumpGuestMemoryFormat so the fixed behaviour becomes discoverable.
DumpGuestMemoryFormat is reachable from both
query-dump-guest-memory-capability's return type and
dump-guest-memory's arguments, so a single flag covers both halves of
the change. Where the feature is absent, a reported win-dmp says
nothing about the guest, and a client that needs the dump to be
loadable afterwards should fall back to elf.

CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260731155001.1204103-1-den@openvz.org>
2026-08-04 23:21:40 +04:00
Michael Tokarev
1667cf6b7d spelling: happend
Fixes: 44adb5fcc2 "target/riscv: Remove spike as default machine"
Fixes: 4881411136 "migration: Always set DEVICE state"
Fixes: 3345fb3b6d "migration/postcopy: Add latency distribution report for blocktime"
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-07-23 17:57:09 +03:00
Markus Armbruster
8b61adae4e qapi: Fix misspelled section tags in doc comments
Section tags are case sensitive and end with a colon.  Screwing up
either gets them interpreted as ordinary paragraph.  Fix a few.

Fixes: 4e88e7e340 (qapi/qom: Define cache enumeration and properties for machine, 2024-11-01)
Fixes: 8eb6d39e22 (qom: qom-list-get, 2025-07-11)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260701061136.798815-1-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
2026-07-14 10:53:03 +02:00
Stefan Hajnoczi
67943f9371 Monitor patches for 2026-07-07
-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCgAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmpMylQSHGFybWJydUBy
 ZWRoYXQuY29tAAoJEDhwtADrkYZTZR0QALmaLG//ZC/AihLLdHHYgQFWQD+2MQiP
 l91oqTb+p40q0WhQYzCVYUc+8SMBY6pG6uuzn/qgpsP335uaFEk8c++znyXmbofy
 eABrnVETv/SokrvCxwEIZaW49B2gfER2dZ59sLKbvDQN30Dg36dbppHgchWeLO4b
 P2kP0veYHSnPx60JE4a0bcvLUO8aaEpb2dkvLOjJdaavJaF1iJURU5CP4hA979PM
 xt74cxqhEB6bASLcCJNuGumjmuUHCJGvt0bIGU7L/7a18RAXCw6kJlqfniZWjapC
 FMwN5OU8KSq2dy3SjbT6NotUQ8/fLgDqiCsd5gCRPROeAPQ8ZHHqBjyWsdPbHXOo
 A5m/XGAqDmWtqBPQkM158RpK20IeGAvTs3LrNQHoFB5f+iLm6dJf0CqbFCj6a4tc
 0w9J7nMUPscEZrJRryjpuYKe82wLrsWTaT3/je/dj2MMDy/Rd6HvjXKhY5P9upHH
 SOa8c4L0bG7PpT0paL2cUf03NmyOhWZFx583VID+R/TOQKjyOtdc//eMpuoqpfGU
 ggiMDG6VY1+YUZ4/gZ84v/gZDeMJ/9R6rpKGiMJKCOJJUS9znPOPiKKBMI+5Vz0w
 5IrugNKhnfMwCbYS2xFjtop9OFSOQBgLz4/7epKBYltWd4Y3h2Y61WsxxFRg85TL
 4MnzmcrMvoK7
 =Lxcx
 -----END PGP SIGNATURE-----

Merge tag 'pull-monitor-2026-07-07' of https://repo.or.cz/qemu/armbru into staging

Monitor patches for 2026-07-07

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCgAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmpMylQSHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTZR0QALmaLG//ZC/AihLLdHHYgQFWQD+2MQiP
# l91oqTb+p40q0WhQYzCVYUc+8SMBY6pG6uuzn/qgpsP335uaFEk8c++znyXmbofy
# eABrnVETv/SokrvCxwEIZaW49B2gfER2dZ59sLKbvDQN30Dg36dbppHgchWeLO4b
# P2kP0veYHSnPx60JE4a0bcvLUO8aaEpb2dkvLOjJdaavJaF1iJURU5CP4hA979PM
# xt74cxqhEB6bASLcCJNuGumjmuUHCJGvt0bIGU7L/7a18RAXCw6kJlqfniZWjapC
# FMwN5OU8KSq2dy3SjbT6NotUQ8/fLgDqiCsd5gCRPROeAPQ8ZHHqBjyWsdPbHXOo
# A5m/XGAqDmWtqBPQkM158RpK20IeGAvTs3LrNQHoFB5f+iLm6dJf0CqbFCj6a4tc
# 0w9J7nMUPscEZrJRryjpuYKe82wLrsWTaT3/je/dj2MMDy/Rd6HvjXKhY5P9upHH
# SOa8c4L0bG7PpT0paL2cUf03NmyOhWZFx583VID+R/TOQKjyOtdc//eMpuoqpfGU
# ggiMDG6VY1+YUZ4/gZ84v/gZDeMJ/9R6rpKGiMJKCOJJUS9znPOPiKKBMI+5Vz0w
# 5IrugNKhnfMwCbYS2xFjtop9OFSOQBgLz4/7epKBYltWd4Y3h2Y61WsxxFRg85TL
# 4MnzmcrMvoK7
# =Lxcx
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 07 Jul 2026 11:43:48 CEST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-monitor-2026-07-07' of https://repo.or.cz/qemu/armbru: (35 commits)
  docs: mark '-mon' as deprecated in favour of -object
  qemu-options: document new monitor-hmp and monitor-qmp objects
  tests: switch from -mon to -object monitor-qmp
  monitor: add support for auto-deleting monitors upon close
  qom: add trace events for user creatable create/delete APIs
  tests/functional: add a stress test for monitor hot unplug
  tests/functional: add e2e test for dynamic QMP monitor hotplug
  tests/qtest: add tests for dynamic monitor add/remove
  monitor: implement support for deleting QMP objects
  monitor: protect qemu_chr_fe_accept_input with monitor lock
  monitor: reject attempts to delete the current monitor
  monitor: convert from oneshot BH to persistent BH
  monitor: implement "user creatable" interface for adding monitors
  monitor: eliminate monitor_is_hmp_non_interactive method
  monitor: drop unused monitor_is_qmp method
  monitor: use dynamic cast in monitor_is_hmp_non_interactive
  monitor: use dynamic cast in QMP commands
  monitor: drop unused monitor_cur_is_qmp
  util: use dynamic cast in error vreport
  monitor: use dynamic cast in monitor_qmp_requests_pop_any_with_lock
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-07-07 19:17:41 +02:00
Daniel P. Berrangé
6c479e70e2 monitor: add support for auto-deleting monitors upon close
The default monitor is usually a long lived object that will exist for
the entire lifetime of the VM. A monitor can only service a single
client at a time though, and so it might be desirable to hotplug
additional monitors at runtime for specific tasks. If doing that,
however, there is a need to remove the monitor when it is no longer
needed.

A use case for hotplugging a monitor can involve a user wishing to
spawn an ad hoc script that uses a temporary monitor. The script can
ask the management application to hotplug a monitor and pass back a
pre-opened FD using SCM_RIGHTS. In this case the lifetime of the
script is not tied to the management application and thus it is
desirable to have automatic cleanup when the script exits.

Allowing a client to run "object-del" against its own monitor adds
complex edge cases, as it would be desirable to send the QMP response
despite the monitor sending it being deleted. Doing "object-del" alone
will also result in orphaning a character device backend instance, as
there is no opportunity to run the companion "chardev-del" command.

A simpler way to ensure cleanup is to add the concept of auto-deleting
monitor objects. Specifically when the "CHR_EVENT_CLOSED" event is
emitted, the equivalent of "object-del" + "chardev-del" can be run
internally. Since the transient client has already droppped its
monitor connection, there is no synchronization to be concerned about
with sending QMP replies. There is still some internal synchronization
needed, however, between the character device event callback and the
bottom-half that runs the delete. There is a chance that an incoming
client connection may arise before the bottom-half runs, which has
to be checked. Once the monitor object is deleted, the event callback
is unregistered from the character device, eliminating any further
races before the character device is fully deleted.

This is implemented via a new "close-action=none|delete" property on
the 'monitor-qmp' object. This concept could be extended with further
actions in future, for example:

 * close-action=shutdown - graceful guest shutdown
 * close-action=terminate - immediate guest poweroff
 * close-action=stop - pause guest CPUs while the monitor is not
                       connected to any client

This is left as an exercise for future interested contributors.

Tested-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260706135824.2623960-33-berrange@redhat.com>
[Commit message typos fixed]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-07 11:16:27 +02:00
Daniel P. Berrangé
75f31e3a8a monitor: implement "user creatable" interface for adding monitors
Implement the user creatable QOM interface and define the monitor-qmp
and monitor-hmp types in QAPI. This unlocks the ability to create them
on the command line with -object or in HMP/QMP with object_add.

For example:

  $QEMU -chardev stdio,id=monchr0 -object monitor-hmp,id=mon0,chrdev=monchr0

Initially the "prepare_delete" callback is hardcoded to return an error
which means -object and object_add can be used, but object_del will fail.
Support for deleting monitors will be introduced in subsequent commits.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Peter Krempa <pkrempa@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260706135824.2623960-24-berrange@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-07-07 11:16:25 +02:00
Avihai Horon
4abebba9f1 migration: Fix "switchover" used as a verb in comments and docs
"Switchover" is a noun; the verb form is "switch over".  Replace all
instances where "switchover" was incorrectly used as a verb in comments
and documentation.

Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260706085211.13905-17-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-07-07 07:12:46 +02:00
Avihai Horon
de0a1aed07 migration: Make switchover-ack re-usable
Switchover-ack is a mechanism to synchronize between source and
destination QEMU during migration to prevent the source from switching
over prematurely.

VFIO uses switchover-ack to ensure switchover happens only after
destination side has loaded the precopy initial bytes. This is important
for VFIO, as otherwise downtime could be impacted and be higher.

In its current state, switchover-ack is a one-time mechanism, meaning
that switchover is acked only once and past that another ACK cannot be
requested again. This was sufficient until now, as VFIO precopy initial
bytes was defined to be monotonically decreasing. Thus, when precopy
initial bytes reached zero for all VFIO devices, a single ACK would be
sent and its validity would hold.

However, now the new VFIO_PRECOPY_INFO_REINIT feature allows precopy
initial bytes to be re-initialized during precopy. Specifically, it
means that initial bytes can grow after reaching zero, which would
invalidate a previously sent switchover ACK.

To solve this, make switchover-ack reusable and allow devices to request
switchover ACKs when needed via the save_query_pending SaveVMHandler.

Since now switchover ACK can be requested for a specific device and in
different times, make switchover ACK per-device (instead of a single ACK
for all devices) and let source side do the pending ACKs accounting.

Keep the legacy switchover-ack mechanism for backward compatibility and
turn it on by a compatibility property for older machines. Enable the
property until VFIO implements the new switchover-ack.

Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Link: https://lore.kernel.org/qemu-devel/20260706085211.13905-8-avihaih@nvidia.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-07-07 07:12:46 +02:00
fanhuang
839c0a2bd8 qapi, hmp: introspection for the sp-mem device
Add a SpMemDeviceInfo variant to MemoryDeviceInfo so `query-memory-devices`
reports each sp-mem instance (id, addr, size, node, memdev), and print it
from HMP `info memory-devices`.

Signed-off-by: FangSheng Huang <FangSheng.Huang@amd.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260623075051.3797975-3-FangSheng.Huang@amd.com>
2026-07-03 21:21:07 -04:00
Peter Xu
1d03e0db3a qapi/migration: Remove @cpr-exec-command doc in MigrationParameter
This parameter was developed during similar window when the deduplication
work was done in commit 2220c2b9ef ("qapi/migration: Don't document
MigrationParameter"), hence it was overlooked.

Remove the leftover parameter.  After all, MigrationParameter is already in
the exception list of the doc sanity checker.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/r/20260528201236.359452-1-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-06-22 17:08:48 -04:00
Stefan Hajnoczi
7fd4de8662 QAPI patches for 2026-06-16
-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCgAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmoxUaISHGFybWJydUBy
 ZWRoYXQuY29tAAoJEDhwtADrkYZTLRYQAJ5AybnBtEdNWya4HQTnLIj2EwHieYI2
 6nmE1AOwgJ1Ba6EV0LtQqxHq4AxYCDGfrs7zWY3Og5YfO5dF57IZICS5Hn1nGPoJ
 7Xw78BzjdFZ2977w8NI8oZmRoryIpV1KOXwExkycEvAF1TNBYQoraQYAjgUQq/Of
 6orIqdvSZ1Jjqz8H8hHkwNdv0In7FpP7hGimGtvKkaVOy9GWrZayFQSvHeI5Q0gj
 lOdck/Qjq4rTZZ8t646nTSB1nYvEaysD6qtMsScBiK9lWDd65cj/lUfz1nVFLhdz
 ak2ayqODb/W+SujLjlNr/PsphcvnE74cpRgKtz0ilAWJ6CGW4/a0sKnXexVsgN7p
 247yCdlDiAqPyUeptBtiToAqPFoH1aVVV6HGhuMg+zc192nhQ1C2zZT5ytqqnCQ/
 NTZM7x8usrXfetyz36V2iYq8XzWAPFAAGYy4ylJWSv4+Npeoq9LYwEaDsMoLgbLL
 tghlo7Z7aYw7r+6FyWg1BogEF7Sc3DZAK9S1lWmfiIzZ8BZZ/P1gJJEbfUHxKLqb
 dE0WydRRmg7NX1r6MmjftkzKndTvztp+TpHEPyIkm2BzSKkJuc8Tw8mgvt4j3p3i
 rNBOnCT/DM/1HpUqWSIAM43JNPop9nB9LAfwhwezKjdcPDiZTrCNFA+5qIL5Mocb
 O4zl+DZDx6rm
 =vmyS
 -----END PGP SIGNATURE-----

Merge tag 'pull-qapi-2026-06-16' of https://repo.or.cz/qemu/armbru into staging

QAPI patches for 2026-06-16

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCgAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmoxUaISHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTLRYQAJ5AybnBtEdNWya4HQTnLIj2EwHieYI2
# 6nmE1AOwgJ1Ba6EV0LtQqxHq4AxYCDGfrs7zWY3Og5YfO5dF57IZICS5Hn1nGPoJ
# 7Xw78BzjdFZ2977w8NI8oZmRoryIpV1KOXwExkycEvAF1TNBYQoraQYAjgUQq/Of
# 6orIqdvSZ1Jjqz8H8hHkwNdv0In7FpP7hGimGtvKkaVOy9GWrZayFQSvHeI5Q0gj
# lOdck/Qjq4rTZZ8t646nTSB1nYvEaysD6qtMsScBiK9lWDd65cj/lUfz1nVFLhdz
# ak2ayqODb/W+SujLjlNr/PsphcvnE74cpRgKtz0ilAWJ6CGW4/a0sKnXexVsgN7p
# 247yCdlDiAqPyUeptBtiToAqPFoH1aVVV6HGhuMg+zc192nhQ1C2zZT5ytqqnCQ/
# NTZM7x8usrXfetyz36V2iYq8XzWAPFAAGYy4ylJWSv4+Npeoq9LYwEaDsMoLgbLL
# tghlo7Z7aYw7r+6FyWg1BogEF7Sc3DZAK9S1lWmfiIzZ8BZZ/P1gJJEbfUHxKLqb
# dE0WydRRmg7NX1r6MmjftkzKndTvztp+TpHEPyIkm2BzSKkJuc8Tw8mgvt4j3p3i
# rNBOnCT/DM/1HpUqWSIAM43JNPop9nB9LAfwhwezKjdcPDiZTrCNFA+5qIL5Mocb
# O4zl+DZDx6rm
# =vmyS
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 16 Jun 2026 09:37:38 EDT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-qapi-2026-06-16' of https://repo.or.cz/qemu/armbru:
  qapi: add doc comment "Intro" section parsing
  qapi/qapidoc: add rendering for INTRO sections
  qapi: remove implicit doc comment Plain section
  qapi: adjust doc comment stub member insertion algorithm
  qapi/parser: add mea culpa comment for ensure_returns
  qapi/parser: move _insert_near_kind() method
  qapi: new doc comment "Intro" section
  qapi/parser: fix comment phrasing
  qapi/parser: make remaining subsection members "private"
  qapi/parser: add has_features property
  qapi/parser: remove unused QAPIDoc subsection members
  tests/qapi: generate output in source order
  python: temporarily restrict max mypy version
  qapi: drop "must exist" from ID descriptions for consistency

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-06-17 10:15:32 -04:00
Filip Hejsek
97ed8acc65 qapi: drop "must exist" from ID descriptions for consistency
Make chardev ID param descriptions more consistent with ID descriptions
elsewhere.

Signed-off-by: Filip Hejsek <filip.hejsek@gmail.com>
Message-ID: <20260609120221.461303-1-filip.hejsek@gmail.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2026-06-15 16:03:07 +02:00
Vladimir Sementsov-Ogievskiy
ad865ad765 qapi: remove user addresses from x-query-virtio-vhost-queue-status
Semantics of these (actually, internal) fields is not simple, they may
contain either virtual or physical addresses. We are going to change
this to simplify the logic. Keeping this logic only for unstable
info command seems too much. Changing semantics of info fields doesn't
seem to make real sense too. So, let's just drop them. We can dot it,
as command is experimental.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Based-on: <20260206095258.894504-1-vsementsov@yandex-team.ru>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260420202032.714884-7-vsementsov@yandex-team.ru>
2026-06-03 08:36:12 -04:00
Vladimir Sementsov-Ogievskiy
1ee0bc0c9b vhost: drop backend_features field
This field is mostly unused and sometimes confusing. We even have
a TODO-like comment to drop it, the comment is removed in this commit.

The field is used to held VHOST_USER_F_PROTOCOL_FEATURES for vhost-user
and/or VHOST_NET_F_VIRTIO_NET_HDR for vhost-net (which may be
vhost-user-net). But we can simply recalculate these two flags in place
from hdev->features, and from net-client for VHOST_NET_F_VIRTIO_NET_HDR.

Note: removing field from x-query-virtio-status result is incompatible
change. We can do it because the command is unstable.

Cc: devel@lists.libvirt.org
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Acked-by: Raphael Norwitz <raphael.s.norwitz@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260420200339.708640-3-vsementsov@yandex-team.ru>
2026-06-03 08:36:11 -04:00
Markus Armbruster
11a19ad20e qapi/net: Drop unused type String
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260506105421.2461117-5-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2026-05-21 13:11:05 +02:00
Markus Armbruster
22ef826531 qapi/net: Wean SLIRP off QAPI type String to improve documentation
String's doc comment is useless.  Replace its use in NetdevUserOptions
by identical types with hopefully useful documentation.

While there, add a non-doc comment explaining why the port forwarding
interface is problematic.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260506105421.2461117-4-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[Commit message typo fixed]
2026-05-21 13:10:40 +02:00
Markus Armbruster
b5efbfb1bb qapi/net: Wean passt off QAPI type String to improve documentation
String's doc comment is useless.  Replace its use in
NetDevPasstOptions by identical types with hopefully useful
documentation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260506105421.2461117-3-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
[One Since: fixed up]
2026-05-21 13:10:15 +02:00
Markus Armbruster
6321d84be2 qapi/net: Rename NetDevPasstOptions to NetdevPasstOptions
We have eighteen QAPI type names starting with Netdev.  Commit
854ee02b22 (net: Add passt network backend) added a first one
starting with NetDev.  Rename it for consistency.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260506105421.2461117-2-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2026-05-21 13:09:04 +02:00
Thomas Huth
3822df47c2 Remove the deprecated glusterfs block driver
Glusterfs has been marked as deprecated since QEMU v9.2, and as far
as I know, nobody spoke up 'til today that it should be kept.
The listed e-mail address integration@gluster.org in our MAINTAINERS
file seems to be bouncing nowadays, and looking at their website
https://www.gluster.org/ the most recent news are from 2020 / 2021 ...
so it seems like there is really hardly any interest in Glusterfs
anymore. Thus it's time to remove the code now from QEMU.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260511063013.39805-1-thuth@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-05-19 17:25:48 +02:00
Kevin Wolf
d5e4090177 blkdebug: Add 'delay-ns' option
Sometimes reproducing a problem for debugging involves slow I/O, so
let's add something to blkdebug to make I/O slow when we need it. This
can be used either together with an error so that the request fails
after the delay, or with errno=0, which allows the request to succeed
after the delay.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20260421161132.99878-2-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-05-19 17:25:48 +02:00
Marc-André Lureau
b389b87d3c ui/console: add vc encoding=utf8/cp437 option
Expose a new "encoding" QemuOpt option.

Add the corresponding QAPI type and properties.

This is going to be wired in the following commits.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2026-05-09 10:24:32 +04:00
Stefan Hajnoczi
cd02ca8a65 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-----

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>
2026-05-06 10:31:51 -04:00
Peter Xu
492cdc995d migration/qapi: Update unit for avail-switchover-bandwidth
Add ", in bytes per second".  Unfortunately indentations need to be updated
completely, but no change on the rest.

Cc: Markus Armbruster <armbru@redhat.com>
Suggested-by: Juraj Marcin <jmarcin@redhat.com>
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/r/20260421202110.306051-16-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-05-05 12:35:25 -04:00
Peter Xu
468e507485 migration/qapi: Introduce system-wide "remaining" reports
Currently, mgmt can only query for remaining RAM using QMP command
"query-migrate" and monitor the "ram" section.  There's no way to report
system-wide remaining data including VFIO devices.  It was not a problem
before, because for a very long time RAM was the only part that matters.

After VFIO migrations landed upstream, it may not be enough. There can be
GPU devices that contain GBs of device states.  Mgmt may want to know how
much remaining for special devices like VFIO, because all of them will be
accounted as VM data to migrate and will contribute to downtime in the
switchover phase.

Add a new "remaining" field in query-migrate results on the top level,
reflecting system-wide remaining data, which will include everything like
VFIO devices.

This information will be useful for mgmt to implement generic way of stall
detection that covers all system resources.  For example, when system-wide
remaining data (especially, if sampled right after each migration
iteration) does not decrease anymore for a relatively long period of time,
then it may imply there is a challenge of converging, mgmt can react based
on how this value changes over time.

Before this patch, "expected_downtime" almost played this role. For
example, by monitoring "expected_downtime" at the beginning of each
iteration can in most cases also reflect the progress of migration
system-wide.

Said that, "expected_downtime" was always calculated based on a bandwidth
value that can fluctuate if avail-switchover-bandwidth is not used. This
new "remaining" field will remove that part of uncertainty for mgmt no
matter if avail-switchover-bandwidth is used by the mgmt.

With the new field, HMP "info migrate" now reports this:

(qemu) info migrate
Status:                 active
Time (ms):              total=12080, setup=14, exp_down=300
Remaining:              1.36 GiB        <--- this is the new line
RAM info:
  Throughput (Mbps):    840.50
  Sizes:                pagesize=4 KiB, total=4.02 GiB
  Transfers:            transferred=1.18 GiB, remain=1.36 GiB
    Channels:           precopy=1.18 GiB, multifd=0 B, postcopy=0 B
    Page Types:         normal=307923, zero=388148
  Page Rates (pps):     transfer=25660
  Others:               dirty_syncs=1

When VFIO is not involved, the value reported in the new field should be
approximately the same as reported in the "remaining" field of the RAM
section.  It is only approximately because the system-wide remaining data
is a cached value, which gets frequently updated by migration core.  OTOH,
the RAM's remaining data is accurate.

When VFIO is involved, the new value reported should normally be larger,
because it will include the size of VFIO remaining data too.

Cc: Aseef Imran <aimran@redhat.com>
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>
Acked-by: Markus Armbruster <armbru@redhat.com> # QAPI schema
Link: https://lore.kernel.org/r/20260421202110.306051-15-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-05-05 12:35:25 -04:00
Peter Xu
af82c8c3e8 migration/qapi: Rename MigrationStats to MigrationRAMStats
This stats is only about RAM, make it accurate.  This paves way for
statistics for all devices.

Thanks to Markus, who pointed out that docs/devel/qapi-code-gen.rst has a
section "Compatibility considerations" stated:

    Since type names are not visible in the Client JSON Protocol, types
    may be freely renamed.  Even certain refactorings are invisible, such
    as splitting members from one type into a common base type.

Hence this change is not ABI violation according to the document.

While at it, touch up the lines to make it read better, correct the
restriction on migration status being 'active' or 'completed': over time we
grew too many new status that will also report "ram" section.

Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: devel@lists.libvirt.org
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juraj Marcin <jmarcin@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Link: https://lore.kernel.org/r/20260421202110.306051-4-peterx@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-05-05 12:35:25 -04:00
Samuel Zhang
97dc5cf045 migration/rdma: add x-rdma-chunk-size parameter
The default 1MB RDMA chunk size causes slow live migration because
each chunk triggers a write_flush (ibv_post_send). For 8GB RAM,
1MB chunk size produces ~15000 flushes vs ~3700 with 1024MB chunk size.

Add x-rdma-chunk-size parameter to configure the RDMA chunk size for
faster migration.
Usage: `migrate_set_parameter x-rdma-chunk-size 1024M`

Performance with RDMA live migration of 8GB RAM VM:

| x-rdma-chunk-size (B) | time (s) | throughput (MB/s) |
|-----------------------|----------|-------------------|
| 1M (default)          | 37.915   |  1,007            |
| 32M                   | 17.880   |  2,260            |
| 1024M                 |  4.368   | 17,529            |

Signed-off-by: Samuel Zhang <guoqing.zhang@amd.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Li Zhijian <lizhijian@fujitsu.com>
Tested-by: Li Zhijian <lizhijian@fujitsu.com>
Acked-by: Fabiano Rosas <farosas@suse.de>
Acked-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20260427031401.3895523-1-guoqing.zhang@amd.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-05-05 12:35:24 -04:00
Markus Armbruster
824141dcf4 hw/core: Deprecate query-kvm
query-accelerators covers all accelerators, and should be used
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260108131455.2240598-2-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[Rebased, missing section title markup fixed]
2026-05-05 12:34:11 +02:00
Stefan Hajnoczi
a02bebe15c Pull request
- Jaehoon Kim's AioContext polling CPU efficiency optimizations
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmnyTCEACgkQnKSrs4Gr
 c8jB2wf7BXoNAW73Qwd31vZO2/0ZSDCQI781aeKrO/zl0k6nBgWKYYxjel3ezSJs
 qfwLnu7RpLFp89i6s9fO3PgyPdq81YJBHqeu/AsqXFcNNkkLPMavzcGCr7YeY3xP
 VIprpNBBYI/v6AnuFeEMp04FtLrcFO82ZIvTMpq7FsssytdmmqcleqQRTlecIpbK
 33z6aYKfPO/0VZRfpj5/NosQGaqU4y9ZgygPVoOvUlmPZgB0TpEReewtphqv7BHa
 LCJD03QBxJyTtsipD0ngcig+LeNzDsdla8fR7LD1hb/iqftxod6anaPIXWYvTu1v
 xC1fWyWZ+r1Nkv249Uzi+dEc4JkMmg==
 =rhl4
 -----END PGP SIGNATURE-----

Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging

Pull request

- Jaehoon Kim's AioContext polling CPU efficiency optimizations

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmnyTCEACgkQnKSrs4Gr
# c8jB2wf7BXoNAW73Qwd31vZO2/0ZSDCQI781aeKrO/zl0k6nBgWKYYxjel3ezSJs
# qfwLnu7RpLFp89i6s9fO3PgyPdq81YJBHqeu/AsqXFcNNkkLPMavzcGCr7YeY3xP
# VIprpNBBYI/v6AnuFeEMp04FtLrcFO82ZIvTMpq7FsssytdmmqcleqQRTlecIpbK
# 33z6aYKfPO/0VZRfpj5/NosQGaqU4y9ZgygPVoOvUlmPZgB0TpEReewtphqv7BHa
# LCJD03QBxJyTtsipD0ngcig+LeNzDsdla8fR7LD1hb/iqftxod6anaPIXWYvTu1v
# xC1fWyWZ+r1Nkv249Uzi+dEc4JkMmg==
# =rhl4
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 29 Apr 2026 14:21:21 EDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [ultimate]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [ultimate]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu:
  qapi/iothread: introduce poll-weight parameter for aio-poll
  aio-poll: refine iothread polling using weighted handler intervals
  aio-poll: avoid unnecessary polling time computation

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-04-30 10:30:22 -04:00
Jaehoon Kim
9fea80ddf0 qapi/iothread: introduce poll-weight parameter for aio-poll
Introduce a configurable poll-weight parameter for adaptive polling
in IOThread. This parameter replaces the hardcoded POLL_WEIGHT_SHIFT
constant, allowing runtime control over how much the most recent
event interval affects the next polling duration calculation.

The poll-weight parameter uses a shift value where larger values
decrease the weight of the current interval, enabling more gradual
adjustments. When set to 0, a default value of 3 is used (meaning
the current interval contributes approximately 1/8 to the weighted
average).

This patch also removes the hardcoded default value checks from
adjust_polling_time(). Instead, poll-grow, poll-shrink, and
poll-weight now use default values initialized in iothread.c
during IOThread creation.

Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260423195918.661299-4-jhkim@linux.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-04-29 11:31:44 -04:00
Jindřich Makovička
335e32cbd0 ui/gtk: Turn clipboard flag into runtime option
- Compile the GTK clipboard support unconditionally

- Introduce GTK clipboard option, defaulting to off

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260427-gtk-clipboard-v5-2-6968feb31a5d@gmail.com>
2026-04-28 18:53:59 +04:00
hongmianquan
fc1a2ec7da monitor: Fix deadlock in monitor_cleanup
During qemu_cleanup, if a non-coroutine QMP command (e.g.,
query-commands) is concurrently received and processed by the
mon_iothread, it can lead to a deadlock in monitor_cleanup.

The root cause is a race condition between the main thread's shutdown
sequence and the coroutine's dispatching mechanism. When handling a
non-coroutine QMP command, qmp_dispatcher_co schedules the actual
command execution as a bottom half in iohandler_ctx and then yields. At
this suspended point, qmp_dispatcher_co_busy remains true.

Subsequently, the main thread in monitor_cleanup(), sets
qmp_dispatcher_co_shutdown, and calls qmp_dispatcher_co_wake(). Since
qmp_dispatcher_co_busy is already true, the aio_co_wake is skipped. The
main thread then enters the AIO_WAIT_WHILE_UNLOCKED loop, it executes
the scheduled BH (do_qmp_dispatch_bh) via aio_poll(iohandler_ctx,
false), which attempts to wake up the coroutine, aio_co_wake schedules a
new wake-up BH in iohandler_ctx. The main thread then blocks
indefinitely in aio_poll(qemu_aio_context, true), while the coroutine's
wake-up BH is starved in iohandler_ctx, qmp_dispatcher_co never reaches
termination, resulting in a deadlock.

The execution sequence is illustrated below:

 IO Thread                 Main Thread (qemu_aio_context)        qmp_dispatcher_co (iohandler_ctx)
    |                                 |                                        |
    |-- query-commands                |                                        |
    |-- qmp_dispatcher_co_wake()      |                                        |
    |    (sets busy = true)           |                                        |
    |                                 |   <-- Wakes up in iohandler_ctx -->    |
    |                                 |                                        |-- qmp_dispatch()
    |                                 |                                        |-- Schedules BH (do_qmp_dispatch_bh)
    |                                 |                                        |-- qemu_coroutine_yield()
    |                                 |                                            [State: Suspended, busy=true]
    |   [ quit triggered ]            |
    |                                 |-- monitor_cleanup()
    |                                 |-- qmp_dispatcher_co_shutdown = true
    |                                 |-- qmp_dispatcher_co_wake()
    |                                 |    -> Checks busy flag. It's TRUE!
    |                                 |    -> Skips aio_co_wake().
    |                                 |
    |                                 |-- AIO_WAIT_WHILE_UNLOCKED:
    |                                 |   |-- aio_poll(iohandler_ctx, false)
    |                                 |   |    -> Executes do_qmp_dispatch_bh
    |                                 |   |    -> Schedules 'co_schedule_bh' in iohandler_ctx
    |                                 |   |
    |                                 |   |-- aio_poll(qemu_aio_context, true)
    |                                 |   |    -> Blocks indefinitely! (Deadlock)
    |                                 |
    |                                 X (Main thread sleeping)                 X (Waiting for next iohandler_ctx poll)

To fix this, we add an explicit aio_wait_kick() in do_qmp_dispatch_bh()
to break the main loop out of its blocking poll, allowing it to evaluate
the loop condition and poll iohandler_ctx.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: hongmianquan <hongmianquan@bytedance.com>
Signed-off-by: wubo.bob <wubo.bob@bytedance.com>
Message-ID: <20260327131024.51947-1-hongmianquan@bytedance.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-31 15:35:19 +02:00
Nathan Chen
d3d2de3d22 qdev: Add an OasMode property type
Introduce a new enum type property allowing to set an Output Address
Size. Values are auto, 32, 36, 40, 42, 44, 48, 52, and 56, where a
value of N specifies an N-bit OAS.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-7-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Nathan Chen
3a3dd64e63 qdev: Add a SsidSizeMode property type
Introduce a new enum type property allowing to set a Substream ID size
for HW-accelerated smmuv3. Values are auto and 0..20. The auto value
allows SSID size property to be derived from host IOMMU capabilities.
A value of 0 disables SubstreamID, while non-zero values specify the
SSID size in bits.

Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Shameer Kolothum <skolothumtho@nvidia.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
Message-id: 20260323182454.1416110-5-nathanc@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-24 14:02:29 +00:00
Stefan Weil
b7ae542de4 Fix several typos in documentation (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
[Mjt: add 2 fixes suggested by Peter: "as a" and "deactivate"]
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-03-23 19:55:24 +03:00
Antoine Damhet
7b13fc97d7 block/curl: add support for S3 presigned URLs
S3 presigned URLs are signed for a specific HTTP method (typically GET
for our use cases). The curl block driver currently issues a HEAD
request to discover the web server features and the file size, which
fails with 'HTTP 403' (forbidden).

Add a 'force-range' option that skips the HEAD request and instead
issues a minimal GET request (querying 1 byte from the server) to
extract the file size from the 'Content-Range' response header. To
achieve this the 'curl_header_cb' is redesigned to generically parse
HTTP headers.

$ $QEMU -drive driver=https,\
             'url=https://s3.example.com/some.img?X-Amz-Security-Token=XXX',
             force-range=true

Enabling the 'force-range' option without the web server specified with
@url supporting it might cause the server to respond successfully with
'HTTP 200' and attempt to send the whole file body. With the
'CURLOPT_NOBODY' option set the libcurl will skip reading after the
headers and close the connection. QEMU still gracefully detects the
missing feature. This might waste a small number of TCP packets but is
otherwise transparent to the user.

Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Antoine Damhet <adamhet@scaleway.com>
Message-ID: <20260227-fix-curl-v3-v3-3-eb8a4d88feef@scaleway.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-10 15:48:48 +01:00
Antoine Damhet
15c719a142 qapi: block: Refactor HTTP(s) common arguments
The HTTPs curl block driver is a superset of the HTTP driver, reflect
that in the QAPI.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Antoine Damhet <adamhet@scaleway.com>
Message-ID: <20260227-fix-curl-v3-v3-2-eb8a4d88feef@scaleway.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-10 15:48:43 +01:00
Hanna Czenczek
40ee2ff0ce qapi/block-export: Document FUSE's multi-threading
Document for users that FUSE's multi-threading implementation
distributes requests in a round-robin manner, regardless of where they
originate from.

As noted by Stefan, this will probably change with a FUSE-over-io_uring
implementation (which is supposed to have CPU affinity), but documenting
that is left for once that is done.

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20260309150856.26800-25-hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-10 12:12:04 +01:00
Hanna Czenczek
277fc1ce18 block/export: Add multi-threading interface
Make BlockExportType.iothread an alternate between a single-thread
variant 'str' and a multi-threading variant '[str]'.

In contrast to the single-thread setting, the multi-threading setting
will not change the BDS's context (and so is incompatible with the
fixed-iothread setting), but instead just pass a list to the export
driver, with which it can do whatever it wants.

Currently no export driver supports multi-threading, so they all return
an error when receiving such a list.

Suggested-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20260309150856.26800-21-hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-10 12:11:57 +01:00
Prasad Pandit
93c8a97f99 migration: introduce MIGRATION_STATUS_FAILING
When migration connection is broken, the QEMU and libvirtd(8)
process on the source side receive TCP connection reset
notification. QEMU sets the migration status to FAILED and
proceeds to migration_cleanup(). Meanwhile, Libvirtd(8) sends
a QMP command to migrate_set_capabilities().

The migration_cleanup() and qmp_migrate_set_capabilities()
calls race with each other. When the latter is invoked first,
since the migration is not running (FAILED), migration
capabilities are reset to false, so during migration_cleanup()
the QEMU process crashes with assertion failure.

Introduce a new migration status FAILING and use it as an
interim status when an error occurs. Once migration_cleanup()
is done, it sets the migration status to FAILED. This helps
to avoid the above race condition and ensuing failure.

Interim status FAILING is set wherever the execution moves
towards migration_cleanup():
  - postcopy_start()
  - migration_thread()
  - migration_cleanup()
  - multifd_send_setup()
  - bg_migration_thread()
  - migration_completion()
  - migration_detect_error()
  - bg_migration_completion()
  - multifd_send_error_propagate()
  - migration_connect_error_propagate()

The migration status finally moves to FAILED and reports an
appropriate error to the user.

Interim status FAILING is _NOT_ set in the following routines
because they do not follow the migration_cleanup() path to the
FAILED state:
  - cpr_exec_cb()
  - qemu_savevm_state()
  - postcopy_listen_thread()
  - process_incoming_migration_co()
  - multifd_recv_terminate_threads()
  - migration_channel_process_incoming()

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
Link: https://lore.kernel.org/qemu-devel/20260224102547.226087-1-ppandit@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2026-03-09 08:53:30 -03:00
Peter Maydell
1ae4271ab8 virtio-gpu updates (resolution, error handling, fences, native context)
- support per-head resolution definitions
   - don't disable scanouts on sdl and gtk when display refreshed
   - take care not confuse virgl with switching contexts
   - use dmabuf to import textures when we can
   - keep virtio BH processing to main-loop
   - improve error handling for fence creation
   - support async fences
   - add support for DRM native context
   - update virtio-gpu docs
   - remove superfluous memory region enabling
   - validate mapping offsets
   - destroy vrigl resources on reset
   - support mapping hostmem blobs with map_fixed
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmmrEysACgkQ+9DbCVqe
 KkQhugf/eab7ZSMfQzOArOjKcr+SSXiFE3wXg9HKRrbZx/yHRAiQ/Fv9Qx7uH8Q5
 Q7/A1l9WN/iwv2/jHWJv7gSOrYaRYIL0vXn/oriVNncZx779o56YhTIEYcSZ+zaF
 lHwLHpnzi2jcrmlhV49Mp1+tUH9U3OXwWzAUKTjhJxnLomoBwwcBaftbbBUj2cmS
 a3t1SMeIEq1hX7fCDnkBUfkUGAmPbk/vp/oXxF5SmBJIiyKB+O9jbx408hMQsNFo
 vulBmD2a5EOPwvBC0K6v+9aAbUicOFHwoQyeFvM8HTObMPj6+F40fvq+STNre22X
 Ln9a+tB/nq+7auX1D9VZSCkH7vzGRw==
 =x8lu
 -----END PGP SIGNATURE-----

Merge tag 'pull-11.0-virtio-gpu-updates-060326-1' of https://gitlab.com/stsquad/qemu into staging

virtio-gpu updates (resolution, error handling, fences, native context)

  - support per-head resolution definitions
  - don't disable scanouts on sdl and gtk when display refreshed
  - take care not confuse virgl with switching contexts
  - use dmabuf to import textures when we can
  - keep virtio BH processing to main-loop
  - improve error handling for fence creation
  - support async fences
  - add support for DRM native context
  - update virtio-gpu docs
  - remove superfluous memory region enabling
  - validate mapping offsets
  - destroy vrigl resources on reset
  - support mapping hostmem blobs with map_fixed

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmmrEysACgkQ+9DbCVqe
# KkQhugf/eab7ZSMfQzOArOjKcr+SSXiFE3wXg9HKRrbZx/yHRAiQ/Fv9Qx7uH8Q5
# Q7/A1l9WN/iwv2/jHWJv7gSOrYaRYIL0vXn/oriVNncZx779o56YhTIEYcSZ+zaF
# lHwLHpnzi2jcrmlhV49Mp1+tUH9U3OXwWzAUKTjhJxnLomoBwwcBaftbbBUj2cmS
# a3t1SMeIEq1hX7fCDnkBUfkUGAmPbk/vp/oXxF5SmBJIiyKB+O9jbx408hMQsNFo
# vulBmD2a5EOPwvBC0K6v+9aAbUicOFHwoQyeFvM8HTObMPj6+F40fvq+STNre22X
# Ln9a+tB/nq+7auX1D9VZSCkH7vzGRw==
# =x8lu
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Mar  6 17:47:23 2026 GMT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-11.0-virtio-gpu-updates-060326-1' of https://gitlab.com/stsquad/qemu:
  virtio-gpu: Support mapping hostmem blobs with map_fixed
  virtio-gpu: Destroy virgl resources on virtio-gpu reset
  virtio-gpu: Replace finish_unmapping with mapping_state
  virtio-gpu: Validate hostmem mapping offset
  virtio-gpu: Remove superfluous memory_region_set_enabled()
  docs/system: virtio-gpu: Document host/guest requirements
  docs/system: virtio-gpu: Update Venus link
  docs/system: virtio-gpu: Add link to Mesa VirGL doc
  virtio-gpu: Support DRM native context
  virtio-gpu: Support asynchronous fencing
  virtio-gpu: Handle virgl fence creation errors
  virtio-gpu: Ensure BHs are invoked only from main-loop thread
  ui/sdl2: Implement dpy dmabuf functions
  ui/sdl2: Restore original context after new context creation
  ui/gdk: Restore original context after new context creation
  ui/egl: Don't change bound GL context when creating new context
  ui/sdl2: Don't disable scanout when display is refreshed
  ui/gtk: Don't disable scanout when display is refreshed
  virtio-gpu: Fix scanout dmabuf cleanup during resource destruction
  Support per-head resolutions with virtio-gpu

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-07 11:22:16 +00:00
Andrew Keesler
d3a4969dc5 Support per-head resolutions with virtio-gpu
In 454f4b0f, we started down the path of supporting separate
configurations per display head (e.g., you have 2 heads - one with
EDID name "AAA" and the other with EDID name "BBB").

In this change, we add resolution to this configuration surface (e.g.,
you have 2 heads - one with resolution 111x222 and the other with
resolution 333x444).

  -display vnc=localhost:0,id=aaa,display=vga,head=0 \
  -display vnc=localhost:1,id=bbb,display=vga,head=1 \
  -device '{"driver":"virtio-vga",
            "max_outputs":2,
            "id":"vga",
            "outputs":[
              {
                 "name":"AAA",
                 "xres":111,
                 "yres":222
              },
              {
                 "name":"BBB",
                 "xres":333,
                 "yres":444
              }
            ]}'

Here is the behavior matrix of the current resolution configuration
surface (xres/yres) with the new resolution configuration surface
(outputs[i].xres/yres).

Note - we use "xres" and "yres" (instead of, say, "width" and "height")
to match analogous virtio_gpu_base_conf.xres/yres.

Case: !(xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
Behavior: current behavior - outputs[0] enabled with default xres/yres

Case: (xres || yres) && !(outputs[i].has_xres && outputs[i].has_yres)
Behavior: current behavior - outputs[0] enabled with xres/yres

Case: outputs[i].has_xres && outputs[i].has_yres
Behavior: new behavior - outputs[i] enabled with outputs[i].xres/yres

Case: outputs[i].has_xres != outputs[i].has_yres
Behavior: error

Signed-off-by: Andrew Keesler <ankeesler@google.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260210123038.2332364-2-ankeesler@google.com>
[AJB: fix format strings for size_t in error_setg]
Message-ID: <20260304165043.1437519-2-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2026-03-06 17:25:47 +00:00
Kevin Wolf
544ddbb637 block: Never drop BLOCK_IO_ERROR with action=stop for rate limiting
Commit 2155d2dd introduced rate limiting for BLOCK_IO_ERROR to emit an
event only once a second. This makes sense for cases in which the guest
keeps running and can submit more requests that would possibly also fail
because there is a problem with the backend.

However, if the error policy is configured so that the VM is stopped on
errors, this is both unnecessary because stopping the VM means that the
guest can't issue more requests and in fact harmful because stopping the
VM is an important state change that management tools need to keep track
of even if it happens more than once in a given second. If an event is
dropped, the management tool would see a VM randomly going to paused
state without an associated error, so it has a hard time deciding how to
handle the situation.

This patch disables rate limiting for action=stop by not relying on the
event type alone any more in monitor_qapi_event_queue_no_reenter(), but
checking action for BLOCK_IO_ERROR, too. If the error is reported to the
guest or ignored, the rate limiting stays in place.

Fixes: 2155d2dd7f ('block-backend: per-device throttling of BLOCK_IO_ERROR reports')
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20260304122800.51923-1-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2026-03-06 17:45:15 +01:00