]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
2 weeks agoplugins/api.c: Trust cpu_get_phys_addr_debug() return address
Peter Maydell [Thu, 30 Apr 2026 09:37:59 +0000 (10:37 +0100)] 
plugins/api.c: Trust cpu_get_phys_addr_debug() return address

In qemu_plugin_translate_vaddr() we have a workaround for not all
implementations of get_phys_addr_debug returning an exact physaddr
for the input virtual address: we OR back in the page offset to the
return value.

Now that we guarantee that get_phys_addr_debug returns the exact
physaddr for the input virtual address, we can drop this workaround.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-14-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-15-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agomonitor: hmp_gva2gpa: Don't page-align cpu_get_phys_addr_debug() arg and return
Peter Maydell [Thu, 30 Apr 2026 09:37:58 +0000 (10:37 +0100)] 
monitor: hmp_gva2gpa: Don't page-align cpu_get_phys_addr_debug() arg and return

In hmp_gva2gpa() we currently have a workaround for not all implementations
of get_phys_addr_debug handling non-page-aligned addresses: we round the
input address from the user down to the target page boundary before the
call and then add the page offset back to the returned value.

Now that we guarantee that all implementations will return the correct
exact physaddr for a virtual address, we can drop this handling.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Dr. David Alan Gilbert <dave@treblig.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260417173105.1648172-13-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-14-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/arm: Rename arm_cpu_get_phys_page()
Peter Maydell [Thu, 30 Apr 2026 09:37:57 +0000 (10:37 +0100)] 
target/arm: Rename arm_cpu_get_phys_page()

The internal helper function arm_cpu_get_phys_page() is named that
way because of its use in the get_phys_page_attrs_debug method.  Now
we've renamed the method, rename the helper to match, since it can
handle non-page-aligned addresses.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260417173105.1648172-12-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-13-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agohw/core: Update docs for get_phys_addr_{attrs_, }debug
Peter Maydell [Thu, 30 Apr 2026 09:37:56 +0000 (10:37 +0100)] 
hw/core: Update docs for get_phys_addr_{attrs_, }debug

Update the documentation for the get_phys_addr_{attrs_,}debug methods
and wrapper functions to state that they can handle non-page aligned
addresses and will return the corresponding exact physaddr for them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260417173105.1648172-11-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-12-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget: Rename cpu_get_phys_page_{,attrs_}debug
Peter Maydell [Thu, 30 Apr 2026 09:37:55 +0000 (10:37 +0100)] 
target: Rename cpu_get_phys_page_{,attrs_}debug

Rename cpu_phys_page_debug() and cpu_phys_page_attrs_debug() to
cpu_phys_addr_debug() and cpu_phys_addr_attrs_debug().

Commit created with:
 sed -i -e 's/cpu_get_phys_page_debug/cpu_get_phys_addr_debug/g;s/cpu_get_phys_page_attrs_debug/cpu_get_phys_addr_attrs_debug/g' $(git grep -l cpu_get_phys_page)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-10-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-11-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget: Rename get_phys_page_debug to get_phys_addr_debug
Peter Maydell [Thu, 30 Apr 2026 09:37:54 +0000 (10:37 +0100)] 
target: Rename get_phys_page_debug to get_phys_addr_debug

Now that we have ensured that all implementations of the get_phys_page_debug
method handle a non-page-aligned input and return the corresponding
non-page-aligned output, the name of the method is somewhat misleading.
Rename it to get_phys_addr_debug.

This commit was produced with the commands

 sed -i -e 's/_cpu_get_phys_page_debug/_cpu_get_phys_addr_debug/g;s/\<get_phys_page_debug\>/get_phys_addr_debug/g' $(git grep -l get_phys_page_debug)
 sed -i -e 's/_cpu_get_phys_page_attrs_debug/_cpu_get_phys_addr_attrs_debug/g;s/\<get_phys_page_attrs_debug\>/get_phys_addr_attrs_debug/g' $(git grep -l get_phys_page_attrs_debug)

