Commit Graph

129244 Commits

Author SHA1 Message Date
Peter Maydell
a4c857aef0 monitor/hmp-cmds: Use cpu_translate_for_debug()
We want to remove the cpu_get_phys_addr_debug() function; update the
HMP gva2gpa command implementation to use cpu_translate_for_debug()
instead.

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-24-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
a0c9fc28bc target/xtensa/xtensa-semi: Use cpu_translate_for_debug()
We want to remove the cpu_get_phys_addr_debug() function; update the
xtensa semihosting code to use cpu_translate_for_debug() instead.

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: <20260430093810.2762539-23-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
9e095560bb hw/xtensa: Use cpu_translate_for_debug()
We want to remove the cpu_get_phys_addr_debug() function; update the
xtensa boards to use cpu_translate_for_debug() instead.

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-22-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
733c2769be target/sparc: Use cpu_translate_for_debug()
We want to remove the cpu_get_phys_addr_debug() function; update the
sparc dump_mmu() function to use cpu_translate_for_debug() instead.

The "mmu_probe succeeds but debug translate fails" cases are probably
not possible in practice; since cpu_get_phys_addr_debug() would
return -1 in that situation we make this conversion retain that
behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260430093810.2762539-21-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
8d00627955 hw/i386/vapic.c: Use cpu_translate_for_debug()
We would like to remove the cpu_get_phys_addr_debug() function, by
moving all callers to cpu_translate_for_debug(). Update the callsites
in vapic.c.

In the process we can drop the old "OR the page offset back in"
workaround that we had for when cpu_get_phys_page_addr() returned
the physaddr of the page base rather than the exact physaddr of
the input virtual address.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260430093810.2762539-20-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
1ae8e5b0f1 system/physmem: Use translate_for_debug() in cpu_memory_rw_debug()
Currently cpu_memory_rw_debug() assumes page-granularity for translations,
and it works in a loop where each iteration translates for the vaddr
rounded down to a page boundary and then copies up to the end of the
page boundary.

Rewrite it to use the new cpu_translate_for_debug(): we no longer want
to round down the input address, and the boundary we copy up to is now
determined by the lg_page_size it returns rather than being assumed
to be page-sized.

This, together with the implementation of translate_for_debug for
Arm targets, fixes the bug where semihosting would incorrectly
fail to access parameter blocks that were in memory where the
start of the 4K region they were in was inaccessible due to MPU
region settings, even if the parameter block itself was readable.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3292
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20260417173105.1648172-18-peter.maydell@linaro.org
Acked-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260430093810.2762539-19-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
abefca8e7f target/arm: Implement translate_for_debug
Implement the translate_for_debug method instead of the
get_phys_addr_attrs_debug one.  This allows us to pass the caller the
lg_page_size from our internal GetPhysAddrResult struct.

Awkwardly, translate_for_debug's "true on success" convention
is the opposite of the one we use internally in ptw.c, so
we have to be careful about the sense of the return values.
This corresponds to the way that arm_cpu_tlb_fill_align()
also has to return true when get_phys_addr() returns false.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260417173105.1648172-17-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260430093810.2762539-18-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
00f3bd9345 hw/core: Implement cpu_get_phys_addr_attrs_debug() with cpu_translate_for_debug()
Implement cpu_get_phys_addr_attrs_debug() with
cpu_translate_for_debug(), so that CPUs can implement only the
translate_for_debug method and have all of the wrapper functions
cpu_translate_for_debug(), cpu_get_phys_addr_attrs_debug() and
cpu_get_phys_addr_debug() work.

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-17-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
d03b78b0d5 hw/core: Implement new cpu_translate_for_debug()
In cpu_memory_rw_debug() we need to do a virtual-to-physical address
translation for debug access.  Currently we assume that the
translation is valid for an entire guest page, but this may not be
true if the target implements some protection regions that have
sub-page granularity. (Currently the only such target is the Arm
CPUs when using an MPU, as in R-profile and M-profile.)

For TCG's emulated accesses, we handle sub-page granularity by the
CPU filling in the lg_page_size field of the CPUTLBEntryFull struct
to tell us how large the region covered by the result is.  But we
didn't extend this to the debug-access code path, with the result
that debug accesses might incorrectly fail because they are looking
at the mapping for the address rounded down to a page boundary.

