128246 Commits

Author SHA1 Message Date
Markus Armbruster
75ecd66028 migration: Fix references to parameter names in error messages
Migration parameter names separate words with hyphens.  A number of
error messages in migrate_params_check() use underscores instead.
Wrong since day one.  Fix them.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260326074247.188674-3-armbru@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2026-03-30 10:46:57 -03:00
Markus Armbruster
95650cafc3 migration: Fix up error message for max-cpu-throttle
Fixes: 1a739d3012 (migration: Do away with usage of QERR_INVALID_PARAMETER_VALUE)
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260326074247.188674-2-armbru@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2026-03-30 10:46:18 -03:00
Peter Maydell
dd3ee9c63d Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* more WHPX fixes and documentation
* hpet: fix bounds check for s->timer[]
* hpet: lower HPET_MAX_TIMERS to 24
* lsi53c895a: keep SCSIRequest alive during DMA
* lsi53c895a: keep device alive during SCRIPTS execution
* hw/acpi: fix save/restore for MIPS Malta machine

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmnKTQ0UHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroNDAQgAry87O2EtgZBK8084Rn41+8w7Hx4K
# HmKGGLRHunZgOPPbFtLFj8sjmZGqV6MuELf8zBIwheJiaWyp9SqPN2FtwldEwLsG
# C37MsUS02SbfPrJPuAMaDsfeFknHaV/pUWiZIYr5S5+dKckz8P9RUZghCVKBmwyL
# mapNE7/++A2HCX2FnABmAsMMo+kt425kCmkDFryJQ9R7j8vjYo2sHn+WpDRjOLYS
# 0K7a5HBCwE+TrdZC1Q3J17VMhX/sFL/Ms8ByIhwJa+WimZoF/roaDBiK/0iUfVlg
# 196U0rvejdymAMWqIU462fyHvVkeW50FCHjTccmqnrIbFEdL4CFZlnrNxQ==
# =JIqb
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 30 11:14:37 2026 BST
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# 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:
  hw/acpi: Do not save/load cpuhp state unconditionally
  lsi53c895a: keep SCSIRequest alive during DMA
  lsi53c895a: keep lsi_request alive as long as the SCSIRequest
  lsi53c895a: keep lsi_request and SCSIRequest in local variables
  lsi53c895a: do not do anything else if a reset is requested by writing ISTAT0
  lsi53c895a: keep a reference to the device while SCRIPTS execute
  hpet: lower HPET_MAX_TIMERS to 24
  hpet: fix bounds check for s->timer[]
  target/i386: emulate: remove redundant logging for unmapped MMIO access
  whpx: i386: trace unsupported MSR accesses
  docs: add WHPX section with initial info
  meson.build: remove i386-softmmu WHPX support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-30 13:54:56 +01:00
Peter Maydell
fb66da4053 Merge tag 'pull-aspeed-20260330' of https://github.com/legoater/qemu into staging
aspeed queue:

* Complete lost interrupts fix in the Aspeed I2C model
* Fix a vlan tag insertion issue in the ftgmac100 model

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmnKYwYACgkQUaNDx8/7
# 7KHzlw/+OxlsY72otFxNbLWtQEOTQvWPDXvTbKsjlVtZalLM7BE/X+EqG6i9pDmj
# Reujd32F5pDX0pLzvFDqKgkQsFPW2F8jPpVMHDzZZkAjH0F5cckP/GO91WFC1F0x
# w7xlh9LKvw/LQcamR3Ptpb9+zuvG+p0O2tg+dmzUDzYwTt/Y7N25gnK9lUNup1qT
# T68Yy5Wa2YkW0J4/BGHOe9wxdM8tHz5izM69sTrb3nDnryiMWwNyMVIcDI1RyM53
# xMy2sMs/SpjxBYIl8+xfiGMGizjwVIyISb3aMC/OtLMMzxZ7PUaGSZLe63qB4kJF
# nBJ5LRxXTvsA74m9/rNk9S28lTtF4j14YVbMKj9hzt+YZzTumu20wfsTY63qja9K
# XWFqKoyD7Hrwt1grAYLWEl4mTNZNgby6091eNOWdYhv2Ogb3JWrTckCtDPWiJpeo
# c6Q9dewUSY0GDA5+2mOcVcDq4zcbZvVqdXqYH2EUasbmMLre/k/Q4zd7AOsC6U9V
# kPnd+cLPnIxMRBlzVKi/Sg2Non8QHsa/EgPyKYny9A4zGHgpGOAloSsRmv/xW3kH
# PFMpz/wIqudjpa0kJtsbE+v5iRixOTpr8oA8E8dPz8lrW9oVbRmqyQHKpIHOILq9
# M6WDnwxJDUqZS8w8Hk1hJMriQUpYPabYdwiWWdnPeyj9cWGuHFU=
# =ZxRl
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 30 12:48:22 2026 BST
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [full]
# gpg:                 aka "Cédric Le Goater <clg@kaod.org>" [full]
# Primary key fingerprint: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1

