]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
4 months agotarget/ppc: Replace TARGET_PAGE_BITS -> qemu_target_page_bits()
Philippe Mathieu-Daudé [Fri, 13 Mar 2026 04:09:52 +0000 (05:09 +0100)] 
target/ppc: Replace TARGET_PAGE_BITS -> qemu_target_page_bits()

Get the target page bits at runtime.

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

4 months agohw/s390x/vfio: Replace TARGET_PAGE_BITS -> qemu_target_page_bits()
Philippe Mathieu-Daudé [Fri, 13 Mar 2026 05:34:33 +0000 (06:34 +0100)] 
hw/s390x/vfio: Replace TARGET_PAGE_BITS -> qemu_target_page_bits()

Get the target page bits at runtime.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260313062055.2188-4-philmd@linaro.org>

4 months agohw/misc: Build 'mac_via' as common unit file
Philippe Mathieu-Daudé [Fri, 13 Mar 2026 04:52:08 +0000 (05:52 +0100)] 
hw/misc: Build 'mac_via' as common unit file

Nothing there is target-specific anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260313062055.2188-39-philmd@linaro.org>

4 months agohw/display: Build stubs once
Philippe Mathieu-Daudé [Tue, 24 Feb 2026 18:14:34 +0000 (19:14 +0100)] 
hw/display: Build stubs once

Move stubs to the global stub_ss[] source set. These files
are now built once for all binaries, instead of one time
per system binary.

Add pixman to qemuutil library dependencies since pixman is
transitively included, which is needed to be able to include
prototypes for stubs we declared:

  In file included from include/ui/console.h:4,
  include/ui/qemu-pixman.h:10:10: fatal error: pixman.h: No such file or directory
     10 | #include <pixman.h>
        |          ^~~~~~~~~~

On OpenBSD, opengl headers are not available in default
include path, and thus we need to add opengl to list of
qemuutil dependencies, otherwise we get:

  In file included from ../hw/display/acpi-vga-stub.c:4:
  In file included from ../hw/display/vga_int.h:28:
  In file included from include/ui/console.h:9:
  include/ui/surface.h:11:11: fatal error: 'epoxy/gl.h' file not found
  # include <epoxy/gl.h>
            ^~~~~~~~~~~~
  1 error generated.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260225035739.42848-8-philmd@linaro.org>
Co-developed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260315070834.198331-4-pierrick.bouvier@linaro.org>

4 months agoplugins/api-system: Handle migrate_add_blocker() failure
Trieu Huynh [Tue, 17 Mar 2026 13:47:33 +0000 (22:47 +0900)] 
plugins/api-system: Handle migrate_add_blocker() failure

migrate_add_blocker() can fail (e.g. if migration is already in
progress), in which case it returns a negative value and populates
its errp argument with the reason.

The previous code ignored the return value. Pass &error_fatal so
that on failure QEMU exits cleanly with an informative error message
rather than continuing in an inconsistent state.

Resolves: CID 1645470
Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260317134733.126584-1-vikingtc4@gmail.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
4 months agofsdev: Build stubs once
Philippe Mathieu-Daudé [Tue, 24 Feb 2026 16:25:35 +0000 (17:25 +0100)] 
fsdev: Build stubs once

Move stubs to the global stub_ss[] source set. These files
are now built once for all binaries, instead of one time
per system binary.

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

4 months agotests/qtest/test-hmp: Free machine options
Fabiano Rosas [Fri, 13 Mar 2026 18:29:54 +0000 (15:29 -0300)] 
tests/qtest/test-hmp: Free machine options

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260313182957.28432-3-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agotests/qtest: Don't dup machine name in qtest_cb_for_every_machine callbacks
Fabiano Rosas [Fri, 13 Mar 2026 18:29:53 +0000 (15:29 -0300)] 
tests/qtest: Don't dup machine name in qtest_cb_for_every_machine callbacks

The qtest_get_machines function caches the list of machines in a
static variable. Dup'ing the machine->name string only serves to leak
that memory when a single test is executed.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260313182957.28432-2-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agomigration: fix implicit integer division in migration_update_counters
Aadeshveer Singh [Mon, 16 Mar 2026 13:45:09 +0000 (19:15 +0530)] 
migration: fix implicit integer division in migration_update_counters

switchover_bw is a uint64_t, so switchover_bw / 1000 results in an
integer division. This value is then assigned to expected_bw_per_ms
which is of type double. This results in losing precision and is type
unsafe. Adding explicit cast ensures floating-point division.

Signed-off-by: Aadeshveer Singh <aadeshveer07@gmail.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260316134509.157964-1-aadeshveer07@gmail.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agocoreaudio: Initialize the buffer for device change
Akihiko Odaki [Wed, 4 Mar 2026 06:16:59 +0000 (15:16 +0900)] 
coreaudio: Initialize the buffer for device change

Reallocate buffers when the active device change as the required buffer
size may differ.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
Acked-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260304-coreaudio-v8-6-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp>

4 months agoaudio: Add functions to initialize buffers
Akihiko Odaki [Wed, 4 Mar 2026 06:16:58 +0000 (15:16 +0900)] 
audio: Add functions to initialize buffers

These functions can be used to re-initialize buffers when hardware
parameters change due to device hotplug, for example.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260304-coreaudio-v8-5-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp>

4 months agocoreaudio: Commit the result of init in the end
Akihiko Odaki [Wed, 4 Mar 2026 06:16:57 +0000 (15:16 +0900)] 
coreaudio: Commit the result of init in the end

init_out_device may only commit some part of the result and leave the
state inconsistent when it encounters a fatal error or the device gets
unplugged during the operation, which is expressed by
kAudioHardwareBadObjectError or kAudioHardwareBadDeviceError. Commit the
result in the end of the function so that it commits the result iff it
sees no fatal error and the device remains plugged.

With this change, handle_voice_change can rely on core->outputDeviceID
to know whether the output device is initialized after calling
init_out_device.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260304-coreaudio-v8-4-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp>

4 months agocoreaudio: Improve naming
Akihiko Odaki [Wed, 4 Mar 2026 06:16:56 +0000 (15:16 +0900)] 
coreaudio: Improve naming

coreaudio had names that are not conforming to QEMU codding style.
coreaudioVoiceOut also had some members that are prefixed with redundant
words like "output" or "audio".
Global names included "out" to tell they are specific to output devices,
but this rule was not completely enforced.
The frame size had three different names "frameSize", "bufferFrameSize",
and "frameCount".

Replace identifiers to fix these problems.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260304-coreaudio-v8-3-bf1d40731e73@rsg.ci.i.u-tokyo.ac.jp>

4 months agoui/surface: Avoid including epoxy/gl.h in header files
Akihiko Odaki [Tue, 3 Mar 2026 13:08:56 +0000 (22:08 +0900)] 
ui/surface: Avoid including epoxy/gl.h in header files

include/ui/shader.h and include/ui/surface.h are included by files that
do not depend on Epoxy so they shouldn't include epoxy/gl.h. Otherwise,
compilations of these files can fail because the path to the directory
containing epoxy/gl.h may not be passed to the compiler.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260303-gl-v1-3-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp>

4 months agoui/console: Remove DisplaySurface::mem_obj
Akihiko Odaki [Tue, 3 Mar 2026 13:08:55 +0000 (22:08 +0900)] 
ui/console: Remove DisplaySurface::mem_obj

Only spice uses it so move it to spice.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260303-gl-v1-2-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp>

4 months agoui/console: Unify pixman-OpenGL format mapping
Akihiko Odaki [Tue, 3 Mar 2026 13:08:54 +0000 (22:08 +0900)] 
ui/console: Unify pixman-OpenGL format mapping

console_gl_check_format() was supposed to check if the pixman format is
supported by surface_gl_create_texture(), but it missed
PIXMAN_BE_x8r8g8b8 and PIXMAN_BE_a8r8g8b8, which are properly mapped to
OpenGL formats by surface_gl_create_texture().

Fix the discrepancy of the two functions by sharing the code to map
pixman formats to OpenGL ones.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260303-gl-v1-1-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp>

4 months agodump: enhance dump_state_prepare fd initialization
Nikolai Barybin [Thu, 11 Sep 2025 12:36:55 +0000 (15:36 +0300)] 
dump: enhance dump_state_prepare fd initialization

Initializing descriptor with zero is unsafe: during cleanup we risk to
unconditional close of fd == 0 in case dump state wasn't fully
initialized. Thus, let's init fd with -1 value and check its value
before closing it.

Signed-off-by: Nikolai Barybin <nikolai.barybin@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20250911123656.413160-2-nikolai.barybin@virtuozzo.com>

4 months agoui/gtk-egl: Ensure EGL surface is available before drawing
Dongwon Kim [Tue, 3 Mar 2026 01:11:51 +0000 (17:11 -0800)] 
ui/gtk-egl: Ensure EGL surface is available before drawing

The EGL surface and context are destroyed when a new GTK window is
created. We must ensure these are recreated and initialized before
any rendering happens in gd_egl_refresh.

Currently, the check for a pending draw is performed before the
surface initialization block. This can result in an attempt to
draw when the EGL surface (vc->gfx.esurface) is not yet available.

This patch moves the drawing check after the surface initialization
to ensure a valid surface exists before rendering in gd_egl_refresh.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260303011151.1925827-1-dongwon.kim@intel.com>

4 months agoui/dbus-listener: remove dbus_filter on connection close
Marc-André Lureau [Tue, 3 Mar 2026 16:41:12 +0000 (17:41 +0100)] 
ui/dbus-listener: remove dbus_filter on connection close

The dbus filter holds a strong reference to the DBusDisplayListener
(via GDestroyNotify) to ensure the listener remains alive while the
filter may still be running in another thread. This creates a
reference cycle (ddl -> conn -> filter -> ddl) that prevents the
listener from being freed.

Break the cycle by connecting to the connection's "closed" signal
and removing the filter when the connection closes.

Fixes: commit fa88b85dea96 ("ui/dbus: filter out pending messages when scanout")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
4 months agoui/dbus-listener: Fix FBO leak in dbus_cursor_dmabuf
Marc-André Lureau [Tue, 3 Mar 2026 16:36:06 +0000 (17:36 +0100)] 
ui/dbus-listener: Fix FBO leak in dbus_cursor_dmabuf

cursor_fb is a local egl_fb that gets an FBO allocated via
egl_fb_setup_for_tex but is never destroyed, leaking the
framebuffer object on every cursor update.

Add egl_fb_destroy() after the cursor data has been read.

Fixes: commit 142ca628a7 ("ui: add a D-Bus display backend")
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
4 months agovirtio-gpu: use computed rowstride instead of deriving it from hostmem
Marc-André Lureau [Tue, 10 Mar 2026 21:26:54 +0000 (01:26 +0400)] 
virtio-gpu: use computed rowstride instead of deriving it from hostmem

