]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
5 weeks agohw/i2c/imx: Always set interrupt status bit if interrupt condition occurs
Bernhard Beschow [Wed, 7 May 2025 12:40:40 +0000 (14:40 +0200)] 
hw/i2c/imx: Always set interrupt status bit if interrupt condition occurs

According to the i.MX 8M Plus reference manual, the status flag
I2C_I2SR[IIF] continues to be set when an interrupt condition
occurs even when I2C interrupts are disabled (I2C_I2CR[IIEN] is
clear). However, the device model only sets the flag when I2C
interrupts are enabled which causes U-Boot to loop forever. Fix
the device model by always setting the flag and let I2C_I2CR[IIEN]
guard I2C interrupts only.

Also remove the comment in the code since it merely stated the
obvious and would be outdated now.

Cc: qemu-stable@nongnu.org
Fixes: 20d0f9cf6a41 ("i.MX: Add I2C controller emulator")
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Acked-by: Corey Minyard <cminyard@mvista.com>
Message-ID: <20250507124040.425773-1-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 54e54e594bc8273d210f7ff4448c165a989cbbe8)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agoxen: mapcache: Split mapcache_grants by ro and rw
Edgar E. Iglesias [Fri, 25 Apr 2025 13:16:01 +0000 (15:16 +0200)] 
xen: mapcache: Split mapcache_grants by ro and rw

Today, we don't track write-abiliy in the cache, if a user
requests a readable mapping followed by a writeable mapping
on the same page, the second lookup will incorrectly hit
the readable entry.

Split mapcache_grants by ro and rw access. Grants will now
have separate ways in the cache depending on writeability.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
(cherry picked from commit 88fb705600a3b612c571efc9f1a6aed923a18dcc)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agoxen: mapcache: Fix finding matching entry
Aleksandr Partanen [Thu, 10 Apr 2025 14:46:04 +0000 (17:46 +0300)] 
xen: mapcache: Fix finding matching entry

If we have request without lock and hit unlocked or invalid
entry during the search, we remap it immediately,
even if we have matching entry in next entries in bucket.
This leads to duplication of mappings of the same size,
and to possibility of selecting the wrong element
during invalidation and underflow it's entry->lock counter

Signed-off-by: Aleksandr Partanen <alex.pentagrid@gmail.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
(cherry picked from commit a4b20f737cda06bb8706a83e27f7fa89863ae689)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agotarget/i386: do not block singlestep for STI
Paolo Bonzini [Mon, 15 Jul 2024 08:35:06 +0000 (10:35 +0200)] 
target/i386: do not block singlestep for STI

STI will trigger a singlestep exception even if it has inhibit-IRQ
behavior.  Do not suppress single-step for all IRQ-inhibiting
instructions, instead special case MOV SS and POP SS.

Cc: qemu-stable@nongnu.org
Fixes: f0f0136abba ("target/i386: no single-step exception after MOV or POP SS", 2024-05-25)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 1e94ddc6854431064c94a7d8f2f2886def285829)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agotarget/i386: do not trigger IRQ shadow for LSS
Paolo Bonzini [Thu, 8 May 2025 09:32:11 +0000 (11:32 +0200)] 
target/i386: do not trigger IRQ shadow for LSS

Because LSS need not trigger an IRQ shadow, gen_movl_seg can't just use
the destination register to decide whether to inhibit IRQs.  Add an
argument.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit e54ef98c8a80d16158bab4341d9a898701270528)
(back-ported to 10.0)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agohw/gpio/imx_gpio: Fix interpretation of GDIR polarity
Bernhard Beschow [Thu, 1 May 2025 18:34:45 +0000 (20:34 +0200)] 
hw/gpio/imx_gpio: Fix interpretation of GDIR polarity

According to the i.MX 8M Plus reference manual, a GPIO pin is
configured as an output when the corresponding bit in the GDIR
register is set.  The function imx_gpio_set_int_line() is intended to
be a no-op if the pin is configured as an output, returning early in
such cases.  However, it inverts the condition.  Fix this by
returning early when the bit is set.

cc: qemu-stable@nongnu.org
Fixes: f44272809779 ("i.MX: Add GPIO device")
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-id: 20250501183445.2389-4-shentey@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit eba837a31b9579e30cc6d7ecb4b5c2662a6ffaba)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agodocs: Don't define duplicate label in qemu-block-drivers.rst.inc
Peter Maydell [Thu, 1 May 2025 09:31:26 +0000 (10:31 +0100)] 
docs: Don't define duplicate label in qemu-block-drivers.rst.inc

Sphinx requires that labels within documents are unique across the
whole manual.  This is because the "create a hyperlink" directive
specifies only the name of the label, not a filename+label.  Some
Sphinx versions will warn about duplicate labels, but even if there
is no warning there is still an ambiguity and no guarantee that the
hyperlink will be created to the right target.