which catches all references to the method name itself plus
the functions which each target uses as the method implementation,
but (deliberately) not the cpu_phys_get_page_debug() and
cpu_phys_get_page_attrs_debug() wrapper functions or their callers.
(We'll deal with those in the next commit.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-9-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-10-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/ppc: Make get_phys_page_debug handle non-page-aligned addrs
Peter Maydell [Thu, 30 Apr 2026 09:37:53 +0000 (10:37 +0100)] 
target/ppc: Make get_phys_page_debug handle non-page-aligned addrs

Currently our implementations of SysemuCPUOps::get_phys_page_debug
and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a
non-page-aligned virtual address and returns the corresponding
non-page-aligned physical address" and "only returns a page-aligned
physical address".  This is awkward for callsites, which in practice
all want the physical address for an arbitrary virtual address and
have to work around the possibility of getting a page-aligned
address, and it doesn't account for protection being possibly on a
sub-page-sized granularity.  We want to standardize on the
implementation having to handle non-page-aligned addresses.

The ppc_xlate() function can accept a non-page-aligned input but may
return a page-aligned output; we take the simple approach of ORing
the page offset back into the result address after calling it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-8-peter.maydell@linaro.org
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>
Message-ID: <20260430093810.2762539-9-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/s390x: Make get_phys_page_debug handle non-page-aligned addrs
Peter Maydell [Thu, 30 Apr 2026 09:37:52 +0000 (10:37 +0100)] 
target/s390x: Make get_phys_page_debug handle non-page-aligned addrs

Currently our implementations of SysemuCPUOps::get_phys_page_debug
and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a
non-page-aligned virtual address and returns the corresponding
non-page-aligned physical address" and "only returns a page-aligned
physical address".  This is awkward for callsites, which in practice
all want the physical address for an arbitrary virtual address and
have to work around the possibility of getting a page-aligned
address, and it doesn't account for protection being possibly on a
sub-page-sized granularity.  We want to standardize on the
implementation having to handle non-page-aligned addresses.

s390x already has an implementation of "give me the actual physical
address, not rounded down", in s390_get_phys_addr_debug(), so we can
use this for the SysemuCPUOps::get_phys_page_debug method, and merge
the s390_cpu_get_phys_page_debug() function into
s390_get_phys_addr_debug() which is now its only caller.

This leaves the function implementing the method with a name
that doesn't match the method name, but we will fix that shortly
by renaming the method to *_addr_* for all targets.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-7-peter.maydell@linaro.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260430093810.2762539-8-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/x86: Make get_phys_page_attrs_debug handle non-page-aligned addrs
Peter Maydell [Thu, 30 Apr 2026 09:37:51 +0000 (10:37 +0100)] 
target/x86: Make get_phys_page_attrs_debug handle non-page-aligned addrs

Currently our implementations of SysemuCPUOps::get_phys_page_debug
and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a
non-page-aligned virtual address and returns the corresponding
non-page-aligned physical address" and "only returns a page-aligned
physical address".  This is awkward for callsites, which in practice
all want the physical address for an arbitrary virtual address and
have to work around the possibility of getting a page-aligned
address, and it doesn't account for protection being possibly on a
sub-page-sized granularity.  We want to standardize on the
implementation having to handle non-page-aligned addresses.

For x86 this is simple: we just need to stop rounding down the
input address to a TARGET_PAGE boundary when calculating the
result to return.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-6-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-7-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/sparc: Make get_phys_page_debug handle non-page-aligned addrs
Peter Maydell [Thu, 30 Apr 2026 09:37:50 +0000 (10:37 +0100)] 
target/sparc: Make get_phys_page_debug handle non-page-aligned addrs

Currently our implementations of SysemuCPUOps::get_phys_page_debug
and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a
non-page-aligned virtual address and returns the corresponding
non-page-aligned physical address" and "only returns a page-aligned
physical address".  This is awkward for callsites, which in practice
all want the physical address for an arbitrary virtual address and
have to work around the possibility of getting a page-aligned
address, and it doesn't account for protection being possibly on a
sub-page-sized granularity.  We want to standardize on the
implementation having to handle non-page-aligned addresses.

The sparc TLB lookup code can handle non-aligned input addresses but
will return page-aligned results.  Rather than attempting to change
the internals of the lookup code, we take the simple approach of
ORing the page offset back into the phys_addr result.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-5-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-6-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/microblaze: Make get_phys_page_attrs_debug handle non-page-aligned addrs
Peter Maydell [Thu, 30 Apr 2026 09:37:49 +0000 (10:37 +0100)] 
target/microblaze: Make get_phys_page_attrs_debug handle non-page-aligned addrs

Currently our implementations of SysemuCPUOps::get_phys_page_debug
and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a
non-page-aligned virtual address and returns the corresponding
non-page-aligned physical address" and "only returns a page-aligned
physical address".  This is awkward for callsites, which in practice
all want the physical address for an arbitrary virtual address and
have to work around the possibility of getting a page-aligned
address, and it doesn't account for protection being possibly on a
sub-page-sized granularity.  We want to standardize on the
implementation having to handle non-page-aligned addresses.

For microblaze, we just need to remove the explicit rounding down to
the page boundary that we were doing in
mb_cpu_get_phys_page_attrs_debug() when calculating the output
physaddr from the results of the MMU lookup.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-4-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-5-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/alpha: Make get_phys_page_debug handle non-page-aligned addrs
Peter Maydell [Thu, 30 Apr 2026 09:37:48 +0000 (10:37 +0100)] 
target/alpha: Make get_phys_page_debug handle non-page-aligned addrs

Currently our implementations of SysemuCPUOps::get_phys_page_debug
and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a
non-page-aligned virtual address and returns the corresponding
non-page-aligned physical address" and "only returns a page-aligned
physical address".  This is awkward for callsites, which in practice
all want the physical address for an arbitrary virtual address and
have to work around the possibility of getting a page-aligned
address, and it doesn't account for protection being possibly on a
sub-page-sized granularity.  We want to standardize on the
implementation having to handle non-page-aligned addresses.

For alpha, the get_physical_address() function accepts arbitrary
input addresses but may return an output rounded down to a page
boundary, so in alpha_cpu_get_phys_page_debug() we OR the within-page
offset into it before returning it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-3-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-4-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agotarget/riscv: Make get_phys_page_debug handle non-page-aligned addrs
Peter Maydell [Thu, 30 Apr 2026 09:37:47 +0000 (10:37 +0100)] 
target/riscv: Make get_phys_page_debug handle non-page-aligned addrs

Currently our implementations of SysemuCPUOps::get_phys_page_debug
and SysemuCPUOps::get_phys_page_attrs_debug are a mix of "accepts a
non-page-aligned virtual address and returns the corresponding
non-page-aligned physical address" and "only returns a page-aligned
physical address".  This is awkward for callsites, which in practice
all want the physical address for an arbitrary virtual address and
have to work around the possibility of getting a page-aligned
address, and it doesn't account for protection being possibly on a
sub-page-sized granularity.  We want to standardize on the
implementation having to handle non-page-aligned addresses.

The only thing in the riscv implementation that we need to fix
is the place where we explicitly round the return value down to
a page boundary before returning it. Drop that.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Chao Liu <chao.liu.zevorn@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260417173105.1648172-2-peter.maydell@linaro.org
Message-ID: <20260430093810.2762539-3-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agohw/i386/vapic: Cope with non-page-aligned return from cpu_get_phys_page_debug()
Peter Maydell [Thu, 30 Apr 2026 09:37:46 +0000 (10:37 +0100)] 
hw/i386/vapic: Cope with non-page-aligned return from cpu_get_phys_page_debug()

Currently the i386 implementation of get_phys_page_debug() always
returns an address aligned to a page boundary, and the vapic.c code
assumes this: it adds back in the page offset after the call.  Change
this to OR in the page offset, so that it works whether
cpu_get_phys_page_debug() returns the page address or the exact
physical address. This will mean the code continues to work when
we change the semantics to standardize on "return exact
physical address".

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260430093810.2762539-2-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agovdpa: Allow VDPA to work on big-endian machine
Konstantin Shkolnyy [Mon, 27 Apr 2026 14:47:46 +0000 (09:47 -0500)] 
vdpa: Allow VDPA to work on big-endian machine

After commit 0caed25cd171 vhost_vdpa_net_load_vlan() started seeing
VIRTIO_NET_F_CTRL_VLAN flag and making 4096 calls to the kernel with
VIRTIO_NET_CTRL_VLAN_ADD command. However, it forgot to convert the
16-bit VLAN IDs to LE format. On BE machine, the kernel calls failed
when they saw "VLAN IDs" greater than 4095, and QEMU then said:
"unable to start vhost net: 5: falling back on userspace virtio", and
VDPA became disabled.

Convert the VLAN ID to LE before putting it into virtio queue.

Fixes: 8f7e9967484d ("vdpa: Restore vlan filtering state")
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Message-ID: <20260427144746.1498-1-kshk@linux.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agoMAINTAINERS: Step up to maintain core machine code
Philippe Mathieu-Daudé [Fri, 17 Apr 2026 10:24:02 +0000 (12:24 +0200)] 
MAINTAINERS: Step up to maintain core machine code

The 'Machine core' section is orphan. Being acquainted
with the code, step up to maintain it.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Yanan Wang <wangyanan55@huawei.com>
Cc: Eduardo Habkost <eduardo@habkost.net>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260417110550.70068-3-philmd@linaro.org>

2 weeks agohw/sd: Update trace events for buf+len data
Christian Speich [Fri, 17 Apr 2026 09:51:40 +0000 (11:51 +0200)] 
hw/sd: Update trace events for buf+len data

After switching sdbuf and sdcard over to use buf+len instead of single
byte operation, the trace events need to be updated.

This patch updates sdbus_{read,write} and sdcard_write_data to output the
buffer that is worked on.

sdcard_read_data is left unchanged, as it did not print the read byte
before anyways.

Signed-off-by: Christian Speich <c.speich@avm.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260417-sdcard-performance-b4-v4-7-119e66be10c2@avm.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agohw/sd/sd: Allow multi-byte read/write for generic paths
Christian Speich [Fri, 17 Apr 2026 09:51:35 +0000 (11:51 +0200)] 
hw/sd/sd: Allow multi-byte read/write for generic paths

Paths that use sd_generic_write/read_data can now write/read multiple
bytes with one call.

Signed-off-by: Christian Speich <c.speich@avm.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260417-sdcard-performance-b4-v4-2-119e66be10c2@avm.de>
[PMD: Access &sd->data[sd->data_offset] in sd_generic_read/write_data]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agodocs/devel/qtest: Mention environment variables usage
Fabiano Rosas [Wed, 29 Apr 2026 00:31:30 +0000 (21:31 -0300)] 
docs/devel/qtest: Mention environment variables usage

Document the QTEST_ environment variables. Only include the ones used
by QTest itself, don't document test-specific variables as they are
more prone to change.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260429003130.15164-4-farosas@suse.de
[picked rst-formatted version from Peter Maydell]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2 weeks agotests/qtest: Individual verbose switches
Fabiano Rosas [Wed, 29 Apr 2026 00:31:29 +0000 (21:31 -0300)] 
tests/qtest: Individual verbose switches

Allow logging to be set for specific parts of QTest. Having a single
QTEST_LOG knob creates an output stream that is almost useless due to
spamming from some operations.

Add a backward-compatible way of selecting which parts will be made
verbose. Reuse the existing QTEST_LOG variable. The new options are:

QTEST_LOG=
fuzz - fuzz.c
qga - unit/test-qga.c
qmp - libqmp.c
qtest - QTest device, i.e. -qtest-log option
test - generic term for usage of all tests

E.g.:

QTEST_LOG=fuzz,qga,qmp,qtest,test
  equivalent to QTEST_LOG=1

QTEST_LOG=qmp,qtest
  enables logging of qmp operations from libqmp.c and logging of the
  qtest device.

QTEST_LOG=test,qmp
  enable test output and libqmp.c output.

QTEST_LOG=-qmp
  enable all output, except for libqmp.c

Acked-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260429003130.15164-3-farosas@suse.de
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2 weeks agotests/qtest/libqtest: Replace QTEST_TRACE with QTEST_QEMU_ARGS
Fabiano Rosas [Wed, 29 Apr 2026 00:31:28 +0000 (21:31 -0300)] 
tests/qtest/libqtest: Replace QTEST_TRACE with QTEST_QEMU_ARGS

The QTEST_TRACE environment variable allows for any QEMU command line
option to be passed if used like so:

export QTEST_TRACE="-trace tracepoint -more -opts -here"

Formalize that usage by accepting a new QTEST_QEMU_ARGS
variable. Since the QTEST_TRACE now becomes redundant, remove its
usage.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260429003130.15164-2-farosas@suse.de
[end all fmt strings with space]
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2 weeks agohw/i3c/dw-i3c: Fix BCR/DCR extraction and PID assembly during ENTDAA
Ashish Anand [Tue, 5 May 2026 13:40:02 +0000 (19:10 +0530)] 
hw/i3c/dw-i3c: Fix BCR/DCR extraction and PID assembly during ENTDAA

The target_info union in dw_i3c_addr_assign_cmd() declares pid, bcr,
and dcr as separate union members, causing them to all alias b[0]
rather than their correct positions in the ENTDAA response buffer.
This results in dw_i3c_update_char_table() being called with BCR and
DCR both read from b[0] instead of b[6] and b[7] respectively,
corrupting the device characteristics table on every ENTDAA operation.
Fix by replacing the broken members with uint64_t d and extracting fields
per the I3C spec ENTDAA wire format.

Additionally, dw_i3c_update_char_table() incorrectly splits PID across
LOC1 and LOC2 at bit 32. Per the Linux kernel HCI driver
(drivers/i3c/master/mipi-i3c-hci/dct_v1.c), the DCT layout requires
LOC1 to hold pid[47:16] and LOC2 to hold pid[15:0]. Fix the split
accordingly.

Signed-off-by: Ashish Anand <ashish.a6@samsung.com>
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Link: https://lore.kernel.org/qemu-devel/20260505134002.509037-1-ashish.a6@samsung.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agohw/arm: Remove fby35 machine
Cédric Le Goater [Sun, 10 May 2026 16:57:04 +0000 (18:57 +0200)] 
hw/arm: Remove fby35 machine

The fby35 machine was deprecated in QEMU 10.2 and is now removed in
QEMU 11.1.

This multi-SoC machine was added as an example of heterogeneous
systems, but the models never evolved and no public firmware is
available to boot it. Users needing multi-SoC emulation should use the
ast2700fc machine instead, which is based on newer AST2700 SoCs with
better support.

Link: https://lore.kernel.org/qemu-devel/20260510165704.2935316-5-clg@redhat.com
Acked-by: Peter Delevoryas <peter@pjd.dev>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agohw/arm: Remove fp5280g2-bmc machine
Cédric Le Goater [Sun, 10 May 2026 16:57:03 +0000 (18:57 +0200)] 
hw/arm: Remove fp5280g2-bmc machine

The fp5280g2-bmc machine was deprecated in QEMU 10.2 and is now
removed in QEMU 11.1.

This Inspur FP5280G2 BMC board does not rely on specific device models
and can be replaced by the ast2500-evb machine with appropriate
fmc-model and I2C device configuration via command line.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260510165704.2935316-4-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agohw/arm: Remove qcom-dc-scm-v1-bmc and qcom-firework-bmc machines
Cédric Le Goater [Sun, 10 May 2026 16:57:02 +0000 (18:57 +0200)] 
hw/arm: Remove qcom-dc-scm-v1-bmc and qcom-firework-bmc machines

The qcom-dc-scm-v1-bmc and qcom-firework-bmc machines were deprecated
in QEMU 10.2 and are now removed in QEMU 11.1.

These Qualcomm lab servers never entered production and do not rely on
specific device models. They can be replaced by the ast2600-evb
machine with appropriate fmc-model and I2C device configuration via
command line.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260510165704.2935316-3-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agohw/arm: Remove sonorapass-bmc machine
Cédric Le Goater [Sun, 10 May 2026 16:57:01 +0000 (18:57 +0200)] 
hw/arm: Remove sonorapass-bmc machine

The sonorapass-bmc machine was deprecated in QEMU 10.2 and is now
removed in QEMU 11.1.

This OCP SonoraPass BMC lab server never entered production and can be
replaced by the ast2500-evb machine with appropriate fmc-model and I2C
device configuration via command line.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260510165704.2935316-2-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agoaspeed/hace: Fix mapped address may not be unmapped issue
Kane Chen [Tue, 12 May 2026 06:50:04 +0000 (06:50 +0000)] 
aspeed/hace: Fix mapped address may not be unmapped issue

In the do_hash_operation, the code may be returned earlier because
hash_prepare_sg_iov or hash_prepare_direct_iov may return a failure.
When this condition is happened, current code flow doesn't go through
later code segments. Finally, it causes the mapped address isn't
unmapped properly.

This change unmaps any mapped addresses when an error occurs,
preventing a resource leak.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com>
Link: https://lore.kernel.org/qemu-devel/20260512065002.1516704-2-kane_chen@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agoaspeed/hace: Prevent total_req_len overflow
Cédric Le Goater [Mon, 4 May 2026 21:34:21 +0000 (23:34 +0200)] 
aspeed/hace: Prevent total_req_len overflow

In accumulate mode, total_req_len is incremented with plen (hwaddr)
for each hash request. Repeated additions can overflow total_req_len
(uint32_t) and potentially bypass validation checks in has_padding().

Add a helper function to detect overflow before incrementing
total_req_len and reject the request if overflow would occur.

Reported-by: Katherine Leaver <katherine.j.leaver@gmail.com>
Cc: qemu-stable@nongnu.org
Fixes: 5cd7d8564a8b ("aspeed/hace: Support AST2600 HACE")
Link: https://lore.kernel.org/qemu-devel/20260504213421.710035-3-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agoaspeed/hace: Fix out-of-bounds read in has_padding()
Cédric Le Goater [Mon, 4 May 2026 21:34:20 +0000 (23:34 +0200)] 
aspeed/hace: Fix out-of-bounds read in has_padding()

The has_padding() function reads the last 8 bytes of a DMA buffer
without validating req_len. req_len is guest-controlled (via
R_HASH_SRC_LEN register or scatter-gather entries) and values less
than 8 cause integer underflow. This can result in an out-of-bounds
read of QEMU process memory.

Add a check to ensure req_len >= 8 before accessing the buffer.

Reported-by: Katherine Leaver <katherine.j.leaver@gmail.com>
Cc: qemu-stable@nongnu.org
Fixes: 5cd7d8564a8b ("aspeed/hace: Support AST2600 HACE")
Link: https://lore.kernel.org/qemu-devel/20260504213421.710035-2-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agohw/misc/aspeed_sbc: Add bounds checking for OTP write operations
Kane Chen [Tue, 28 Apr 2026 05:52:56 +0000 (05:52 +0000)] 
hw/misc/aspeed_sbc: Add bounds checking for OTP write operations

There is a mismatch between the Aspeed OTP model and the Aspeed SBC
model in how the guest-provided address is handled.
aspeed_sbc_otp_prog() passes a word-indexed address directly
to address_space_write() without converting it to a byte offset,
whereas aspeed_otp_write() expects a byte offset and applies an
additional shift (otp_addr << 2). This double-shift confusion means
that an out-of-range word address can lead to a write beyond the
allocated storage.

Fix this by adding bounds checking on the word offset before
converting to byte offset and passing to address_space_write().
This matches the existing bounds check in aspeed_sbc_otp_read().

Cc: Kane-Chen-AS <kane_chen@aspeedtech.com>
Cc: qemu-stable@nongnu.org
Fixes: 1a00754ccf15 ("hw/misc: Add Aspeed Secure Boot Controller model")
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3436
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/qemu-devel/20260428055254.76581-2-kane_chen@aspeedtech.com
[ clg: Kept otp_addr in event logged in aspeed_sbc_otp_prog() ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 weeks agohw/sd: Switch read/write primitive to buf+len
Christian Speich [Fri, 17 Apr 2026 09:51:34 +0000 (11:51 +0200)] 
hw/sd: Switch read/write primitive to buf+len

Currently, read/writes are broken down into individual bytes which result
in many function calls. This is quite bad for performance and since both
the layer below and above work with larger buffers, it should be
corrected.

This patch is the first that switches the corresponding interface over to
use a buf+len instead of a single byte. However, for most cases the
implementation still only reads one byte and is then called again with
the remaining buffer.

Optimizations taking advantage of this new interface are to follow in the
next commits.

Signed-off-by: Christian Speich <c.speich@avm.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260417-sdcard-performance-b4-v4-1-119e66be10c2@avm.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agohw/sd/sdcard: Add support for pre-setting the authentication key
Jan Kiszka [Wed, 15 Apr 2026 05:46:07 +0000 (07:46 +0200)] 
hw/sd/sdcard: Add support for pre-setting the authentication key

In contrast to real eMMCs, we are not (yet) persisting the full state
of the device. This particularly includes the authentication key used
for RPMB access, complicating testing of firmware images which do not
support initial provisioning of the key.

One way to address this would be, e.g., extending the eMMC disk image
with a special sector to store further state. A simpler approach is used
here: Add another device property that allows to specify the
authentication key, bringing up the eMMC as if the key has already been
provisioned before.

This is how to tell qemu to use the OP-TEE test key:

 -device emmc,[...],auth-key=D3EB3EC36E334C9F988CE2C0B85954610D2BCF8664844DF2AB56E6C61BB701E4

Or use this for machine-configured eMMCs:

 -global emmc.auth-key=D3EB3EC36E334C9F988CE2C0B85954610D2BCF8664844DF2AB56E6C61BB701E4

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@arm.com>
Message-ID: <9fab19ee4c755f9cb2abf55494541fcadff46cbd.1776231967.git.jan.kiszka@siemens.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agoscripts: mkemmc.sh: Fix output pollution on missing images
Jan Kiszka [Wed, 15 Apr 2026 05:46:06 +0000 (07:46 +0200)] 
scripts: mkemmc.sh: Fix output pollution on missing images

Reorder the redirections so that the 2>/dev/null can actually take
effect.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@arm.com>
Message-ID: <b9d603b7396719f38e03cd969a4ac1b48f5ea96a.1776231967.git.jan.kiszka@siemens.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agohw/display/cirrus_vga: Fix packed-24 color-expansion transparent copies
Peter Maydell [Fri, 10 Apr 2026 18:32:49 +0000 (19:32 +0100)] 
hw/display/cirrus_vga: Fix packed-24 color-expansion transparent copies

For the "color expansion" subtype of raster operations, the source
pixel format is a monochrome bitmap, and the destination can be any
of 8, 16, 24 or 32bpp.

For these pattern operations, the GR2F register includes a field
which specifies how much to skip at the start of each scanline.  In
the 8, 16 and 32 bit cases, this field is 3 bits and is a count of
pixels to skip.  We get this case right.  However, for the 24 bit
case, the field is 5 bits and is a count of destination bytes to
skip.

In commit ad81218e40e27 ("depth=24 write mask fix (Volker Ruppert)")
in 2005, we updated the code to (attempt to) handle the 5-bit mask
case.  However, we don't do the right thing when the 5-bit mask
indicates that we need to skip more than 8 bits of the input bitmap:
we will right-shift the 0x80 constant completely off the right hand
side, and will be off-by-one for all the source bitmap loads.

Fix this by calculating the whole number of input bytes we need to
skip and the residual number of bits.  In the 8/16/32bpp case the
bytes to skip is always zero.

Cc: qemu-stable@nongnu.org
Fixes: ad81218e40e27 ("depth=24 write mask fix (Volker Ruppert)")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Junjie Cao <junjie.cao@intel.com>
Tested-by: Junjie Cao <junjie.cao@intel.com>
Message-ID: <20260410183249.4046456-3-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agohw/display/cirrus_vga: Fix packed-24 color-expansion transparent pattern fills
Peter Maydell [Fri, 10 Apr 2026 18:32:48 +0000 (19:32 +0100)] 
hw/display/cirrus_vga: Fix packed-24 color-expansion transparent pattern fills

The Cirrus Logic VGA card has "pattern fill" blit modes where it
repeatedly copies an 8x8 source pattern to the display.  For the
"color expansion" subtype of these, the source pixel format is an 8x8
monochrome bitmap, and the destination can be any of 8, 16, 24 or
32bpp.  We implemented these wrong for the 24bpp case, in a way that
results in a complaint from the undefined-behavior sanitizer about a
shift by a negative value.

For these pattern fills, the GR2F register includes a field which
specifies how much to skip at the start of each scanline.  In the 8,
16 and 32 bit cases, this field is 3 bits and is a count of pixels to
skip.  We get this case right.  However, for the 24 bit case, the
field is 5 bits and is a count of destination bytes to skip.  We
tried to add support for 24-bits in commit ad81218e40e27 ("depth=24
write mask fix (Volker Ruppert)") in 2005.  However we got this
wrong, because when we need to skip, for example, 30 bytes in the
destination, this is 10 input pixels but the whole pattern is only 8
pixels wide, and we ended up with a negative bitpos for the first bit
to use in the pattern.

Fix the bug by masking srcskipleft in the 24-bit case so that it
correctly gives the first pixel to use in the pattern even if we skip
so many pixels that we have wrapped around to what would have been
the second copy of the pattern to the destination.

This patch was produced based on the information in the CL-GD5446
Technical Reference Manual, specifically sections 5.8 "GR2F: BLT
Destination Left-Side Clipping" and 9.4.8 "Pattern Fills".

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3377
Fixes: ad81218e40e27 ("depth=24 write mask fix (Volker Ruppert)")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Junjie Cao <junjie.cao@intel.com>
Tested-by: Junjie Cao <junjie.cao@intel.com>
Message-ID: <20260410183249.4046456-2-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agohw/ufs: Zero reserved bytes in REPORT LUNS response header
Jeuk Kim [Mon, 11 May 2026 04:59:29 +0000 (13:59 +0900)] 
hw/ufs: Zero reserved bytes in REPORT LUNS response header

ufs_emulate_report_luns() writes the 4-byte LUN list length into
outbuf[0..3] via stl_be_p() but leaves outbuf[4..7], the reserved
field, uninitialized. Those bytes are then DMA'd to guest memory,
leaking uninitialized QEMU stack data.

Fixes: 7708e298180 ("hw/ufs/lu: skip automatic zero-init of large array")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
2 weeks agohw/ufs: Keep MCQ SQs alive while requests are outstanding
Jeuk Kim [Wed, 6 May 2026 04:50:49 +0000 (13:50 +0900)] 
hw/ufs: Keep MCQ SQs alive while requests are outstanding

MCQ requests are allocated with their SQ, but can remain in flight on the
CQ list or in the SCSI layer after leaving the SQ free list.

Reject runtime SQ deletion while any request is still outstanding, and
use separate teardown helpers so device exit can still release MCQ
queues after child devices have been unrealized.

Fixes: 5c079578d2e ("hw/ufs: Add support MCQ of UFSHCI 4.0")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
2 weeks agohw/ufs: Reject zero-depth MCQ queues
Jeuk Kim [Wed, 6 May 2026 04:50:34 +0000 (13:50 +0900)] 
hw/ufs: Reject zero-depth MCQ queues

Reject SQATTR.SIZE and CQATTR.SIZE values that produce zero-entry MCQ
queues. Such queues can later trigger a divide-by-zero while advancing
queue pointers.

Fixes: 5c079578d2e ("hw/ufs: Add support MCQ of UFSHCI 4.0")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
2 weeks agohw/ufs: Guard MCQ CQ accesses against missing queues
Jeuk Kim [Mon, 16 Mar 2026 05:39:46 +0000 (14:39 +0900)] 
hw/ufs: Guard MCQ CQ accesses against missing queues

A guest can ring an MCQ CQ doorbell before the completion queue exists.
The CQ head write path then dereferences a NULL CQ through
ufs_mcq_cq_full().

Ignore CQ head updates for missing CQs, and make ufs_mcq_cq_full()
handle a missing CQ defensively.

Fixes: f78762a3cc8 ("hw/ufs: Fix mcq completion queue wraparound")
Reported-by: Rayhan Ramdhany Hanaputra <hanaputrarayhan@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
2 weeks agohw/ufs: Validate MCQ SQ references before use
Jeuk Kim [Mon, 16 Mar 2026 05:39:04 +0000 (14:39 +0900)] 
hw/ufs: Validate MCQ SQ references before use

A guest can program an out-of-range SQATTR.CQID value, or ring an
MCQ SQ doorbell before the submission queue exists.

Reject SQ creation when the referenced CQ is invalid, and ignore SQ
doorbells for queues that have not been created. This prevents a
guest-triggerable out-of-bounds read and NULL pointer dereference.

Fixes: 5c079578d2e ("hw/ufs: Add support MCQ of UFSHCI 4.0")
Reported-by: Rayhan Ramdhany Hanaputra <hanaputrarayhan@gmail.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jeuk Kim <jeuk20.kim@samsung.com>
2 weeks agotarget/s390x: add gen-features.h dependency to s390x_system_ss
Marc-André Lureau [Sun, 10 May 2026 20:41:24 +0000 (00:41 +0400)] 
target/s390x: add gen-features.h dependency to s390x_system_ss

Commit 0b83acf2f05 moved gen_features_h from s390x_ss to
s390x_common_ss. However s390x_system_ss (containing ioinst.c) was left
without the dependency, causing a build race: it can be compiled before
gen-features.h is generated (via cpu.h -> cpu_models.h -> cpu_features.h
-> gen-features.h)

Add gen_features_h to s390x_system_ss to correct the build ordering.

Fixes: 0b83acf2f05 ("target/s390x: Introduce common system/user meson source set")
Acked-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agomeson: drop sphinx-build < 1.7 compatiblity check
Marc-André Lureau [Mon, 11 May 2026 10:42:07 +0000 (14:42 +0400)] 
meson: drop sphinx-build < 1.7 compatiblity check

Since commit fe791b7fcc ("Python: bump minimum sphinx version to
3.4.3"), we no longer support building with sphinx-build < 3.4.3

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
2 weeks agohw/riscv/virt: free flash devices and OEM strings on finalization
Marc-André Lureau [Mon, 27 Apr 2026 12:39:24 +0000 (16:39 +0400)] 
hw/riscv/virt: free flash devices and OEM strings on finalization

Add instance_finalize to free the two pflash devices (when unrealized)
and the OEM ID strings allocated during instance_init. Fixes leaks
found by ASan.

Fixes: 71eb522c4063 ("riscv/virt: Add the PFlash CFI01 device")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/ppc/pnv: drop extra ref on PHB after adding as child
Marc-André Lureau [Mon, 27 Apr 2026 12:26:56 +0000 (16:26 +0400)] 
hw/ppc/pnv: drop extra ref on PHB after adding as child

object_new() returns an object with refcount 1, and
object_property_add_child() adds another reference. The initial
reference must be dropped so the parent becomes the sole owner,
otherwise the PHB objects leak when the chip is destroyed.

Fixes: 0d512c7120a2 ("ppc/pnv: turn chip8->phbs[] into a PnvPHB* array")
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>
Reviewed-by: Aditya Gupta <adityag@linux.ibm.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/arm/virt: free flash devices and OEM strings on finalization
Marc-André Lureau [Mon, 27 Apr 2026 12:10:20 +0000 (16:10 +0400)] 
hw/arm/virt: free flash devices and OEM strings on finalization

Flash devices created in instance_init via qdev_new() hold an extra
reference that is only dropped on sysbus_realize_and_unref(). When the
machine is destroyed before realization, the flash objects leak. Also,
the oem_id and oem_table_id strings from g_strndup() are never freed.

Fixes: 602b458201ff ("acpi: Permit OEM ID and OEM table ID fields to be changed")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/arm/sbsa-ref: free unrealized flash devices on finalization
Marc-André Lureau [Mon, 27 Apr 2026 12:09:32 +0000 (16:09 +0400)] 
hw/arm/sbsa-ref: free unrealized flash devices on finalization

Flash devices are created with qdev_new() in instance_init and added as
children, but the initial reference from qdev_new() is only dropped by
sysbus_realize_and_unref() during machine init. When the machine object
is destroyed before realization (e.g. during qtest device introspection),
the flash devices leak.

Fixes: e9fdf453240e ("hw/arm: Add arm SBSA reference machine, devices part")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/arm/aspeed: free fmc_model and spi_model on finalization
Marc-André Lureau [Mon, 27 Apr 2026 12:05:25 +0000 (16:05 +0400)] 
hw/arm/aspeed: free fmc_model and spi_model on finalization

The fmc_model and spi_model strings are allocated via g_strdup in
property setters but never freed when the machine object is destroyed.

Fixes: 9820e52fbef7 ("hw/arm/aspeed: Add machine properties to define the flash models")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/gpio/pca9552: fix state_str leak in pca955x_set_led
Marc-André Lureau [Mon, 27 Apr 2026 12:04:49 +0000 (16:04 +0400)] 
hw/gpio/pca9552: fix state_str leak in pca955x_set_led

visit_type_str() allocates state_str, but the function never frees it
on any code path. Use g_autofree to ensure it is freed on return.

Fixes: a90d8f84674d ("misc/pca9552: Add qom set and get")
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/fsi: move OPBus qbus_init() to instance_init
Marc-André Lureau [Mon, 4 May 2026 07:40:01 +0000 (11:40 +0400)] 
hw/fsi: move OPBus qbus_init() to instance_init

Remove the TODO comment that documented the workaround, as it is
no longer needed.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/fsi: move OPBus address space init to realize
Marc-André Lureau [Mon, 27 Apr 2026 11:51:55 +0000 (15:51 +0400)] 
hw/fsi: move OPBus address space init to realize

The OPBus instance_init initializes an AddressSpace, registering it in
the global address_spaces list. When a bare OPBus object is created
and destroyed (e.g. by qom-tests), there is no finalize to remove the
stale entry, leading to a heap-use-after-free when a subsequent
flatviews_reset iterates the list.

Move address_space_init to the bus realize callback and add the
corresponding address_space_destroy in unrealize, following the
NubusBus pattern. Also fix the memory_region_init owner from NULL to
the OPBus object, so the MR is properly parented instead of dangling
under the "unattached" container.

Fixes: eb04c35da2c0 ("hw/fsi: Aspeed APB2OPB & On-chip peripheral bus")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agosystem/qtest: add missing qtest_finalize()
Marc-André Lureau [Mon, 27 Apr 2026 10:54:00 +0000 (14:54 +0400)] 
system/qtest: add missing qtest_finalize()

Free owned resources on object finalization.

Fixes: 6ba7ada3559e ("qtest: add a QOM object for qtest")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoaccel/kvm: free device path on finalization
Marc-André Lureau [Mon, 27 Apr 2026 10:53:55 +0000 (14:53 +0400)] 
accel/kvm: free device path on finalization

kvm_set_device allocates device via g_strdup, but no
instance_finalize existed for the KVM accelerator type.

Fixes: aef158b093b9 ("Add class property to configure KVM device node to use")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoscsi/pr-manager-helper: free path on finalization
Marc-André Lureau [Mon, 27 Apr 2026 10:53:48 +0000 (14:53 +0400)] 
scsi/pr-manager-helper: free path on finalization

set_path allocates path via g_strdup, but
pr_manager_helper_instance_finalize did not free it.

Fixes: 9bad2a6b9d0a ("scsi: add persistent reservation manager using qemu-pr-helper")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agobackends/igvm-cfg: free filename on finalization
Marc-André Lureau [Mon, 27 Apr 2026 10:53:42 +0000 (14:53 +0400)] 
backends/igvm-cfg: free filename on finalization

set_igvm allocates filename via g_strdup, but igvm_cfg_finalize
did not free it.

Fixes: c1d466d267cf ("backends/igvm: Add IGVM loader and configuration")
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agonet/can: free ifname on socketcan finalization
Marc-André Lureau [Mon, 27 Apr 2026 10:53:33 +0000 (14:53 +0400)] 
net/can: free ifname on socketcan finalization

can_host_socketcan_set_if allocates ifname via g_strdup, but no
instance_finalize existed to free it.

Fixes: ea15ea8a7c67 ("net/can: support for connecting to Linux host SocketCAN interface.")
Acked-by: Pavel Pisa <pisa@fel.cvut.cz>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/core/resetcontainer: free children array on finalization
Marc-André Lureau [Mon, 27 Apr 2026 10:47:44 +0000 (14:47 +0400)] 
hw/core/resetcontainer: free children array on finalization

resettable_container_init allocates a GPtrArray for children, but
resettable_container_finalize was empty and never freed it.

Fixes: 4c046ce37af0 ("hw/core: Add ResetContainer which holds objects implementing Resettable")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/i386/x86: free oem_id and oem_table_id on finalization
Marc-André Lureau [Mon, 27 Apr 2026 10:47:27 +0000 (14:47 +0400)] 
hw/i386/x86: free oem_id and oem_table_id on finalization

x86_machine_initfn allocates oem_id and oem_table_id via g_strndup,
but no instance_finalize existed for x86_machine_info, so these
strings were never freed when the object was destroyed.

Add x86_machine_finalize to release both fields.

Fixes: d07b22863b8e ("acpi: Move setters/getters of oem fields to X86MachineState")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console: remove console from global list on finalization
Marc-André Lureau [Wed, 22 Apr 2026 20:06:11 +0000 (00:06 +0400)] 
ui/console: remove console from global list on finalization

This commit removes the QemuConsole from the global "consoles" list when
it is finalized, fixing use-after-free on throw-away objects.

Reproducer: QMP command qom-list-properties with typename
"qemu-text-console", "qemu-fixed-text-console" or
"qemu-graphic-console".

The assertions added ensure that `dcls`, `gl_block`, and the
`dump_queue` are empty before removal, confirming the console is in a
clean state. This is left to handle correctly in a future series for
hot-unplug case.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agosystem/ioport: Fix qom-list-properties crash on portio list obj
Peter Xu [Thu, 23 Apr 2026 18:32:11 +0000 (14:32 -0400)] 
system/ioport: Fix qom-list-properties crash on portio list obj

Currently qom-list-properties QMP command will crash when querying the
portio list MR object.  It's because its finalize() assumes full
initialization done in portio_list_add_1().

Provide a simple fix for now to avoid the crash.  There is chance for a
longer term fix, ideally MR should be initialized in instance_init().

However that'll need more work, and that should also be done with cleaning
the hard-coded MR operations in portio_list_add_1().  To be explored.

Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Link: https://lore.kernel.org/r/87a4uvw066.fsf@pond.sub.org
Reported-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
2 weeks agonet/colo-compare: guard finalize against uninitialized state
Marc-André Lureau [Fri, 24 Apr 2026 21:00:51 +0000 (01:00 +0400)] 
net/colo-compare: guard finalize against uninitialized state

colo_compare_finalize() assumes the object was fully set up by
colo_compare_complete(), but a bare object_new() followed by
object_unref() skips the complete callback entirely.

This causes two crashes:
- qemu_mutex_destroy on the static event_mtx which was never
  initialized (colo_compare_active is false)
- qemu_bh_delete(NULL) and iothread dereference when s->iothread
  is NULL

Guard the event_mtx teardown with colo_compare_active, and the
iothread-dependent cleanup with an s->iothread NULL check.

Fixes: 45942b79b9f8 ("net/colo-compare.c: Check that colo-compare is active")
Cc: peterx@redhat.com
Acked-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoio/net-listener: move mutex init to instance_init
Marc-André Lureau [Fri, 24 Apr 2026 21:00:42 +0000 (01:00 +0400)] 
io/net-listener: move mutex init to instance_init

The QIONetListener mutex is initialized in the convenience
constructor qio_net_listener_new() rather than in an instance_init.
This means a bare object_new(TYPE_QIO_NET_LISTENER) produces an
object with an uninitialized mutex, but instance_finalize
unconditionally calls qemu_mutex_destroy() on it, which aborts.

Move the mutex initialization to a proper instance_init so that init
and finalize are always paired regardless of how the object is
created.

Fixes: 9d86181874a ("qio: Protect NetListener callback with mutex")
Cc: peterx@redhat.com
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/remote: guard listener unregister in finalize
Marc-André Lureau [Fri, 24 Apr 2026 21:00:30 +0000 (01:00 +0400)] 
hw/remote: guard listener unregister in finalize

Guard the unregister by checking whether the listener callback was
set, which only happens right before registration.

Cc: jag.raman@oracle.com
Fixes: c7d80c7c1d9 ("multi-process: Associate fd of a PCIDevice with its object")
Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoqom/object: update doc about NULL values in link properties
Marc-André Lureau [Sun, 3 May 2026 08:00:42 +0000 (12:00 +0400)] 
qom/object: update doc about NULL values in link properties

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agohw/remote: check visit return in vfu_object_set_socket
Marc-André Lureau [Fri, 24 Apr 2026 15:05:06 +0000 (19:05 +0400)] 
hw/remote: check visit return in vfu_object_set_socket

vfu_object_set_socket() dereferences o->socket without checking if
visit_type_SocketAddress() succeeded. On failure, o->socket remains
NULL, leading to a NULL dereference. Check the return value.

Fixes: 8f9a9259d32c ("vfio-user: define vfio-user-server object")
Reviewed-by: Jagannathan Raman <jag.raman@oracle.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoMerge tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging
Stefan Hajnoczi [Mon, 11 May 2026 14:49:53 +0000 (10:49 -0400)] 
Merge tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging

- gtk clipboard fixes
- dbus-vmstate test fixes
- vt100 emulator support for utf8
- qemu-vnc tool

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmn/axAACgkQ2ujhCXWW
# nOXsvw/+IUmFaUQQ1a/7DaRVqemWJK6voFqPI7Zykftlq2qkDovo3L/JG+d3soqk
# l9VIIFv1EpN4ZfL6r7poaV/bXPwBJG9JDvQAD7o+9i97eWBMbWFsPbdo2gtyJYhC
# 29WosuaUa3YJ9rjc2YWLrOCx0RIjYZCgh2UJuS0XaZZdQNiv2E+p35dBvqP5fM/E
# DVvJEpGFQvHoQN9Tp9LU7HyONo1gp77+0SA2OKA30nL7RcEmHqpoDHxkz86C+ffN
# 9qzxC7armk2bjRHKsaNr1of1BOLycGK3Gz9vR/y3ycYKFsc9IRdWyRxmHMY/Rt31
# rMZ522PkgEA+W9j7DpF9nSGaLFB9fo0S1IXIWcDZYoAx+mXJ+ib+IOmfakrVOc1L
# T60GIkPvWPYiaMetCuoiM/TyEKhFIUs9soNJ1tYlfUNEzqSdxkFCjxRlKlUUUrmR
# VLcUJ8NtrXwdiwa999uD8+58GOQyyLBnPKUqelL9nir5uzJNALYHBe5rh/1seW1o
# +D4Yq3ahPEs9JPcRAdHc0WcSctERvlbTgcgWYLPWJtYjn++hmCDgvYByg4EP3cLB
# lIT9XP7aYYqaUBfSYOWyJxGIkSxzb8f9Fju5fwnUe/19Is79ycl0wanezLa73yY5
# Wl6GZo7LC5D0pKgATWAzEV8YLJS6NIoA1QF5FOT1EBeH2Dfn6Io=
# =bQJb
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 09 May 2026 13:12:48 EDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'ui-pull-request' of https://gitlab.com/marcandre.lureau/qemu: (33 commits)
  qemu-options: document -chardev dbus
  tools/qemu-vnc: add standalone VNC server over D-Bus
  tests/qtest: drop DBUS_VMSTATE_TEST_TMPDIR
  ui: extract common sources into a static library
  ui/vnc: replace VNC_DEBUG with trace-events
  ui/console: rename public API to use consistent qemu_console_ prefix
  ui/console: add doc comment for qemu_console_{un}register_listener()
  ui/console: simplify registering display/console change listener
  ui/vnc: add vnc-system unit, to allow different implementations
  ui/vnc: defer listener registration until the console is known
  ui/vnc: clean up VNC displays on exit
  ui/vnc: merge vnc_display_init() and vnc_display_open()
  ui/vnc: vnc_display_init() and vnc_display_open() return bool
  ui/vnc: make the worker thread per-VncDisplay
  ui/console-vc: move VT100 emulation into separate unit
  ui/console: remove console_ch_t typedef and console_write_ch()
  ui/console-vc: extract vt100_init() and vt100_fini()
  ui/console-vc: extract vt100_keysym() from qemu_text_console_handle_keysym()
  ui/console-vc: extract vt100_input() from vc_chr_write()
  ui/console-vc: move VT100 state machine and output FIFO into QemuVT100
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 weeks agoMerge tag 'pull-fpu-20260509' of https://gitlab.com/rth7680/qemu into staging
Stefan Hajnoczi [Mon, 11 May 2026 14:49:37 +0000 (10:49 -0400)] 
Merge tag 'pull-fpu-20260509' of https://gitlab.com/rth7680/qemu into staging

fpu: Cleanups and export FloatParts{64,128} internals,
     so far with a limited number of primitives.
host-utils: Introduce signed saturation primitives

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmn/WBYdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV+Uzgf9EnDTxP6DC+axVf4B
# HM9lFLf7VBVLvN9SJKmqyAVueCTXqFxjtaYkkps7syXevcklSWOgDcJglPyBRjua
# UQsV3QSj1XPe4GNS679a0dYpepuOJAoG0ThWuPKMIoIL6sI3Bgr72cEAjmKe2mXB
# dXHjsVWXAvG0b0GWom2pr+OPjF9B3DljGPS5X2D4bNGWQq+z4YD3j0tcHBumtJrJ
# DjENcRMe83cOAwwiw+nz3B1QdPM/6uNSYUTGD3D+IfTXw8KJctRGCOmMz6Yaz4xO
# n99N7H5drc1AzGzz5p/sSZh9WiPClpJPmF8U7DY9phsXwWlTLX25v/0g/CrDXKf5
# IKkDBw==
# =xs2f
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 09 May 2026 11:51:50 EDT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-fpu-20260509' of https://gitlab.com/rth7680/qemu: (28 commits)
  host-utils: Introduce signed saturation primitives
  fpu: Drop QEMU_FLATTEN from muladd routines
  fpu: Return struct from parts{64,128}_addsub
  fpu: Return struct from parts{64,128}_mul
  fpu: Export parts{64,128}_compare
  fpu: Split scalbn from partsN(muladd_scalbn)
  fpu: Introduce record_denormals_used
  fpu: Return struct from parts{64,128}_pick_nan_muladd
  fpu: Introduce parts64_round_to_fmt
  fpu: Export default_nan, pick_nan, return_nan routines
  fpu: Return struct from parts{64,128}_round_to_int
  fpu: Return struct from parts{64,128}_div
  fpu: Return struct from parts{64,128}_pick_nan
  fpu: Sink exp_bias adjustment in float64r32_pack_raw
  fpu: Return struct from parts{64,128}_return_nan
  fpu: Return struct from parts{64,128}_silence_nan
  fpu: Return struct from parts{64,128}_default_nan
  fpu: Export unpack_canonical and round_pack_canonical routines
  fpu: Export FloatFmt structures
  fpu: Split FloatParts{64,128} to softfloat-parts.h
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 weeks agohost-utils: Introduce signed saturation primitives
Richard Henderson [Tue, 28 Apr 2026 18:32:49 +0000 (04:32 +1000)] 
host-utils: Introduce signed saturation primitives

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 weeks agofpu: Drop QEMU_FLATTEN from muladd routines
Richard Henderson [Sun, 26 Apr 2026 02:23:00 +0000 (12:23 +1000)] 
fpu: Drop QEMU_FLATTEN from muladd routines

The float16, bfloat16 and float128 paths are not so
important that they require forced optimization.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 weeks agoqemu-options: document -chardev dbus
uchouT [Sat, 9 May 2026 09:48:01 +0000 (17:48 +0800)] 
qemu-options: document -chardev dbus

Document the dbus backend introduced in commit 3e301c8d7ef0 ("ui/dbus:
add chardev backend & interface")

Signed-off-by: uchouT <i@uchout.moe>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260509094801.111103-1-i@uchout.moe>

2 weeks agotools/qemu-vnc: add standalone VNC server over D-Bus
Marc-André Lureau [Thu, 2 Apr 2026 13:19:05 +0000 (17:19 +0400)] 
tools/qemu-vnc: add standalone VNC server over D-Bus

Add a standalone VNC server binary that connects to a running QEMU
instance via the D-Bus display interface (org.qemu.Display1, via the bus
or directly p2p). This allows serving a VNC display without compiling
VNC support directly into the QEMU system emulator, and enables running
the VNC server as a separate process with independent lifecycle and
privilege domain.

Built only when both VNC and D-Bus display support are enabled.
If we wanted to have qemu -vnc disabled, and qemu-vnc built, we would
need to split CONFIG_VNC. This is left as a future exercise.

Current omissions include some QEMU VNC runtime features (better handled via
restart), legacy options, and Windows support.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agotests/qtest: drop DBUS_VMSTATE_TEST_TMPDIR
Marc-André Lureau [Mon, 16 Mar 2026 20:33:11 +0000 (00:33 +0400)] 
tests/qtest: drop DBUS_VMSTATE_TEST_TMPDIR

It can rely on the location of the temporary configuration instead, so
we don't have to set that environment variable on every test.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui: extract common sources into a static library
Marc-André Lureau [Mon, 23 Feb 2026 10:42:00 +0000 (11:42 +0100)] 
ui: extract common sources into a static library

Move clipboard, cursor, display-surface, input-keymap, kbd-state,
keymaps, vt100, and qemu-pixman into a separate static library 'qemuui'.
This allows these common UI sources to be linked by targets outside of
the system emulator build, such as standalone VNC or D-Bus display
binaries.

keymaps generation has to be moved earlier, so that header dependency
are resolved first.

The library objects are re-exported via a dependency so existing
system_ss consumers are unaffected.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/vnc: replace VNC_DEBUG with trace-events
Marc-André Lureau [Tue, 7 Apr 2026 15:14:51 +0000 (19:14 +0400)] 
ui/vnc: replace VNC_DEBUG with trace-events

Replace #ifdef printf() with run-time trace events.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console: rename public API to use consistent qemu_console_ prefix
Marc-André Lureau [Tue, 3 Mar 2026 20:45:06 +0000 (21:45 +0100)] 
ui/console: rename public API to use consistent qemu_console_ prefix

Rename the display and graphic console public functions to follow a
consistent qemu_console_ (or qemu_graphic_console_) naming convention.

The previous API used a mix of prefixes: dpy_, graphic_hw_,
graphic_console_, console_has_, and update_displaychangelistener().
Unify them under a common qemu_console_ namespace for better
discoverability and consistency.

The main renames are:
- dpy_gfx_*() / dpy_text_*() / dpy_gl_*() → qemu_console_*()
- dpy_{get,set}_ui_info() → qemu_console_{get,set}_ui_info()
- graphic_hw_*() → qemu_console_hw_*()
- graphic_console_*() → qemu_graphic_console_*()
- console_has_gl() → qemu_console_has_gl()
- update_displaychangelistener() → qemu_console_listener_set_refresh()

No functional changes.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoMerge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
Stefan Hajnoczi [Sat, 9 May 2026 11:39:01 +0000 (07:39 -0400)] 
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* scsi: register again after PREEMPT without reservation
* scsi: handle reservation changes across migration

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmn+KNYUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroM4tAf/Yrkk3/VBFxP7jCJAwZ49g9tgl3+b
# 98+4HpybZ46AV2EK5o+sfeOptiP+5feostsoMGNGptyDjGBl0sxZhXJimys29QXr
# 1TkRrBnpYH/E7JNqJcj79pFOUC7qIaPHYqgyVZrTM1b1dRuk2f1db0h/yKG2YGDu
# EjoUGdYeY/LjvxuytyY74nJ6oNjHJx3vBGyjBWXP3oDlIZA2FSBuu/E3oF562r/a
# u4I3ZOQATeLAfLVB8Sx731B7aJxMBh7qCi4Pxz580b4oK94YVpn8mo2x+8CBAvdo
# Ib7Mfz1sYjgQNipyrM3FoMteYCy/xrA9lhJFzosrVx4sGXCiSNx+Xnh2PA==
# =r31J
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 08 May 2026 14:17:58 EDT
# 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:
  scsi: handle reservation changes across migration
  scsi: register again after PREEMPT without reservation
  scsi: always send valid PREEMPT TYPE field
  scsi: adjust error_prepend() formatting
  scsi: change buf_size to unsigned int in scsi_SG_IO()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 weeks agoMerge tag 'firmware-20260508-pull-request' of https://gitlab.com/kraxel/qemu into...
Stefan Hajnoczi [Sat, 9 May 2026 11:37:35 +0000 (07:37 -0400)] 
Merge tag 'firmware-20260508-pull-request' of https://gitlab.com/kraxel/qemu into staging

hw/uefi: collection of CVE fixes.

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmn9svYACgkQTLbY7tPo
# cThcEA/8DG1riNLCKxotL4k6doFP91LW72j11vrxkrP1QtTc7Al7Pd7jFpiO46cx
# cGgFuhwZT3pzY6lCIekheDzbm1nW09V9UcMzirW9kpwCiw9R79sMw6DXFxJ1Zmza
# DFuvBajdQ0Cik+iesNeN1M+Zg55hXe2FJTgxo/bUR8wSgfv2oew/B61RV9j43q3Q
# g7mJKgJTlnleS8yJyN5js3G59p7egOgFZSdcJlMC9Ozkun/bonoTJAeYMF5N7LXI
# kA5p42kGLCNe6nOUrQSk+WSum8CnAld6Qs+b13gVbsMK83QRF3yApXG63bJGqBJ1
# t4zWLUieTCEVW38I/MOEjGu2qEksfLe81KJ7hfEMLhUPjeCv9++9YU35XgbHubIv
# Kfh7B0xV0K9g+JYEYfflwQdI5AdSp5EmFb9ztf02u4CH5nC0EcDVb8hB2fJW+Psj
# ElJH0SQl+Hdco/Ln7dcenKMgqAl9ekarYysV3xvO4e59pxqx/2S03HiEvNnrYByw
# pklUobv8gnuZujHyq/5fOgrLnH7qMsfgyYRej4iBaRWNOa4K5Oz0HhnBxdpjvMqa
# 1u3BXlv6VjDrGNnhHUA+2nPdqx2iUSDbE20BhUoOAOjOnGfCi6REFWS7fhyLvQBT
# MedYFgWT/eD37n65j+4Nvd73CQfHasQCFEedAbU8wAQRoDe+jP0=
# =gKLo
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 08 May 2026 05:55:02 EDT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* tag 'firmware-20260508-pull-request' of https://gitlab.com/kraxel/qemu:
  hw/uefi: avoid possibly unaligned variable_auth_2 struct field access
  hw/uefi: verify data size before accessing it in wrap_pkcs7
  hw/uefi: add name_size check to uefi_vars_mm_lock_variable()
  hw/uefi: fix ucs2 string helper functions
  hw/uefi: verify pio_xfer_offset before calculating buffer checksum
  hw/uefi: fix buffer overruns

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 weeks agoMerge tag 'pull-loongarch-20260508-2' of https://github.com/gaosong715/qemu into...
Stefan Hajnoczi [Sat, 9 May 2026 11:37:20 +0000 (07:37 -0400)] 
Merge tag 'pull-loongarch-20260508-2' of https://github.com/gaosong715/qemu into staging

pull-loongarch-20260508

# -----BEGIN PGP SIGNATURE-----
#
# iLMEAAEKAB0WIQTKRzxE1qCcGJoZP81FK5aFKyaCFgUCaf2HjwAKCRBFK5aFKyaC
# FnBgA/4rVzGrTcTvLIxceLpewgBsH+BsAxHvpOwaVWWPHWjTWL5BgYiudS4dukTO
# fllXZBAIejUded8h5YazdGqqN2nZYq3QAQD3TKgkqDaiS2qdbVHn1caTLyPg6oEK
# XKyZwzQpuZ3xjlYbnmNwDMTkChV1sxEKSpWZlSHwcgUNhuvFWQ==
# =Oze1
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 08 May 2026 02:49:51 EDT
# gpg:                using RSA key CA473C44D6A09C189A193FCD452B96852B268216
# gpg: Good signature from "Song Gao <gaosong@loongson.cn>" [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: CA47 3C44 D6A0 9C18 9A19  3FCD 452B 9685 2B26 8216

* tag 'pull-loongarch-20260508-2' of https://github.com/gaosong715/qemu:
  target/loongarch: Add support for dbar hint variants
  hw/loongarch/virt: Define versioned virt machine
  hw/loongarch/virt: Define virt machine type with type_init()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 weeks agoMerge tag 'pull-target-arm-20260507' of https://gitlab.com/pm215/qemu into staging
Stefan Hajnoczi [Sat, 9 May 2026 11:37:05 +0000 (07:37 -0400)] 
Merge tag 'pull-target-arm-20260507' of https://gitlab.com/pm215/qemu into staging

target-arm queue:
 * Initial experimental GICv5 interrupt controller emulation
 * target/arm: Report IL=0 for Thumb 16-bit BKPT insn
 * hw/misc/bcm2835_rng: Specify valid memory access sizes

# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmn8tN8ZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3kRED/43IeDEsDkxsikfrbZWqzQY
# Mpy3FDYeSa31XE0xcK97wbpEhwdzUdsyjR3lHIphHTOIit8XdrawySEtaA9k2pKc
# o1AmI8s2QReg0cM+Znwc9mSfDi52ExxrVEObGUBa27RVtX06jY9nwrUfegAaMMW5
# bIljGTc6b9U5XEbxe2qF53BeQouYtgsSLInA5ID6TtZwocw/sSYyIwEmJ7AVGvX/
# 6BepwjYg6jWTqZ884YNuUK4PAFMxgsxtowEI3D7Frxc0sPOxzZYitp5hrnQwZJdo
# 7omXk3VVEjOsJRztdy6Ulxw4+atb4zLcZRHIi96w719/Q7dUmLggK2ZG1FmMHNat
# TevJFEmg5eYjdXWEodIRCHCpGXBxzUFzfh8lEGW5afsjxQMRABgKHv9e5bcpmyT+
# +YpgWgscC2FJTv6/E6Qjy4VYLjyUHbqsUWtr+5OZFb8pHd9DWO5gGwZE2RhDwKUI
# RaCrMneVhPWDHfyauIgAQ1K2DdDRr8a75mDVbH620ldxyoetKnork7huE1qwKC32
# be46fk9u6/KcyafbQQCiZe3KzqoKxpvJPsu5tlsvLtuzEgz6pQdI5j0NsS0k3Ow8
# VSfynqAFaCUNZaJNqLj6Inj9YOqYzxu+6RmB3s+L1+Aj2QxHiPQJjbggCHJOPTo0
# 2uyaQodquIbdfBabUpgtlg==
# =B0BC
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 07 May 2026 11:50:55 EDT
# gpg:                using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg:                issuer "peter.maydell@linaro.org"
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@gmail.com>" [full]
# gpg:                 aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>" [full]
# gpg:                 aka "Peter Maydell <peter@archaic.org.uk>" [unknown]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83  15CF 3C25 25ED 1436 0CDE

* tag 'pull-target-arm-20260507' of https://gitlab.com/pm215/qemu: (67 commits)
  hw/misc/bcm2835_rng: Specify valid memory access sizes
  target/arm: Report IL=0 for Thumb 16-bit BKPT insn
  hw/arm/virt: Allow user to select GICv5
  hw/arm/virt: Enable GICv5 CPU interface when using GICv5
  hw/arm/virt: Use correct interrupt type for GICv5 SPIs in the DTB
  hw/arm/virt: Handle GICv5 in interrupt bindings for PPIs
  hw/arm/virt: Advertise GICv5 in the DTB
  hw/arm/virt: Create and connect GICv5
  hw/arm/virt: Split GICv2 and GICv3/4 creation
  hw/arm/virt: Pull "wire CPU interrupts" out of create_gic()
  hw/arm/virt: Move MSI controller creation out of create_gic()
  hw/arm/virt: Remember CPU phandles rather than looking them up by name
  hw/intc/arm_gicv3_cpuif: Don't allow GICv3 if CPU has GICv5 cpuif
  target/arm: Add has_gcie property to enable FEAT_GCIE
  target/arm: Connect internal interrupt sources up as GICv5 PPIs
  target/arm: GICv5 cpuif: Signal IRQ or FIQ
  target/arm: GICv5 cpuif: Implement GIC CDDI
  hw/intc/arm_gicv5: Implement Deactivate command
  target/arm: GICv5 cpuif: Implement GIC CDEOI
  target/arm: GICv5 cpuif: Implement GICR CDIA command
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 weeks agoMerge tag 'bsd-user-2026-05-pull-request' of https://gitlab.com/bsdimp/qemu-from...
Stefan Hajnoczi [Sat, 9 May 2026 11:36:20 +0000 (07:36 -0400)] 
Merge tag 'bsd-user-2026-05-pull-request' of https://gitlab.com/bsdimp/qemu-from-official into staging

bsd-user May 2026 pull request

Three patch series were reviewed during the code freeze and are finally ready to
head into the tree.

(1) Use SPDX identifiers in most places. This makes it easier for me to upstream
since I can do almost all of the files in the forked tree and not have it be an
issue each time I add a new file.

(2) Per discussions in the review, copy thunk.c to bsd-user from linux-user. We
will use this in the third set of patches, ioctls. All that changed is the
copyright header. This file has style problems, but fixing them would be a worse
problem than the style issues since we share it with linux-user and want to
track changes there. In the future we may actually share, but for now this was
the compromise.

(3) All the ioctls that bsd-user supports in FreeBSD. This uses the thunk.c code
to translate back and forth between host and target. A number of pedantic
changes were made against the blitz branch upstream and were discovered or
highlighted by claude code.

I used claude to extract all the ioctl code from the blitz branch for
upstreaming. I had it review the code and fixed the problems it found (though
one was a false positive). I've not tagged these as Assisted-by: since that part
of our policy is in flux. No creative output of claude was applied here, though
it also suggested the commit messages (that I rewrote in large part, but
vestiges of the original remain). To be clear: Claude didn't write any of
the actual code.

# -----BEGIN PGP SIGNATURE-----
# Comment: GPGTools - https://gpgtools.org
#
# iQIzBAABCgAdFiEEIDX4lLAKo898zeG3bBzRKH2wEQAFAmn7+HkACgkQbBzRKH2w
# EQBseRAAn4RqHJDLLdFpyfspFPOr8Etjmq6MdJ3MXtDauyOWE2IIY1bBsr5a81Ko
# VjG3zpZ3kOE6eQsCKIHHUEljtrfej3kdrvfdMI5d0Qtk4YQSU3rN2Tz6CRNIQNRb
# xALkkvsKY0AxP1xzdldUMCR2oO0AT1u0NC7aPpiKbg8Z4wUujDcaPXnNkun6xoRw
# ysELRm3G1zyvIw0WX3LUrcxYel+O4cXoF1Fzi3ZLSyryeKOBXTQG/uA7+9YJUyLx
# wsrl++bACCDHwkwnuFiIvg+ZkBiMfkVHz6SLRcMfVjwmAfRuPukvjB8ZZBXRLT94
# zeG+R9t4zCRKC8Cka4AsYUyceHfgj/kdNkEd7u5rJHVHSUsfQAbWywRRhjOyO4Ad
# 3nzKOCJ68e4bu3FOc7ih2pcrS71/zxR1HWa2FgwPOntrDaagCbugfSepZ5bJewvW
# rBqujzgLV7B5fNDUAaYP+HnYr/qu6oaJZ4APalubBu+/Y++P1KBzfsiNSoFLHTzU
# XFsGB0ktMbVJtqMfQKNBJlsd8XrRguhRvrujwBAKJxUt1XIS7lJfYQIN1sn2pfBe
# evUsHsp978u1BR58rwEMRJeYxLIZe+Q6T3JJNXhwC+WsWZvjdLo2Xta78HcudC0R
# z1FnH99jlUFpgHiySQUMR/6FYPBxRMQ4dPa4hgLVKYOSyN4GguI=
# =L844
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 06 May 2026 22:27:05 EDT
# gpg:                using RSA key 2035F894B00AA3CF7CCDE1B76C1CD1287DB01100
# gpg: Good signature from "Warner Losh <wlosh@netflix.com>" [unknown]
# gpg:                 aka "Warner Losh <imp@bsdimp.com>" [unknown]
# gpg:                 aka "Warner Losh <imp@freebsd.org>" [unknown]
# gpg:                 aka "Warner Losh <imp@village.org>" [unknown]
# gpg:                 aka "Warner Losh <wlosh@bsdimp.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 2035 F894 B00A A3CF 7CCD  E1B7 6C1C D128 7DB0 1100

* tag 'bsd-user-2026-05-pull-request' of https://gitlab.com/bsdimp/qemu-from-official: (25 commits)
  bsd-user: Add call to do_bsd_ioctl and add bsd-ioctl.c to the build
  bsd-user: Add init_bsd_ioctl function
  bsd-user: Add do_bsd_ioctl main function
  bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int function
  bsd-user: Add target_to_host_sockaddr_in6 function
  bsd-user: Add do_ioctl_unsupported function
  bsd-user: Add log_unsupported_ioctl function
  bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
  bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h
  bsd-user: Add bsd-ioctl.h header
  bsd-user: Add FreeBSD ioctl command table
  bsd-user: Add FreeBSD ioctl type definitions
  bsd-user: Add FreeBSD IPv6 ioctl definitions
  bsd-user: Add FreeBSD disk ioctl definitions
  bsd-user: Add FreeBSD cryptodev ioctl definitions
  bsd-user: Add FreeBSD socket ioctl definitions
  bsd-user: Add FreeBSD file I/O ioctl definitions
  bsd-user: Add FreeBSD tty ioctl definitions
  bsd-user: ioctl: add common definitions
  bsd-user: Copy linux-user/thunk.c to bsd-user
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 weeks agoui/console: add doc comment for qemu_console_{un}register_listener()
Marc-André Lureau [Sat, 4 Apr 2026 14:45:15 +0000 (18:45 +0400)] 
ui/console: add doc comment for qemu_console_{un}register_listener()

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console: simplify registering display/console change listener
Marc-André Lureau [Tue, 3 Mar 2026 20:06:57 +0000 (21:06 +0100)] 
ui/console: simplify registering display/console change listener

Introduce qemu_console_register_listener() which combines setting
dcl->con, dcl->ops and calling register_displaychangelistener() into a
single call. This removes repetitive boilerplate across all display
backends and makes it harder to forget setting one of the fields.

Also move the early-return check in unregister_displaychangelistener()
before the trace call, so that unregistering a never-registered listener
(e.g. on error paths) does not dereference a NULL ops pointer.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/vnc: add vnc-system unit, to allow different implementations
Marc-André Lureau [Mon, 16 Mar 2026 08:40:16 +0000 (12:40 +0400)] 
ui/vnc: add vnc-system unit, to allow different implementations

The qemu-vnc server will want to signal the XVP requests, let it
have its own implementation.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/vnc: defer listener registration until the console is known
Marc-André Lureau [Wed, 25 Feb 2026 13:15:26 +0000 (14:15 +0100)] 
ui/vnc: defer listener registration until the console is known

Previously, the display change listener was registered early in
vnc_display_new() without a console, requiring vnc_display_open() to
conditionally unregister and re-register it when the actual console was
resolved. Since vnc_display_new() and vnc_display_open() were merged in
the previous commit, simply delay the registration and keyboard state
initialization to vnc_display_open(), after the console has been looked
up. This removes the conditional re-registration and simplifies the code.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/vnc: clean up VNC displays on exit
Marc-André Lureau [Wed, 8 Apr 2026 13:15:42 +0000 (17:15 +0400)] 
ui/vnc: clean up VNC displays on exit

Previously, VNC displays were never torn down on QEMU exit, leaking
resources and leaving connected clients with unclean disconnects.

Add vnc_cleanup() to free all VNC displays during qemu_cleanup().
Make vnc_display_close() initiate disconnection of active clients,
and have vnc_display_free() drain the main loop until all clients
have completed their teardown, instead of asserting the client list
is empty.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/vnc: merge vnc_display_init() and vnc_display_open()
Marc-André Lureau [Tue, 24 Feb 2026 15:22:59 +0000 (16:22 +0100)] 
ui/vnc: merge vnc_display_init() and vnc_display_open()

Combine the two-step vnc_display_init()/vnc_display_open() sequence
into a single vnc_display_new() function that returns VncDisplay*.
This simplifies the API by making vnc_display_open() an
internal detail and will allow further code simplification.

vnc_display_new() is moved to vnc.h, since it returns VncDisplay* now.
Add vnc_display_free() for consistency, and it will be later used.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/vnc: vnc_display_init() and vnc_display_open() return bool
Marc-André Lureau [Sat, 4 Apr 2026 14:28:59 +0000 (18:28 +0400)] 
ui/vnc: vnc_display_init() and vnc_display_open() return bool

Use the QEMU-style error pattern returning "true" on success.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/vnc: make the worker thread per-VncDisplay
Marc-André Lureau [Tue, 7 Apr 2026 12:03:02 +0000 (16:03 +0400)] 
ui/vnc: make the worker thread per-VncDisplay

The VNC encoding worker thread was using a single global queue shared
across all VNC displays, with no way to stop it. This made it impossible
to properly clean up resources when a VncDisplay is freed.

Move the VncJobQueue from a file-scoped global to a per-VncDisplay
member, so each display owns its worker thread and queue. Add
vnc_stop_worker_thread() to perform an orderly shutdown: signal the
thread to exit, join it, and destroy the queue. The thread is now
created as QEMU_THREAD_JOINABLE instead of QEMU_THREAD_DETACHED.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console-vc: move VT100 emulation into separate unit
Marc-André Lureau [Sun, 22 Feb 2026 18:46:58 +0000 (19:46 +0100)] 
ui/console-vc: move VT100 emulation into separate unit

Move the VT100 terminal emulation code into dedicated ui/vt100.c and
ui/vt100.h files, completing the extraction from console-vc.c started
in the previous patches. This makes the VT100 layer a self-contained
module that can be reused independently of the chardev/console
infrastructure.

The code is moved as-is, with minor coding style fixes (adding missing
braces, fixing whitespace) applied during the move.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console: remove console_ch_t typedef and console_write_ch()
Marc-André Lureau [Tue, 28 Apr 2026 08:59:27 +0000 (12:59 +0400)] 
ui/console: remove console_ch_t typedef and console_write_ch()

Since commit e2f82e924d05 ("console: purge curses bits from
console.h"), console_ch_t is a plain uint32_t typedef and
console_write_ch() is a trivial assignment (*dest = ch). These
abstractions were originally needed because console_ch_t was the
curses chtype when CONFIG_CURSES was enabled, and console_write_ch()
handled VGA-to-curses character translation. That commit moved the
curses logic into curses_update(), making the typedef and helper
dead abstractions.

Replace console_ch_t with uint32_t and console_write_ch() calls
with direct assignments.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console-vc: extract vt100_init() and vt100_fini()
Marc-André Lureau [Sun, 22 Feb 2026 19:04:52 +0000 (20:04 +0100)] 
ui/console-vc: extract vt100_init() and vt100_fini()

Consolidate VT100 initialization and finalization into dedicated
functions, continuing the extraction of the VT100 layer from the
console/chardev code.

vt100_init() gathers the scattered setup (cursor timer, list insertion,
FIFO creation, default attributes, and image) that was previously spread
across vc_chr_open() and qemu_text_console_class_init().

vt100_fini() pairs with it by handling list removal, FIFO destruction,
and cells cleanup, replacing the open-coded QTAILQ_REMOVE in
qemu_text_console_finalize().

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console-vc: extract vt100_keysym() from qemu_text_console_handle_keysym()
Marc-André Lureau [Thu, 19 Feb 2026 21:36:46 +0000 (22:36 +0100)] 
ui/console-vc: extract vt100_keysym() from qemu_text_console_handle_keysym()

Move the keysym handling logic out of qemu_text_console_handle_keysym()
into a new vt100_keysym() helper that operates on QemuVT100 directly,
continuing the effort to decouple the VT100 layer from the console layer.

The echo path is updated to call vt100_input() instead of
qemu_chr_write(), since the function no longer has direct access
to the chardev.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console-vc: extract vt100_input() from vc_chr_write()
Marc-André Lureau [Thu, 19 Feb 2026 21:18:01 +0000 (22:18 +0100)] 
ui/console-vc: extract vt100_input() from vc_chr_write()

Move the VT100 input processing logic out of vc_chr_write() into a new
vt100_input() function that operates on QemuVT100 directly, rather than
going through the Chardev/VCChardev layers. This continues the effort
to decouple the VT100 emulation from the chardev backend, making the
VT100 layer self-contained and reusable.

vc_chr_write() becomes a thin wrapper that extracts the QemuVT100 from
the chardev and delegates to vt100_input().

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console-vc: move VT100 state machine and output FIFO into QemuVT100
Marc-André Lureau [Thu, 19 Feb 2026 14:10:26 +0000 (15:10 +0100)] 
ui/console-vc: move VT100 state machine and output FIFO into QemuVT100

Move the terminal escape sequence parser state (TTYState, esc_params,
text attributes, saved cursor position) and the output FIFO from
VCChardev/QemuTextConsole into QemuVT100. Rename the corresponding
functions from vc_* to vt100_* to reflect they now operate on the VT100
layer directly, removing the indirection through vc->console->vt.

Add an out_flush callback to QemuVT100 so vt100_write() can flush
output without knowing about QemuTextConsole, and move FIFO/VT100
initialization from qemu_text_console_init() to vc_chr_open() where
the callback can be wired up.

This continues the decoupling of VT100 terminal emulation from the
chardev layer, making QemuVT100 a self-contained terminal emulator.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 weeks agoui/console-vc: add UTF-8 input decoding with CP437 rendering
Marc-André Lureau [Thu, 12 Mar 2026 13:29:29 +0000 (17:29 +0400)] 
ui/console-vc: add UTF-8 input decoding with CP437 rendering

The text console receives bytes that may be UTF-8 encoded (e.g. from
a guest running a modern distro), but currently treats each byte as a
raw character index into the VGA/CP437 font, producing garbled output
for any multi-byte sequence.

Add a UTF-8 decoder using Bjoern Hoehrmann's DFA. The DFA inherently
rejects overlong encodings, surrogates, and codepoints above U+10FFFF.
Completed codepoints are then mapped to CP437, unmappable characters are
displayed as '?'.

Note that QEMU has a "buffered" utf8 decoder in util/unicode.c, but
it is not a good fit for byte-per-byte decoding.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/dbus: expose vc encoding via D-Bus Chardev.VCEncoding interface
Marc-André Lureau [Mon, 20 Apr 2026 13:04:31 +0000 (17:04 +0400)] 
ui/dbus: expose vc encoding via D-Bus Chardev.VCEncoding interface

When a D-Bus VC chardev is instantiated, export an extra
org.qemu.Display1.Chardev.VCEncoding interface on the chardev
object.  This lets D-Bus display clients discover the encoding
(cp437 or utf8) in use by the virtual console.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console: default vc encoding to cp437 for machine < 11.1
Marc-André Lureau [Thu, 23 Apr 2026 11:41:22 +0000 (15:41 +0400)] 
ui/console: default vc encoding to cp437 for machine < 11.1

Add a QOM "encoding" enum property to some chardev-vc backends
(console-vc & dbus - gtk and spice don't make use of it) so that the
machine compat mechanism can override the default. For machine versions
prior to 11.1, the charset defaults to cp437 (raw 8-bit VGA) instead of
utf8, preserving the historical behaviour.

The following commits are going to wire this to VT100 emulation code and
an extra exported D-Bus property.

Note that GTK libvte uses utf8 unconditionally, and Spice doesn't have a
way to set the encoding, and typically just use libvte in client too.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/console: add vc encoding=utf8/cp437 option
Marc-André Lureau [Mon, 20 Apr 2026 08:11:24 +0000 (12:11 +0400)] 
ui/console: add vc encoding=utf8/cp437 option

Expose a new "encoding" QemuOpt option.

Add the corresponding QAPI type and properties.

This is going to be wired in the following commits.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agochar: error out if given unhandled size options
Marc-André Lureau [Thu, 23 Apr 2026 11:20:53 +0000 (15:20 +0400)] 
char: error out if given unhandled size options

This is a small help, because in fact all combined chardev
options are accepted by qemu_chardev_opts[]. But given that a user may
legitimately want to use the size options with a VC backend, we can
report an error when we know the backend doesn't support it.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoqemu-options.hx: document -chardev vc backend-specific behavior
Marc-André Lureau [Mon, 20 Apr 2026 11:50:24 +0000 (15:50 +0400)] 
qemu-options.hx: document -chardev vc backend-specific behavior

The -chardev vc documentation only mentioned the built-in console with
optional size parameters, but the actual behavior depends on the display
backend. Document the GTK (libvte), D-Bus and spice-app cases.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2 weeks agoui/gtk: Fix GTK assertion failure introduced with clipboard fixes
Jindřich Makovička [Fri, 1 May 2026 08:10:38 +0000 (10:10 +0200)] 
ui/gtk: Fix GTK assertion failure introduced with clipboard fixes

gtk_clipboard_request_targets actually returns n_targets == -1
when targets ==  NULL instead of zero. This result in failed assertion
within GTK:

qemu: Gtk: gtk_targets_include_text:
assertion 'targets != NULL || n_targets == 0' failed

Extend the check to require non-null targets and positive n_targets.

Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260501-clipboard-assert-fix-v1-1-e549243e4583@gmail.com>