Since calc_image_hostmem() already computes the stride, return it and
use it directly. This is both simpler and more correct.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-Id: <20260311-cve-v1-2-f72b4c7c1ab2@redhat.com>

4 months agovirtio-gpu: fix overflow check when allocating 2d image
Marc-André Lureau [Tue, 10 Mar 2026 21:26:53 +0000 (01:26 +0400)] 
virtio-gpu: fix overflow check when allocating 2d image

The calc_image_hostmem() comment says pixman_image_create_bits() checks
for overflow. However, this relied on the facts that "bits" was NULL and
it performed it when it was introduced. Since commit 9462ff4695aa, the
"bits" argument can be provided and the check is no longer applied.

Promotes the computation to uint64_t and adds an explicit overflow check
to avoid potential later OOB read/write on the image data.

Fixes: CVE-2026-3886
Fixes: ZDI-CAN-27578
Fixes: 9462ff4695aa ("virtio-gpu/win32: allocate shareable 2d resources/images")
Reported-by: Zero Day Initiative <zdi-disclosures@trendmicro.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-Id: <20260311-cve-v1-1-f72b4c7c1ab2@redhat.com>

4 months agoui/vdagent: add migration blocker when machine version < 10.1
Fiona Ebner [Tue, 10 Mar 2026 14:25:39 +0000 (15:25 +0100)] 
ui/vdagent: add migration blocker when machine version < 10.1

In QEMU 10.1, commit 5d56bff11e ("ui/vdagent: add migration support")
added migration support for the vdagent chardev and commit 42000e0013
("ui/vdagent: remove migration blocker") removed the migration
blocker. No compat for older machine versions was added, so migration
with pre-10.1 machine version, from a 10.1 binary to a pre-10.1 binary
will result in a failure when loading the VM state in the target
instance:

> Unknown savevm section or instance 'vdagent' 0. Make sure that your
> current VM setup matches your saved VM setup, including any
> hotplugged devices

Add a compat flag to block migration when the machine version is less
than 10.1 to avoid this.

Cc: qemu-stable@nongnu.org
Fixes: 42000e0013 ("ui/vdagent: remove migration blocker")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20260310142552.240877-1-f.ebner@proxmox.com>

4 months agorutabaga: improve error handling, fix potential crash during init
Marc-André Lureau [Tue, 27 Jan 2026 12:09:34 +0000 (16:09 +0400)] 
rutabaga: improve error handling, fix potential crash during init

When virtio_gpu_rutabaga_get_num_capsets() returns 0, virtio_init()
isn't called and the device later crashes during realize.
==72545==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x556ad6f7ba9e bp 0x7ffe6958f810 sp 0x7ffe6958f7e0 T0)
==72545==The signal is caused by a READ memory access.
==72545==Hint: address points to the zero page.
#0 0x556ad6f7ba9e in virtio_memory_listener_commit ../hw/virtio/virtio.c:4034
#1 0x556ad6a24c96 in listener_add_address_space ../system/memory.c:3128
#2 0x556ad6a25d15 in memory_listener_register ../system/memory.c:3216
#3 0x556ad6f7bf11 in virtio_device_realize ../hw/virtio/virtio.c:4075

Rework error handling of the function to set Error appropriately. 0
capset may be ok now.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
4 months agoaudio/mixeng: drop some needless checks
Marc-André Lureau [Tue, 24 Feb 2026 16:32:29 +0000 (17:32 +0100)] 
audio/mixeng: drop some needless checks

The NULL checks for be, name, callback_fn, and as in
audio_mixeng_backend_open_{in,out} are redundant: the callers
audio_be_open_{in,out} already assert that name, callback_fn, and as
are non-NULL, and dereference be unconditionally via
AUDIO_BACKEND_GET_CLASS(be) before the call.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20260224163229.2918858-1-marcandre.lureau@redhat.com>

4 months agomigration/options: Fix leaks in StrOrNull qdev accessors
Fabiano Rosas [Thu, 12 Mar 2026 20:46:19 +0000 (17:46 -0300)] 
migration/options: Fix leaks in StrOrNull qdev accessors

Fix a couple of possible leaks detected by Coverity. Both are
currently harmless. This code is only used for the very specific
purpose of maintaining compatibility of a few migration options which
can be set via QEMU command line (-global migration.tls-*). The
command line interface is not supported and only used during
development and testing.

1) The setter function set_StrOrNull() is invoked whenever the -global
migration.tls-* command line options are set. The way it could leak is
that the temporary "StrOrNull *str_or_null" object is allocated before
calling the visitor, which could fail and cause an early return of the
function, leaving *ptr unset and str_or_null leaking.

2) The getter function get_StrOrNull() is unreachable code. It's only
there to provide a complete implementation of the property. Still, the
way it could leak is that the temporary "StrOrNull *str_or_null" might
be allocated and is simply never returned to the caller nor freed.

Fix the possible leaks:

1) at set_StrOrNull(): change the allocation of str_or_null to happen
only after the visit call has returned successfully.

2) at get_StrOrNull(): assert that the object is non-NULL, there is no
need for a temporary object.

The reason it should be non-NULL is that the property is initialized
by the default setter of the qdev property. The initialization is
unlikely to fail because the call to the setter is setup by qdev,
which has boilerplate ensuring the to-be-set object is allocated and
of the correct type. Moreover, passing NULL via command line to
-global migration.tls-* is not possible.

A programming error could result in an invalid call to the setter,
which would leave the object NULL and cause a crash in the getter, but
that's not a worthwhile scenario to protect against given the low
probability of this code being even reached.

While here, update the comment about why there's no QNULL in this
StrOrNull property to be more clear.

Fixes: CID 1643919
Fixes: CID 1643920
Cc: Markus Armbruster <armbru@redhat.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Link: https://lore.kernel.org/qemu-devel/20260312204619.1969-1-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agomigration: assert that the same migration handler is not being added twice
Ani Sinha [Wed, 11 Mar 2026 07:01:14 +0000 (12:31 +0530)] 
migration: assert that the same migration handler is not being added twice

Currently the code that adds a migration blocker does not check if the same
blocker already exists. Assert that the migration handler being added has
not been added already.

CC: Markus Armbruster <armbru@redhat.com>
CC: Peter Xu <peterx@redhat.com>
CC: Prasad Pandit <pjp@fedoraproject.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260311070114.164434-1-anisinha@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agotests/qtest/migration: Force exit-on-error=false
Fabiano Rosas [Wed, 11 Mar 2026 21:34:18 +0000 (18:34 -0300)] 
tests/qtest/migration: Force exit-on-error=false

Some tests can cause QEMU to exit(1) too early while the incoming
coroutine has not yielded for a first time yet. This trips ASAN
because resources related to dispatching the incoming process will
still be allocated in the io/channel.c layer without a
straight-forward way for the migration code to clean them up.

As an example of one such issue, the UUID validation happens early
enough that the temporary socket from qio_net_listener_channel_func()
still has an elevated refcount. If it fails, the listener dispatch
code never gets to free the resource:

Direct leak of 400 byte(s) in 1 object(s) allocated from:
    #0 0x55e668890a07 in malloc asan_malloc_linux.cpp:68:3
    #1 0x7f3c7e2b6648 in g_malloc ../glib/gmem.c:130
    #2 0x55e66a8ef05f in object_new_with_type ../qom/object.c:767:15
    #3 0x55e66a8ef178 in object_new ../qom/object.c:789:12
    #4 0x55e66a93bcc6 in qio_channel_socket_new ../io/channel-socket.c:70:31
    #5 0x55e66a93f34f in qio_channel_socket_accept ../io/channel-socket.c:401:12
    #6 0x55e66a96752a in qio_net_listener_channel_func ../io/net-listener.c:64:12
    #7 0x55e66a94bdac in qio_channel_fd_source_dispatch ../io/channel-watch.c:84:12
    #8 0x7f3c7e2adf4b in g_main_dispatch ../glib/gmain.c:3476
    #9 0x7f3c7e2adf4b in g_main_context_dispatch_unlocked ../glib/gmain.c:4284
    #10 0x7f3c7e2b00c8 in g_main_context_dispatch ../glib/gmain.c:4272

The exit(1) also requires some tests to setup qtest to expect a return
code of 1 from the QEMU process. Although we can check migration
status changes to be fairly certain where the failure happened, there
is always the possibility of QEMU exiting for another reason and the
test passing. This happens frequently with sanitizers enabled, but
also risks masking issues in the regular build.

Stop allowing the incoming migration to exit and instead require the
tests to wait for the FAILED state and end QEMU gracefully with
qtest_quit.

In practice this means setting exit-on-error=false for every incoming
migration, changing MIG_TEST_FAIL_DEST_QUIT_ERR to MIG_TEST_FAIL and
waiting for a change of state where necessary.

With this, the MIG_TEST_FAIL_DEST_QUIT_ERR error result is now unused,
remove it.

The affected tests are:
validate_uuid_error
multifd_tcp_cancel
dirty_limit
precopy_unix_tls_x509_default_host
precopy_tcp_tls_no_hostname
tcp_tls_x509_mismatch_host
dbus_vmstate_missing_src
dbus_vmstate_missing_dst