For QEMU this is awkward, because we have various .rst.inc fragments
which we include into multiple .rst files.  If you define a label in
the .rst.inc file then it will be a duplicate label.  We have mostly
worked around this by not putting labels into those .rst.inc files,
or by adding "insert a label" functionality into the hxtool extension
(see commit 1eeb432a953b0 "doc/sphinx/hxtool.py: add optional label
argument to SRST directive").

Unfortunately in commit 7f6314427e78 ("docs/devel: add a codebase
section") we accidentally added a duplicate label, because not all
Sphinx versions warn about the mistake.

In this case the link was only from the developer docs codebase
summary, so as the simplest fix for the stable branch, we drop
the link entirely.

Cc: qemu-stable@nongnu.org
Fixes: 1eeb432a953b0 "doc/sphinx/hxtool.py: add optional label argument to SRST directive"
Reported-by: Dario Faggioli <dfaggioli@suse.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-id: 20250501093126.716667-1-peter.maydell@linaro.org
(cherry picked from commit 82707dd4f07613eed8d639956a43bddffca5cd5c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agotarget/arm: Don't assert() for ISB/SB inside IT block
Peter Maydell [Thu, 1 May 2025 12:55:44 +0000 (13:55 +0100)] 
target/arm: Don't assert() for ISB/SB inside IT block

If the guest code has an ISB or SB insn inside an IT block, we
generate incorrect code which trips a TCG assertion:

qemu-system-arm: ../tcg/tcg-op.c:3343: void tcg_gen_goto_tb(unsigned int): Assertion `(tcg_ctx->goto_tb_issue_mask & (1 << idx)) == 0' failed.

This is because we call gen_goto_tb(dc, 1, ...) twice:

 brcond_i32 ZF,$0x0,ne,$L1
 add_i32 pc,pc,$0x4
 goto_tb $0x1
 exit_tb $0x73d948001b81
 set_label $L1
 add_i32 pc,pc,$0x4
 goto_tb $0x1
 exit_tb $0x73d948001b81

Both calls are in arm_tr_tb_stop(), one for the
DISAS_NEXT/DISAS_TOO_MANY handling, and one for the dc->condjump
condition-failed codepath.  The DISAS_NEXT handling doesn't have this
problem because arm_post_translate_insn() does the handling of "emit
the label for the condition-failed conditional execution" and so
arm_tr_tb_stop() doesn't have dc->condjump set.  But for
DISAS_TOO_MANY we don't do that.

Fix the bug by making arm_post_translate_insn() handle the
DISAS_TOO_MANY case.  This only affects the SB and ISB insns when
used in Thumb mode inside an IT block: only these insns specifically
set is_jmp to TOO_MANY, and their A32 encodings are unconditional.

For the major TOO_MANY case (breaking the TB because it would cross a
page boundary) we do that check and set is_jmp to TOO_MANY only after
the call to arm_post_translate_insn(); so arm_post_translate_insn()
sees is_jmp == DISAS_NEXT, and  we emit the correct code for that
situation.

With this fix we generate the somewhat more sensible set of TCG ops:
 brcond_i32 ZF,$0x0,ne,$L1
 set_label $L1
 add_i32 pc,pc,$0x4
 goto_tb $0x1
 exit_tb $0x7c5434001b81

(NB: the TCG optimizer doesn't optimize out the jump-to-next, but
we can't really avoid emitting it because we don't know at the
point we're emitting the handling for the condexec check whether
this insn is going to happen to be a nop for us or not.)

Cc: qemu-stable@nongnu.org
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2942
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20250501125544.727038-1-peter.maydell@linaro.org
(cherry picked from commit 8ed7c0b6488a7f20318d6ba414f1cbcd0ed92afe)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agohw/arm/npcm8xx_boards: Correct valid_cpu_types setting of NPCM8XX SoC
Tim Lee [Mon, 28 Apr 2025 02:29:34 +0000 (10:29 +0800)] 
hw/arm/npcm8xx_boards: Correct valid_cpu_types setting of NPCM8XX SoC

NPCM8XX SoC is the successor of the NPCM7XX. It features quad-core
Cortex-A35 (Armv8, 64-bit) CPUs and some additional peripherals.
Correct the `valid_cpu_types` setting to match the NPCM8XX SoC.

Cc: qemu-stable@nongnu.org
Fixes: 7e70eb3cad7c83 ("hw/arm: Add NPCM845 Evaluation board")
Signed-off-by: Tim Lee <timlee660101@gmail.com>
Message-id: 20250428022934.3081139-1-timlee660101@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 97cdd1b0a7a010702a1d118b74c3af3bb2edb35c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
5 weeks agoaccel/tcg: Don't use TARGET_LONG_BITS in decode_sleb128
Richard Henderson [Wed, 30 Apr 2025 21:35:47 +0000 (14:35 -0700)] 
accel/tcg: Don't use TARGET_LONG_BITS in decode_sleb128

When we changed decode_sleb128 from target_long to
int64_t, we failed to adjust the shift limit.

Cc: qemu-stable@nongnu.org
Fixes: c9ad8d27caa ("tcg: Widen gen_insn_data to uint64_t")
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 9401f91b9b0c46886388735b3f2033a9c254895a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
6 weeks agomeson: Use osdep_prefix for strchrnul()
Akihiko Odaki [Thu, 24 Apr 2025 04:50:14 +0000 (13:50 +0900)] 
meson: Use osdep_prefix for strchrnul()

macOS SDK may have the symbol of strchrnul(), but it is actually
available only on macOS 15.4 or later and that fact is codified in
string.h. Include the header file using osdep_prefix to check if the
function is available on the deployment target.

Cc: qemu-stable@nongnu.org
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250424-buildsys-v1-4-97655e3b25d7@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit a5b30be534538dc6e44a68ce9734e45dd08f52ec)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
6 weeks agomeson: Share common C source prefixes
Akihiko Odaki [Thu, 24 Apr 2025 04:50:13 +0000 (13:50 +0900)] 
meson: Share common C source prefixes

gnu_source_prefix defines _GNU_SOURCE for compiler object functions.
The definition is universally available in the code base.

docs/devel/style.rst also says that the "qemu/osdep.h" header is
always included, so files included in the file is also universally
available in the code base.

Rename gnu_source_prefix to osdep_prefix, and add #include directives
that are referred by the users of gnu_source_prefix and contained in
qemu/osdep.h to safely de-duplicate #include directives.

Cc: qemu-stable@nongnu.org
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250424-buildsys-v1-3-97655e3b25d7@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 797150d69d2edba8b1bd4a7d8c7ba2df1219c503)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
6 weeks agomeson: Remove CONFIG_STATX and CONFIG_STATX_MNT_ID
Akihiko Odaki [Thu, 24 Apr 2025 04:50:12 +0000 (13:50 +0900)] 
meson: Remove CONFIG_STATX and CONFIG_STATX_MNT_ID

CONFIG_STATX and CONFIG_STATX_MNT_ID are not used since commit
e0dc2631ec4 ("virtiofsd: Remove source").

Cc: qemu-stable@nongnu.org
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250424-buildsys-v1-2-97655e3b25d7@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 6804b89fb531f5dd49c1e038214c89272383e220)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
6 weeks agomeson: Use has_header_symbol() to check getcpu()
Akihiko Odaki [Thu, 24 Apr 2025 04:50:11 +0000 (13:50 +0900)] 
meson: Use has_header_symbol() to check getcpu()

The use of gnu_source_prefix in the detection of getcpu() was
ineffective because the header file that declares getcpu() when
_GNU_SOURCE is defined was not included. Pass sched.h to
has_header_symbol() so that the existence of the declaration will be
properly checked.

Cc: qemu-stable@nongnu.org
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250424-buildsys-v1-1-97655e3b25d7@daynix.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 563cd698dffb977eea0ccfef3b95f6f9786766f3)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
6 weeks agotarget/mips: Fix MIPS16e translation
Hauke Mehrtens [Sat, 12 Apr 2025 19:40:03 +0000 (21:40 +0200)] 
target/mips: Fix MIPS16e translation

Fix a wrong conversion to gen_op_addr_addi(). The framesize should be
added like it was done before.

This bug broke booting OpenWrt MIPS32 BE malta Linux system images
generated by OpenWrt.

Cc: qemu-stable@nongnu.org
Fixes: d0b24b7f50e1 ("target/mips: Use gen_op_addr_addi() when possible")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250412194003.181411-1-hauke@hauke-m.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit d4a785ba30ce6d8acf0206f049fb4a7494e0898a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
6 weeks agohw/core/cpu: gdb_arch_name string should not be freed
Peter Maydell [Mon, 17 Mar 2025 14:28:11 +0000 (14:28 +0000)] 
hw/core/cpu: gdb_arch_name string should not be freed

The documentation for the CPUClass::gdb_arch_name method claims that
the returned string should be freed with g_free().  This is not
correct: in commit a650683871ba728 we changed this method to
instead return a simple constant string, but forgot to update
the documentation.

Make the documentation match the new semantics.

Fixes: a650683871ba728 ("hw/core/cpu: Return static value with gdb_arch_name()")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250317142819.900029-2-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
(cherry picked from commit 56a9f0d4c4a483ce217e5290db69cb1788586787)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
6 weeks agohw/core: Get default_cpu_type calling machine_class_default_cpu_type()
Philippe Mathieu-Daudé [Tue, 22 Apr 2025 08:32:31 +0000 (10:32 +0200)] 
hw/core: Get default_cpu_type calling machine_class_default_cpu_type()

Since commit 62b4a227a33 the default cpu type can come from the
valid_cpu_types[] array. Call the machine_class_default_cpu_type()
instead of accessing MachineClass::default_cpu_type field.

Cc: qemu-stable@nongnu.org
Fixes: 62b4a227a33 ("hw/core: Add machine_class_default_cpu_type()")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-Id: <20250422084114.39499-1-philmd@linaro.org>
(cherry picked from commit d5f241834be1b323ea697a469ff0f1335a1823fe)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 weeks agotarget/avr: Improve decode of LDS, STS
Richard Henderson [Sun, 23 Mar 2025 17:16:23 +0000 (10:16 -0700)] 
target/avr: Improve decode of LDS, STS

The comment about not being able to define a field with
zero bits is out of date since 94597b6146f3
("decodetree: Allow !function with no input bits").

This fixes the missing load of imm in the disassembler.

Cc: qemu-stable@nongnu.org
Fixes: 9d8caa67a24 ("target/avr: Add support for disassembling via option '-d in_asm'")
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit 6b661b7ed7cd02c54a78426d5eb7dd8543b030ed)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 weeks agotarget/i386/hvf: fix lflags_to_rflags
Paolo Bonzini [Thu, 3 Apr 2025 19:39:54 +0000 (21:39 +0200)] 
target/i386/hvf: fix lflags_to_rflags

Clear the flags before adding in the ones computed from lflags.

Cc: Wei Liu <liuwe@linux.microsoft.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 94a159f3dc737d00749cc930adaec112abe07b3c)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 weeks agotarget/i386: Reset parked vCPUs together with the online ones
Maciej S. Szmigiero [Thu, 27 Mar 2025 18:24:16 +0000 (19:24 +0100)] 
target/i386: Reset parked vCPUs together with the online ones

Commit 3f2a05b31ee9 ("target/i386: Reset TSCs of parked vCPUs too on VM
reset") introduced a way to reset TSCs of parked vCPUs during VM reset to
prevent them getting desynchronized with the online vCPUs and therefore
causing the KVM PV clock to lose PVCLOCK_TSC_STABLE_BIT.

The way this was done was by registering a parked vCPU-specific QEMU reset
callback via qemu_register_reset().

However, it turns out that on particularly device-rich VMs QEMU reset
callbacks can take a long time to execute (which isn't surprising,
considering that they involve resetting all of VM devices).

In particular, their total runtime can exceed the 1-second TSC
synchronization window introduced in KVM commit 5d3cb0f6a8e3 ("KVM:
Improve TSC offset matching").
Since the TSCs of online vCPUs are only reset from "synchronize_post_reset"
AccelOps handler (which runs after all qemu_register_reset() handlers) this
essentially makes that fix ineffective on these VMs.

The easiest way to guarantee that these parked vCPUs are reset at the same
time as the online ones (regardless how long it takes for VM devices to
reset) is to piggyback on post-reset vCPU synchronization handler for one
of online vCPUs - as there is no generic post-reset AccelOps handler that
isn't per-vCPU.

The first online vCPU was selected for that since it is easily available
under "first_cpu" define.
This does not create an ordering issue since the order of vCPU TSC resets
does not matter.

Fixes: 3f2a05b31ee9 ("target/i386: Reset TSCs of parked vCPUs too on VM reset")
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Link: https://lore.kernel.org/r/e8b85a5915f79aa177ca49eccf0e9b534470c1cd.1743099810.git.maciej.szmigiero@oracle.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit f6b5f71f04529d3f56b35f91badac9f5e7e225ca)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 weeks agotarget/i386: Fix model number of Zhaoxin YongFeng vCPU template
Ewan Hai [Mon, 14 Apr 2025 07:53:42 +0000 (03:53 -0400)] 
target/i386: Fix model number of Zhaoxin YongFeng vCPU template

The model number was mistakenly set to 0x0b (11) in commit ff04bc1ac4.
The correct value is 0x5b. This mistake occurred because the extended
model bits in cpuid[eax=0x1].eax were overlooked, and only the base
model was used.

Using the wrong model number can affect guest behavior. One known issue
is that vPMU (which relies on the model number) may fail to operate
correctly.

This patch corrects the model field by introducing a new vCPU version.

Fixes: ff04bc1ac4 ("target/i386: Introduce Zhaoxin Yongfeng CPU model")
Signed-off-by: Ewan Hai <ewanhai-oc@zhaoxin.com>
Link: https://lore.kernel.org/r/20250414075342.411626-1-ewanhai-oc@zhaoxin.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 280712b78781c43511d6286d40f9a518a4de25ff)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
7 weeks agoUpdate version for the v10.0.0 release v10.0.0
Stefan Hajnoczi [Tue, 22 Apr 2025 13:32:33 +0000 (09:32 -0400)] 
Update version for the v10.0.0 release

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoUpdate version for v10.0.0-rc4 release v10.0.0-rc4
Stefan Hajnoczi [Tue, 15 Apr 2025 15:54:04 +0000 (11:54 -0400)] 
Update version for v10.0.0-rc4 release

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoRevert "virtio-net: Copy received header to buffer"
Antoine Damhet [Tue, 8 Apr 2025 14:53:33 +0000 (16:53 +0200)] 
Revert "virtio-net: Copy received header to buffer"

This reverts commit 7987d2be5a8bc3a502f89ba8cf3ac3e09f64d1ce.

The goal was to remove the need to patch the (const) input buffer
with a recomputed UDP checksum by copying headers to a RW region and
inject the checksum there. The patch computed the checksum only from the
header fields (missing the rest of the payload) producing an invalid one
and making guests fail to acquire a DHCP lease.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2727
Cc: qemu-stable@nongnu.org
Signed-off-by: Antoine Damhet <adamhet@scaleway.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20250408145345.142947-1-adamhet@scaleway.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agotests/functional/test_aarch64_replay: reenable on macos
Pierrick Bouvier [Thu, 10 Apr 2025 22:55:50 +0000 (15:55 -0700)] 
tests/functional/test_aarch64_replay: reenable on macos

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250410225550.46807-3-pierrick.bouvier@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agosystem/main: transfer replay mutex ownership from main thread to main loop thread
Pierrick Bouvier [Thu, 10 Apr 2025 22:55:49 +0000 (15:55 -0700)] 
system/main: transfer replay mutex ownership from main thread to main loop thread

On MacOS, UI event loop has to be ran in the main thread of a process.
Because of that restriction, on this platform, qemu main event loop is
ran on another thread [1].

This breaks record/replay feature, which expects thread running qemu_init
to initialize hold this lock, breaking associated functional tests on
MacOS.

Thus, as a generalization, and similar to how BQL is handled, we release
it after init, and reacquire the lock before entering main event loop,
avoiding a special case if a separate thread is used.

Tested on MacOS with:
$ meson test -C build --setup thorough --print-errorlogs \
func-x86_64-x86_64_replay func-arm-arm_replay func-aarch64-aarch64_replay
$ ./build/qemu-system-x86_64 -nographic -icount shift=auto,rr=record,rrfile=replay.log
$ ./build/qemu-system-x86_64 -nographic -icount shift=auto,rr=replay,rrfile=replay.log

[1] https://gitlab.com/qemu-project/qemu/-/commit/f5ab12caba4f1656479c1feb5248beac1c833243

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2907
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250410225550.46807-2-pierrick.bouvier@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
Stefan Hajnoczi [Mon, 14 Apr 2025 15:02:34 +0000 (11:02 -0400)] 
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging

trivial patches for 2025-04-14

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEZKoqtTHVaQM2a/75gqpKJDselHgFAmf81fEACgkQgqpKJDse
# lHihiBAAlf/FCOGs4qCJuwuoeebI9WC22C+80hQPNMiXLvV7wQWJMqdf6UvPOUt/
# LUdndWrPb2hKKVzcv6mMEKl0wEAxOdxB1FiZZltKwIJiES1OXJcKjNSK84PTN/CN
# WDC/mVjv5v10X7x3xUHTqB1qr6MpWuSQLnfob5u40MVa43wZj6fJPeSYzHsWNgrx
# 47xLlqFyGVv7mMtIxpYsrKoFypNaTTHggSydZnUkOQBIsXvxE9mEagIdNhjGQVNh
# gx76DWxYnjM932yIizKCQJhe2umetlHUR9dUEqWkI8xRA0pQVTE/p5c+rkIxCzeu
# uAadKOOGdRaHKjinyMQMoFTjC6CH8f1znWVwYJvsh2XLyJXb7PAo6jq3piUWLQpv
# OTXSQ2N/1FJeYEkliyjJibabviJpmdY3mzr/Bw0jJh3KYGm1Ub/lGjjaVes5PwHz
# xa5jnm2Dk9sdpWP2VCyxhlffs5iSOQblPBit4UeTyytg1SZohcWNevcz+AdrCUEE
# nYvxQoAl0euq6oAXDV1qsVl7HwgEm9FCiMJY8G94G890wGx9gPIZ+Ofp+9GHbve0
# sxY027EjvosX9Om2IRexmLpwnHRCUYw+09fD8iqs7ie/oN5ryTgYG5oZMAjAZC46
# Rd+dcuxxmT9uc5XZoZaGzloNmCDI7RjMAMAaSlwUMXHB0XA0wc8=
# =VgUD
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 14 Apr 2025 05:31:29 EDT
# gpg:                using RSA key 64AA2AB531D56903366BFEF982AA4A243B1E9478
# gpg: Good signature from "Michael Tokarev <mjt@debian.org>" [unknown]
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>" [unknown]
# gpg:                 aka "Michael Tokarev <mjt@tls.msk.ru>" [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: 9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
#      Subkey fingerprint: 64AA 2AB5 31D5 6903 366B  FEF9 82AA 4A24 3B1E 9478

* tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu:
  docs: Document removal of 64-bit on 32-bit emulation
  Fix objdump output parser in "nsis.py"
  docs: Fix some typos (found by codespell and typos)

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'pull-10.0-final-fixes-090425-1' of https://gitlab.com/stsquad/qemu into...
Stefan Hajnoczi [Mon, 14 Apr 2025 15:02:09 +0000 (11:02 -0400)] 
Merge tag 'pull-10.0-final-fixes-090425-1' of https://gitlab.com/stsquad/qemu into staging

Final fixes for 10.0

 - properly exit aarch64-softmmu tcg tests on unexpected exceptions
 - fix deadlock when uninstalling a plugin

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmf2P+0ACgkQ+9DbCVqe
# KkTHdAf/b4CGLNJBS7UV/eYxhgxJ2TM4KgfXm4FvrcS4V5rpNheMuLoQzgYDY+EC
# 5ioANRcY+rOK2Yd+upO4SbaUyAvf7C5kAtMgs6AYiqbm5F8b47FS/q8f9mBBJ+qB
# tl2FU6hjVjymMRoaPqqpPkkkHy9YNHe48TP4ohGfD6336JA5MW6v8nhdK+d3fsan
# AUCSWAe8gxjmM6qnrhku6vvJ5EOiqpsb8zhsWVXdZesSG+1ATm6KCo6hDd0OkMrk
# si6ML5txU1rxx5VOkGlDUo7ZV2TE/zdgMyaP/kXGtKuj+ipLMzqNjlD50xPJu05b
# o4hTbt8erzxduVHrBKT5qhKQl8BEpw==
# =LN/t
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 09 Apr 2025 05:37:49 EDT
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-10.0-final-fixes-090425-1' of https://gitlab.com/stsquad/qemu:
  tests/tcg/plugins: add plugin to test reset and uninstall
  plugins/loader: fix deadlock when resetting/uninstalling a plugin
  tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agodocs: Document removal of 64-bit on 32-bit emulation
Richard Henderson [Sat, 12 Apr 2025 16:43:15 +0000 (09:43 -0700)] 
docs: Document removal of 64-bit on 32-bit emulation

With acce728cbc6c we disallowed configuring 64-bit guests on
32-bit hosts, but forgot to document that in removed-features.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2 months agoFix objdump output parser in "nsis.py"
Arthur Sengileyev [Sat, 12 Apr 2025 18:08:30 +0000 (21:08 +0300)] 
Fix objdump output parser in "nsis.py"

In msys2 distribution objdump from gcc is using single tab character
prefix, but objdump from clang is using 4 white space characters instead.
The script will not identify any dll dependencies for a QEMU build
generated with clang. This in turn will fail the build, because there
will be no files inside dlldir and no setup file will be created.
Instead of checking for whitespace in prefix use lstrip to accommodate
for differences in outputs.

Signed-off-by: Arthur Sengileyev <arthur.sengileyev@gmail.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2 months agodocs: Fix some typos (found by codespell and typos)
Stefan Weil via [Sat, 12 Apr 2025 18:11:47 +0000 (20:11 +0200)] 
docs: Fix some typos (found by codespell and typos)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2 months agotests/tcg/plugins: add plugin to test reset and uninstall
Pierrick Bouvier [Fri, 4 Apr 2025 03:20:27 +0000 (20:20 -0700)] 
tests/tcg/plugins: add plugin to test reset and uninstall

We perform a plugin reset, uninstall, and make sure we went through
those steps.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20250404032027.430575-3-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
2 months agoplugins/loader: fix deadlock when resetting/uninstalling a plugin
Pierrick Bouvier [Fri, 4 Apr 2025 03:20:26 +0000 (20:20 -0700)] 
plugins/loader: fix deadlock when resetting/uninstalling a plugin

Reported and fixed by Dmitry Kurakin.

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2901
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20250404032027.430575-2-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agotests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S
Alex Bennée [Fri, 4 Apr 2025 11:51:12 +0000 (12:51 +0100)] 
tests/tcg: fix semihosting SYS_EXIT for aarch64 in boot.S

We don't expect to hit exceptions in our testing so currently all the
vectors report an un-expected exception and then attempt to exit.
However for aarch64 we should always use the extended information
block as we do in _exit. Rather than duplicate the code on the error
handler just branch to the _exit handler with a failing status code.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250404115641.258048-1-alex.bennee@linaro.org>

2 months agoUpdate version for v10.0.0-rc3 release v10.0.0-rc3
Stefan Hajnoczi [Wed, 9 Apr 2025 08:33:10 +0000 (04:33 -0400)] 
Update version for v10.0.0-rc3 release

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'hw-misc-20250408' of https://github.com/philmd/qemu into staging
Stefan Hajnoczi [Wed, 9 Apr 2025 08:32:46 +0000 (04:32 -0400)] 
Merge tag 'hw-misc-20250408' of https://github.com/philmd/qemu into staging

Misc HW patches

- Fix overrun when parsing SMBIOS OEM string (Daan)
- Correctly call handle_machine_dumpdtb() callback (Joel)
- List HVF as supported for virt machine (Zhang)
- Correct UFS segment/alloc size comments (Keoseong)
- Do not expose unimplemented devices in i.MX8mp DTB (Guenter & Bernhard)
- Attach NVMe private namespaces to proper controller (Klaus)
- Fix typo in SDPX license checker script (Zhao)

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmf1cOAACgkQ4+MsLN6t
# wN5ZERAAttyD+ZJwIOeTmrVyIhYNAKVKBWzUnqce+k+1NUG0kT/+FXN7rmP4lFhM
# 2VasfWG8UVBpOcd2FfjimDadYEZ48WtE6z4txf7Fk3rDYOtC7U8l2dvGRhrvdnv+
# NaClU7+PZwpaS2KE/rGTRXm+QC4gc9GnMz6PPwTcBybVWh6342L7EUcbv0AYhTmn
# S1w/jQIwX6OKYkjHdR3WRacx3skKf9PCDoaZkQxxHPCPDzkpf8pJhojScvwg+CBz
# PoT9OqKm9vS9UXLxTUFsdW7SWKc7xAJwFWZS/QXtUV5X+D/w1eQ3qEBEwShPecxl
# XehwNfaO5YqI6oiSGm+XZlz4Hk7bmoRMv4cl9JZ+ifiU/RronlYiMjRL79lqWXCL
# Yp0q553YwdAIFlwzOE3Zblf/4H3iZ0dbc1wSRJLGE+pFvslUb0uch8WqkLQ+FX0q
# kUBTJx8bvy0pmV0w/n6aY8gCygBZoK8hK5NZJ7Iq38y8UQ4vjLAlycd6XocA7aQk
# PdyFjXvY4ofVldmLMaJdX4pQTgi1/GVSNa7G/cTrF5tcxwIcmVbvpqtZwB3+YxGu
# pwQnD1eR5u9ZLsXNoRM2RRCBRB/h7k6HavSJ3JFtNjbQU07C3oFoQ9VePcKLl1Xl
# wmHRBq3twgx/ZZAnYZyPQL2mmTcmo125kT3ZFVgl77UzzA/piD0=
# =0xrJ
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 08 Apr 2025 14:54:24 EDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'hw-misc-20250408' of https://github.com/philmd/qemu:
  scripts/checkpatch: Fix typo in SPDX-License-Identifier keyword
  hw/nvme: fix attachment of private namespaces
  hw/arm/imx8mp-evk: Temporarily remove unimplemented imx8mp-fspi node from devicetree
  hw/arm/imx8mp-evk: Remove unimplemented cpu-idle-states properties from devicetree
  hw/ufs: Fix incorrect comment for segment_size and allocation_unit_size
  docs/arm: Add apple HVF host for supported guest CPU type
  hw/core/machine: Fix -machine dumpdtb=file.dtb
  smbios: Fix buffer overrun when using path= option

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoscripts/checkpatch: Fix typo in SPDX-License-Identifier keyword
Zhao Liu [Tue, 8 Apr 2025 16:27:02 +0000 (00:27 +0800)] 
scripts/checkpatch: Fix typo in SPDX-License-Identifier keyword

Fix the typo in the error message to help `grep` the example:

ERROR: New file '***' requires 'SPDX-License-Identifer'

Fixes: fa4d79c64dae ("scripts: mandate that new files have SPDX-License-Identifier")
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250408162702.2350565-1-zhao1.liu@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/nvme: fix attachment of private namespaces
Klaus Jensen [Tue, 8 Apr 2025 10:20:46 +0000 (12:20 +0200)] 
hw/nvme: fix attachment of private namespaces

Fix regression when attaching private namespaces that gets attached to
the wrong controller.

Keep track of the original controller "owner" of private namespaces, and
only attach if this matches on controller enablement.

Fixes: 6ccca4b6bb9f ("hw/nvme: rework csi handling")
Reported-by: Alan Adamson <alan.adamson@oracle.com>
Suggested-by: Alan Adamson <alan.adamson@oracle.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Tested-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Message-ID: <20250408-fix-private-ns-v1-1-28e169b6b60b@samsung.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/arm/imx8mp-evk: Temporarily remove unimplemented imx8mp-fspi node from devicetree
Guenter Roeck [Sat, 5 Apr 2025 21:49:00 +0000 (23:49 +0200)] 
hw/arm/imx8mp-evk: Temporarily remove unimplemented imx8mp-fspi node from devicetree

The nxp,imx8mp-fspi node triggers a warning backtrace.
Remove it from the devicetree file.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Inspired-by: commit bf1da4b308 ("hw/arm/raspi4b: Temporarily disable unimplemented rpi4b devices")
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
[Bernhard: split patch, adapt commit message]
Message-ID: <20250405214900.7114-4-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/arm/imx8mp-evk: Remove unimplemented cpu-idle-states properties from devicetree
Guenter Roeck [Sat, 5 Apr 2025 21:48:59 +0000 (23:48 +0200)] 
hw/arm/imx8mp-evk: Remove unimplemented cpu-idle-states properties from devicetree

The cpu-idle-states property causes a hard boot hang. Rather than documenting
the workaround, perform the removal from the devicetree automatically.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
[Bernhard: split patch, update documentation, adapt commit message]
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <20250405214900.7114-3-shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/ufs: Fix incorrect comment for segment_size and allocation_unit_size
Keoseong Park [Thu, 3 Apr 2025 09:21:40 +0000 (18:21 +0900)] 
hw/ufs: Fix incorrect comment for segment_size and allocation_unit_size

The comments for segment_size and allocation_unit_size incorrectly
described them as 4KB. According to the UFS specification,
segment_size is expressed in units of 512 bytes.
Given segment_size = 0x2000 (8192), the actual size is 4MB.
Similarly, allocation_unit_size = 1 means 1 segment = 4MB.

This patch updates the comments to reflect the correct size.

Signed-off-by: Keoseong Park <keosung.park@samsung.com>
Reviewed-by: Jeuk Kim <jeuk20.kim@samsung.com>
Message-ID: <20250403092140epcms2p355a7f039871b3e5b409754ef450b9158@epcms2p3>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agodocs/arm: Add apple HVF host for supported guest CPU type
Zhang Chen [Tue, 1 Apr 2025 08:31:02 +0000 (16:31 +0800)] 
docs/arm: Add apple HVF host for supported guest CPU type

In my test, latest QEMU already support Apple HVF for -cpu host and max.

From guest VM lscpu:

Architecture:             aarch64
  CPU op-mode(s):         64-bit
  Byte Order:             Little Endian
CPU(s):                   11
  On-line CPU(s) list:    0-10
Vendor ID:                Apple
  Model name:             -
    Model:                0
    Thread(s) per core:   1
    Core(s) per socket:   11
    Socket(s):            1
    Stepping:             0x0
    BogoMIPS:             48.00
    Flags:                fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 asimddp sha512 asim
                          dfhm dit uscat ilrcpc flagm ssbs sb paca pacg dcpodp flagm2 frint

Signed-off-by: Zhang Chen <zhangckid@gmail.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-ID: <20250401083102.72845-1-zhangckid@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/core/machine: Fix -machine dumpdtb=file.dtb
Joel Stanley [Tue, 1 Apr 2025 04:15:08 +0000 (14:45 +1030)] 
hw/core/machine: Fix -machine dumpdtb=file.dtb

In commit 8fd2518ef2f8 ("hw: Centralize handling of -machine dumpdtb
option") the call to dump was moved with respect to the init of the
machine.  This resulted in the device tree missing parts of the machine
description, depending on how they construct their device tree.

The arm virt machine is missing some PSCI nodes, while the riscv one
is missing most of its content.

Move the dump to after the notifiers have been run, allowing
virt_machine_done to be called and the device tree to be fully
populated.

Fixes: 8fd2518ef2f8 ("hw: Centralize handling of -machine dumpdtb option")
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250401041509.719153-1-joel@jms.id.au>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agosmbios: Fix buffer overrun when using path= option
Daan De Meyer [Sun, 23 Mar 2025 21:35:54 +0000 (22:35 +0100)] 
smbios: Fix buffer overrun when using path= option

We have to make sure the array of bytes read from the path= file
is null-terminated, otherwise we run into a buffer overrun later on.

Fixes: bb99f4772f54017490e3356ecbb3df25c5d4537f ("hw/smbios: support loading OEM strings values from a file")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2879

Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Valentin David <valentin.david@canonical.com>
Message-ID: <20250323213622.2581013-1-daan.j.demeyer@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agoMerge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging
Stefan Hajnoczi [Tue, 8 Apr 2025 13:59:33 +0000 (09:59 -0400)] 
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging

Block layer patches

- scsi-disk: Apply error policy for host_status errors again
- qcow2: Fix qemu-img info crash with missing crypto header
- qemu-img bench: Fix division by zero for zero-sized images
- test-bdrv-drain: Fix data races

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmf1HdQRHGt3b2xmQHJl
# ZGhhdC5jb20ACgkQfwmycsiPL9Z9QxAAlKjkXt5mshcMPPNAIFkBarvF318T8azh
# 5A4soABMpgZBceXaadWMEkBiYGW7jvoBwRVivVNB7jLfar3jchfW8xEAerLXMpAE
# O6n6vwXQz5fy1w5VqJuA/lA/5ZGdt8P7NvvOGcd00GySo6df2lOBtCbDjtwT5t6a
# 0w6b5d/qSIsfm7wEIh7Vh8HjQ88WoOXSti9xQppyd48onNRT+6p2XtyXD75EeZi+
# uYS/NNwViNVRD2df3q4Thi3Q9AMhlDn8yZUqgMpwupbZcXNgjdfMNMPUUmRTNDrO
# 33byZu+nrrq+Qz5xTSekD9anV4M1yJ+aWYxL7BI2RP87u4OgcZuCgNcFHzZ2j9BJ
# xrV0wPdh1xdY8kn/5+X27/gC5cjb5AYoiA4SGZJsZpcvYnBz/jRIMoUY9HVc1Y+N
# hW/endbNTpQYlEzmTb6RRccV7gTsD8V+Dc5TOg/RLgpdxahiZg0JAxT4sUkb52Ij
# CH5kPRkEsluSXf86qFyDitMlE/SCl4bL9xoHnydgeaMJovMRAT6I/UpUdLkgsacL
# ul6snvKPRXXP6PnM8hKHJmZwzKyzJVaVnQSG4TefNQTLIro3ZgVKzUek4dmpIHmg
# hn9GOqENeS3soKg1vyniWEsNdg/t6YvEfFutJk5LJVRb5F18sht9IIYWNJKdWxuV
# S7S3kAlMXow=
# =Dv5w
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 08 Apr 2025 09:00:04 EDT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* tag 'for-upstream' of https://repo.or.cz/qemu/kevin:
  test-bdrv-drain: Fix data races
  scsi-disk: Apply error policy for host_status errors again
  qcow2: Don't crash qemu-img info with missing crypto header
  qemu-img: fix division by zero in bench_cb() for zero-sized images

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'pull-ppc-for-10.0-3-20250408' of https://gitlab.com/npiggin/qemu into...
Stefan Hajnoczi [Tue, 8 Apr 2025 13:12:48 +0000 (09:12 -0400)] 
Merge tag 'pull-ppc-for-10.0-3-20250408' of https://gitlab.com/npiggin/qemu into staging

* Fix a couple of recent regressions in powernv SPRs

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEETkN92lZhb0MpsKeVZ7MCdqhiHK4FAmf1GkwACgkQZ7MCdqhi
# HK6tmw//XnldKdvFSaiisqxutdf+wWneqI1X+cVzVpSf6JyUN+SX3c4CSkt/u4NJ
# msWtmCEcHvvZBR0el9AxQVWhuRbO8A6EkkR8Fcx955rQ/CNPTz3YcHatIzpN2JMA
# NnnB9HxekBFet27A7+8iwtJGuQw5PPjbqN3GhzZcZZ3Kv8BTKZSBv1fnYINqdR9O
# 1gCaJRh3JLQn7cIj9Qh2MvMO4b+1XwuLuwosN5yd9x5oES9TarNFJbNq4/oSTIVI
# jdEb0CTwXL+IpymHLsVdvSmLALf218qnoRm8PqsOcep74MkXKBj+f158tJWha2wQ
# 9og75EYhnglLtU85TymCIlXFIA/DmN72zY7IK+dTr8ZDn4N7W9dSpJqqQjy9vSxX
# g9Z0/F38HBBzTVh+kgJ0Z9cjIkned4zRNZvxaiFl3f5TOEidZ5GU5fW16tWoE6Cj
# 44m5X6Si8SvPD+1pFHDd1cUQdNWoIjEW1uei1gK3E1jqmJNUfau8TaVqADQA1q4m
# RU4AFdP16tYMiRYEBdpCU6OmHgDn+lmoCwFN7n/hU88s4x5aLjYMCt0/XH3v84dg
# 4UpYz38icp9/nzOVdrCMFuiFd8ni+cFZ9ZaUSzTVKyQfJZ+IT7H2EyJgbcsIKTWj
# rPTuBjeHpsmo2XFumTKcvNUmnQB9LxkAhkSnkqhCSrEhoGySDik=
# =ryYx
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 08 Apr 2025 08:45:00 EDT
# gpg:                using RSA key 4E437DDA56616F4329B0A79567B30276A8621CAE
# gpg: Good signature from "Nicholas Piggin <npiggin@gmail.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: 4E43 7DDA 5661 6F43 29B0  A795 67B3 0276 A862 1CAE

* tag 'pull-ppc-for-10.0-3-20250408' of https://gitlab.com/npiggin/qemu:
  target/ppc: Fix SPRC/SPRD SPRs for P9/10
  target/ppc: Big-core scratch register fix

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'pull-qapi-2025-04-08' of https://repo.or.cz/qemu/armbru into staging
Stefan Hajnoczi [Tue, 8 Apr 2025 13:12:40 +0000 (09:12 -0400)] 
Merge tag 'pull-qapi-2025-04-08' of https://repo.or.cz/qemu/armbru into staging

QAPI patches patches for 2025-04-08

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmf0y3ESHGFybWJydUBy
# ZWRoYXQuY29tAAoJEDhwtADrkYZTSXgP/iSQ0F/8GFqdX9+k5WJ7Sd+IzxJPkPM2
# UnjhT2viBP7pC2/Ok2NFfUnigXBCNFyLX/TNcWAK1RMfxuj9GWSJqAMxrMlTPgp0
# Oef3RdE4gQ0h/8/hA8VwdAHza9ItAdZDmpOYO1JGq1B+FVb0P8HPtwKYFhf+gMGa
# YcEuwD6DkilbPGnSEBmN7t78V7yp/pQ6SL/38O97aVyEmrVGtqAD1KiV2Va7JjVF
# GoOYivejTyqJeaY9dvPxxfWi/3HAPFN+q2giNZe+dOPuyYQ6oeryIyJM+sM1/8xG
# PTJayBnV7f8tXPvWrJVyiMC8vWropZ3ExY2/YJ2WNmhJIvrhj9pVxiCUgD18Akgf
# McvDjExVilIMNQCBnRLdrXDFWcc8Y+/GlVMB386a0X9OS+be3Am6b34MDG3UMjvy
# 6SL4fyOyfBkBNxrsJnngcMZgUf/VcwdLBGMGfpS9kjsXEQtlV9SfB3TbBnRMfh+t
# DWSLnEFh5AaYOnmGcC6+JG9sttM93+Boyq/tqi8n+38TDQswOB8q/XtSdHYd0f6L
# dEfD0kRmaOCOrWjakeRKvDJ0IvZbWl/iBmYDfSbe6cFIeMC82cR8sud7WYhZLk+D
# /Q0hMp7u7954ASxdM+P6iuPE17586edtWkk442uH/vKKkwYoPFyBN6+LSNAJEREX
# 4SHZhLuHCNNN
# =X7db
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 08 Apr 2025 03:08:33 EDT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* tag 'pull-qapi-2025-04-08' of https://repo.or.cz/qemu/armbru:
  qga/qapi-schema: Add a proper introduction
  storage-daemon/qapi/qapi-schema: Add a proper introduction
  qapi/qapi-schema: Address the introduction's bit rot
  qapi/qapi-schema: Update introduction for example notation
  docs/sphinx/qmp_lexer: Highlight elisions like comments, not prompts
  docs/sphinx/qmp_lexer: Generalize elision syntax
  docs/devel/qapi-code-gen: Improve the part on qmp-example directive
  docs/interop: Sanitize QMP reference manuals TOC
  docs/interop: Delete "QEMU Guest Agent Protocol Reference" TOC
  qapi/rocker: Tidy up query-rocker-of-dpa-flows example
  docs/devel/qapi-code-gen: Tidy up whitespace

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'pull-loongarch-20250408' of https://github.com/gaosong715/qemu into staging
Stefan Hajnoczi [Tue, 8 Apr 2025 13:12:27 +0000 (09:12 -0400)] 
Merge tag 'pull-loongarch-20250408' of https://github.com/gaosong715/qemu into staging

loongarch bug fix for 10.0

# -----BEGIN PGP SIGNATURE-----
#
# iLMEAAEKAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCZ/THrQAKCRBAov/yOSY+
# 37asA/0YLOX9BvqG5Qk2cDYJD7ZCTuVsd7bJ0VHGbbf4vuuvmD8ubGeJf1F8cse0
# mufip5/DHlzV3gB+G/vavkG/i45mMDlkyFgvuYaEHZiYH/+3S1Np0/iyl3RFpGNz
# Srua0Flo4PppYRbQ2NG0puvpuhNziTQTMneTm2YiMMBxl4p2OA==
# =BwNB
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 08 Apr 2025 02:52:29 EDT
# gpg:                using RSA key B8FF1DA0D2FDCB2DA09C6C2C40A2FFF239263EDF
# gpg: Good signature from "Song Gao <m17746591750@163.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: B8FF 1DA0 D2FD CB2D A09C  6C2C 40A2 FFF2 3926 3EDF

* tag 'pull-loongarch-20250408' of https://github.com/gaosong715/qemu:
  hw/loongarch/virt: Replace destination error with error_abort
  hw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agotest-bdrv-drain: Fix data races
Vitalii Mordan [Wed, 2 Apr 2025 10:21:19 +0000 (13:21 +0300)] 
test-bdrv-drain: Fix data races

This patch addresses potential data races involving access to Job fields
in the test-bdrv-drain test.

Fixes: 7253220de4 ("test-bdrv-drain: Test drain vs. block jobs")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2900
Signed-off-by: Vitalii Mordan <mordan@ispras.ru>
Message-ID: <20250402102119.3345626-1-mordan@ispras.ru>
[kwolf: Fixed up coding style and one missing atomic access]
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 months agoscsi-disk: Apply error policy for host_status errors again
Kevin Wolf [Mon, 7 Apr 2025 15:59:49 +0000 (17:59 +0200)] 
scsi-disk: Apply error policy for host_status errors again

Originally, all failed SG_IO requests called scsi_handle_rw_error() to
apply the configured error policy. However, commit f3126d65, which was
supposed to be a mere refactoring for scsi-disk.c, broke this and
accidentally completed the SCSI request without considering the error
policy any more if the error was signalled in the host_status field.

Apart from the commit message not describing the change as intended,
errors indicated in host_status are also obviously backend errors and
not something the guest must deal with independently of the error
policy.

This behaviour means that some recoverable errors (such as a path error
in multipath configurations) were reported to the guest anyway, which
might not expect it and might consider its disk broken.

Make sure that we apply the error policy again for host_status errors,
too. This addresses an existing FIXME comment and allows us to remove
some comments warning that callbacks weren't always called. With this
fix, they are called in all cases again.

The return value passed to the request callback doesn't have more free
values that could be used to indicate host_status errors as well as SAM
status codes and negative errno. Store the value in the host_status
field of the SCSIRequest instead and use -ENODEV as the return value (if
a path hasn't been reachable for a while, blk_aio_ioctl() will return
-ENODEV instead of just setting host_status, so just reuse it here -
it's not necessarily entirely accurate, but it's as good as any errno).

Cc: qemu-stable@nongnu.org
Fixes: f3126d65b393 ('scsi: move host_status handling into SCSI drivers')
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250407155949.44736-1-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 months agotarget/ppc: Fix SPRC/SPRD SPRs for P9/10
Nicholas Piggin [Thu, 24 Oct 2024 15:18:12 +0000 (01:18 +1000)] 
target/ppc: Fix SPRC/SPRD SPRs for P9/10

Commit 60d30cff847 ("target/ppc: Move SPR indirect registers into
PnvCore") was mismerged and moved the SPRs to power8-only, instead
of power9/10-only.

Fixes: 60d30cff847 ("target/ppc: Move SPR indirect registers into PnvCore")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
2 months agotarget/ppc: Big-core scratch register fix
Nicholas Piggin [Thu, 5 Sep 2024 22:13:51 +0000 (08:13 +1000)] 
target/ppc: Big-core scratch register fix

The per-core SCRATCH0-7 registers are shared between big cores, which
was missed in the big-core implementation. It is difficult to model
well with the big-core == 2xPnvCore scheme we moved to, this fix
uses the even PnvCore to store the scrach data.

Also remove a stray log message that came in with the same patch that
introduced patch.

Fixes: c26504afd5f5c ("ppc/pnv: Add a big-core mode that joins two regular cores")
Cc: qemu-stable@nongnu.org
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
2 months agoqcow2: Don't crash qemu-img info with missing crypto header
Kevin Wolf [Tue, 18 Mar 2025 20:11:43 +0000 (21:11 +0100)] 
qcow2: Don't crash qemu-img info with missing crypto header

qcow2_refresh_limits() assumes that s->crypto is non-NULL whenever
bs->encrypted is true. This is actually not the case: qcow2_do_open()
allows to open an image with a missing crypto header for BDRV_O_NO_IO,
and then bs->encrypted is true, but s->crypto is still NULL.

It doesn't make sense to open an invalid image, so remove the exception
for BDRV_O_NO_IO. This catches the problem early and any code that makes
the same assumption is safe now.

At the same time, in the name of defensive programming, we shouldn't
make the assumption in the first place. Let qcow2_refresh_limits() check
s->crypto rather than bs->encrypted. If s->crypto is NULL, it also can't
make any requirement on request alignment.

Finally, start a qcow2-encryption test case that only serves as a
regression test for this crash for now.

Reported-by: Leonid Reviakin <L.reviakin@fobos-nt.ru>
Reported-by: Denis Rastyogin <gerben@altlinux.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20250318201143.70657-1-kwolf@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 months agoqemu-img: fix division by zero in bench_cb() for zero-sized images
Denis Rastyogin [Tue, 18 Mar 2025 10:19:00 +0000 (13:19 +0300)] 
qemu-img: fix division by zero in bench_cb() for zero-sized images

This error was discovered by fuzzing qemu-img.

This commit fixes a division by zero error in the bench_cb() function
that occurs when using the bench command with a zero-sized image.

The issue arises because b->image_size can be zero, leading to a
division by zero in the modulo operation (b->offset %= b->image_size).
This patch adds a check for b->image_size == 0 and resets b->offset
to 0 in such cases, preventing the error.

Signed-off-by: Denis Rastyogin <gerben@altlinux.org>
Message-ID: <20250318101933.255617-1-gerben@altlinux.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2 months agoqga/qapi-schema: Add a proper introduction
Markus Armbruster [Fri, 4 Apr 2025 12:14:13 +0000 (14:14 +0200)] 
qga/qapi-schema: Add a proper introduction

Contents adapted from qapi/qapi-schema.json.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-12-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agostorage-daemon/qapi/qapi-schema: Add a proper introduction
Markus Armbruster [Fri, 4 Apr 2025 12:14:12 +0000 (14:14 +0200)] 
storage-daemon/qapi/qapi-schema: Add a proper introduction

Contents adapted from qapi/qapi-schema.json.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-11-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agoqapi/qapi-schema: Address the introduction's bit rot
Markus Armbruster [Fri, 4 Apr 2025 12:14:11 +0000 (14:14 +0200)] 
qapi/qapi-schema: Address the introduction's bit rot

Cut the crap that stopped making sense years ago.  Adjust the
remainder.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-10-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agoqapi/qapi-schema: Update introduction for example notation
Markus Armbruster [Fri, 4 Apr 2025 12:14:10 +0000 (14:14 +0200)] 
qapi/qapi-schema: Update introduction for example notation

The introduction explains example notation.  The series merged in
merge commit e6485190f77e (in 9.1) improved how they look in generated
docs, but neglected to update the introduction accordingly.  Do that
now.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-9-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agodocs/sphinx/qmp_lexer: Highlight elisions like comments, not prompts
Markus Armbruster [Fri, 4 Apr 2025 12:14:09 +0000 (14:14 +0200)] 
docs/sphinx/qmp_lexer: Highlight elisions like comments, not prompts

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-8-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agodocs/sphinx/qmp_lexer: Generalize elision syntax
Markus Armbruster [Fri, 4 Apr 2025 12:14:08 +0000 (14:14 +0200)] 
docs/sphinx/qmp_lexer: Generalize elision syntax

Accept "... lorem ipsum ..."  in addition to "...".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-7-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agodocs/devel/qapi-code-gen: Improve the part on qmp-example directive
Markus Armbruster [Fri, 4 Apr 2025 12:14:07 +0000 (14:14 +0200)] 
docs/devel/qapi-code-gen: Improve the part on qmp-example directive

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-6-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agodocs/interop: Sanitize QMP reference manuals TOC
Markus Armbruster [Fri, 4 Apr 2025 12:14:06 +0000 (14:14 +0200)] 
docs/interop: Sanitize QMP reference manuals TOC

The "QEMU QMP Reference Manual" and the "QEMU Storage Daemon QMP
Reference Manual" start with a table of contents that looks like this:

    Contents

    * Title of the manual
      * Title of first first-level section
        * Title of its first second-level section
        * Title of its second second-level section
        ...
      * Title of second first-level section
      ...

The first level is useless.  Drop it.

While there, delete the option that limits the TOC to depth 3.  Its
actual depth was 3 before the patch, and is now 2.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-5-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agodocs/interop: Delete "QEMU Guest Agent Protocol Reference" TOC
Markus Armbruster [Fri, 4 Apr 2025 12:14:05 +0000 (14:14 +0200)] 
docs/interop: Delete "QEMU Guest Agent Protocol Reference" TOC

The "QEMU Guest Agent Protocol Reference" starts with the following
table of contents:

    Contents

    * QEMU Guest Agent Protocol Reference

      * QEMU guest agent protocol commands and structs

This is useless.  Delete the entire TOC.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-4-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agoqapi/rocker: Tidy up query-rocker-of-dpa-flows example
Markus Armbruster [Fri, 4 Apr 2025 12:14:04 +0000 (14:14 +0200)] 
qapi/rocker: Tidy up query-rocker-of-dpa-flows example

The command can return any number of RockerOfDpaFlow objects.  The
example shows it returning exactly two, with the second object's
members elided.  Tweak it so it elides elements after the first
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-3-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
[Commit message typo fixed]

2 months agodocs/devel/qapi-code-gen: Tidy up whitespace
Markus Armbruster [Fri, 4 Apr 2025 12:14:03 +0000 (14:14 +0200)] 
docs/devel/qapi-code-gen: Tidy up whitespace

Consistently use two spaces to separate sentences.

Put "::" on a line of its own when it's preceded by whitespace.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20250404121413.1743790-2-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2 months agohw/loongarch/virt: Replace destination error with error_abort
Bibo Mao [Mon, 24 Mar 2025 03:01:45 +0000 (11:01 +0800)] 
hw/loongarch/virt: Replace destination error with error_abort

In function virt_cpu_plug() and virt_cpu_unplug(), the error is
impossile. Destination error is not propagated and replaced with
error_abort. With this, the logic is simple.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20250324030145.3037408-3-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
2 months agohw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug()
Bibo Mao [Mon, 24 Mar 2025 03:01:44 +0000 (11:01 +0800)] 
hw/loongarch/virt: Fix cpuslot::cpu set at last in virt_cpu_plug()

In function virt_cpu_plug(), Object cpuslot::cpu is set at last
only when there is no any error, otherwise it is problematic that
cpuslot::cpu is set in advance however it returns because of error.

Fixes: ab9935d2991e (hw/loongarch/virt: Implement cpu plug interface)
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20250324030145.3037408-2-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
2 months agoMerge tag 'pull-riscv-to-apply-20250407-1' of https://github.com/alistair23/qemu...
Stefan Hajnoczi [Mon, 7 Apr 2025 13:18:33 +0000 (09:18 -0400)] 
Merge tag 'pull-riscv-to-apply-20250407-1' of https://github.com/alistair23/qemu into staging

Sixth RISC-V PR for 10.0

* Deprecate the default RISC-V machine

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEaukCtqfKh31tZZKWr3yVEwxTgBMFAmfzXpQACgkQr3yVEwxT
# gBOmaA//cJ9ENSmSfCOagp0yc54YsV12WFZO6g+oGggkur2PhxDSHQk3TspkUed2
# oWMD6U2t0PoYk8mXhNHvYXVFC4HygA5kan1pWVg/1XbrmZPPdYbe1wwXbUjwAy91
# 5fNNqNQtEge4Von8fSbgK7Pc1bDIe1W296muKgfiO8ZQVRmbKQLfSEvdedAzsaPf
# +C/VG0V4thYa8mXyZlLryw2SKpn03wUtrhInHmqkDPjip7J/X7/Bb0lWOSlGGDSG
# ODpvCDDznbPNV21Hwjtbf9EauiorIJVBsnBv/vde5t6ZaRuRpn3ZDfxozPi1yO0o
# uOcypd7v4kZpaJDWxmEUTRvbQls8AOUDoKsBKEbRjQScRyQpwdjynonVDYykVHq3
# 4ByWKDqejxk39g5cvzNMvRqma4MTJnbfmxrwopw1XYVhjDD7jFCq+8duO5+WPyRI
# bTS0qh6B/t4d3loma75InVry2TfycbmP/2rw2yazh8wsg3KQ5LNKb/K+SPgekzQu
# oGxxd0zYClMMS1qumtiZRgAn5F8Ub5ld1xnfANmZtj+QwqjqnwyEMj2ergTBZsJP
# 0rlJWmzl//Mpb5aguMUSyM18Ra/q0j08TjMq3f4Nkcrflk4FGoaN2lguYsFqN3Lc
# VnT8woFGWd2Wl+FUt2aKwCWTW4OsdImxsNY9g1cp7KqNHMs9Z9k=
# =XfZF
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 07 Apr 2025 01:11:48 EDT
# gpg:                using RSA key 6AE902B6A7CA877D6D659296AF7C95130C538013
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [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: 6AE9 02B6 A7CA 877D 6D65  9296 AF7C 9513 0C53 8013

* tag 'pull-riscv-to-apply-20250407-1' of https://github.com/alistair23/qemu:
  docs: deprecate RISC-V default machine option

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agodocs: deprecate RISC-V default machine option
Daniel Henrique Barboza [Fri, 4 Apr 2025 12:28:58 +0000 (09:28 -0300)] 
docs: deprecate RISC-V default machine option

Commit 5b4beba124 ("RISC-V Spike Machines") added the Spike machine and
made it default for qemu-system-riscv32/64. It was the first RISC-V
machine added in QEMU so setting it as default was sensible.

Today we have 7 riscv64 and 6 riscv32 machines and having 'spike' as
default machine is not intuitive. For example, [1] is a bug that was
opened with the 'virt' board in mind, but given that the user didn't
pass a '-machine' option, the user was using 'spike' without knowing.

Being explicit in the command line is desirable when we have a handful
of boards available, so deprecate the default machine setting from
RISC-V.

[1] https://gitlab.com/qemu-project/qemu/-/issues/2467

Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250404122858.241598-1-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 months agoMerge tag 'pull-tcg-20250403' of https://gitlab.com/rth7680/qemu into staging
Stefan Hajnoczi [Fri, 4 Apr 2025 14:23:17 +0000 (10:23 -0400)] 
Merge tag 'pull-tcg-20250403' of https://gitlab.com/rth7680/qemu into staging

tcg: Allocate TEMP_VAL_MEM frame in temp_load()
tests/functional: Skip aarch64_replay test on macOS
hw/arm: Do not build VMapple machine by default
tests/functional/test_aarch64_rme_virt: fix sporadic failure

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmfvMOsdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV+wYQf+Kfd4x/v5oZW9QAwH
# +FItVtYIJ2Mfp7BilNmSY9jmHcO46RQ8pkJv/CltlZHFCe7s8+qJKpPhQCfUMhUH
# DW5SIWXZw+bOIxDycm1XssnQDyJODzwLFi1VmWL1gmoEXhgYea0owxFBPAzBOtrj
# 1viHQOhr2iymsukD5KACajtrwYDzc2g6xZwCx1SLsFO1bolVLlcKgBsolItM+/sO
# 5IkCkEHgkZ7bADFig2Qm797H5cTVuqn00JGwU2cfYAMxMqNi0G0bv1C1OMHwShdg
# R8lfnxk8lHv58GtJcPgP50ByRTotW5HXSQN9DujWiJjLXfW9AYqOeuXFPbaLLxaG
# gwkqlA==
# =WbPO
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 03 Apr 2025 21:07:55 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-tcg-20250403' of https://gitlab.com/rth7680/qemu:
  hw/arm: Do not build VMapple machine by default
  tests/qtest: Skip Aarch64 VMapple machine
  tests/functional: Skip aarch64_replay test on macOS
  tests/functional: Add a decorator for skipping tests on particular OS
  tests/functional/test_aarch64_rme_virt: fix sporadic failure
  tcg: Allocate TEMP_VAL_MEM frame in temp_load()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'pull-nbd-2025-04-03' of https://repo.or.cz/qemu/ericb into staging
Stefan Hajnoczi [Fri, 4 Apr 2025 14:23:12 +0000 (10:23 -0400)] 
Merge tag 'pull-nbd-2025-04-03' of https://repo.or.cz/qemu/ericb into staging

NBD patches for 2025-04-03

- revert iotest 162 workaround, now that qemu-nbd bug is fixed

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAmfvCUAACgkQp6FrSiUn
# Q2rQTgf8CRTvRe1lRBheUnC8nP8cqwZJSEXZjU/U82R2ZYYvKbreY5HHbn8EeaUr
# 7CeJW0lnitw3KLXAjUOQnXjjW89lh9adKIcReDnO014AW1zW3a6J0KgCLQxRBja5
# k4h1SQFMyaZJAwPNcYMR9+bYfCGotMxITUeKopPOy3LI5HqKW+sLzt8OGGXvJy06
# 4w/KmaFlYH5Z9CoGISjGhXBN0l6K+BAcU7nEOcl1nByceW3Dy2od3dci4bko4B8X
# qGr+om5Md4zK2335iZ+nVooFn/4Rh4oLKm5DeF4pVBl9tqKd+S+TeleOGP4SDlt+
# PwTab1pAFyx9f/vPE1mrwhfXO1t+eA==
# =Cyv0
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 03 Apr 2025 18:18:40 EDT
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* tag 'pull-nbd-2025-04-03' of https://repo.or.cz/qemu/ericb:
  Revert "iotests: Stop NBD server in test 162 before starting the next one"

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into...
Stefan Hajnoczi [Fri, 4 Apr 2025 14:23:04 +0000 (10:23 -0400)] 
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging

virtio,pc: fixes

A couple of fixes for 10.0.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmfu+r0PHG1zdEByZWRo
# YXQuY29tAAoJECgfDbjSjVRp/3IH+gNzJadzc1O6xHClVsJeVY0HOfDYgPtdKxWZ
# bu4JQXtrvF3avP9Mp1r2wInnEX1Pdjy36i7RaVsq8TB9Mdn6F6uiSSqu14Pn/Od6
# NNDXJgy+vFixKrGryESuI9Wp2XR2Haiwnj51qvswlQKNqx6arHVGWpUvKTvlb+8I
# +Yu2GmFTEMHl+TuQ/qDEJLSvek704zyrFBRx7WzmvLfJjSFUpZUe26J0X7YdpqKh
# 9o+tjb46W3bPgSa+fTFboD60pKsc+NOmFkpsC1romeNlXX0iyDupRN8+LumzDrhx
# zrs8RQ0TAQ4nceAHmcvDxenGF9/Uzl3zs0D80Q/JPLkovCGpo5c=
# =S0jX
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 03 Apr 2025 17:16:45 EDT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu:
  hw/i386/amd_iommu: Assign pci-id 0x1419 for the AMD IOMMU device
  virtio-net: Fix num_buffers for version 1

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'migration-20250401-pull-request' of https://gitlab.com/farosas/qemu into...
Stefan Hajnoczi [Fri, 4 Apr 2025 14:22:52 +0000 (10:22 -0400)] 
Merge tag 'migration-20250401-pull-request' of https://gitlab.com/farosas/qemu into staging

Migration pull request

Fix QIOChannelBlock's seek routine

# -----BEGIN PGP SIGNATURE-----
#
# iQJEBAABCAAuFiEEqhtIsKIjJqWkw2TPx5jcdBvsMZ0FAmfsQ0sQHGZhcm9zYXNA
# c3VzZS5kZQAKCRDHmNx0G+wxndsTD/4nKaz3aNQH/0sxQtdkvWi53NSs5LQsjzps
# rS1+FrU1D/gbqmI1yVKLEao51JMiu3VuyFFddpDKqKwQDtHFBNL5GwvHWtrOujvV
# jpLHPJNQCeB5X7OPNOEllRcVDUzgEDrmwkDAwKF8+VEIlKIh7ZFZ8bHfOUO3Rxd+
# bXHybQEFV2/O7YckdbctswVNCId/vZkwkOQrJWUP0hCLl6ECThnz6acqu2fJ7A7E
# OK2TdruAfSXFNF0cpbehnALeaZrhqQDdM++ztbmhC0V5KBhdvydIZcCGQaqjm0t5
# NQdaJ2U6YE4QHXefN+yml9sXPIyMq7W7hAHMnbCH51UnTOAN8jmszpfR5L3S1XMX
# 8qJ30lk1Mch2xNKXbi8AeKI0wvAJ7ipUYmhbtbcAo7nZFAVPuJ7U3mr0/5sgC1TJ
# X8pNfateIY665CaP+BpCWVHnAoe7YZ9m6Y0WhgwWRH0O8fTIUUKe0AecNOjicYhU
# OdVrdkMHuBiQGnwfyHVo6K6p/BvO9O6Di2ekL4Fnnlw+LPL/58CPNZKVa/LTDJVv
# SDLL3b8S6qGecGlV4WWigECDQhYKDC2S9C0qdd6U2a+r5GTxdIb53ZXVdmSJ0vBu
# goQSZ/zCAaSPlzAVcoDiP6iPOqTpwyIr1ya7zfn3+V9HW+rilK0AdjnPDs5iigzi
# SVlCMxGyeg==
# =O0UE
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 01 Apr 2025 15:49:31 EDT
# gpg:                using RSA key AA1B48B0A22326A5A4C364CFC798DC741BEC319D
# gpg:                issuer "farosas@suse.de"
# gpg: Good signature from "Fabiano Rosas <farosas@suse.de>" [unknown]
# gpg:                 aka "Fabiano Almeida Rosas <fabiano.rosas@suse.com>" [unknown]
# gpg: WARNING: The key's User ID is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: AA1B 48B0 A223 26A5 A4C3  64CF C798 DC74 1BEC 319D

* tag 'migration-20250401-pull-request' of https://gitlab.com/farosas/qemu:
  migration: fix SEEK_CUR offset calculation in qio_channel_block_seek

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agohw/arm: Do not build VMapple machine by default
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 20:32:41 +0000 (22:32 +0200)] 
hw/arm: Do not build VMapple machine by default

Unfortunately as of v10.0.0-rc2 the VMapple machine is unusable:

  $ qemu-system-aarch64 -M vmapple [...]
  *** Terminating app due to uncaught exception 'NSInvalidArgumentException',
      reason: '-[PGIOSurfaceHostDeviceDescriptor setMapMemory:]: unrecognized selector sent to instance 0x600001ede820'
  *** First throw call stack:
  (
    0   CoreFoundation          0x000000019c759df0 __exceptionPreprocess + 176
    1   libobjc.A.dylib         0x000000019c21eb60 objc_exception_throw + 88
    2   CoreFoundation          0x000000019c816ce0 -[NSObject(NSObject) __retain_OA] + 0
    3   CoreFoundation          0x000000019c6c7efc ___forwarding___ + 1500
    4   CoreFoundation          0x000000019c6c7860 _CF_forwarding_prep_0 + 96
    5   qemu-system-aarch64     0x000000010486dbd0 apple_gfx_mmio_realize + 200
    6   qemu-system-aarch64     0x0000000104e6ab5c device_set_realized + 352
    7   qemu-system-aarch64     0x0000000104e7250c property_set_bool + 100
    8   qemu-system-aarch64     0x0000000104e7023c object_property_set + 136
    9   qemu-system-aarch64     0x0000000104e74870 object_property_set_qobject + 60
    10  qemu-system-aarch64     0x0000000104e70748 object_property_set_bool + 60
    11  qemu-system-aarch64     0x0000000104e69bd8 qdev_realize_and_unref + 20
    12  qemu-system-aarch64     0x0000000104e258e0 mach_vmapple_init + 1728
    13  qemu-system-aarch64     0x000000010481b0ac machine_run_board_init + 1892
    14  qemu-system-aarch64     0x0000000104a4def8 qmp_x_exit_preconfig + 260
    15  qemu-system-aarch64     0x0000000104a51ba8 qemu_init + 14460
    16  qemu-system-aarch64     0x0000000104f7cef8 main + 36
    17  dyld                    0x000000019c25eb4c start + 6000
  )
  libc++abi: terminating due to uncaught exception of type NSException
  Abort trap: 6

Disable the machine so it isn't built by default.

This is tracked as https://gitlab.com/qemu-project/qemu/-/issues/2913

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250403203241.46692-6-philmd@linaro.org>

2 months agotests/qtest: Skip Aarch64 VMapple machine
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 20:32:40 +0000 (22:32 +0200)] 
tests/qtest: Skip Aarch64 VMapple machine

First, the VMapple machine only works with the ARM 'host' CPU
type, which isn't accepted for QTest:

  $ qemu-system-aarch64 -M vmapple -accel qtest
  qemu-system-aarch64: The 'host' CPU type can only be used with KVM or HVF

Second, the QTest framework expects machines to be createable
without specifying optional arguments, however the VMapple
machine requires few of them:

  $ qemu-system-aarch64 -M vmapple -accel qtest
  qemu-system-aarch64: No firmware specified

  $ qemu-system-aarch64 -M vmapple -accel qtest -bios /dev/null
  qemu-system-aarch64: No AUX device. Please specify one as pflash drive.

Restrict this machine with QTest so we can at least run check-qtest,
otherwise we get:

  $ make check-qtest-aarch64
  qemu-system-aarch64: The 'host' CPU type can only be used with KVM or HVF
  Broken pipe
  ../tests/qtest/libqtest.c:199: kill_qemu() tried to terminate QEMU process but encountered exit status 1 (expected 0)
  ...
   7/26 qemu:qtest+qtest-aarch64 / qtest-aarch64/test-hmp     ERROR      24.71s   killed by signal 6 SIGABRT
   2/26 qemu:qtest+qtest-aarch64 / qtest-aarch64/qom-test     ERROR      71.23s   killed by signal 6 SIGABRT

Suggested-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250403203241.46692-5-philmd@linaro.org>

2 months agotests/functional: Skip aarch64_replay test on macOS
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 20:32:39 +0000 (22:32 +0200)] 
tests/functional: Skip aarch64_replay test on macOS

As of v10.0.0-rc2 this test is still failing on macos:

  $ make check-functional-aarch64 V=1
  ...
  ERROR:../../replay/replay-internal.c:235:replay_mutex_unlock: assertion failed: (replay_mutex_locked())
  Bail out! ERROR:../../replay/replay-internal.c:235:replay_mutex_unlock: assertion failed: (replay_mutex_locked())

This is tracked as https://gitlab.com/qemu-project/qemu/-/issues/2907

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250403203241.46692-4-philmd@linaro.org>

2 months agotests/functional: Add a decorator for skipping tests on particular OS
Philippe Mathieu-Daudé [Thu, 3 Apr 2025 20:32:38 +0000 (22:32 +0200)] 
tests/functional: Add a decorator for skipping tests on particular OS

Since tests might be failing on some operating systems,
introduce the skipIfOperatingSystem() decorator.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250403203241.46692-3-philmd@linaro.org>

2 months agotests/functional/test_aarch64_rme_virt: fix sporadic failure
Pierrick Bouvier [Thu, 3 Apr 2025 20:32:37 +0000 (22:32 +0200)] 
tests/functional/test_aarch64_rme_virt: fix sporadic failure

This test was randomly failing on our CI, and on dev machines,
especially with QEMU debug builds.

>From the information collected, it's related to an implementation choice
in edk2 QEMU virt support. The workaround is to disable KASLR, to avoid
accessing protected memory.
Note: this is *not* needed for the similar test_aarch64_rme_sbsaref.

More information is available on the associated GitLab issue.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2823
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250328183816.2687925-1-pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250403203241.46692-2-philmd@linaro.org>

2 months agotcg: Allocate TEMP_VAL_MEM frame in temp_load()
Philippe Mathieu-Daudé [Tue, 1 Apr 2025 14:43:32 +0000 (16:43 +0200)] 
tcg: Allocate TEMP_VAL_MEM frame in temp_load()

Be sure to allocate the temp frame if it wasn't.

In the resolved issues, incomplete dead code elimination left a load
at the top of an unreachable loop.  We simply need to allocate the
stack slot to avoid crashing.

Fixes: c896fe29d6c ("TCG code generator")
Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Reported-by: Helge Konetzka <hk@zapateado.de>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2891
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2899
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20250401144332.41615-1-philmd@linaro.org>

2 months agoRevert "iotests: Stop NBD server in test 162 before starting the next one"
Thomas Huth [Wed, 26 Mar 2025 14:35:33 +0000 (15:35 +0100)] 
Revert "iotests: Stop NBD server in test 162 before starting the next one"

This reverts commit e2668ba1ed44ad56f2f1653ff5f53b277d534fac.

This commit made test 162 fail occasionally with:

 162   fail      [13:06:40] [13:06:40]   0.2s   (last: 0.2s)  output mismatch
 --- tests/qemu-iotests/162.out
 +++ tests/qemu-iotests/scratch/qcow2-file-162/162.out.bad
 @@ -3,6 +3,7 @@
  === NBD ===
  qemu-img: Could not open 'json:{"driver": "nbd", "host": -1}': address
   resolution failed for -1:10809: Name or service not known
  image: nbd://localhost:PORT
 +./common.rc: line 371: kill: (891116) - No such process
  image: nbd+unix://?socket=42

The nbd server should normally terminate automatically, so trying to
kill it here now seems to cause a race that will cause a test failure
when the server terminated before the kill command has been executed.

The "Stop NBD server" patch has originally been written to solve another
problem with a hanging nbd server, but since that problem has been properly
solved by commit 3e1683485656, we now don't need the "_stop_nbd_server" here
anymore.

Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250326143533.932899-1-thuth@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2 months agohw/i386/amd_iommu: Assign pci-id 0x1419 for the AMD IOMMU device
Suravee Suthikulpanit [Tue, 25 Mar 2025 02:11:40 +0000 (02:11 +0000)] 
hw/i386/amd_iommu: Assign pci-id 0x1419 for the AMD IOMMU device

Currently, the QEMU-emulated AMD IOMMU device use PCI vendor id 0x1022
(AMD) with device id zero (undefined). Eventhough this does not cause any
functional issue for AMD IOMMU driver since it normally uses information
in the ACPI IVRS table to probe and initialize the device per
recommendation in the AMD IOMMU specification, the device id zero causes
the Windows Device Manager utility to show the device as an unknown device.

Since Windows only recognizes AMD IOMMU device with device id 0x1419 as
listed in the machine.inf file, modify the QEMU AMD IOMMU model to use
the id 0x1419 to avoid the issue. This advertise the IOMMU as the AMD
IOMMU device for Family 15h (Models 10h-1fh).

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Message-Id: <20250325021140.5676-1-suravee.suthikulpanit@amd.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 months agovirtio-net: Fix num_buffers for version 1
Akihiko Odaki [Wed, 8 Jan 2025 12:13:29 +0000 (21:13 +0900)] 
virtio-net: Fix num_buffers for version 1

The specification says the device MUST set num_buffers to 1 if
VIRTIO_NET_F_MRG_RXBUF has not been negotiated.

Fixes: df91055db5c9 ("virtio-net: enable virtio 1.0")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20250108-buffers-v1-1-a0c85ff31aeb@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 months agoUpdate version for v10.0.0-rc2 release v10.0.0-rc2
Stefan Hajnoczi [Tue, 1 Apr 2025 17:15:45 +0000 (13:15 -0400)] 
Update version for v10.0.0-rc2 release

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'pull-aspeed-20250401' of https://github.com/legoater/qemu into staging
Stefan Hajnoczi [Tue, 1 Apr 2025 13:25:25 +0000 (09:25 -0400)] 
Merge tag 'pull-aspeed-20250401' of https://github.com/legoater/qemu into staging

aspeed queue:

* Fixed SCU access size on AST2500 and AST2600 SoCs

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmfr2DsACgkQUaNDx8/7
# 7KHlHg/8D5/maW8yAfQjUBfvy2+tzpV1SvBTKxSvv5n9tP3CFDSgNjFXfDnt06qK
# xNE4YzK5I7wWQ20OKXB1LfqHqaJJXT7G1Qc44ZbmfHdiISMuaZaWDjQyzXO/TDSH
# e8Svb3iV4IA2J2B6dsbPOym6XMFL9awhXurhYTxfnl9oFhkvgaP1H6Ur0/m8peOq
# HELkY18nyWbpeZyIArEagXtBb1n1ucn51dwaDLq9F+D5vXAe6NN8Am5RG/gEED6X
# P/o6/VphxR/EmijbIrixHUWmORnuXV4KI13xdLb3hyjIOtgjFPENQuUJTczwkK/8
# mpdTOj+m8ovGMuFGmvnGy6uyYRmXQarBOSSR19XPlMF1qlO7rUUzYPTl7M8M45C5
# UuU9Q60KNSiCHdQqimdZwy/IoI8nuEHMT6g2/Vd82OUJ6K/uR3V0dVel7LVEOvVj
# 1xXtNOL8Xy5W0Z84nPLOjpD1WU8Khl8m6OZR81RWR9jTj61dX9AfggkJXSzU6G0Z
# Yhv6shqYRn+LpAN/cjqUP6hR1C0iBCi+lBNG6wKq3DVCDXPCg8yEW9D+NUwVj64z
# 6BMF335RP3phkmpFMniJ83Ad4yxOmKubQcIIXjLvEiAdppxvDCjQBgYkKHRXkJV0
# wVYnfDwB2quDA1oS3tLibvRf366NjhPfJhMx+yiL4RgFUQ/BvfI=
# =VRwA
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 01 Apr 2025 08:12:43 EDT
# gpg:                using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1
# gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [full]
# gpg:                 aka "Cédric Le Goater <clg@kaod.org>" [full]
# Primary key fingerprint: A0F6 6548 F048 95EB FE6B  0B60 51A3 43C7 CFFB ECA1

* tag 'pull-aspeed-20250401' of https://github.com/legoater/qemu:
  hw/misc/aspeed_scu: Correct minimum access size for AST2500 / AST2600
  hw/misc/aspeed_scu: Set MemoryRegionOps::impl::access_size to 32-bit

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agoMerge tag 'hw-misc-20250331' of https://github.com/philmd/qemu into staging
Stefan Hajnoczi [Tue, 1 Apr 2025 13:25:14 +0000 (09:25 -0400)] 
Merge tag 'hw-misc-20250331' of https://github.com/philmd/qemu into staging

Misc HW patches

- Expose v7M System Control Space as little endian (Philippe)
- Deprecate MipsSim machine (Thomas)
- Improve some devices categories / descriptions (Philippe)
- Correct memory_rw_debug() prototype (Richard)
- Do not expose i.MX 8M SoC as user-creatable (Bernhard)
- Do not expose some PLL & eFuse devices as user-creatable (Philippe)
- Do not reset Goldfish RTC time on machine reset (Heinrich)
- Fix incorrect BCM2835 AUX interrupt ID when RX disabled (Chung-Yi)
- Fix DesignWare PCI host bridge ATU_UPPER_TARGET register access (Philippe)
- Memory leak fixes (Bernhard & Zheng Huang)
- Prevent out-of-bound access in avr_print_insn (Richard)
- Fixes around MIPS page mask (Richard)

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmfq8VYACgkQ4+MsLN6t
# wN4AvhAAyTWwGhLfelpPgfj6JHCNiUFUjp4R5a3Y2ROJ19UQ8pcK0RlE5jFNzA6G
# sUmy6cl4XK3ojT5EJ/FyVMlLniw9hWmOiIgHHLU+h2Ji+oCS3S2N2T2hFCs4vbT+
# SNjhN1RIdrlWnoSJZiiKM4njKcJxwvg0MCmvOgV70Njy+sVB9zu7YdA0i8yryXOy
# a0PDMS71hckF2HBizYrhYAhxPISK3oVoeLRUeGGQhZBUMmu+oZoEWp0DjeuMPoQv
# pUX0G7LAqNWCyhIXHEUYGAtSZJc08wEmoypbj1s9PDO5q6NEruCwiWyNHTBXzPsS
# ingMM66o2xPCk8BnWSRvpocTgi2QYI/nk+S9L5Gr+FWMGmCbiFAX6c7OH6t4jqz2
# HwqKDZ1FJzBnquT/5ABR5won0cvjsTGhr76oxEyeM3xrGKyysmrBXWYYXjnaidlc
# uzr4hc6UT6bYlN53SG1dZP6/aWWcK57MaqrJnjOmLi+VEUEC8p9iOjN+ED7QicBj
# Wc1TPMeE8TK7EVJoeor1PAyLHWE+oGDOb8Rcyauxge9cPcqZPWYeSp3HpwhLJb+K
# XbwFoSsQRCXT4acL70hkHyjfXtM1qu+g7dWFvEGPlqfuQMvfk4fOfwKbJVxb8UvO
# OO96TUPnhpxiC6gYxMRJ9ZwIbzyZ9+SG3loW1OVSmx3Ndth2mh8=
# =O3jG
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 31 Mar 2025 15:47:34 EDT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* tag 'hw-misc-20250331' of https://github.com/philmd/qemu: (23 commits)
  target/mips: Simplify and fix update_pagemask
  target/mips: Require even maskbits in update_pagemask
  target/mips: Revert TARGET_PAGE_BITS_VARY
  target/sparc: Log unimplemented ASI load/store accesses
  target/avr: Fix buffer read in avr_print_insn
  target/hppa: Remove duplicated CPU_RESOLVING_TYPE definition
  hw/pci-host/designware: Fix ATU_UPPER_TARGET register access
  hw/ufs: free irq on exit
  hw/char/bcm2835_aux: Fix incorrect interrupt ID when RX disabled
  hw/sd/sdhci: free irq on exit
  hw/scsi/lsi53c895a: fix memory leak in lsi_scsi_realize()
  hw/nvram/xlnx-efuse: Do not expose as user-creatable
  hw/misc/pll: Do not expose as user-creatable
  hw/rtc/goldfish: keep time offset when resetting
  hw/mips: Mark the "mipssim" machine as deprecated
  hw/dma/i82374: Categorize and add description
  hw/display/dm163: Add description
  hw/block/m25p80: Categorize and add description
  hw/core/cpu: Use size_t for memory_rw_debug len argument
  hw/arm/fsl-imx8mp: Remove unused define
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2 months agohw/misc/aspeed_scu: Correct minimum access size for AST2500 / AST2600
Joel Stanley [Mon, 31 Mar 2025 23:04:44 +0000 (01:04 +0200)] 
hw/misc/aspeed_scu: Correct minimum access size for AST2500 / AST2600

Guest code was performing a byte load to the SCU MMIO region, leading
to the guest code crashing (it should be using proper accessors, but
that is not Qemu's bug). Hardware and the documentation[1] both agree
that byte loads are okay, so change all of the aspeed SCU devices to
accept a minimum access size of 1.

[1] See the 'ARM Address Space Mapping' table in the ASPEED docs. This
is section 6.1 in the ast2400 and ast2700, and 7.1 in the ast2500 and
ast2600 datasheets.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2636
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Troy Lee <leetroy@gmail.com>
Message-ID: <20241118021820.4928-1-joel@jms.id.au>
[PMD: Rebased, only including SCU changes]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://lore.kernel.org/qemu-devel/20250331230444.88295-3-philmd@linaro.org
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 months agohw/misc/aspeed_scu: Set MemoryRegionOps::impl::access_size to 32-bit
Philippe Mathieu-Daudé [Mon, 31 Mar 2025 23:04:43 +0000 (01:04 +0200)] 
hw/misc/aspeed_scu: Set MemoryRegionOps::impl::access_size to 32-bit

All MemoryRegionOps::read/write() handlers switch over a 32-bit
aligned value, because converted using TO_REG(), which is defined
as:

  #define TO_REG(offset) ((offset) >> 2)

So all implementations are 32-bit.
Set min/max access_size accordingly.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://lore.kernel.org/qemu-devel/20250331230444.88295-2-philmd@linaro.org
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2 months agotarget/mips: Simplify and fix update_pagemask
Richard Henderson [Fri, 28 Mar 2025 17:55:26 +0000 (12:55 -0500)] 
target/mips: Simplify and fix update_pagemask

When update_pagemask was split from helper_mtc0_pagemask,
we failed to actually write to the new parameter but continue
to write to env->CP0_PageMask.  Thus the use within
page_table_walk_refill modifies cpu state and not the local
variable as expected.

Simplify by renaming to compute_pagemask and returning the
value directly.  No need for either env or pointer return.

Fixes: 074cfcb4dae ("target/mips: Implement hardware page table walker for MIPS32")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250328175526.368121-4-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: qemu-stable@nongnu.org
2 months agotarget/mips: Require even maskbits in update_pagemask
Richard Henderson [Fri, 28 Mar 2025 17:55:25 +0000 (12:55 -0500)] 
target/mips: Require even maskbits in update_pagemask

The number of bits set in PageMask must be even.

Fixes: d40b55bc1b86 ("target/mips: Fix PageMask with variable page size")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250328175526.368121-3-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: qemu-stable@nongnu.org
2 months agotarget/mips: Revert TARGET_PAGE_BITS_VARY
Richard Henderson [Fri, 28 Mar 2025 17:55:24 +0000 (12:55 -0500)] 
target/mips: Revert TARGET_PAGE_BITS_VARY

Revert ee3863b9d41 and a08d60bc6c2b.  The logic behind changing
the system page size because of what the Loongson kernel "prefers"
is flawed.

In the Loongson-2E manual, section 5.5, it is clear that the cpu
supports a 4k page size (along with many others).  Similarly for
the Loongson-3 series CPUs, the 4k page size is mentioned in the
section 7.7 (PageMask Register).  Therefore we must continue to
support a 4k page size.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250328175526.368121-2-richard.henderson@linaro.org>
[PMD: Mention Loongson-3 series CPUs]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agotarget/sparc: Log unimplemented ASI load/store accesses
Philippe Mathieu-Daudé [Tue, 25 Mar 2025 12:10:33 +0000 (13:10 +0100)] 
target/sparc: Log unimplemented ASI load/store accesses

When the cache-controller feature is not implemented,
log potential ASI access as unimplemented.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Clément Chigot <chigot@adacore.com>
Message-Id: <20250325123927.74939-4-philmd@linaro.org>

2 months agotarget/avr: Fix buffer read in avr_print_insn
Richard Henderson [Sun, 23 Mar 2025 01:43:36 +0000 (18:43 -0700)] 
target/avr: Fix buffer read in avr_print_insn

Do not unconditionally attempt to read 4 bytes, as there
may only be 2 bytes remaining in the translator cache.

Cc: qemu-stable@nongnu.org
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250325224403.4011975-2-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agotarget/hppa: Remove duplicated CPU_RESOLVING_TYPE definition
Philippe Mathieu-Daudé [Fri, 21 Mar 2025 10:24:35 +0000 (11:24 +0100)] 
target/hppa: Remove duplicated CPU_RESOLVING_TYPE definition

The CPU_RESOLVING_TYPE definition was added in commit
0dacec874fa ("cpu: add CPU_RESOLVING_TYPE macro"), but
then added again in commit d3ae32d4d20. Remove the
duplication.

Fixes: d3ae32d4d20 ("target/hppa: Implement cpu_list")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250321184200.4329-1-philmd@linaro.org>

2 months agohw/pci-host/designware: Fix ATU_UPPER_TARGET register access
Philippe Mathieu-Daudé [Mon, 31 Mar 2025 14:46:13 +0000 (16:46 +0200)] 
hw/pci-host/designware: Fix ATU_UPPER_TARGET register access

Fix copy/paste error writing to the ATU_UPPER_TARGET
register, we want to update the upper 32 bits.

Cc: qemu-stable@nongnu.org
Reported-by: Joey <jeundery@gmail.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2861
Fixes: d64e5eabc4c ("pci: Add support for Designware IP block")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gustavo Romero <gustavo.romero@linaro.org>
Message-Id: <20250331152041.74533-2-philmd@linaro.org>

2 months agohw/ufs: free irq on exit
Zheng Huang [Sat, 29 Mar 2025 11:47:19 +0000 (19:47 +0800)] 
hw/ufs: free irq on exit

Fix a memory leak bug in ufs_init_pci() due to u->irq
not being freed in ufs_exit().

Signed-off-by: Zheng Huang <hz1624917200@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <43ceb427-87aa-44ee-9007-dbaecc499bba@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/char/bcm2835_aux: Fix incorrect interrupt ID when RX disabled
Chung-Yi Chen [Fri, 28 Mar 2025 12:37:25 +0000 (20:37 +0800)] 
hw/char/bcm2835_aux: Fix incorrect interrupt ID when RX disabled

Fix a misconfiguration issue in the read implementation of the
AUX_MU_IIR_REG register. This issue can lead to a transmit interrupt
being incorrectly interpreted as a receive interrupt when the receive
interrupt is disabled and the receive FIFO holds valid bytes.

The AUX_MU_IIR_REG register (interrupt ID bits [2:1]) indicates the
status of mini UART interrupts:

    - 00: No interrupts
    - 01: Transmit FIFO is empty
    - 10: Receive FIFO is not empty
    - 11: <Not possible>

When the transmit interrupt is enabled and the receive interrupt is
disabled, the original code incorrectly sets the interrupt ID bits.
Specifically:

    1. Transmit FIFO empty, receive FIFO empty
        - Expected 0b01, returned 0b01 (correct)
    2. Transmit FIFO empty, receive FIFO not empty
        - Expected 0b01, returned 0b10 (incorrect)

In the second case, the code sets the interrupt ID to 0b10 (receive FIFO
is not empty) even if the receive interrupt is disabled.

To fix this, the patch adds additional condition for setting the
interrupt ID bits to also check if the receive interrupt is enabled.

Reference: BCM2835 ARM Peripherals, page 13. Available on
https://datasheets.raspberrypi.com/bcm2835/bcm2835-peripherals.pdf

Fixes: 97398d900ca ("bcm2835_aux: add emulation of BCM2835 AUX (aka UART1) block")
Signed-off-by: Chung-Yi Chen <yeechen0207@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250328123725.94176-1-yeechen0207@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/sd/sdhci: free irq on exit
Zheng Huang [Fri, 28 Mar 2025 09:49:35 +0000 (17:49 +0800)] 
hw/sd/sdhci: free irq on exit

Fix a memory leak bug in sdhci_pci_realize() due to s->irq
not being freed in sdhci_pci_exit().

Signed-off-by: Zheng Huang <hz1624917200@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <09ddf42b-a6db-42d5-954b-148d09d8d6cc@gmail.com>
[PMD: Moved qemu_free_irq() call before sdhci_common_unrealize()]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/scsi/lsi53c895a: fix memory leak in lsi_scsi_realize()
Zheng Huang [Fri, 28 Mar 2025 03:21:49 +0000 (11:21 +0800)] 
hw/scsi/lsi53c895a: fix memory leak in lsi_scsi_realize()

Address a memory leak bug in the usages of timer_del().

The issue arises from the incorrect use of the ambiguous timer API
timer_del(), which does not free the timer object. The LeakSanitizer
report this issue during fuzzing. The correct API timer_free() freed
the timer object instead.

=================================================================
==2586273==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x55f2afd89879 in calloc /llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:75:3
    #1 0x7f443b93ac50 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x5ec50)
    #2 0x55f2b053962e in timer_new include/qemu/timer.h:542:12
    #3 0x55f2b0514771 in timer_new_us include/qemu/timer.h:582:12
    #4 0x55f2b0514288 in lsi_scsi_realize hw/scsi/lsi53c895a.c:2350:24
    #5 0x55f2b0452d26 in pci_qdev_realize hw/pci/pci.c:2174:9

Signed-off-by: Zheng Huang <hz1624917200@outlook.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <73cd69f9-ff9b-4cd4-b8aa-265f9d6067b9@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2 months agohw/nvram/xlnx-efuse: Do not expose as user-creatable
Philippe Mathieu-Daudé [Tue, 25 Mar 2025 22:21:28 +0000 (23:21 +0100)] 
hw/nvram/xlnx-efuse: Do not expose as user-creatable

This device is part of SoC components thus can not
be created manually.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250325224310.8785-10-philmd@linaro.org>

2 months agohw/misc/pll: Do not expose as user-creatable
Philippe Mathieu-Daudé [Tue, 25 Mar 2025 22:21:17 +0000 (23:21 +0100)] 
hw/misc/pll: Do not expose as user-creatable

All these devices are part of SoC components and can not
be created manually.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20250325224310.8785-9-philmd@linaro.org>