Provide a cpu_translate_for_debug() function which reports to the
caller not just the physical address and attributes of the
translation but also the lg_page_size for which it is valid.  The
fallback implementation calls cpu_get_phys_addr_attrs_debug() and
assumes target-page-sized validity.

NB: the "return true on valid access, false on failure" follows
the same convention as TCGCPUOps::tlb_fill_align() (though it
is the opposite of what we use in some other places, e.g.
in target/arm's get_phys_addr_* functions).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20260417173105.1648172-15-peter.maydell@linaro.org
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260430093810.2762539-16-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2026-05-12 22:35:54 +02:00
Peter Maydell
3bccc43918 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
916acc2532 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
11f5c51557 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
d4cbf7dabc 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
d6aefbc524 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
85ea0ab9e7 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
2960429541 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
dfdf349889 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
7cfaffba7c 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
2b178c202b 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
d9a1e19c16 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
2a0b7590ee 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
2ae8467854 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>
2026-05-12 22:35:54 +02:00
Peter Maydell
1d6553ff27 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>
2026-05-12 22:35:54 +02:00
Konstantin Shkolnyy
ecbebe2a19 vdpa: Allow VDPA to work on big-endian machine
After commit 0caed25cd1 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: 8f7e996748 ("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>
2026-05-12 22:35:54 +02:00
Philippe Mathieu-Daudé
f5120a21e4 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>
2026-05-12 22:35:54 +02:00
Christian Speich
d7f3ab9d5a 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>
2026-05-12 22:35:54 +02:00
Christian Speich
eff58d3d96 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>
2026-05-12 22:35:27 +02:00
Christian Speich
468fa450a7 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>
2026-05-12 07:03:12 +02:00
Jan Kiszka
f34a7b3ec6 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>
2026-05-12 07:03:10 +02:00
Jan Kiszka
800eca1371 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>
2026-05-12 07:03:09 +02:00
Peter Maydell
27d14251b9 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 ad81218e40 ("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: ad81218e40 ("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>
2026-05-12 07:03:07 +02:00
Peter Maydell
aefeecb413 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 ad81218e40 ("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: ad81218e40 ("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>
2026-05-12 07:02:58 +02:00
Stefan Hajnoczi
5e61afe211 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>
2026-05-11 10:49:53 -04:00
Stefan Hajnoczi
e1f06e20ca 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>
2026-05-11 10:49:37 -04:00
Richard Henderson
1649553313 host-utils: Introduce signed saturation primitives
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2026-05-09 10:50:01 -05:00
Richard Henderson
a93d477899 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>
2026-05-09 10:50:01 -05:00
uchouT
e4c7ebde64 qemu-options: document -chardev dbus
Document the dbus backend introduced in commit 3e301c8d7e ("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>
2026-05-09 18:54:16 +04:00
Marc-André Lureau
3a453266e3 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>
2026-05-09 18:54:16 +04:00
Marc-André Lureau
2eacf4b7be 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>
2026-05-09 18:54:15 +04:00
Marc-André Lureau
c28f118805 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>
2026-05-09 18:54:15 +04:00
Marc-André Lureau
d5503319da 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>
2026-05-09 18:54:15 +04:00
Marc-André Lureau
405a42e365 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>
2026-05-09 18:54:15 +04:00
Stefan Hajnoczi
8333dba732 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>
2026-05-09 07:39:01 -04:00
Stefan Hajnoczi
5f489e1ed0 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>
2026-05-09 07:37:35 -04:00
Stefan Hajnoczi
4eee6ecb57 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>
2026-05-09 07:37:20 -04:00
Stefan Hajnoczi
533a789e13 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>
2026-05-09 07:37:06 -04:00
Stefan Hajnoczi
1743c1de16 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>
2026-05-09 07:36:21 -04:00
Marc-André Lureau
2f6e359c5b 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>
2026-05-09 10:25:01 +04:00
Marc-André Lureau
770af5de56 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>
2026-05-09 10:25:00 +04:00
Marc-André Lureau
8f95c4053b 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>
2026-05-09 10:24:58 +04:00