Also add a comment to QEMU source explaining that the incoming
coroutine might block for a while until it yields as this is the
actual root cause of the issue.

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-6-farosas@suse.de
[assert that key doesn't already exists]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agomigration/multifd: Fix leaks of TLS error objects
Fabiano Rosas [Wed, 11 Mar 2026 21:34:17 +0000 (18:34 -0300)] 
migration/multifd: Fix leaks of TLS error objects

The code currently ignores errors from multifd threads that happen
after a first error has already been propagated. Make sure the
subsequent errors are freed appopriately.

This fixes a leak of the TLS session->werr when the certificate
validation fails after multifd threads are already running. The first
writes on the threads will fail deep into the gnutls stack.

No need to check if(err) because the callers are all under a similar
check.

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-5-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agotests/qtest/migration: Fix leak in CPR exec test
Fabiano Rosas [Wed, 11 Mar 2026 21:34:16 +0000 (18:34 -0300)] 
tests/qtest/migration: Fix leak in CPR exec test

The string was being dup'ed only to get around the const of the
qdict_get_str() return value.

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-4-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agoio: Fix TLS bye task leak
Fabiano Rosas [Wed, 11 Mar 2026 21:34:15 +0000 (18:34 -0300)] 
io: Fix TLS bye task leak

Recent fixes to TLS tasks memory handling have left the TLS bye task
uncovered. Fix by freeing the task in the same way the handshake task
is freed.

Direct leak of 704 byte(s) in 4 object(s) allocated from:
    #1 0x7f5909b1d6a0 in g_malloc0 ../glib/gmem.c:163
    #2 0x557650496d61 in qio_task_new ../io/task.c:58:12
    #3 0x557650475d7f in qio_channel_tls_bye ../io/channel-tls.c:352:12
    #4 0x55764f7a1bb4 in migration_tls_channel_end ../migration/tls.c:159:5
    #5 0x55764f709750 in migration_ioc_shutdown_gracefully ../migration/multifd.c:462:9
    #6 0x55764f6fcf53 in multifd_send_terminate_threads ../migration/multifd.c:493:13
    #7 0x55764f6fcafb in multifd_send_shutdown ../migration/multifd.c:580:5
    #8 0x55764f6e1b14 in migration_cleanup ../migration/migration.c:1323:9
    #9 0x55764f6f5bac in migration_cleanup_bh ../migration/migration.c:1350:5

Fixes: d39d0f3acd ("io: fix cleanup for TLS I/O source data on cancellation")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-3-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agotests/qtest/migration: Fix leak of migration tests data
Fabiano Rosas [Wed, 11 Mar 2026 21:34:14 +0000 (18:34 -0300)] 
tests/qtest/migration: Fix leak of migration tests data

When the migration-test is invoked with the '-p' flag (to run a single
test), the glib code won't call the destroy function for the
not-executed tests, causing the MigrationTest wrapper data to leak.

This doesn't affect make check, but affects debugging use-cases where
having a leak pop up in ASAN output is extra annoying.

Fix by adding the tests data to a list and freeing them all at the end
of migration-test execution. Any tests actually dispatched by glib
will have the destroy function called as usual.

Note that migration_test_add_suffix() is altered to call
migration_test_add() so that there's only one place adding the data to
the list.

Performance is not an issue at the moment, we have < 100 tests.

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Link: https://lore.kernel.org/qemu-devel/20260311213418.16951-2-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
4 months agoppc/pnv: fix dumpdtb option
Shivang Upadhyay [Wed, 11 Mar 2026 14:35:49 +0000 (20:05 +0530)] 
ppc/pnv: fix dumpdtb option

The '-machine dumpdtb' command line option stopped working on
PowerPC/pnv systems after recent design change [1].

Fixing this by generating fdt blob in `pnv_init`.

[1] https://lore.kernel.org/qemu-devel/20250206151214.2947842-1-peter.maydell@linaro.org/

Cc: Aditya Gupta <adityag@linux.ibm.com>
Cc: Harsh Prateek Bora <harshpb@linux.ibm.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: BALATON Zoltan <balaton@eik.bme.hu>
Cc: qemu-stable@nongnu.org
Fixes: 8fd2518ef2f8d34 ("hw: Centralize handling of -machine dumpdtb option")
Signed-off-by: Shivang Upadhyay <shivangu@linux.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20260311143549.118720-1-shivangu@linux.ibm.com
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
4 months agoblock/mirror: fix assertion failure upon duplicate complete for job using 'replaces'
Fiona Ebner [Wed, 11 Mar 2026 14:54:25 +0000 (15:54 +0100)] 
block/mirror: fix assertion failure upon duplicate complete for job using 'replaces'

If s->replace_blocker was already set by an earlier invocation of
mirror_complete(), then there will be an assertion failure when
error_setg() is called for it a second time. The bdrv_op_block_all()
and bdrv_ref() operations should only be done a single time too.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Message-Id: <20260311145717.668492-2-f.ebner@proxmox.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
4 months agorust: fix build when --disable-rust and meson < 1.9
Paolo Bonzini [Sat, 14 Mar 2026 07:50:51 +0000 (08:50 +0100)] 
rust: fix build when --disable-rust and meson < 1.9

Commit e65030ed50ee moved rust_std and build.rust_std from per-target
override_options into the project's default_options, in order to avoid
repetition.  However, default_options are validated unconditionally at
project initialization, even when Rust is disabled.  This breaks builds
with meson < 1.9.0 which does not know about "build.rust_std":

  meson.build:1:0: ERROR: Unknown option: "build.rust_std".

Make the options conditional on the meson version, since Rust only
supports new versions of Meson anyway.

Fixes: e65030ed50ee ("rust: remove unnecessary repetitive options")
Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agobuild-sys: use the "run" variable
Marc-André Lureau [Wed, 11 Feb 2026 10:33:05 +0000 (14:33 +0400)] 
build-sys: use the "run" variable

Avoid unused variables and hand-written path, this should also help meson
to figure out the relation between the commands.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20260211103305.3112657-1-marcandre.lureau@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4 months agoMerge tag 'pr-plugins-20260316' of https://gitlab.com/pbo-linaro/qemu into staging
Peter Maydell [Tue, 17 Mar 2026 10:20:30 +0000 (10:20 +0000)] 
Merge tag 'pr-plugins-20260316' of https://gitlab.com/pbo-linaro/qemu into staging

Changes:
- [PATCH] contrib/plugins/uftrace.c: fix depth for exit events (Pierrick Bouvier <pierrick.bouvier@linaro.org>)
Link: https://lore.kernel.org/qemu-devel/20260313063441.2048882-1-pierrick.bouvier@linaro.org
# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEZrmU7KFPfy5auggff5BUDQoc0A8FAmm4kCsACgkQf5BUDQoc
# 0A8gRQv+LZIiG75VL5cy+tpdD+kcwu+hsQ5Y6qGA6zs9TrdARxKtQ2Ozg9VjrMGE
# bTzhxo7ldwEjcki8bvi4yYN3uXtJzg/PODYcN7KWdqihunS97Iqr64Fd5aqkmNkV
# LNBbeLh+9qqtLY/k0YyR5yNJZ+9XuPatG+x/gG7WE0Ij3rMI2y1RIW7oq0MeBVuH
# gY9fsH80CL8wJC+LHkJDwpDXZyFLTh2+Q7kUGk51E3FYDQzHzV8Zewrmy3Vu+1RD
# 1+3EIBbC8e0fjYZEG6FFn0cBjx+TH11y2eN8JRvnmsMqoYRONSd2rUBQG5KFYcvO
# tJzDMCm7rfDWS+URs9SAb0a9mW0QNPBtZhhW5amHVFBQwIxpnznzC+xMCl51GUQe
# 1cNCzUCMhjSkFFUhvbWpB5IjQhDT6vKQ2y+telUDQ3VG1k914slEi2bIBECIEFeu
# u3X/4fCSU25rsXrjadbUKrnahRf9kGWmw1vZoZzGkb95HUpG3mgOXt7n8Ej9q1kt
# RBB/+NwN
# =q1H1
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 16 23:20:11 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-20260316' of https://gitlab.com/pbo-linaro/qemu:
  contrib/plugins/uftrace.c: fix depth for exit events

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agocontrib/plugins/uftrace.c: fix depth for exit events
Pierrick Bouvier [Fri, 13 Mar 2026 06:34:41 +0000 (23:34 -0700)] 
contrib/plugins/uftrace.c: fix depth for exit events

Uftrace plugin was recording wrong depth for exit events, resulting in
incoherent traces, especially for partial ones.

Thanks to Honggyu Kim, one of the original author of uftrace, who
spotted the issue.
https://github.com/namhyung/uftrace/pull/2031#issuecomment-4051762627

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260313063441.2048882-1-pierrick.bouvier@linaro.org
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
4 months agothrottle-group: Fix race condition in throttle_group_restart_queue()
Alberto Garcia [Thu, 12 Mar 2026 12:12:00 +0000 (13:12 +0100)] 
throttle-group: Fix race condition in throttle_group_restart_queue()

When a timer is fired a pending I/O request is restarted and
tg->any_timer_armed is reset so other requests can be scheduled.

However we're resetting any_timer_armed first in timer_cb() before
the request is actually restarted, and there's a window between both
moments in which another thread can arm the same timer, hitting an
assertion in throttle_group_restart_queue().

This can be solved by deferring the reset of tg->any_timer_armed to
the moment when the queue is actually restarted, which is protected by
tg->lock, preventing other threads from arming the timer before that.

In addition to that, throttle_group_restart_tgm() is also updated to
hold tg->lock while the timer is being inspected. Here we consider
three different scenarios:

- If the tgm has a timer set, fire it immediately
- If another tgm has a timer set, restart the queue anyway
- If there is no timer set in this group then simulate a timer that
  fires immediately, by setting tg->any_timer_armed in order to
  prevent other threads from arming a timer in the meantime.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3194
Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-Id: <825598ef34ad384d936da19d634eda75598508f7.1773316842.git.berto@igalia.com>
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
4 months agoMerge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
Peter Maydell [Mon, 16 Mar 2026 13:07:33 +0000 (13:07 +0000)] 
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging

trivial patches for 2026-03-16

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmm34HIACgkQgqpKJDse
# lHjIwA/9G+XvpJHAXsK8QdPQAlrcCstV9GYJ/+wprclWM6rsWf+zQQ4RvQqxj4ue
# YzYmK37LVp2QyxNHACN5BYR/k7VUxjgdDZgu2bj3gw2A9XFkwnUHZuzvNaWPllit
# ugeeDP9dA+gM+YrUhPSwmDSX03KZrF1hipaQqPdFpCRaN1guvtNfnveqgGgE4eRm
# svwv40z0+kQW7pg/7cpPCp0ATdeYoLV84jOcEpR7gVdheektrIC2rQSUNl4Eqg1b
# VrvvoGZ+M4sJOyzz/jFEauWEYOjRT/3t0B1fy4jyUVOAKaDsPRBS1R3XvYGmgfEG
# OusGvluoLXdQ53xcdE448wTO9pQFnMjmrWsqtVyevyD3Rd0x1Rl2sQwZ4qoq5rgr
# Ck6ruvSnBM8tthSHktpYLdI1pcjAp3xS7LsVK+bQk9sJuIYiDczgDpsnkg/YgbtA
# Gqbbh1/2WIufpRd9HhhFo5yEzWfoHvGgSI1AytIkG4/VRKS5vXQ+sbGV2j4oVBte
# Wpx87zWaZytqdkA5i3EzOY/3JT63tpyEbzpZc35psGo6z/khUrdzqpLUwmt8MNNH
# oxadGK3B/r6rfaXOo9zN1ACCp1tY9D/OCow7MTPdnU5ySMkIzKO59akpw9SoShzC
# O8Ok0j/onHZbZwIt7rYAWODbeIN4zyoVsKbk1xFV2+CGoHWeOK8=
# =KGOq
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 16 10:50:26 2026 GMT
# gpg:                using RSA key 64AA2AB531D56903366BFEF982AA4A243B1E9478
# gpg: Good signature from "Michael Tokarev <mjt@debian.org>" [full]
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>" [full]
# gpg:                 aka "Michael Tokarev <mjt@tls.msk.ru>" [full]
# Primary key fingerprint: 9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
#      Subkey fingerprint: 64AA 2AB5 31D5 6903 366B  FEF9 82AA 4A24 3B1E 9478

* tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu:
  rename CONFIG_EPOLL_CREATE1 to CONFIG_EPOLL, and stop checking for epoll in meson.build
  meson.build: do not check for epoll.h (CONFIG_EPOLL)
  linux-user: assume epoll is always present
  meson.build: stop checking for inotify_init()
  linux-user: assume inotify sycalls are always present
  meson.build: stop checking for splice()
  linux-user/syscall.c: assume splice is always present
  docs: Move xbzrle.txt into the migration folder and convert to rst
  target/i386: fix NULL pointer dereference in legacy-cache=off handling
  hw/usb/core.c: reorder usage and assertion of p->ep
  system/physmem.c: remove useless assertion of block
  dump/dump.c: reorder usage and assertion of block
  migration/savevm.c: reorder usage and assertion of mis->from_src_file

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agoMerge tag 'pull-target-arm-20260316' of https://gitlab.com/pm215/qemu into staging
Peter Maydell [Mon, 16 Mar 2026 13:07:17 +0000 (13:07 +0000)] 
Merge tag 'pull-target-arm-20260316' of https://gitlab.com/pm215/qemu into staging

target-arm queue:
 * hw/net/rtl8319: Work around GCC sanitizer / -Wstringop-overflow bug
 * semihosting: Correctly byteswap data when CPU is in big-endian mode
 * hw/dma/pl080: Fix various minor bugs
 * MAINTAINERS: Remove some no-longer active maintainers
 * tests/qtest: Use g_strdup_printf() in various arm tests

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmm33l8ZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3ssREACHRyPRM/BdgjxLcQ+mZDYl
# WLSJzytrgdBmUsALt1T6hKMAfAdtdNVbLO/4r9r1zSDhXWcHOd+hsiq0IF+F6CZd
# qKIB++aVrNDWA5v0tlz+j4kQNCeFOX/u53CB9nZtaV/dMrAZbiuOulxDzd9grKJi
# m3ZT7YfIAV6nNLp/J7Q7P8rvM5quN/1ohTGqKSmMgLAZgqa0ac8cV3NYqVpnd4Jc
# +pqoQQb54uKpMKRacAUX2OMk6XuxDI3szdciVQLLhhrglwMo3xoAwpX600lAcvYv
# 2D+8nb5A90u7pfIY4xGajIBqiBP5PQC2RiTUd0qRmOklnVx7gRHaI9N1LOA/DtX1
# YKCPuH3CZEuZ+s4bWH9+ahaHbu5eHmqhxlp+CdICWbf+MBa1bCig2gT6su26AeHs
# hEcLt9QQwKAfjegs4S9J90ph13LADau8VkSIP6WMfTuDmNesQY6/JlaGq8/qWrfL
# WfJF8i9fHpEX7OSy+/CwUS02HTDrn2MRTmAt2ihee5oYRuEdmSfYCjMvt5Nhbej3
# nzNWBw/BpgdNsdIPfJSoNWP/VQTTX6rYvUQh4+Z90SVqFyfGSCb9JOVg6Ab39Q8p
# gfjkIU2NwhZmDCjh4CqJLihKCPCUiFKlYrvOpAHkuDXcLqzLvF03A7WIHs4cA5+T
# PwUs4qJF8kpBsJOdshbQAQ==
# =V7Lm
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 16 10:41:35 2026 GMT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [ultimate]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [ultimate]
# gpg:                 aka "Peter Maydell <peter@archaic.org.uk>" [ultimate]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20260316' of https://gitlab.com/pm215/qemu:
  tests/qtest/aspeed_gpio-test: Use g_strdup_printf() instead of char arrays
  tests/qtest/ast2700-gpio-test: Use g_strdup_printf() instead of char arrays
  tests/qtest/arm-cpu-features: Use g_strdup_printf() instead of char arrays
  tests/qtest/ast2700-sgpio-test: Use g_strdup_printf() instead of char arrays
  MAINTAINERS: Remove Chris Browy
  MAINTAINERS: Remove Andrey Smirnov
  MAINTAINERS: Remove Radoslaw Biernacki
  MAINTAINERS: Remove Eduardo Habkost
  MAINTAINERS: Remove Cameron Esfahani
  MAINTAINERS: Remove Hannes Reinecke
  hw/dma/pl080: Ignore bottom 2 bits of LLI register
  hw/dma/pl080: Update interrupts after pl080_run()
  hw/dma/pl080: Handle bogus swidth and dwidth in transfers
  semihosting/uaccess: Use the cpu_internal_tswap() functions
  include/exec: Provide the cpu_internal_tswap() functions
  include/hw/core: Rename virtio_is_big_endian to internal_is_big_endian
  hw/net/rtl8319: Work around GCC sanitizer / -Wstringop-overflow bug

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agorename CONFIG_EPOLL_CREATE1 to CONFIG_EPOLL, and stop checking for epoll in meson...
Michael Tokarev [Fri, 9 Jan 2026 21:22:25 +0000 (00:22 +0300)] 
rename CONFIG_EPOLL_CREATE1 to CONFIG_EPOLL, and stop checking for epoll in meson.build

Since CONFIG_EPOLL is now unused, it's okay to
perform this rename, to make it less ugly.

Since epoll is linux-specific and is always present on linux,
define CONFIG_EPOLL to 1 on linux, without compile-time test.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agomeson.build: do not check for epoll.h (CONFIG_EPOLL)
Michael Tokarev [Fri, 9 Jan 2026 21:19:38 +0000 (00:19 +0300)] 
meson.build: do not check for epoll.h (CONFIG_EPOLL)

The only place where we used CONFIG_EPOLL was linux-user,
which now enables it unconditionally.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agolinux-user: assume epoll is always present
Michael Tokarev [Fri, 9 Jan 2026 21:14:57 +0000 (00:14 +0300)] 
linux-user: assume epoll is always present

epoll is in linux since 2.6 (glibc 2.3.2).
epoll_init1 has been added in 2.6.27 (glibc 2.9).
There's no need to check for its presence, including all other
epoll-related syscalls.

Modern architectures don't have epoll_create(), only
epoll_create1(), so keep conditional around the former.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agomeson.build: stop checking for inotify_init()
Michael Tokarev [Fri, 9 Jan 2026 20:48:09 +0000 (23:48 +0300)] 
meson.build: stop checking for inotify_init()

the only place in qemu which used the check for inotify_init()
was linux-user, which now assumes inotify_init() is always
present.  There's no need to check for this function anymore.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agolinux-user: assume inotify sycalls are always present
Michael Tokarev [Fri, 9 Jan 2026 20:46:02 +0000 (23:46 +0300)] 
linux-user: assume inotify sycalls are always present

inotify_init() and other syscalls appeared in linux 2.6.13,
inotify_init1() - in linux 2.6.27.

There's no need to check their presence on linux anymore.

Keep condition on TARGET_NR_inotify_init because modern
architectures have only more generic inotify_init1().

Other, not linux-specific, places of the code checks for
inotify_init1() syscall only.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agomeson.build: stop checking for splice()
Michael Tokarev [Fri, 9 Jan 2026 20:28:09 +0000 (23:28 +0300)] 
meson.build: stop checking for splice()

CONFIG_SPLICE was only needed for linux-user/, where it is not
used anymore (assuming splice &Co is always present)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agolinux-user/syscall.c: assume splice is always present
Michael Tokarev [Fri, 9 Jan 2026 20:27:05 +0000 (23:27 +0300)] 
linux-user/syscall.c: assume splice is always present

splice() &Co are defined since linux 2.6.17 (glibc 2.5).
Assume it is always present.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agodocs: Move xbzrle.txt into the migration folder and convert to rst
Thomas Huth [Tue, 10 Mar 2026 09:28:22 +0000 (10:28 +0100)] 
docs: Move xbzrle.txt into the migration folder and convert to rst

xbzrle is a feature of migration and thus this file should go
into the docs/devel/migration/ folder. While we're at it, turn
it into proper .rst format, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agotarget/i386: fix NULL pointer dereference in legacy-cache=off handling
Sergei Heifetz [Thu, 5 Mar 2026 06:04:31 +0000 (11:04 +0500)] 
target/i386: fix NULL pointer dereference in legacy-cache=off handling

The check that xcc->model is not NULL occurs after it is dereferenced
inside x86_cpu_get_versioned_cache_info(), so something like
`-cpu host,legacy-cache=off` leads to a segfault rather than an error.
This patch fixes that.

Fixes: cca0a000d06f897411a8a ("target/i386: allow versioned CPUs to specify new cache_info")
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
[Mjt: simplify the following condition too]
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agohw/usb/core.c: reorder usage and assertion of p->ep
Sergei Heifetz [Sun, 8 Feb 2026 10:39:58 +0000 (15:39 +0500)] 
hw/usb/core.c: reorder usage and assertion of p->ep

Reorder the code so the assertion of p->ep occurs before it is
used in the subsequent lines.

Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agosystem/physmem.c: remove useless assertion of block
Sergei Heifetz [Sun, 8 Feb 2026 10:39:57 +0000 (15:39 +0500)] 
system/physmem.c: remove useless assertion of block

It is useless to assert that block is not NULL because it is
already dereferenced in the first line of the function.

The assertion is also unnecessary because the function is called
in only two places, and `block` can't be NULL in either of them:
- In `migration/ram.c`, we have already dereferenced `block` in
  the code just before the call.
- In `system/memory.c`, we assert `mr->ram_block` before passing
  it to the function.

(We could split the declaration and initialization of oldsize,
but then we would need to remove the const qualifier. As the
assertion is useless anyway, removing the const qualifier seems
worse.)

Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agodump/dump.c: reorder usage and assertion of block
Sergei Heifetz [Sun, 8 Feb 2026 10:39:56 +0000 (15:39 +0500)] 
dump/dump.c: reorder usage and assertion of block

Reorder the code so the assertion of block occurs before it is
used in the subsequent lines.

Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agomigration/savevm.c: reorder usage and assertion of mis->from_src_file
Sergei Heifetz [Sun, 8 Feb 2026 10:39:55 +0000 (15:39 +0500)] 
migration/savevm.c: reorder usage and assertion of mis->from_src_file

Reorder the code so the assertion of mis->from_src_file occurs before
the call to migration_ioc_unregister_yank_from_file, which dereferences
it in qemu_file_get_ioc.

Fixes: 39675ffffb3394 ("migration: Move the yank unregister of channel_close out")
Signed-off-by: Sergei Heifetz <heifetz@yandex-team.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
4 months agoMerge tag 'pull-request-2026-03-16' of https://gitlab.com/thuth/qemu into staging
Peter Maydell [Mon, 16 Mar 2026 10:43:15 +0000 (10:43 +0000)] 
Merge tag 'pull-request-2026-03-16' of https://gitlab.com/thuth/qemu into staging

* Fix various crashes that can occur when starting QEMU with -device xyz,help
* Update various sections in the MAINTAINERS file

# -----BEGIN PGP SIGNATURE-----
#
# iQIyBAABCgAdFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmm33eAACgkQLtnXdP5w
# LbUAnA/2NUNIRc18cIAmC5AABoLPeLd96ndPXoayMc78fdJXeM4GsFHqQ0Qqj56B
# nSZY9nHHzv8f9n+pVISoffuywP0ldR7+ThKVyps8rkmsXDuBsdNwZU829toq43lg
# V0+/UtyxrZLujV581TrmKlPf25sY5BV96YHWzXuUm2E5ikrSzqNcm+1ZNRRhWa5R
# gu0bhfAcILnmXxYYrIO/JWM38j7Kz2BHLGN2A8UepORhs5gUg5vk33RaTrzDfbwN
# rTxLKjLxYEPV2E9YTBsmMQqsiBomHjw66g5Rtq68KE26RodPeEdLsk9Yd7WbWfEf
# HGnZ/l2aZ8OoaricIvUdMQmkAVjxZE4b+a6AiZ38KsJ/3XEXQqbkvGRW3OCkAWOY
# kzRuxWJKoPIkvm4jfN39cZEtzHnXdrNgiVCwGuMn0BwqHOPIF/W+5XImOW1dqlTL
# CfR11yjUdpW33/hWmXtHkAYDlf5cP7/eL/KStrSv3DkG9/CNTAfwEvjkOyBq3C+K
# J/aiufIkbkUr8ZpfJ+eledbAkvvv1/d8/u5vlqyVa4sL7hdcaxQrUDxjojrE7EoM
# xB0eS4eFZNsRQn3YrvqyCMxwwO16HyeOOYSv/7Z2wixe/FCRQEjxl02/430ITVNS
# MB1/fKUWd4/SUY+BqtBHSo4qNPEbmxzOXKVEJHLS2bqqnDmEcg==
# =0ClG
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar 16 10:39:28 2026 GMT
# 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-16' of https://gitlab.com/thuth/qemu:
  MAINTAINERS: Add another reviewer to s390x boot
  MAINTAINERS: Downgrade the functional testing section to "Odd Fixes"
  MAINTAINERS: Remove myself from various sections
  MAINTAINERS: Update the s390x maintainers
  MAINTAINERS: Update S390-ccw boot maintainers/reviewers
  hw/acpi: generic_event_device: Don't call qdev_get_machine in initfn
  hw/arm: fsl-imx6: Don't call qdev_get_machine in soc init
  hw/arm: fsl-imx8mp: Don't call qdev_get_machine in soc init
  hw/arm: fsl-imx7: Don't call qdev_get_machine in soc init
  hw/arm: xlnx-zynqmp: Don't call qdev_get_machine in soc init
  hw/riscv: microchip_pfsoc: Don't call qdev_get_machine in soc init
  hw/riscv: sifive_e: Don't call qdev_get_machine in soc init
  target/mips/cpu: Move initialization of memory region to realize function
  target/xtensa/cpu: Move initialization of memory region to realize function

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agoMerge tag 'linux-user-for-v11-pull-request' of https://github.com/hdeller/qemu-hppa...
Peter Maydell [Mon, 16 Mar 2026 10:42:41 +0000 (10:42 +0000)] 
Merge tag 'linux-user-for-v11-pull-request' of https://github.com/hdeller/qemu-hppa into staging

Two linux-user patches

Two linux-user patches from Razvan Ghiorghe.

# -----BEGIN PGP SIGNATURE-----
#
# iHUEABYKAB0WIQS86RI+GtKfB8BJu973ErUQojoPXwUCabRXkwAKCRD3ErUQojoP
# X8E4AQDtltuCmD+RnJ5yWNAh4Rx8kOU/tChL8kE44NjMz9HdxAEA37DKINiPHCOs
# G7kmfKqwUpJWVSXeMjUp0iaNOUydbAw=
# =ahOd
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Mar 13 18:29:39 2026 GMT
# gpg:                using EDDSA key BCE9123E1AD29F07C049BBDEF712B510A23A0F5F
# gpg: Good signature from "Helge Deller <deller@gmx.de>" [unknown]
# gpg:                 aka "Helge Deller <deller@kernel.org>" [unknown]
# gpg:                 aka "Helge Deller <deller@debian.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 4544 8228 2CD9 10DB EF3D  25F8 3E5F 3D04 A7A2 4603
#      Subkey fingerprint: BCE9 123E 1AD2 9F07 C049  BBDE F712 B510 A23A 0F5F

* tag 'linux-user-for-v11-pull-request' of https://github.com/hdeller/qemu-hppa:
  linux-user: fix mremap with old_size=0 for shared mappings
  linux-user: Fix zero_bss for RX PT_LOAD segments

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4 months agoMAINTAINERS: Add another reviewer to s390x boot
Eric Farman [Fri, 13 Mar 2026 19:48:10 +0000 (20:48 +0100)] 
MAINTAINERS: Add another reviewer to s390x boot

Jason offered to help review this area of code;
let's make sure he's notified of changes.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
Message-ID: <20260313194810.1844241-2-farman@linux.ibm.com>
Acked-by: Jason J. Herne <jjherne@linux.ibm.com>
Acked-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agoMAINTAINERS: Downgrade the functional testing section to "Odd Fixes"
Thomas Huth [Fri, 13 Mar 2026 11:34:22 +0000 (12:34 +0100)] 
MAINTAINERS: Downgrade the functional testing section to "Odd Fixes"

I won't have that much time for QEMU anymore in the future, so downgrade
the status of the "functional testing framework" section to "Odd Fixes"
to avoid wrong expectations. While we're at it, also switch to my other
e-mail address here that I'm already using for the other sections where
I am still listed as maintainer / reviewer.

Message-ID: <20260313113424.15583-5-thuth@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agoMAINTAINERS: Remove myself from various sections
Thomas Huth [Fri, 13 Mar 2026 11:34:21 +0000 (12:34 +0100)] 
MAINTAINERS: Remove myself from various sections

I likely won't have much time in the future for QEMU anymore, so
remove myself from various sections that have already enough other
maintainers / reviewers.

Message-ID: <20260313113424.15583-4-thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agoMAINTAINERS: Update the s390x maintainers
Thomas Huth [Fri, 13 Mar 2026 11:34:20 +0000 (12:34 +0100)] 
MAINTAINERS: Update the s390x maintainers

I'm going to move to another project next month, so I will not have
enough time to take care of s390x patches anymore. Fortunately,
Cornelia volunteered to take over the job of collecting s390x patches,
and Eric and Matthew offered help to back her up, so we can keep
the "S390 general architecture support" section in the "supported"
state. Thanks for your help, Cornelia, Eric and Matthew!

Message-ID: <20260313113424.15583-3-thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agoMAINTAINERS: Update S390-ccw boot maintainers/reviewers
Jared Rossi [Fri, 13 Mar 2026 11:34:19 +0000 (12:34 +0100)] 
MAINTAINERS: Update S390-ccw boot maintainers/reviewers

Christian Borntraeger is no longer active in this space.  Promote myself to
maintainer and demote Christian to reviewer.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
Acked-by: Eric Farman <farman@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260310142118.1120291-1-jrossi@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260313113424.15583-2-thuth@redhat.com>

4 months agohw/acpi: generic_event_device: Don't call qdev_get_machine in initfn
Alistair Francis [Thu, 12 Mar 2026 04:31:58 +0000 (14:31 +1000)] 
hw/acpi: generic_event_device: Don't call qdev_get_machine in initfn

Calling qdev_get_machine() in the acpi_ged_initfn function would result
in the following assert

    ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.

when trying to run

    ./qemu-system-aarch64 -S -display none -M virt -device acpi-ged,help

as the machine wasn't created yet. We call qdev_get_machine() to obtain
the ram slots of the machine. So instead of initialising the GED in
the init let's instead do it in the realise where the machine
will exist.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260312043158.4191378-8-alistair.francis@wdc.com>
[thuth: Replaced soc_init with acpi_ged_initfn in the patch description]
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agohw/arm: fsl-imx6: Don't call qdev_get_machine in soc init
Alistair Francis [Thu, 12 Mar 2026 04:31:57 +0000 (14:31 +1000)] 
hw/arm: fsl-imx6: Don't call qdev_get_machine in soc init

Calling qdev_get_machine() in the soc_init function would result in
the following assert

    ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.

when trying to run

    ./qemu-system-aarch64 -S -display none -M virt -device fsl-imx6,help

as the machine wasn't created yet. We call qdev_get_machine() to obtain
the number of CPUs in the machine. So instead of initialising the CPUs in
the SoC init let's instead do it in the realise where the machine
will exist.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260312043158.4191378-7-alistair.francis@wdc.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agohw/arm: fsl-imx8mp: Don't call qdev_get_machine in soc init
Alistair Francis [Thu, 12 Mar 2026 04:31:56 +0000 (14:31 +1000)] 
hw/arm: fsl-imx8mp: Don't call qdev_get_machine in soc init

Calling qdev_get_machine() in the soc_init function would result in
the following assert

    ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.

when trying to run

    ./qemu-system-aarch64 -S -display none -M virt -device fsl-imx8mp,help

as the machine wasn't created yet. We call qdev_get_machine() to obtain
the number of CPUs in the machine. So instead of initialising the CPUs in
the SoC init let's instead do it in the realise where the machine
will exist.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260312043158.4191378-6-alistair.francis@wdc.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agohw/arm: fsl-imx7: Don't call qdev_get_machine in soc init
Alistair Francis [Thu, 12 Mar 2026 04:31:55 +0000 (14:31 +1000)] 
hw/arm: fsl-imx7: Don't call qdev_get_machine in soc init

Calling qdev_get_machine() in the soc_init function would result in
the following assert

    ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.

when trying to run

    ./qemu-system-aarch64 -S -display none -M virt -device fsl-imx7,help

as the machine wasn't created yet. We call qdev_get_machine() to obtain
the number of CPUs in the machine. So instead of initialising the CPUs in
the SoC init let's instead do it in the realise where the machine
will exist.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260312043158.4191378-5-alistair.francis@wdc.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agohw/arm: xlnx-zynqmp: Don't call qdev_get_machine in soc init
Alistair Francis [Thu, 12 Mar 2026 04:31:54 +0000 (14:31 +1000)] 
hw/arm: xlnx-zynqmp: Don't call qdev_get_machine in soc init

Calling qdev_get_machine() in the soc_init function would result in
the following assert

    ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.

when trying to run

    ./qemu-system-aarch64 -S -display none -M virt -device xlnx-zynqmp,help

as the machine wasn't created yet. We call qdev_get_machine() to obtain
the number of CPUs in the machine. So instead of initialising the CPUs in
the SoC init let's instead do it in the realise where the machine
will exist.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260312043158.4191378-4-alistair.francis@wdc.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agohw/riscv: microchip_pfsoc: Don't call qdev_get_machine in soc init
Alistair Francis [Thu, 12 Mar 2026 04:31:53 +0000 (14:31 +1000)] 
hw/riscv: microchip_pfsoc: Don't call qdev_get_machine in soc init

Calling qdev_get_machine() in the soc_init function would result in
the following assert

    ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.

when trying to run

    ./qemu-system-riscv64 -S -display none -M virt -device microchip.pfsoc,help

as the machine wasn't created yet. We call qdev_get_machine() to obtain
the number of CPUs in the machine. So instead of setting the CPU
num-harts in the init function let's set it in realise where the machine
will exist.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260312043158.4191378-3-alistair.francis@wdc.com>
[thuth: Fix a complaint from checkpatch.pl with regards to multi-line comment]
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agohw/riscv: sifive_e: Don't call qdev_get_machine in soc init
Alistair Francis [Thu, 12 Mar 2026 04:31:52 +0000 (14:31 +1000)] 
hw/riscv: sifive_e: Don't call qdev_get_machine in soc init

Calling qdev_get_machine() in the soc_init function would result in
the following assert

    ../hw/core/qdev.c:858: qdev_get_machine: Assertion `dev' failed.

when trying to run

    ./qemu-system-riscv64 -S -display none -M virt -device riscv.sifive.e.soc,help

as the machine wasn't created yet. We call qdev_get_machine() to obtain
the number of CPUs in the machine. So instead of setting the CPU
num-harts in the init function let's set it in realise where the machine
will exist.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260312043158.4191378-2-alistair.francis@wdc.com>
[thuth: Fix a complaint from checkpatch.pl with regards to multi-line comment]
Signed-off-by: Thomas Huth <thuth@redhat.com>
4 months agotarget/mips/cpu: Move initialization of memory region to realize function
Thomas Huth [Wed, 11 Mar 2026 21:16:29 +0000 (22:16 +0100)] 
target/mips/cpu: Move initialization of memory region to realize function

When introspecting the Loongson-3A4000 CPUs from the command line, QEMU
currently crashes:

 $ ./qemu-system-mips64el -device Loongson-3A4000-mips64-cpu,help
 qemu-system-mips64el: ../../devel/qemu/system/physmem.c:1401:
  register_multipage: Assertion `num_pages' failed.
 Aborted (core dumped)

Move the initialization of the memory regions to the realize function
to fix this problem.

Reported-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <87y0jxzdrk.fsf@pond.sub.org>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260311211629.118608-1-thuth@redhat.com>

4 months agotarget/xtensa/cpu: Move initialization of memory region to realize function
Thomas Huth [Wed, 11 Mar 2026 20:25:03 +0000 (21:25 +0100)] 
target/xtensa/cpu: Move initialization of memory region to realize function

When introspecting the xtensa CPUs from the command line, QEMU currently
crashes:

 $ ./qemu-system-xtensa -device dc233c-xtensa-cpu,help
 qemu-system-xtensa: ../../devel/qemu/system/physmem.c:1401:
  register_multipage: Assertion `num_pages' failed.
 Aborted (core dumped)

Move the initialization of the memory regions to the realize function
to fix this problem.

Reported-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260311202503.107026-1-thuth@redhat.com>

5 months agorunstate: handle return code of EOPNOTSUPP properly from rebuild_guest()
Ani Sinha [Tue, 10 Mar 2026 09:44:48 +0000 (15:14 +0530)] 
runstate: handle return code of EOPNOTSUPP properly from rebuild_guest()

If rebuild_guest() accelerator callback returns EOPNOTSUPP, this means that the
accelerator does not support rebuilding the guest state. Handle this case
properly and separately from other error return codes.

Fixes: 4003e5e65fe0("hw/accel: add a per-accelerator callback to change VM accelerator handle")
Reported-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260310094450.35861-2-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agotests/qtest/aspeed_gpio-test: Use g_strdup_printf() instead of char arrays
Peter Maydell [Tue, 10 Mar 2026 15:33:34 +0000 (15:33 +0000)] 
tests/qtest/aspeed_gpio-test: Use g_strdup_printf() instead of char arrays

Older versions of gcc with -Wformat-overflow=2 don't like the usage of
fixed size char arrays in this test; gcc 7.5.0 (SUSE Linux) says:

../tests/qtest/aspeed_gpio-test.c: In function ‘test_set_input_pins’:
../tests/qtest/aspeed_gpio-test.c:149:36: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
             sprintf(name, "gpio%c%d", c, i);
                                    ^
../tests/qtest/aspeed_gpio-test.c:149:13: note: ‘sprintf’ output between 7 and 17 bytes into a destination of size 16
             sprintf(name, "gpio%c%d", c, i);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This can't actually happen because of the limited size of the values
being substituted in.  However rather than require readers to check
whether the arrays really have been declared large enough, we prefer
to use g_strdup_printf() for this kind of string work.

Reported-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260310153334.3063224-3-peter.maydell@linaro.org

5 months agotests/qtest/ast2700-gpio-test: Use g_strdup_printf() instead of char arrays
Peter Maydell [Tue, 10 Mar 2026 15:33:33 +0000 (15:33 +0000)] 
tests/qtest/ast2700-gpio-test: Use g_strdup_printf() instead of char arrays

Older versions of gcc with -Wformat-overflow=2 don't like the usage of
fixed size char arrays in this test; gcc 7.5.0 (SUSE Linux) says:

../tests/qtest/ast2700-gpio-test.c: In function ‘test_input_pins’:
../tests/qtest/ast2700-gpio-test.c:54:36: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=]
             sprintf(name, "gpio%c%d", c, i);
                                    ^
../tests/qtest/ast2700-gpio-test.c:54:13: note: ‘sprintf’ output between 7 and 17 bytes into a destination of size 16
             sprintf(name, "gpio%c%d", c, i);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This can't actually happen because of the limited size of the values
being substituted in.  However rather than require readers to check
whether the arrays really have been declared large enough, we prefer
to use g_strdup_printf() for this kind of string work.

Reported-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260310153334.3063224-2-peter.maydell@linaro.org

5 months agotests/qtest/arm-cpu-features: Use g_strdup_printf() instead of char arrays
Peter Maydell [Tue, 10 Mar 2026 15:15:07 +0000 (15:15 +0000)] 
tests/qtest/arm-cpu-features: Use g_strdup_printf() instead of char arrays

Older versions of gcc with -Wformat-overflow=2 don't like the usage of
fixed size char arrays in this test; gcc 7.5.0 (SUSE Linux) says:

../tests/qtest/arm-cpu-features.c: In function ‘test_query_cpu_model_expansion_kvm’:
../tests/qtest/arm-cpu-features.c:578:35: error: ‘%u’ directive writing
between 1 and 10 bytes into a region of size 5
[-Werror=format-overflow=]

These can't actually happen because of the limited size of the values
being substituted in.  However rather than require readers to check
whether the arrays really have been declared large enough, we prefer
to use g_strdup_printf() for this kind of string work.

Reported-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260310151507.2973843-3-peter.maydell@linaro.org

5 months agotests/qtest/ast2700-sgpio-test: Use g_strdup_printf() instead of char arrays
Peter Maydell [Tue, 10 Mar 2026 15:15:06 +0000 (15:15 +0000)] 
tests/qtest/ast2700-sgpio-test: Use g_strdup_printf() instead of char arrays

Older versions of gcc with -Wformat-overflow=2 don't like the usage of
fixed size char arrays in this test; gcc 7.5.0 (SUSE Linux) says:

../tests/qtest/ast2700-sgpio-test.c: In function ‘test_output_pins’:
../tests/qtest/ast2700-sgpio-test.c:27:33: error: ‘sprintf’ may write a
terminating nul past the end of the destination
[-Werror=format-overflow=]

../tests/qtest/ast2700-sgpio-test.c: In function ‘test_irq_level_high’:
../tests/qtest/ast2700-sgpio-test.c:85:33: error: ‘sprintf’ may write a
terminating nul past the end of the destination
[-Werror=format-overflow=]

These can't actually happen because of the limited size of the values
being substituted in.  However rather than require readers to check
whether the arrays really have been declared large enough, we prefer
to use g_strdup_printf() for this kind of string work.

Reported-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-id: 20260310151507.2973843-2-peter.maydell@linaro.org

5 months agoMAINTAINERS: Remove Chris Browy
Peter Maydell [Fri, 6 Mar 2026 12:05:55 +0000 (12:05 +0000)] 
MAINTAINERS: Remove Chris Browy

Chris Browy's listed email address is undeliverable:

The recipient server did not accept our requests to connect; it
times out on attempts to connect by my sending mail server (gmail):
  [avery-design.com 99.83.249.127: timed out]
  [avery-design.com 75.2.78.167: timed out]

Remove his name from the file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260306120555.2035421-7-peter.maydell@linaro.org

5 months agoMAINTAINERS: Remove Andrey Smirnov
Peter Maydell [Fri, 6 Mar 2026 12:05:54 +0000 (12:05 +0000)] 
MAINTAINERS: Remove Andrey Smirnov

Andrey Smirnov doesn't wish to be listed in MAINTAINERS any more;
remove his email from the relevant sections.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260306120555.2035421-6-peter.maydell@linaro.org

5 months agoMAINTAINERS: Remove Radoslaw Biernacki
Peter Maydell [Fri, 6 Mar 2026 12:05:53 +0000 (12:05 +0000)] 
MAINTAINERS: Remove Radoslaw Biernacki

Radoslaw Biernacki doesn't wish to be listed in MAINTAINERS any more;
remove his email from the relevant sections.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260306120555.2035421-5-peter.maydell@linaro.org

5 months agoMAINTAINERS: Remove Eduardo Habkost
Peter Maydell [Fri, 6 Mar 2026 12:05:52 +0000 (12:05 +0000)] 
MAINTAINERS: Remove Eduardo Habkost

Eduardo Habkost doesn't wish to be listed in MAINTAINERS any more;
remove his email, and also the git trees he used to use.

Move the QOM boilerplate conversion script scripts/codeconverter
to "Orphan" status, as it no longer has any listed maintainers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260306120555.2035421-4-peter.maydell@linaro.org

5 months agoMAINTAINERS: Remove Cameron Esfahani
Peter Maydell [Fri, 6 Mar 2026 12:05:51 +0000 (12:05 +0000)] 
MAINTAINERS: Remove Cameron Esfahani

Cameron Esfahani doesn't wish to be listed in MAINTAINERS any more;
remove his email from the relevant sections.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260306120555.2035421-3-peter.maydell@linaro.org

5 months agoMAINTAINERS: Remove Hannes Reinecke
Peter Maydell [Fri, 6 Mar 2026 12:05:50 +0000 (12:05 +0000)] 
MAINTAINERS: Remove Hannes Reinecke

Hannes Reinecke doesn't wish to be listed in MAINTAINERS any more;
remove his email from the relevant sections.

As 'megasas' no longer has any listed maintainers, move it to
"Orphan" status.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260306120555.2035421-2-peter.maydell@linaro.org

5 months agohw/dma/pl080: Ignore bottom 2 bits of LLI register
Tao Ding [Thu, 12 Mar 2026 08:02:35 +0000 (16:02 +0800)] 
hw/dma/pl080: Ignore bottom 2 bits of LLI register

The PL080 channel LLI (linked list item) register has bits [31:2] of
the address of the next LLI in bits [31:2], with bit [1] reserved
and bits [0] the AHB master select. We were incorrectly using the
whole register value as the address, which meant that if the guest
programmed something into the AHB master select bit we would use
an incorrect address, and read incorrect data from memory.

The following reproducer creates a setup which has bit 0 set in
an LLI value:

Configuration
    ../configure --target-list=arm-softmmu --enable-debug
Reproducer
    ./qemu-system-arm -M versatilepb -m 128M -nographic -S \
     -device loader,addr=0x00002000,data=0x00000004,data-len=4 \
     -device loader,addr=0x00002004,data=0x00001004,data-len=4 \
     -device loader,addr=0x00002008,data=0x00000000,data-len=4 \
     -device loader,addr=0x0000200c,data=0x9e4bf001,data-len=4 \
     -device loader,addr=0x00000000,data=0x44332211,data-len=4 \
     -device loader,addr=0x00000004,data=0x88776655,data-len=4 \
     -device loader,addr=0x00001000,data=0x00000000,data-len=4 \
     -device loader,addr=0x00001004,data=0x00000000,data-len=4 \
     -device loader,addr=0x10130030,data=0x00000001,data-len=4 \
     -device loader,addr=0x10130100,data=0x00000000,data-len=4 \
     -device loader,addr=0x10130104,data=0x00001000,data-len=4 \
     -device loader,addr=0x10130108,data=0x00002001,data-len=4 \
     -device loader,addr=0x1013010C,data=0x1e4bf001,data-len=4 \
     -device loader,addr=0x10130110,data=0x0000c001,data-len=4

The correct result with this bug fix:
    (qemu) xp /1wx 0x00001000
     00001000: 0x44332211
    (qemu) xp /1wx 0x00001004
     00001004: 0x88776655

Cc: qemu-stable@nongnu.org
Signed-off-by: Tao Ding <dingtao0430@163.com>
[PMM: Adjusted commit message]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: cb35c1b622674da7a2b70691402132f691933f2c.1773301927.git.dingtao0430@163.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 months agohw/dma/pl080: Update interrupts after pl080_run()
Tao Ding [Thu, 12 Mar 2026 08:02:33 +0000 (16:02 +0800)] 
hw/dma/pl080: Update interrupts after pl080_run()

In the codepath in pl080_write() where we run the DMA engine
after a change in the channel configuration register, we were
missing a pl080_update() call, which meant that we weren't
raising any interrupts generated by that DMA transfer.

A repro case for this is to program the PL080 and then
check the interrupt status by looking at the PL190 status
register, since the PL080 interrupt output is connected
to input 17 of the PL190. We look at the register value via
the QEMU monitor:

Reproducer
    ./qemu-system-arm -M versatilepb -m 128M -nographic -S \
    -device loader,addr=0x00000000,data=0x11223344,data-len=4 \
    -device loader,addr=0x00001000,data=0x00000000,data-len=4 \
    -device loader,addr=0x10130030,data=0x00000001,data-len=4 \
    -device loader,addr=0x10130100,data=0x00000000,data-len=4 \
    -device loader,addr=0x10130104,data=0x00001000,data-len=4 \
    -device loader,addr=0x10130108,data=0x00000000,data-len=4 \
    -device loader,addr=0x1013010C,data=0x9e4bf001,data-len=4 \
    -device loader,addr=0x10130110,data=0x0000c001,data-len=4

Qemu monitor
    (qemu) xp /1wx 0x10140008
    10140008: 0x00000000

The correct result after this fix:
    (qemu) xp /1wx 0x10140008
    10140008: 0x00020000

Cc: qemu-stable@nongnu.org
Signed-off-by: Tao Ding <dingtao0430@163.com>
Message-id: 7584486ba62bc6d767c0d132dc843067f8c5efff.1773301927.git.dingtao0430@163.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: Adjusted commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 months agohw/dma/pl080: Handle bogus swidth and dwidth in transfers
Peter Maydell [Fri, 6 Mar 2026 15:21:40 +0000 (15:21 +0000)] 
hw/dma/pl080: Handle bogus swidth and dwidth in transfers

The PL080 TRM states that the DWidth and SWidth fields of the channel
control registers can only validly specify widths up to 32 bits (i.e.
values from 0 to 2) and all other values are reserved.

Currently we don't check this, so if the guest specifies an invalid
value we will transfer more data into our local 'buff[]' array than
it can hold.

Check the widths; since the TRM doesn't clearly specify any behaviour
for what to do on invalid values, we choose to log them and then
ignore the channel for transfers.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3203
Reviewed-by: Jim MacArthur <jim.macarthur@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260306152140.2191653-1-peter.maydell@linaro.org

5 months agolinux-user: fix mremap with old_size=0 for shared mappings
Razvan Ghiorghe [Mon, 9 Mar 2026 23:30:32 +0000 (01:30 +0200)] 
linux-user: fix mremap with old_size=0 for shared mappings

When old_size is zero and old_address refers to a shareable mapping,
mremap() should create a new mapping of the same pages according to the
mremap(2) man page. The MREMAP_MAYMOVE flag must be specified in this case.

Previously, QEMU's target_mremap() rejected this valid case with EFAULT
during the initial validation, before checking for the special
old_size == 0 behaviour.

This patch adds proper handling for old_size == 0:
- Validates that MREMAP_MAYMOVE flag is set (required by man spec)
- Passes the call through to the host mremap()
- Creates a new mapping without invalidating the original, with both
  being valid and sharing the same physical memory frames.
- Ensures the new mapping address falls within the valid guest address
  region before returning it to the guest.

Tested with the reproducer from the issue on qemu-riscv64, qemu-hppa,
and qemu-aarch64.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3105
Signed-off-by: Razvan Ghiorghe <razvanghiorghe16@gmail.com>
Tested-by: Helge Deller <deller@gmx.de>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
5 months agolinux-user: Fix zero_bss for RX PT_LOAD segments
Razvan Ghiorghe [Mon, 2 Feb 2026 00:24:46 +0000 (02:24 +0200)] 
linux-user: Fix zero_bss for RX PT_LOAD segments

zero_bss() incorrectly assumed that any PT_LOAD containing .bss must be
writable, rejecting valid ELF binaries where .bss overlaps the tail of
an RX file-backed page.

Instead of failing, temporarily enable write access on the overlapping
page to zero the fractional bss range, then restore the original page
permissions once initialization is complete.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3179
Signed-off-by: Razvan Ghiorghe <razvanghiorghe16@gmail.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
5 months agosemihosting/uaccess: Use the cpu_internal_tswap() functions
Martin Kröning [Wed, 11 Mar 2026 16:27:16 +0000 (17:27 +0100)] 
semihosting/uaccess: Use the cpu_internal_tswap() functions

The semihosting ABI [1] states:
> Multi-byte values in memory must be formatted as pure little-endian or pure
> big-endian to match the endianness mapping configuration of the processor.

This commits ensures that semihosting data is properly byte-swapped if
the guest's CPU is currently in a different runtime-configurable
endianness than the host's CPU.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3258
Buglink: https://github.com/taiki-e/semihosting/issues/18
[1]: https://github.com/ARM-software/abi-aa/blob/2025Q1/semihosting/semihosting.rst#the-semihosting-interface

Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260311-semihosting-cpu-tswap-v3-3-8e239575ec08@eonerc.rwth-aachen.de
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 months agoinclude/exec: Provide the cpu_internal_tswap() functions
Martin Kröning [Wed, 11 Mar 2026 16:27:15 +0000 (17:27 +0100)] 
include/exec: Provide the cpu_internal_tswap() functions

These functions are needed to support semihosting on CPUs that support
runtime-configurable endianness. They should not be used in other contexts.

Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
Message-id: 20260311-semihosting-cpu-tswap-v3-2-8e239575ec08@eonerc.rwth-aachen.de
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 months agoinclude/hw/core: Rename virtio_is_big_endian to internal_is_big_endian
Martin Kröning [Wed, 11 Mar 2026 16:27:14 +0000 (17:27 +0100)] 
include/hw/core: Rename virtio_is_big_endian to internal_is_big_endian

These functions are needed to do semihosting on CPUs that support
runtime-configurable endiannes. This commit renames them and allows
using them for semihosting, but makes sure to signal that these
functions should not be used in other circumstances.

Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260311-semihosting-cpu-tswap-v3-1-8e239575ec08@eonerc.rwth-aachen.de
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 months agohw/net/rtl8319: Work around GCC sanitizer / -Wstringop-overflow bug
Peter Maydell [Thu, 12 Mar 2026 18:28:00 +0000 (18:28 +0000)] 
hw/net/rtl8319: Work around GCC sanitizer / -Wstringop-overflow bug

If you compile QEMU with GCC with -fsanitize=address and
-Wstringop-overflow, this causes GCC to produce a false-positive
warning which it does not produce when the sanitizer is not enabled
(and which makes compilation fail if you're using -Werror, as we do
by default for builds from git):

../../hw/net/rtl8139.c: In function ‘rtl8139_io_writeb’:
../../hw/net/rtl8139.c:2264:17: error: writing 8 bytes into a region of size 0 [-Werror=stringop-overflow=]
 2264 |                 memcpy(data_to_checksum, saved_ip_header + 12, 8);
      |                 ^
In file included from ../../hw/net/rtl8139.c:62:
/home/pm215/qemu/include/net/eth.h:50:14: note: at offset [8, 48] into destination object ‘ip_ver_len’ of size 1
   50 |     uint8_t  ip_ver_len;     /* version and header length */
      |              ^~~~~~~~~~
../../hw/net/rtl8139.c:2192:21: error: writing 8 bytes into a region of size 0 [-Werror=stringop-overflow=]
 2192 |                     memcpy(data_to_checksum, saved_ip_header + 12, 8);
      |                     ^
/home/pm215/qemu/include/net/eth.h:50:14: note: at offset [8, 48] into destination object ‘ip_ver_len’ of size 1
   50 |     uint8_t  ip_ver_len;     /* version and header length */
      |              ^~~~~~~~~~
../../hw/net/rtl8139.c:2192:21: error: writing 8 bytes into a region of size 0 [-Werror=stringop-overflow=]
 2192 |                     memcpy(data_to_checksum, saved_ip_header + 12, 8);
      |                     ^
/home/pm215/qemu/include/net/eth.h:50:14: note: at offset [8, 48] into destination object ‘ip_ver_len’ of size 1
   50 |     uint8_t  ip_ver_len;     /* version and header length */
      |              ^~~~~~~~~~
In file included from /home/pm215/qemu/include/system/memory.h:21,
                 from /home/pm215/qemu/include/hw/pci/pci.h:4,
                 from /home/pm215/qemu/include/hw/pci/pci_device.h:4,
                 from ../../hw/net/rtl8139.c:54:
In function ‘stl_he_p’,
    inlined from ‘stl_be_p’ at /home/pm215/qemu/include/qemu/bswap.h:371:5,
    inlined from ‘rtl8139_cplus_transmit_one’ at ../../hw/net/rtl8139.c:2244:21,
    inlined from ‘rtl8139_cplus_transmit’ at ../../hw/net/rtl8139.c:2345:28,
    inlined from ‘rtl8139_io_writeb’ at ../../hw/net/rtl8139.c:2728:17:
/home/pm215/qemu/include/qemu/bswap.h:284:5: error: writing 4 bytes into a region of size 0 [-Werror=stringop-overflow=]
  284 |     __builtin_memcpy(ptr, &v, sizeof(v));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/pm215/qemu/include/net/eth.h: In function ‘rtl8139_io_writeb’:
/home/pm215/qemu/include/net/eth.h:50:14: note: at offset [24, 64] into destination object ‘ip_ver_len’ of size 1
   50 |     uint8_t  ip_ver_len;     /* version and header length */
      |              ^~~~~~~~~~

This has been triaged as a bug in GCC:
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114494
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99673
(the sanitizer pass rewrites the IR in a way that conflicts with its
use by the warning pass that runs afterwards).

Since this is the only place in our code where we hit this, work
around it by disabling the -Wstringop-overflow in the part of
the function that hits it. We do this only when using the
address sanitizer on GCC, so that we still get the benefit
of the warning in most compilation scenarios.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3006
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Yodel Eldar <yodel.eldar@yodel.dev>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20260305140512.1330691-1-peter.maydell@linaro.org

5 months agoMerge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
Peter Maydell [Thu, 12 Mar 2026 15:21:06 +0000 (15:21 +0000)] 
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* accel/kvm: fix typo in variable name
* system: fix coverity issues related to confidential guest reset
* target/i386: add compat for migrating error code
* docs fixes
* hyperv/syndbg: check length returned by cpu_physical_memory_map()
* typedefs: move QIgvm out of typedefs.h
* rust: Update Cargo.lock
* i386/cpu: cleanups for ClearwaterForest, AMX and more

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmmynZkUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroP4mgf/bBnkf9xtT4M7+tIoHWCPKGCBuKpQ
# K0IXQ3QM9SJkQpKDbxwytFeGUo2+3jzbsOL+TSm95BmvM9lLj1eP3RALs1r+N1MV
# PISUVwtYyva69OaY/AoiVk5GXMvUqnLMdKm/wTfASH9iA8vd8G20dq0UUqqV+sK0
# e1RZIC9iAURbYnEJhHVgN+I6BXEhDntX087YRV4DR04HI7Ypr8IoOFEbSGIjSbvo
# oiSnBHHH/4L6GlrHtGx03JXlqYG2i2jq/9k5InHXSKHkK9WdVxi8G9WdieoV/Eur
# bsFDJnQs48Na2WKR8R+OIsONdiyU+4zcFOSn8pOM6mJmdD7Fk+/3IPq/2g==
# =IIgH
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu Mar 12 11:03:53 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:
  typedefs: move QIgvm out of typedefs.h
  rust: Update Cargo.lock
  target/i386: add compat for migrating error code
  docs: mention that WHPX supports Arm too
  qemu-options.hx: document Hyper-V enlightenments accelerator option
  docs: remove 64-bit only mentions for accelerators
  accel/kvm: fix typo in variable name
  coverity: fix coverity issues related to confidential guest reset
  i386/cpu: Enable CPUID 0x1f & cache model for ClearwaterForest
  i386/cpu: Adjust the note for CPU models with its-no
  i386/cpu: Remove unnecessary cache_info fields from builtin CPU model
  i386/cpu: Rename AMX mirror feature words with -alias suffix
  i386/cpu: Rename AMX mirror cpuid macros with _ALIAS suffix
  hyperv/syndbg: check length returned by cpu_physical_memory_map()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5 months agotypedefs: move QIgvm out of typedefs.h
Paolo Bonzini [Wed, 11 Mar 2026 16:19:16 +0000 (17:19 +0100)] 
typedefs: move QIgvm out of typedefs.h

Typedefs.h should only be used for really core types; QIgvm is
just an opaque struct that is defined in system/igvm-internal.h,
and the typedef itself can be placed simply in system/igvm.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agorust: Update Cargo.lock
Philippe Mathieu-Daudé [Mon, 9 Mar 2026 17:24:40 +0000 (18:24 +0100)] 
rust: Update Cargo.lock

Update Cargo.lock on top of commit  7ecd3f71079 ("Merge tag
'for-upstream' of https://gitlab.com/bonzini/qemu into staging").

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260309172440.66409-1-philmd@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agotarget/i386: add compat for migrating error code
Fiona Ebner [Tue, 10 Mar 2026 15:43:23 +0000 (16:43 +0100)] 
target/i386: add compat for migrating error code

If cpu->env.has_error_code is true, backwards migration of a VM from
a QEMU binary with commit 27535e9cca to a QEMU binary without commit
27535e9cca will fail:

> kvm: error while loading state for instance 0x0 of device 'cpu'

In practice, wrongly setting the error code to 0 on the target is
often unproblematic, so additionally checking error_code != 0 in
cpu_errcode_needed() is not enough to mitigate the issue. Instead, add
proper machine version compat handling.

Cc: qemu-stable@nongnu.org
Fixes: 27535e9cca ("target/i386: Add support for save/load of exception error code")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20260310154348.495332-1-f.ebner@proxmox.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agodocs: mention that WHPX supports Arm too
Mohamed Mediouni [Wed, 11 Mar 2026 10:26:26 +0000 (11:26 +0100)] 
docs: mention that WHPX supports Arm too

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260311102626.46546-4-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agoqemu-options.hx: document Hyper-V enlightenments accelerator option
Mohamed Mediouni [Wed, 11 Mar 2026 10:26:25 +0000 (11:26 +0100)] 
qemu-options.hx: document Hyper-V enlightenments accelerator option

This option is WHPX-specific and controls whether Hyper-V enlightenments are enabled.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260311102626.46546-3-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agodocs: remove 64-bit only mentions for accelerators
Mohamed Mediouni [Wed, 11 Mar 2026 10:26:24 +0000 (11:26 +0100)] 
docs: remove 64-bit only mentions for accelerators

QEMU itself no longer supports 32-bit systems.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260311102626.46546-2-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agoaccel/kvm: fix typo in variable name
Alyssa Ross [Wed, 11 Mar 2026 09:53:15 +0000 (10:53 +0100)] 
accel/kvm: fix typo in variable name

Fixes: 94a8d39afd ("kvm: Consolidate must-have capability checks")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260311095315.25013-1-hi@alyssa.is
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agocoverity: fix coverity issues related to confidential guest reset
Ani Sinha [Wed, 11 Mar 2026 07:40:48 +0000 (13:10 +0530)] 
coverity: fix coverity issues related to confidential guest reset

Fix issues reported by Peter.

Fixes: ec9bafd2ea9d12c ("i386/sev: add support for confidential guest reset")
Fixes: e76c30bb13ecb9d ("hw/machine: introduce machine specific option 'x-change-vmfd-on-reset'")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260311074048.61367-1-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 months agoMerge tag 'qtest-20260311-pull-request' of https://gitlab.com/farosas/qemu into staging
Peter Maydell [Thu, 12 Mar 2026 09:48:03 +0000 (09:48 +0000)] 
Merge tag 'qtest-20260311-pull-request' of https://gitlab.com/farosas/qemu into staging

Qtest pull request

- memory leak fixes

# -----BEGIN PGP SIGNATURE-----
#
# iQJEBAABCAAuFiEEqhtIsKIjJqWkw2TPx5jcdBvsMZ0FAmmx49sQHGZhcm9zYXNA
# c3VzZS5kZQAKCRDHmNx0G+wxnSVPEAC5YnD2OAn6MYYWolLtauIMI1VKL0Z2fKLg
# f/qymCek5w7ktfi455kQoQIfixBYV8yPT5CLC+qvgYuL+BRQykUYwzHYP+As+boC
# etdmjdwJUkUEQEuIDuoSBWomVNEB6f2plgFJpcyTCbHlXAmEQYhcSQruEhWGMmwg
# F5UgJPbHOIhm0wk6S3wLs43V3M+wZnEnxa+AxT7wkWdTI3ZCAymRpvL3coUA0ACZ
# SkImWuxdx1Y8LW970vCw/AbIdTYnaB8WiPShbvVAkbTe2Sk9WkWyJ5zB2bEdVg/Z
# 8AsP1+/nVZDb4PdCeSYlD/0G378NFGpm5lF1I0OSPeI9yRuSxo0rS/aZsfxajOrH
# XNM0s6daWmyRkqPz00EcuKjWQwd26tv0sz6rmTkIj/XMBvlW5H455Z0lUM5TQ6K3
# dbmkZ0fkwlxpcIJqBi0JzVakBNjNnRVv6NzyFoYJ6I5gvv/8h/SwGk36pRBb0BSi
# X0sle6qEmpF9IRb56FI9vVhUdldCrIu8I0lY0cSWqWleMKO+geVcMOFixdmCOKwk
# CR8ZhaqkC6qdhFqlGX4nIoy2bvhrj5ULtQjXSnpfSRZCZajpfMxG4VNhrNpDy/CE
# bFajU+mNO29wJ9ACqE43cx/YpvGzkv5qvAg8yR52gjPQ8+sx7HU4cSdm1VTLcU/Z
# /UnojkSTJg==
# =8Bwh
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed Mar 11 21:51:23 2026 GMT
# gpg:                using RSA key AA1B48B0A22326A5A4C364CFC798DC741BEC319D
# gpg:                issuer "farosas@suse.de"
# gpg: Good signature from "Fabiano Rosas <farosas@suse.de>" [unknown]
# gpg:                 aka "Fabiano Almeida Rosas <fabiano.rosas@suse.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: AA1B 48B0 A223 26A5 A4C3  64CF C798 DC74 1BEC 319D

* tag 'qtest-20260311-pull-request' of https://gitlab.com/farosas/qemu:
  tests/qtest/test-x86-cpuid-compat: Switch test_feature_flag to data-driven
  tests/qtest/test-x86-cpuid-compat: Switch test_cpuid_prop to data-driven
  tests/qtest/vhost-user-test: Use g_timeout_add() to schedule connect

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>