* tag 'pull-aspeed-20260330' of https://github.com/legoater/qemu:
  net/ftgmac100: preserve full VLAN TCI in TX tag insertion
  hw/i2c/aspeed_i2c: reset and migrate pending_intr_sts

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-30 13:54:48 +01:00
Peter Maydell
e389503e73 Merge tag 'pull-request-2026-03-30' of https://gitlab.com/thuth/qemu into staging
* Fix some warnings from pylint in the functional tests
* Fix migration of the isa-cirrus-vga device
* Remove obsolete linuxboot.bin prebuilt blob
* Fix migration functional test to check for socat instead of ncat now

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmnKT7YACgkQLtnXdP5w
# LbXqmA/8CUxZvJCxtODkw7jl8dX5yPRFs7HbYlY3RklhO8GhM4GHVo0ywxPAH3RG
# pkwXZwSp9I+ABY3fXwiFjMCYtM66iCR3UIateGonbREQgMn8A0EIeOQlCKF+rvaM
# HKucqanEk/lRAvuWJMEzo/3kPiUgblFieMZqUEdgTxH5YhJxi/IRq3HsESG5NKJn
# R+7u6KrgHJaZLhcLoBCRZ2FAf6wUTv+wpV58LoMsFXYQDRIsUU53u8uDWkUDy5yU
# TKMZOB0E5+Rb94apU2x3i7oAbQP8AX4fEGhzAiN00e8hjm8o5yRMHcK2aC1wpAlC
# VUnBwRPntiWGJKYMhaRS0Pe9gwTbUHvaO61GZpduK+Vip8mG8VRw1Ar71g703Zna
# AIqlJhqR4CS04I6SuF13qtJWmCOHw+sSzU8tMQe7MNGWF1rNuAk1GB5Lm5+nIm2e
# NVn6zGsI0v39ERGjUdCv2GZTZyfFdm+0+vB/nWvaCExsjVKErsaU1t/KNHL9ur2v
# 9x80CubNXy3bV8gnlgBzmgYkLxIyT6QpyPY3moKt9oHimy7XSEcMel80MiWEK8sL
# uPW2BKN+m0gUThuWG/3X9dkg/9nci81yoSpyuRvW8UBegqAFdLUjBfq/iCPNWtpI
# aX8aIgIQBoLfRGjUFBuButkWT2XQlxmp/TqT9FYkfvKAWobPNlU=
# =5aFN
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 30 11:25:58 2026 BST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [undefined]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2026-03-30' of https://gitlab.com/thuth/qemu:
  tests/functional/migration.py: Skip migration_with_exec() if socat is not available
  pc-bios: remove obsolete linuxboot.bin prebuilt blob
  hw/display/cirrus_vga_isa: Disable global_vmstate by default for new machines
  hw/display/vga-isa: Fix migration of the isa-vga device
  tests/functional/qemu_test: Silence warnings from pylint in config.py
  tests/functional/qemu_test: Split huge fetch() function in asset.py
  tests/functional/qemu_test: Silence (most) warnings from pylint in asset.py

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-30 11:50:24 +01:00
Zhao Liu
c0eaf14d93 tests/functional/migration.py: Skip migration_with_exec() if socat is not available
Commit 643a171f56 ("tests: Replace ncat with socat in migration test
and drop ncat from containers") replaced ncat with socat, but missed to
skip related test cases if socat is not available, which will cause test
errors on the system without socat.

Fix this by checking socat instead of the original ncat.

Fixes: 643a171f56 ("tests: Replace ncat with socat in migration test and drop ncat from containers")
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Message-ID: <20260330053300.2721608-1-zhao1.liu@intel.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2026-03-30 12:21:09 +02:00
Zhao Liu
0f254f70d4 hw/acpi: Do not save/load cpuhp state unconditionally
Commit 7aa563630b ("pc: Start with modern CPU hotplug interface
by default") removed the .needed callback (vmstate_test_use_cpuhp)
from vmstate_cpuhp_state in both piix4.c and ich9.c.

However, PIIX4 is also used by non-PC boards - MIPS Malta, which does
not select CONFIG_ACPI_CPU_HOTPLUG. For MIPS Malta, the linker resolves
vmstate_cpu_hotplug to the stub one in acpi-cpu-hotplug-stub.c, which is
a zero-initialized VMStateDescription with .fields == NULL.

Before commit 7aa563630b, .needed() of PIIX4's vmstate_cpuhp_state
returned false for MIPS Malta since PIIX4PMState always initialized the
field cpu_hotplug_legacy as true. Malta implicitly relies on this
initial value to bypass vmstate_cpuhp_state. However, this is unstable
because Malta itself does not support CPU hotplugging, whether via the
legacy way or the modern way.

Commit 7aa563630b removed .needed() check for vmstate_cpuhp_state,
this broke the existing dependency that Malta had relied on, forcing
Malta to save and load vmstate_cpuhp_state during the save/load process,
which in turn caused a segmentation fault due to NULL fields in the
stub-compiled code.

Fix this by bringing back the .needed = cpuhp_needed callback for
vmstate_cpuhp_state of PIIX4, that checks
MachineClass::has_hotpluggable_cpus. Boards that do not support CPU
hotplug (only MIPS Malta) will skip this subsection entirely, which
is both correct and consistent with the previous behavior.

At the same time, add a similar .needed() check to ICH9. Although no
boards with ICH9 are affected by this issue, this helps avoid potential
issues in the future.

Reproducer (MIPS Malta):
  $ qemu-img create -f qcow2 dummy.qcow2 32M
  $ qemu-system-mipsel -nographic \
      -drive if=none,format=qcow2,file=dummy.qcow2
  [Type "C-a c" to get the "(qemu)" monitor prompt)]
  (qemu) savevm foo    # segfault

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Fixes: 7aa563630b ("pc: Start with modern CPU hotplug interface by default")
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3360
Tested-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/r/20260330053008.2721532-1-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
d459131ff5 lsi53c895a: keep SCSIRequest alive during DMA
Reentrant MMIO can cause the SCSIRequest to be completed, at which
point lsi_request_orphan would drop the last reference.  Anything
that happens afterwards would access freed data.  Keep a reference
to the SCSIRequest and, through req->hba_private, to the lsi_request*
for as long as DMA runs.

Reported-by: Jihe Wang <wangjihe.mail@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
7c7aaaa342 lsi53c895a: keep lsi_request alive as long as the SCSIRequest
To protect against using the lsi_request after SCSIRequest has been freed,
keep the HBA-private data alive until the last reference to the SCSIRequest
is gone.  Because req->hba_private was used (even if just for an assertion)
to check that the request was still either current or queued, add a boolean
field that is set when the SCSIRequest is cancelled or completed, which
is when the lsi_request would have been unqueued.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
1ca38f84e1 lsi53c895a: keep lsi_request and SCSIRequest in local variables
Protect against changes from reentrant device MMIO during DMA, by always
operating on the same request.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:22 +02:00
Paolo Bonzini
64807c84e8 lsi53c895a: do not do anything else if a reset is requested by writing ISTAT0
If the device is reset, anything that is done before will not really
be visible.  So do the reset and exit immediately if that is one
of the requests in the value written to ISTAT0.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 12:14:17 +02:00
Marc-André Lureau
eea54988fd ui/vnc-jobs: clear source tag
Avoid potentially removing a dangling source & simplify code.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2026-03-30 14:05:15 +04:00
Marc-André Lureau
3cae0b46be ui/vnc-jobs: fix VncRectEntry leak on job cleanup
When a VncJob is freed, its associated VncRectEntry list must also be
freed. Previously, vnc_job_push() and the disconnected path in
vnc_worker_thread_loop() called g_free(job) directly, leaking all
VncRectEntry allocations.

Introduce vnc_job_free() which iterates and frees the rectangle entries
before freeing the job itself, and use it in both paths.

Also add QLIST_REMOVE() in the worker loop before g_free(entry), so
that entries processed during normal operation are properly unlinked.
Without this, vnc_job_free() would iterate dangling pointers to
already-freed entries, causing use-after-free.

Fixes: bd023f953e ("vnc: threaded VNC server")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2026-03-30 14:05:10 +04:00
GuoHan Zhao
e5ef268596 ui/dbus: tear down clipboard callbacks on display finalize
The clipboard D-Bus teardown path currently runs when the peer
disappears, but not when DBusDisplay itself is finalized.

That leaves pending clipboard requests and signal handlers associated
with the clipboard proxy active past display teardown.

Add an explicit clipboard fini hook and invoke it from
dbus_display_finalize() so the clipboard teardown also runs during
display destruction.

bixes: ff1a5810f6 ("ui/dbus: add clipboard interface")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Message-ID: <20260330091310.42868-1-zhaoguohan@kylinos.cn>
[ Marc-André - Move clipobard finalization to the function]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2026-03-30 14:02:33 +04:00
GuoHan Zhao
2151a67eb6 ui/dbus: associate add_client completion with its request
Commit 99997823bb ("ui/dbus: add p2p=on/off option")
introduced an asynchronous D-Bus client setup path, with the completion
handler reaching back into the global dbus_display state.

This makes the callback effectively operate on whatever request is
current when it runs, rather than the one that created it. A completion
from an older request can therefore clear a newer
add_client_cancellable or install its connection after a replacement
request has already been issued. It also relies on the DBusDisplay
instance remaining alive until completion.

Fix this by passing the DBusDisplay and GCancellable as callback data,
taking references while the async setup is in flight, and only acting
on completion if it still matches the current request. Also drop the
previous cancellable before creating a new request.

Fixes: 99997823bb ("ui/dbus: add p2p=on/off option")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260326065111.626236-1-zhaoguohan@kylinos.cn>
2026-03-30 14:02:32 +04:00
Marc-André Lureau
924b0be88d audio/mixeng: fix sw/hw mixup in audio_pcm_sw_init_
Commit 42061a1435 ("audio/mixeng: replace redundant pcm_info fields
with AudioFormat") accidentally changed the conv/clip function selection
in audio_pcm_sw_init_ to use hw->info.af (the hardware voice format)
instead of sw->info.af (the software voice format). This causes audio
distortion when the software and hardware voices use different formats,
as the wrong conversion functions are applied to the audio data.

Fix by using sw->info.af, restoring the original behavior.

Fixes: 42061a1435 ("audio/mixeng: replace redundant pcm_info fields with AudioFormat")
Reported-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2026-03-30 14:02:32 +04:00
Paolo Bonzini
4862d2c951 lsi53c895a: keep a reference to the device while SCRIPTS execute
SCRIPTS execution can trigger PCI device unplug and consequently
a use-after-free after the unplug returns.  Avoid this by keeping
the device alive.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3090
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:25 +02:00
Paolo Bonzini
7be175e65f hpet: lower HPET_MAX_TIMERS to 24
Each timer block occupies 32 bytes, but they only start at
offset 256 of the 1024-byte MMIO register space.  Therefore
the correct limit for HPET_MAX_TIMERS is 24, not 32.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:25 +02:00
Paolo Bonzini
24b9ebd5f1 hpet: fix bounds check for s->timer[]
Fix an off-by-one issue in QEMU's HPET read and write MMIO handlers.
Both handlers check timer_id > s->num_timers instead of timer_id >=
s->num_timers, allowing a guest to access one timer beyond the valid
range.

The affected slot is initialized properly in hpet_realize, which goes
through all HPET_MAX_TIMERS elements of the array, so even though
it is not reset in hpet_reset() the bug does not cause any use of
uninitialized host memory.  Because of this, and also because (even
though HPET_MAX_TIMERS is 32) the HPET only has room for 24 timers in
its MMIO region, the bug has no security implications.

Commit 869b0afa4f ("rust/hpet: Drop BqlCell wrapper for num_timers",
2025-06-06) silently fixed the same bug in rust/hw/timer/hpet/src/device.rs.

Reported-by: Yuma Kurogome, Ricerca Security, Inc. <yumak@ricsec.co.jp>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:25 +02:00
Mohamed Mediouni
ee5b216c0e target/i386: emulate: remove redundant logging for unmapped MMIO access
ReactOS's install ISO does a bunch of 4-byte accesses
to 0xffdff124. This doesn't happen for the boot ISO.

It looks to be an access relative to the Windows KPCR
which is at 0xffdff000 but mistakenly done prior to
paging being on...

As this logging is redundant with -d invalid_mem,
remove it.

https://geoffchappell.com/studies/windows/km/ntoskrnl/inc/ntos/i386_x/kpcr.htm

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260327011152.4126-5-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:24 +02:00
Mohamed Mediouni
77a5deba0d whpx: i386: trace unsupported MSR accesses
Not actionable information for users, so stop
having it displayed unconditionally.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/r/20260327011152.4126-4-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:24 +02:00
Mohamed Mediouni
ea1169bca4 docs: add WHPX section with initial info
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260327011152.4126-3-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:24 +02:00
Mohamed Mediouni
1feb92de34 meson.build: remove i386-softmmu WHPX support
target/i386/emulate is pretty much incompatible
with i386-softmmu and fixing that doesn't look
worthwhile given the binary unification goals...

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260327011152.4126-2-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-30 11:36:24 +02:00
linhuang
9160305d92 net/ftgmac100: preserve full VLAN TCI in TX tag insertion
The VLAN tag insertion helper took vlan_tci as an 8-bit value, while
the descriptor provides a 16-bit VLAN TCI. This truncated egress tags
and caused VLAN ID corruption (for example, 4088/0x0ff8 became
248/0x00f8 at the receiver).

Change vlan_tci to uint16_t in the TX VLAN insertion path so the full
802.1Q TCI is preserved and transmitted correctly.

Fixes: c2ab73fcbe ("ftgmac100: Fix integer overflow in ftgmac100_do_tx()")
Signed-off-by: linhuang <linhuang@ruijie.com.cn>
Link: https://lore.kernel.org/qemu-devel/1471e413d3589b6734819bda2b59b725b74f273a.d551129b.99fc.47f6.86dc.0759227268a2@feishu.cn
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-03-30 07:36:25 +02:00
GuoHan Zhao
9c32999643 hw/i2c/aspeed_i2c: reset and migrate pending_intr_sts
Commit 7e82393ed0 ("hw/i2c/aspeed: fix lost interrupts on
back-to-back commands") introduced pending_intr_sts to preserve
interrupt bits that collide with already pending status bits.

That deferred interrupt state is consumed later when the guest clears
INTR_STS, but it is not reset in aspeed_i2c_bus_reset() and it is not
part of the bus migration state. A reset can therefore leave stale
deferred bits behind, and migration can silently drop them.

Clear pending_intr_sts on reset and include it in VMState while keeping
compatibility with older migration streams.

Fixes: 7e82393ed0 ("hw/i2c/aspeed: fix lost interrupts on back-to-back commands")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
Link: https://lore.kernel.org/qemu-devel/20260325085450.126595-1-zhaoguohan@kylinos.cn
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Jithu Joseph <jithu.joseph@oss.qualcomm.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-03-30 07:36:25 +02:00
Daniel P. Berrangé
a2f0c836bd pc-bios: remove obsolete linuxboot.bin prebuilt blob
The corresponding source was removed in

  commit 88641f4df3
  Author: Philippe Mathieu-Daudé <philmd@linaro.org>
  Date:   Thu Jan 8 11:30:39 2026 +0800

    hw/i386: Remove linuxboot.bin

We must also remove the pre-built blob to avoid a GPL violation
from lack of complete & corresponding source.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260324122025.892666-1-berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Thomas Huth
af4eea83d2 hw/display/cirrus_vga_isa: Disable global_vmstate by default for new machines
In the long run, we would like to get rid of the code that allows to
register migration state globally, so set global_vmstate to false when
using the isa-cirrus-vga device with new machines, and only enable it
for older machines to avoid breaking the migration there.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260326154850.301609-1-thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Thomas Huth
d7189d4009 hw/display/vga-isa: Fix migration of the isa-vga device
QEMU currently crashes when migrating a guest that uses the
isa-vga device as display. This happens because vga_isa_class_initfn()
registers a vmsd for vmstate_vga_common that operates on VGACommonState.
But the isa-vga device is derived from ISADevice, not from VGACommonState,
so the migration code tries to fill in the data for VGACommonState to
the memory that is a ISADevice instead, which is of cause causing trouble.

We need an indirection here as it's also e.g. done in vga-pci.c, so
that the migration data gets filled into the right location.

While we're at it, also drop the "global_vmstate = true" here. Since
migration was broken for this device during the last 15 years (!) anyway,
we don't have to worry about maintaining backward compatibility with this
switch for older versions of QEMU anymore.

Fixes: 7435b791ca ("vga-isa: convert to qdev")
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260326113457.159065-1-thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Thomas Huth
de9698ead4 tests/functional/qemu_test: Silence warnings from pylint in config.py
Pylint complains here:

 config.py:1:0: C0114: Missing module docstring (missing-module-docstring)
 config.py:28:4: W0719: Raising too general exception: Exception (broad-exception-raised)

Add a module description and replace the general Exception to fix this.
And while we're at it, and since we've got a proper module description
string now, also replace the copy-n-pasted comment at the top of the file
with a proper SPDX identifier.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260324163543.55503-5-thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Thomas Huth
bfda4354ee tests/functional/qemu_test: Split huge fetch() function in asset.py
The fetch() function has become really huge and pylint complains about
that. Extract the internal retry-three-times-download loop into a
separate function to make it a little bit more readable and to make
pylint happy about this file again.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260324163543.55503-4-thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Thomas Huth
d22f790934 tests/functional/qemu_test: Silence (most) warnings from pylint in asset.py
Pylint currently complains:

 asset.py:1:0: C0114: Missing module docstring (missing-module-docstring)
 asset.py:21:0: C0115: Missing class docstring (missing-class-docstring)
 asset.py:28:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
 asset.py:34:0: C0115: Missing class docstring (missing-class-docstring)
 asset.py:49:15: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
 asset.py:73:4: C0116: Missing function or method docstring (missing-function-docstring)
 asset.py:80:4: C0116: Missing function or method docstring (missing-function-docstring)
 asset.py:83:4: C0116: Missing function or method docstring (missing-function-docstring)
 asset.py:125:4: C0116: Missing function or method docstring (missing-function-docstring)
 asset.py:181:43: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
 asset.py:190:39: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
 asset.py:201:39: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
 asset.py:213:15: W0718: Catching too general exception Exception (broad-exception-caught)
 asset.py:218:35: C0209: Formatting a regular string which could be an f-string (consider-using-f-string)
 asset.py:125:4: R0912: Too many branches (16/12) (too-many-branches)
 asset.py:125:4: R0915: Too many statements (64/50) (too-many-statements)
 asset.py:228:4: C0116: Missing function or method docstring (missing-function-docstring)
 asset.py:249:4: C0116: Missing function or method docstring (missing-function-docstring)
 asset.py:257:4: C0116: Missing function or method docstring (missing-function-docstring)

Fix all the warnings except for the R0912 and R0915 which will be tackled
in a later commit.
And while we're at it, also add a proper SPDX license identifier.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260324163543.55503-3-thuth@redhat.com>
2026-03-27 21:14:34 +01:00
Peter Maydell
91f6a9cb1b Merge tag 'qga-pull-2026-03-27' of https://github.com/kostyanf14/qemu into staging
qga-pull-2026-03-27

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEwsLBCepDxjwUI+uE711egWG6hOcFAmnGxwgACgkQ711egWG6
# hOdp2Q/+KEAF9+CNBJSwlfiNpC8U0SK0IzgP/PRGADUrZa422dWxmbwxyU3RkMY5
# HbFyupLCpnUn+CrmLwUyEDVXAWDox78SGPNt9L/E/GxnVKXgIi/caPayk2SSMrll
# gGlbvc4NMQc6bZwoPiqms58Fm9N0QlgA20TP8yg7doViuWOEhVK2cP8rR0TWWkQ1
# 69EJ7uEwNYhAVrC66ajPZMcH1JEmsLydNbHZK0AcsId32C+mbug71ewRTG5Uq9hS
# a1y3UaylDNuO+alLqpYj2Ej9ouTO0leSvnWOPrPGNdpONHhb5FXZ2whviiKbpAq/
# nGYi39slrxMsc67kkpnlztWwDrUW2XL2D1eF71WwAvSSGJdKd/4tJo1zvW3kMmTG
# NB4rJ7tud7ko63lsuMYnlocKgobeqDBjtY+OjDjn294gVJ5qkpWIdvbGn4pCePEZ
# EPgeRso3zoIYW0FQmOfxJ8pj3RkaINP3CvGbrbPoozYD6Q+Y3O5KEzwLCn1RofGc
# FwyaOlTAAFdTjGYveRhGfk/4TffI29MzJD2dSqdRDJNjDfhjJDK6E2MHwkEMgOXB
# 7dkZhEIssgQIGEVElVv8xb0sadAGkEWA8a0ytcdSqYGGjzgbEPWbz2Ywp5Mee+8T
# XNCam/GlzwnYSpU+Ar2VsicYK20nKeu0CO5RzuCzKJw/QZv2FF8=
# =8J6E
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Mar 27 18:06:00 2026 GMT
# gpg:                using RSA key C2C2C109EA43C63C1423EB84EF5D5E8161BA84E7
# gpg: Good signature from "Kostiantyn Kostiuk (Upstream PR sign) <kkostiuk@redhat.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: C2C2 C109 EA43 C63C 1423  EB84 EF5D 5E81 61BA 84E7

* tag 'qga-pull-2026-03-27' of https://github.com/kostyanf14/qemu:
  scripts/qemu-guest-agent/fsfreeze-hook: Fix syslog-fallback logic
  scripts/qemu-guest-agent/fsfreeze-hook: Avoid use of PIPESTATUS
  scripts/qemu-guest-agent/fsfreeze-hook: Avoid bash-isms

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-27 18:41:05 +00:00
Peter Maydell
bbaad5ee25 Merge tag 'pr-gh_rename-20260327' of https://gitlab.com/pbo-linaro/qemu into staging
Changes:
- [PATCH] docs and tests: assets moved after GitHub account renaming (Pierrick Bouvier <pierrick.bouvier@linaro.org>)
  Link: https://lore.kernel.org/qemu-devel/20260326214436.256215-1-pierrick.bouvier@linaro.org

# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEZrmU7KFPfy5auggff5BUDQoc0A8FAmnGy6AACgkQf5BUDQoc
# 0A+Etgv9HpSzNWwdQ4kdKjlTH37zJzkIQ5iz4e1KefOkRGwolGc2ODF3ibiUP6hP
# 3OTBNHvOI6kkM0aYRqYlMTvyDxIXkEb8TCOfLHdO1vC8sYt9/0GqWoNrrCVPZy/a
# QH9dsNtRzHp7kKcSOPP4spe900mmGXnbEQ4mDhHp22an14MPXnnDIE1lrIBVRei6
# 06TFrhj1kVWhOqpSbMPT7YOZyDewqq+HNORnyuF7Z8w5aKZnGpmnb51x4tcwavjH
# vR+SRW6bXl0RuX9CA5XbA58OS9EINnDjCYA7Prj2fNwYZpt2dX+MRRW+SMTtbGxV
# jGWYmdygDLaj7EUSK8AJuguCS4Me3yOGyGad8PNFp0b900do/QHM/xaGxYmdIjyO
# 2IXe9bcuPa4S3WoV72VXnMtc7qEl9dPfBhLv9KExQA4MtQhF+cycf8+kTNnEaUck
# wX0oYuS4Lr/Q0b8mcMyhvr21ujc2HA6R/m/KRo0BgQ3BnzjxMR9TLMtxV6SqpVkC
# RnaBCozz
# =TSoR
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Mar 27 18:25:36 2026 GMT
# gpg:                using RSA key 66B994ECA14F7F2E5ABA081F7F90540D0A1CD00F
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@linaro.org>" [undefined]
# 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: 66B9 94EC A14F 7F2E 5ABA  081F 7F90 540D 0A1C D00F

* tag 'pr-gh_rename-20260327' of https://gitlab.com/pbo-linaro/qemu:
  docs and tests: assets moved after GitHub account renaming

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-27 18:40:53 +00:00
Pierrick Bouvier
d5a678c87c docs and tests: assets moved after GitHub account renaming
GitHub setup a permanent redirection for all repositories when accounts,
so the old links will keep on working also.

However, GitHub allow this username to be reused again. To ensure no one
can inject malicious content, I took ownership of the (newly free)
pbo-linaro account [1], so no one else can claim it.

[1] https://github.com/pbo-linaro

Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260326214436.256215-1-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-03-27 11:25:02 -07:00
Peter Maydell
08497afcb2 scripts/qemu-guest-agent/fsfreeze-hook: Fix syslog-fallback logic
In the fsfreeze script we attempt to implement "log to a file if we
can, and fall back to syslog if we cannot".  We do this with:

  [ ! -w "$LOGFILE" ] && USE_SYSLOG=1
  touch "$LOGFILE" >/dev/null 2>&1 || USE_SYSLOG=1

This has a weird behaviour if it is run in a setup where we have
permissions that would allow us to write to $LOGFILE but it does not
currently exist.  On the first execution, the '-w' fails and so we
set USE_SYSLOG=1.  But since we also do the "touch $LOGFILE" step we
create an empty logfile.  Then on the second time the script is
executed, we see a writeable logfile and will use it.  The effect is
"log to syslog once, then to the logfile thereafter", which is not
likely to be what anybody wants.

Update the condition of the first check to only pick syslog if
the logfile exists but is not writable. This means that:
 * if the logfile doesn't exist but we are able to create it,
   we will create it and use it
 * if the logfile already exists and we can write to it,
   we will use it
 * if the logfile already exists but we can't write to it,
   we will fall back to syslog
 * if the logfile doesn't exist and we can't create it,
   we will fall back to syslog

Cc: qemu-stable@nongnu.org
Fixes: 85978dfb6b ("qemu-ga: Optimize freeze-hook script logic of logging error")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260317094806.1944053-4-peter.maydell@linaro.org
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
2026-03-27 19:55:01 +02:00
Peter Maydell
65b9f4791c scripts/qemu-guest-agent/fsfreeze-hook: Avoid use of PIPESTATUS
PIPESTATUS is a bash-specific construct, and this script is supposed
to be POSIX shell. We only use it in one place, to capture the exit
status of a command whose output we are piping to 'logger'.

Replace the PIPESTATUS usage with the trick described in
https://unix.stackexchange.com/questions/14270/get-exit-status-of-process-thats-piped-to-another/70675#70675
which uses a command-group to capture the status of the
first process in the pipeline.

Cc: qemu-stable@nongnu.org
Fixes: 85978dfb6b ("qemu-ga: Optimize freeze-hook script logic of logging error")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3339
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260317094806.1944053-3-peter.maydell@linaro.org
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
2026-03-27 19:55:01 +02:00
Peter Maydell
b5abb655fa scripts/qemu-guest-agent/fsfreeze-hook: Avoid bash-isms
The fsfreeze-hook script starts with #!/bin/sh, but it uses
several bash-specific constructs, resulting in misbehaviour
on guest systems where /bin/sh is some other POSIX shell.

Fix the simple ones reported by shellcheck:

In scripts/qemu-guest-agent/fsfreeze-hook line 27:
touch "$LOGFILE" &>/dev/null || USE_SYSLOG=1
                 ^---------^ SC3020 (warning): In POSIX sh, &> is undefined.

In scripts/qemu-guest-agent/fsfreeze-hook line 31:
    local message="$1"
    ^-----------^ SC3043 (warning): In POSIX sh, 'local' is undefined.

In scripts/qemu-guest-agent/fsfreeze-hook line 46:
    log_message "Executing $file $@"
                                 ^-- SC2145 (error): Argument mixes string and array. Use * or separate argument.

In scripts/qemu-guest-agent/fsfreeze-hook line 55:
    if [ $STATUS -ne 0 ]; then
         ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting.

There is also a use of PIPESTATUS that is more complex to fix;
that will be dealt with in a separate commit.

Cc: qemu-stable@nongnu.org
Fixes: 85978dfb6b ("qemu-ga: Optimize freeze-hook script logic of logging error")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260317094806.1944053-2-peter.maydell@linaro.org
Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
2026-03-27 19:55:01 +02:00
Peter Maydell
770f50c14f Merge tag 'pull-nvme-20260326' of https://gitlab.com/birkelund/qemu into staging
nvme queue

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEUigzqnXi3OaiR2bATeGvMW1PDekFAmnE7OEACgkQTeGvMW1P
# Delfsgf/Z1L/MTif4pciPpSqvSo0D4NtaGCdqJDe+meA2/Z93SWokjDk21DoQ0qb
# A3ZdOE0jNGF3pjpWA82OWzVdk3Lur12tYvPq8HpnmoR76Ou3ZqQJlLXcLuT5jkHH
# hFJZRfu4gIGKS8Fks+MKsqwH+oB6bNpvXN87T6IpzF2U9aPqNM00wa678ALUDbjr
# rZBA7Zp0eyhCyKgB2IU+3X70tr4gQ0ZxkQrXAenzF2uWz1qsOCCvoSZvmFR8DDRV
# H5uG4fFvDXn+AceCbu/guvCtf6tiQ0cNr+SStb3DktxUU9BR3LaWXHtxlH4ic5sm
# xbc4dCE1tHo5sytu3nw/enWgSqqsYw==
# =Qmni
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Mar 26 08:22:57 2026 GMT
# gpg:                using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [full]
# gpg:                 aka "Klaus Jensen <k.jensen@samsung.com>" [full]
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#      Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'pull-nvme-20260326' of https://gitlab.com/birkelund/qemu:
  hw/nvme: fix heap-buffer-overflow in nvme_abort
  hw/nvme: re-enable wzds bit in namespace dlfeat

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-26 10:26:39 +00:00
Peter Maydell
0b4c378fbc Merge tag 'pr-plugins-20260325' of https://gitlab.com/pbo-linaro/qemu into staging
Changes:
- [PATCH 0/3] plugins: fix endianness for qemu_plugin_mem_get_value() (Pierrick Bouvier <pierrick.bouvier@linaro.org>)
   Link: https://lore.kernel.org/qemu-devel/20260325024252.3369186-1-pierrick.bouvier@linaro.org

# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEZrmU7KFPfy5auggff5BUDQoc0A8FAmnEWRAACgkQf5BUDQoc
# 0A/bnwv+M7tE/AxJBopnzMcAl2TAzYJXW2ZvipPutnPd83XNu5O/g1IBaQzGr06n
# 21SmDiNy7hUIW13bTPJXljycrykAgx320Fuj6R+E59Pa2D4sk7vJcwN7aJhMTgWy
# S0HhAeasHiNcPoEb8jPq6sGzS+wt4Xh+kmdjBa3CjIeerMMo/0bipUGn92Q01M81
# h+R9gDKmgtDci/fDx66Fvz8hE7P6jFTx6rHL1e1ksFBJ+FqYt9SQXQLqCcDLKzbo
# SW9k8wju1POxaKvf3Dg5vctejoogFzJCtKF7M/Fa4qo0DXzJP6eDMhlHcvzjfedJ
# xeVirOd5x3CO4AZ5KHCAoQWPu++UeGhirGhRCFc4s2MUopTwN8t4FGR0wpZxzGYC
# gNHB7/F3cm+pulMbr2MQZg3xVyy0q9+2ltNGjwo/vyjG4RxUIvNX6dsxu2sZ7Zpw
# lT1NqX0/4AlMsfeQCV3Rnx0V7+4HGarpbBZw5+Pgz2uhbP5g5ik5WBJY9rCzpwM/
# tFY4CTL4
# =NqGd
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Mar 25 21:52:16 2026 GMT
# gpg:                using RSA key 66B994ECA14F7F2E5ABA081F7F90540D0A1CD00F
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@linaro.org>" [undefined]
# 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: 66B9 94EC A14F 7F2E 5ABA  081F 7F90 540D 0A1C D00F

* tag 'pr-plugins-20260325' of https://gitlab.com/pbo-linaro/qemu:
  tests/tcg/plugins/mem.c: fix endian swap in update_region_info
  include/plugins/qemu-plugin.h: add note about endianness of value returned by qemu_plugin_mem_get_value
  tcg: Pass host-endian values to plugin_gen_mem_callbacks_*

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-26 10:26:30 +00:00
Kaixuan Li
eb5cc99aff hw/nvme: fix heap-buffer-overflow in nvme_abort
In nvme_abort(), the submission queue pointer is dereferenced from the
guest-controlled sqid before validating it with nvme_check_sqid():

    NvmeSQueue *sq = n->sq[sqid];

Since sqid is a 16-bit value (range 0-65535) taken directly from CDW10,
and n->sq[] is typically only max_ioqpairs+1 (65) entries, a malicious
guest can trigger an out-of-bounds heap read by sending an Abort command
with a large sqid.

ASan reports this as heap-buffer-overflow in nvme_abort.

Fix this by moving the array dereference to after the nvme_check_sqid()
bounds validation.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3348
Fixes: 75209c071a ("hw/nvme: actually implement abort")
Cc: qemu-stable@nongnu.org
Signed-off-by: Kaixuan Li <kaixuanli@ntu.edu.sg>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
2026-03-26 09:14:35 +01:00
Pankaj Raghav
55720ba97d hw/nvme: re-enable wzds bit in namespace dlfeat
dlfeat was changed from 0x9 to 0x1 when PI support was added.
It was removed because we can't rely on unmap and have to physically
clear it to get the checksums right but that doesnt mean that we do not
support the bit.

The spec says that if wzds is enabled, then the controller supports
deallocate (DEAC) on write zeroes. But DEAC bit in write zeroes command
is only a hint, the controller might choose to physically write zeroes in
those areas.

As we are sending write zeroes command with BDRV_REQ_MAY_UNMAP to the
underlying block device anyway (if the unmap operation is supported),
change the dlfeat value back to 0x9.

A new flag FALLOC_FL_WRITE_ZEROES has been introduced in linux for
fallocate which will use the wzds bit in dlfeat to quickly zeroout extents
using unmap operation whenever possible[1].

[1] https://lore.kernel.org/linux-fsdevel/20250619111806.3546162-1-yi.zhang@huaweicloud.com/

Fixes: 146f720c55 ("hw/block/nvme: end-to-end data protection")
Suggested-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
2026-03-26 09:14:35 +01:00
Pierrick Bouvier
e074c90947 tests/tcg/plugins/mem.c: fix endian swap in update_region_info
value returned by qemu_plugin_mem_get_value() is always in host-endian
order, so we need to convert TO target endianness and not FROM it.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260325024252.3369186-4-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-03-25 14:51:15 -07:00
Pierrick Bouvier
a08fff99be include/plugins/qemu-plugin.h: add note about endianness of value returned by qemu_plugin_mem_get_value
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260325024252.3369186-3-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-03-25 14:51:15 -07:00
Richard Henderson
539421a428 tcg: Pass host-endian values to plugin_gen_mem_callbacks_*
If the host does not support swapped-endian loads and stores,
then we emulate those within the tcg expanders with explicit
bswap operations.

However, we were passing values to the plugin interface in
the middle of those bswap operations, which meant that we
would pass values of the wrong endianness to plugins when
running on hosts without swapped-endian loads and stores.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3351
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260325024252.3369186-2-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
2026-03-25 14:51:15 -07:00
Peter Maydell
3c46691f16 Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* tests/functional: preserve PYTHONPATH entries
* target/i386: show GMET feature
* target/i386/emulate, whpx/i386: on-demand access to runtime state, MMU fixes
* tdx: fix use-after-free in tdx_fetch_cpuid
* treewide: replace qemu_hw_version() with QEMU_HW_VERSION
* sb16: detect invalid migration stream

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmnEGeAUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroM8wgf/VuuB+yMlsgtDEG1jnAsQcg0gu+p6
# gIBb87RFyZKdrs6ZOtSfgyfo1XRBiHYr/UYoTIkz0PaOb+Scpq5QPKUDceGqUgAm
# g3GBtGxTN5tekQzcYFE4flIewsIFXNQh7Wgq4OWLMJqvBm3hoTEyaRMc6hS+F+S5
# Lyd81VWeV5zmer/+PdMH/gpG5+p4a+Me/NsEsd1xhnckakPbiaWJ/o76BxIt6GLo
# 3AwHuBr+l6wfg5OCv3WIz3y/HmeFuHnXYicvagoPVKgT1bH8zNeaRKeXVknl0rQn
# 6ficJOa0AyDlI9UcUBG4ivQrmdeiWMaiB+Hx2Yd+KW3DRgg8wRdp7tvlSw==
# =uGpa
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Mar 25 17:22:40 2026 GMT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# 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:
  target/i386: emulate: follow priv_check_exempt
  target/i386: emulate: set PG_ERROR_W_MASK as expected
  target/i386: expose AMD GMET feature
  hw/audio/sb16: validate VMState fields in post_load
  whpx: i386: fast runtime state reads
  whpx: i386: fetch segments on-demand
  target/i386: emulate: segmentation rework
  whpx: i386: indirect access to CRs
  target/i386: emulate: indirect access to CRs
  whpx: i386: add implementation of new x86_emul_ops
  target/i386: emulate: add new callbacks
  whpx: i386: don't restore segment registers after MMIO handling
  whpx: i386: skip XCRs read for MMIO exits
  whpx: i386: skip TSC read for MMIO exits
  whpx: i386: enable exceptions VM exit only when needed
  whpx: i386: workaround for Windows 10 support
  treewide: replace qemu_hw_version() with QEMU_HW_VERSION
  tdx: fix use-after-free in tdx_fetch_cpuid
  tests/functional: preserve PYTHONPATH entries

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-25 19:36:04 +00:00
Mohamed Mediouni
ba41e52541 target/i386: emulate: follow priv_check_exempt
Follow priv_check_exempt flag argument for
x86_write_mem_priv/x86_read_mem_priv.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260324230016.80914-3-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-25 18:22:27 +01:00
Mohamed Mediouni
a003cd280e target/i386: emulate: set PG_ERROR_W_MASK as expected
Make setting PG_ERROR_W_MASK no longer dependent on the access
being a priv violation.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260324230016.80914-2-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-25 18:22:27 +01:00
Paolo Bonzini
746a823a17 target/i386: expose AMD GMET feature
This is implemented entirely by the hypervisor, so only the bit has to be
exposed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-25 18:22:27 +01:00
Jenny Guanni Qu
cb1e8c18df hw/audio/sb16: validate VMState fields in post_load
The SB16 VMState loads in_index and out_data_len as raw INT32
values with no bounds validation. A crafted migration stream or
VM snapshot can set these to values exceeding their respective
buffer sizes (in2_data[10] and out_data[50]), causing heap OOB
write in dsp_write() and heap OOB read in dsp_read().

Add bounds checks in sb16_post_load() to reject invalid values
before they can be used as array indices.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3326
Reported-by: Jenny Guanni Qu <qguanni@gmail.com>
Signed-off-by: Jenny Guanni Qu <qguanni@gmail.com>
Link: https://lore.kernel.org/r/20260318192918.65481-1-qguanni@gmail.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-25 18:22:27 +01:00
Mohamed Mediouni
378b1fdb1a whpx: i386: fast runtime state reads
Now that there's an on-demand interface for fetching CRs
and segments, only query GPRs and query everything else
on-demand for vmexits.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260324151323.74473-13-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-25 18:22:27 +01:00