]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
5 weeks agoi386/tdx: Fix the typo of the comment of struct TdxGuest
Xiaoyao Li [Tue, 3 Jun 2025 05:03:04 +0000 (01:03 -0400)] 
i386/tdx: Fix the typo of the comment of struct TdxGuest

Change sha348 to sha384.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Link: https://lore.kernel.org/r/20250603050305.1704586-3-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agoi386/cpu: Rename enable_cpuid_0x1f to force_cpuid_0x1f
Xiaoyao Li [Tue, 3 Jun 2025 05:03:03 +0000 (01:03 -0400)] 
i386/cpu: Rename enable_cpuid_0x1f to force_cpuid_0x1f

The name of "enable_cpuid_0x1f" isn't right to its behavior because the
leaf 0x1f can be enabled even when "enable_cpuid_0x1f" is false.

Rename it to "force_cpuid_0x1f" to better reflect its behavior.

Suggested-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Link: https://lore.kernel.org/r/20250603050305.1704586-2-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agoi386/tdx: Error and exit when named cpu model is requested
Xiaoyao Li [Thu, 12 Jun 2025 13:38:01 +0000 (09:38 -0400)] 
i386/tdx: Error and exit when named cpu model is requested

Currently, it gets below error when requesting any named cpu model with
"-cpu" to boot a TDX VM:

  qemu-system-x86_64: KVM_TDX_INIT_VM failed: Invalid argument

It misleads people to think it's the bug of KVM or QEMU. It is just that
current QEMU doesn't support named cpu model for TDX.

To support named cpu models for TDX guest, there are opens to be
finalized and needs a mount of additional work.

For now, explicitly check the case when named cpu model is requested.
Error report a hint and exit.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20250612133801.2238342-1-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agoi386/cpu: Warn about why CPUID_EXT_PDCM is not available
Xiaoyao Li [Tue, 4 Mar 2025 05:24:50 +0000 (00:24 -0500)] 
i386/cpu: Warn about why CPUID_EXT_PDCM is not available

When user requests PDCM explicitly via "+pdcm" without PMU enabled, emit
a warning to inform the user.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250304052450.465445-3-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agoi386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check
Xiaoyao Li [Tue, 4 Mar 2025 05:24:49 +0000 (00:24 -0500)] 
i386/cpu: Move adjustment of CPUID_EXT_PDCM before feature_dependencies[] check

There is one entry relates to CPUID_EXT_PDCM in feature_dependencies[].
So it needs to get correct value of CPUID_EXT_PDCM before using
feature_dependencies[] to apply dependencies.

Besides, it also ensures CPUID_EXT_PDCM value is tracked in
env->features[FEAT_1_ECX].

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250304052450.465445-2-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agorust: hpet: fix new warning
Paolo Bonzini [Mon, 16 Jun 2025 16:56:49 +0000 (18:56 +0200)] 
rust: hpet: fix new warning

Nightly rustc complains that HPETAddrDecode has a lifetime but it is not
clearly noted that it comes from &self.  Apply the compiler's suggestion
to shut it up.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agorust: pl011: Add missing logging to match C version
Bernhard Beschow [Sun, 15 Jun 2025 11:20:36 +0000 (13:20 +0200)] 
rust: pl011: Add missing logging to match C version

Co-developed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20250615112037.11992-4-shentey@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agorust: pl011: Implement logging
Bernhard Beschow [Sun, 15 Jun 2025 11:20:35 +0000 (13:20 +0200)] 
rust: pl011: Implement logging

Now that there is logging support in Rust for QEMU, use it in the pl011
device.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20250615112037.11992-3-shentey@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agorust/qemu-api: Add initial logging support based on C API
Bernhard Beschow [Sun, 15 Jun 2025 11:20:34 +0000 (13:20 +0200)] 
rust/qemu-api: Add initial logging support based on C API

A log_mask_ln!() macro is provided which expects similar arguments as the
C version. However, the formatting works as one would expect from Rust.

To maximize code reuse the macro is just a thin wrapper around
qemu_log(). Also, just the bare minimum of logging masks is provided
which should suffice for the current use case of Rust in QEMU.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20250615112037.11992-2-shentey@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agorust: move rust.bindgen to qemu-api crate
Paolo Bonzini [Fri, 13 Jun 2025 12:49:27 +0000 (14:49 +0200)] 
rust: move rust.bindgen to qemu-api crate

Once qemu-api is split in multiple crates, each of them will have
its own invocation of bindgen.  There cannot be only one, because
there are occasional "impl" blocks for the bindgen-generated
structs (e.g. VMStateFlags or QOM classes) that have to
reside in the same crate as the bindgen-generated code.

For now, prepare for this new organization by invoking bindgen
within the qemu-api crate's build definitions; it's also a
much better place to list enums that need specific treatment
from bindgen.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
5 weeks agorust: prepare variable definitions for multiple bindgen invocations
Paolo Bonzini [Fri, 13 Jun 2025 12:51:54 +0000 (14:51 +0200)] 
rust: prepare variable definitions for multiple bindgen invocations

When splitting the QEMU Rust bindings into multiple crates, the
bindgen-generated structs also have to be split so that it's
possible to add "impl" blocks (e.g. for Sync/Send or Default,
or even for utility methods in cases such as VMStateFlags).

Tweak various variable definitions in meson.build, to avoid naming
conflicts once there will be multiple bindgen invocations.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agorust: qom: change instance_init to take a ParentInit<>
Paolo Bonzini [Tue, 4 Mar 2025 19:48:05 +0000 (20:48 +0100)] 
rust: qom: change instance_init to take a ParentInit<>

This removes undefined behavior associated to writing to uninitialized
fields, and makes it possible to remove "unsafe" from the instance_init
implementation.

However, the init function itself is still unsafe, because it must promise
(as a sort as MaybeUninit::assume_init) that all fields have been
initialized.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agorust: qom: make ParentInit lifetime-invariant
Paolo Bonzini [Fri, 28 Feb 2025 09:20:48 +0000 (10:20 +0100)] 
rust: qom: make ParentInit lifetime-invariant

This is the trick that allows the parent-field initializer to be used
only for the object that it's meant to be initialized.  This way,
the owner of a MemoryRegion must be the object that embeds it.

More information is in the comments; it's best explained with a simplified
example.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agorust: qom: introduce ParentInit
Paolo Bonzini [Fri, 28 Feb 2025 08:40:30 +0000 (09:40 +0100)] 
rust: qom: introduce ParentInit

This is a smart pointer for MaybeUninit; it can be upcasted to the
already-initialized parent classes, or dereferenced to a MaybeUninit
for the class that is being initialized.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agorust: hpet: fully initialize object during instance_init
Paolo Bonzini [Tue, 15 Apr 2025 11:13:19 +0000 (13:13 +0200)] 
rust: hpet: fully initialize object during instance_init

The array of BqlRefCell<HPETTimer> is not initialized yet at the
end of instance_init.  In particular, the "state" field is NonNull
and therefore it is invalid to have it as zero bytes.

Note that MaybeUninit is necessary because assigning to self.timers[index]
would trigger Drop of the old value.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agorust: qemu_api: introduce MaybeUninit field projection
Paolo Bonzini [Fri, 28 Feb 2025 08:41:42 +0000 (09:41 +0100)] 
rust: qemu_api: introduce MaybeUninit field projection

Add a macro that makes it possible to convert a MaybeUninit<> into
another MaybeUninit<> for a single field within it.  Furthermore, it is
possible to use the resulting MaybeUninitField<> in APIs that take the
parent object, such as memory_region_init_io().

This allows removing some of the undefined behavior from instance_init()
functions, though this may not be the definitive implementation.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agopc-bios/dtb/meson: Prefer target name to be outfile, not infile
Bernhard Beschow [Tue, 10 Jun 2025 20:41:28 +0000 (22:41 +0200)] 
pc-bios/dtb/meson: Prefer target name to be outfile, not infile

Makes this custom_target() usage consistent with other ones in QEMU.

Fixes: 6e0dc9d2a88a ("meson: compile bundled device trees")
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20250610204131.2862-3-shentey@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agohw: Fix type constant for DTB files
Bernhard Beschow [Tue, 10 Jun 2025 20:41:27 +0000 (22:41 +0200)] 
hw: Fix type constant for DTB files

Commit fcb1ad456c58 ("system/datadir: Add new type constant for DTB files")
introduced a new type constant for DTB files and converted the boards with
bundled device trees to use it. Convert the other boards for consistency.

Fixes: fcb1ad456c58 ("system/datadir: Add new type constant for DTB files")
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20250610204131.2862-2-shentey@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386: fix TB exit logic in gen_movl_seg() when writing to SS
Mark Cave-Ayland [Wed, 11 Jun 2025 13:03:15 +0000 (14:03 +0100)] 
target/i386: fix TB exit logic in gen_movl_seg() when writing to SS

Before commit e54ef98c8a ("target/i386: do not trigger IRQ shadow for LSS"), any
write to SS in gen_movl_seg() would cause a TB exit. The changes introduced by
this commit were intended to restrict the DISAS_EOB_INHIBIT_IRQ exit to the case
where inhibit_irq is true, but missed that a DISAS_EOB_NEXT exit can still be
required when writing to SS and inhibit_irq is false.

Comparing the PE(s) && !VM86(s) section with the logic in x86_update_hflags(), we
can see that the DISAS_EOB_NEXT exit is still required for the !CODE32 case when
writing to SS in gen_movl_seg() because any change to the SS flags can affect
hflags. Similarly we can see that the existing CODE32 case is still correct since
a change to any of DS, ES and SS can affect hflags. Finally for the
gen_op_movl_seg_real() case an explicit TB exit is not needed because the segment
register selector does not affect hflags.

Update the logic in gen_movl_seg() so that a write to SS with inhibit_irq set to
false where PE(s) && !VM86(s) will generate a DISAS_EOB_NEXT exit along with the
inline comment. This has the effect of allowing Win98SE to boot in QEMU once
again.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: e54ef98c8a ("target/i386: do not trigger IRQ shadow for LSS")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2987
Link: https://lore.kernel.org/r/20250611130315.383151-1-mark.cave-ayland@ilande.co.uk
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agomeson: cleanup win32 library detection
Paolo Bonzini [Mon, 9 Jun 2025 10:58:54 +0000 (12:58 +0200)] 
meson: cleanup win32 library detection

As pointed out by Akihiko Odaki, all Win32 libraries in MinGW have lowercase
names.  This means that on (case-insensitive) Windows you can use the mixed-case
names suggested by Microsoft or all-lowercase names, while on Linux you need to
make them lowercase.

QEMU was already using lowercase names, so there is no need to test the
mixed-case name version of libSynchronization.  Remove the unnecessary test
and while at it make all the tests use "required: true".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
7 weeks agoMerge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging
Stefan Hajnoczi [Thu, 12 Jun 2025 18:16:11 +0000 (14:16 -0400)] 
Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging

Pull request

v2:
- Fix incorrect hw/audio/gus commit message

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmhLETkACgkQnKSrs4Gr
# c8hvmQf/Rtc605hI3loERIv62n3m16oI3bwMdB3RvqIlQMc1Nk539Y4UCgd1jx7k
# S4WEFCdu3EJG0Y21kcyBjyN+CHYfjtfNQYdPwkJC+kGwU1GlX5iRSdoiSK8RWMUg
# +1Cnq4K3gc0LNZjYoxgQCddhuo5wP4oonw+glCoGqa3crF7aOmje28GLTyxUn4IB
# 3tE+fO6CNlXeX+AMeHZEAJCz5p0rQ/o+LbkmQ/INnqaF75pw/5QDUEYnluyB2zEe
# IS7ZQuYtytLWSGD0bmCQDWIHf7/2rBDI4c/kZHuQBV+KbbP+DG39Xe/0IWdUwfl/
# BTlffUzhQipZU07o+YnKm+Al7w2TIA==
# =LTAj
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 12 Jun 2025 13:41:13 EDT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [ultimate]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [ultimate]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* tag 'block-pull-request' of https://gitlab.com/stefanha/qemu: (31 commits)
  net/stream: skip automatic zero-init of large array
  net/socket: skip automatic zero-init of large array
  hw/ufs/lu: skip automatic zero-init of large array
  hw/scsi/megasas: skip automatic zero-init of large arrays
  hw/scsi/lsi53c895a: skip automatic zero-init of large array
  hw/usb/hcd-ohci: skip automatic zero-init of large array
  hw/ppc/spapr_tpm_proxy: skip automatic zero-init of large arrays
  hw/ppc/pnv_occ: skip automatic zero-init of large struct
  hw/nvme/ctrl: skip automatic zero-init of large arrays
  hw/net/xgamc: skip automatic zero-init of large array
  hw/net/virtio-net: skip automatic zero-init of large arrays
  hw/net/tulip: skip automatic zero-init of large array
  hw/net/rtl8139: skip automatic zero-init of large array
  hw/misc/aspeed_hace: skip automatic zero-init of large array
  hw/hyperv/syndbg: skip automatic zero-init of large array
  hw/display/vmware_vga: skip automatic zero-init of large struct
  hw/dma/xlnx_csu_dma: skip automatic zero-init of large array
  hw/char/sclpconsole-lm: skip automatic zero-init of large array
  hw/audio/via-ac97: skip automatic zero-init of large array
  hw/audio/sb16: skip automatic zero-init of large array
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agonet/stream: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:09 +0000 (13:37 +0100)] 
net/stream: skip automatic zero-init of large array

The 'net_stream_send' method has a 68k byte array used for copying
data between guest and host. Skip the automatic zero-init of this
array to eliminate the performance overhead in the I/O hot path.

The 'buf1' array will be fully initialized when reading data off
the network socket.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-32-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agonet/socket: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:08 +0000 (13:37 +0100)] 
net/socket: skip automatic zero-init of large array

The 'net_socket_send' method has a 68k byte array used for copying
data between guest and host. Skip the automatic zero-init of this
array to eliminate the performance overhead in the I/O hot path.

The 'buf1' array will be fully initialized when reading data off
the network socket.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-31-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/ufs/lu: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:07 +0000 (13:37 +0100)] 
hw/ufs/lu: skip automatic zero-init of large array

The 'ufs_emulate_scsi_cmd' method has a 4k byte array used for
copying data from the device. Skip the automatic zero-init of
this array to eliminate the performance overhead in the I/O hot
path.

The 'outbuf' array will be fully initialized when data is copied
from the guest.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-30-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/scsi/megasas: skip automatic zero-init of large arrays
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:06 +0000 (13:37 +0100)] 
hw/scsi/megasas: skip automatic zero-init of large arrays

The 'megasas_dcmd_pd_get_list' and 'megasas_dcmd_get_properties'
methods have 4k structs used for copying data from the device.
Skip the automatic zero-init of this array to eliminate the
performance overhead in the I/O hot path.

The 'info' structs are manually initialized with memset(). The
compiler ought to be intelligent enough to turn the memset()
into a static initialization operation, and thus not duplicate
the automatic zero-init. Replacing memset() with '{}' makes it
unambiguous that the arrays are statically initialized.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-29-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/scsi/lsi53c895a: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:05 +0000 (13:37 +0100)] 
hw/scsi/lsi53c895a: skip automatic zero-init of large array

The 'lsi_memcpy' method has a 4k byte array used for copying data
to/from the device. Skip the automatic zero-init of this array to
eliminate the performance overhead in the I/O hot path.

The 'buf' array will be fully initialized when data is copied.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-28-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/usb/hcd-ohci: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:04 +0000 (13:37 +0100)] 
hw/usb/hcd-ohci: skip automatic zero-init of large array

The 'ohci_service_iso_td' method has a 8k byte array used for copying
data between guest and host. Skip the automatic zero-init of this
array to eliminate the performance overhead in the I/O hot path.

The 'buf' array will be fully initialized when reading data from guest
memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-27-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/ppc/spapr_tpm_proxy: skip automatic zero-init of large arrays
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:03 +0000 (13:37 +0100)] 
hw/ppc/spapr_tpm_proxy: skip automatic zero-init of large arrays

The 'tpm_execute' method has a pair of 4k arrays used for copying
data between guest and host. Skip the automatic zero-init of these
arrays to eliminate the performance overhead in the I/O hot path.

The two arrays will be fully initialized when reading data from
guest memory or reading data from the proxy FD.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-26-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/ppc/pnv_occ: skip automatic zero-init of large struct
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:02 +0000 (13:37 +0100)] 
hw/ppc/pnv_occ: skip automatic zero-init of large struct

The 'occ_model_tick' method has a 12k struct used for copying
data between guest and host. Skip the automatic zero-init of this
struct to eliminate the performance overhead in the I/O hot path.

The 'dynamic_data' buffer will be fully initialized when reading
data from the guest.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-25-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/nvme/ctrl: skip automatic zero-init of large arrays
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:01 +0000 (13:37 +0100)] 
hw/nvme/ctrl: skip automatic zero-init of large arrays

The 'nvme_map_sgl' method has a 256 element array used for copying
data from the device. Skip the automatic zero-init of this array
to eliminate the performance overhead in the I/O hot path.

The 'segment' array will be fully initialized when reading data from
the device.

The 'nme_changed_nslist' method has a 4k byte array that is manually
initialized with memset(). The compiler ought to be intelligent
enough to turn the memset() into a static initialization operation,
and thus not duplicate the automatic zero-init. Replacing memset()
with '{}' makes it unambiguous that the array is statically initialized.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Message-id: 20250610123709.835102-24-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/net/xgamc: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:37:00 +0000 (13:37 +0100)] 
hw/net/xgamc: skip automatic zero-init of large array

The 'xgmac_enet_send' method has a 8k byte array used for copying
data between guest and host. Skip the automatic zero-init of this
array to eliminate the performance overhead in the I/O hot path.

The 'frame' buffer will be fully initialized when reading guest
memory to fetch the data to send.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-23-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/net/virtio-net: skip automatic zero-init of large arrays
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:59 +0000 (13:36 +0100)] 
hw/net/virtio-net: skip automatic zero-init of large arrays

The 'virtio_net_receive_rcu' method has three arrays with
VIRTQUEUE_MAX_SIZE elements, which are apprixmately 32k in
size used for copying data between guest and host. Skip the
automatic zero-init of these arrays to eliminate the
performance overhead in the I/O hot path.

The three arrays will be selectively initialized as required
when processing network buffers.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-22-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/net/tulip: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:58 +0000 (13:36 +0100)] 
hw/net/tulip: skip automatic zero-init of large array

The 'tulip_setup_frame' method has a 4k byte array used for copynig
DMA data from the device. Skip the automatic zero-init of this array
to eliminate the performance overhead in the I/O hot path.

The 'buf' array will be fully initialized when reading data from the
device.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-21-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/net/rtl8139: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:57 +0000 (13:36 +0100)] 
hw/net/rtl8139: skip automatic zero-init of large array

The 'rtl8139_transmit_one' method has a 8k byte array used for
copying data between guest and host. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O
hot path.

The 'txbuffer' will be fully initialized when reading PCI DMA
buffers.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-20-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/misc/aspeed_hace: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:56 +0000 (13:36 +0100)] 
hw/misc/aspeed_hace: skip automatic zero-init of large array

The 'do_hash_operation' method has a 256 element iovec array used for
holding pointers to data that is to be hashed. Skip the automatic
zero-init of this array to eliminate the performance overhead in the
I/O hot path.

The 'iovec' array will be selectively initialized based on data that
needs to be hashed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-19-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/hyperv/syndbg: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:55 +0000 (13:36 +0100)] 
hw/hyperv/syndbg: skip automatic zero-init of large array

The 'handle_recv_msg' method has a 4k byte array used for copying
data between the network socket and guest memory. Skip the automatic
zero-init of this array to eliminate the performance overhead in the
I/O hot path.

The 'data_buf' array will be fully initialized when data is read
off the network socket.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-18-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/display/vmware_vga: skip automatic zero-init of large struct
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:54 +0000 (13:36 +0100)] 
hw/display/vmware_vga: skip automatic zero-init of large struct

The 'vmsvga_fifo_run' method has a struct which is a little over 20k
in size, used for holding image data for cursor changes. Skip the
automatic zero-init of this struct to eliminate the performance
overhead in the I/O hot path.

The cursor variable will be fully initialized only when processing
a cursor definition message from the guest.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-17-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/dma/xlnx_csu_dma: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:53 +0000 (13:36 +0100)] 
hw/dma/xlnx_csu_dma: skip automatic zero-init of large array

The 'xlnx_csu_dma_src_notify' method has a 4k byte array used for
copying DMA data. Skip the automatic zero-init of this array to
eliminate the performance overhead in the I/O hot path.

The 'buf' array will be fully initialized when data is copied.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-16-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/char/sclpconsole-lm: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:52 +0000 (13:36 +0100)] 
hw/char/sclpconsole-lm: skip automatic zero-init of large array

The 'process_mdb' method has a 4k byte array used for copying data
between the guest and the chardev backend. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O hot
path.

The 'buffer' array will be selectively initialized when data is converted
between EBCDIC and ASCII.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-15-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/audio/via-ac97: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:51 +0000 (13:36 +0100)] 
hw/audio/via-ac97: skip automatic zero-init of large array

The 'out_cb' method has a 4k byte array used for copying data
between the audio backend and device. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O hot
path.

The 'tmpbuf' array will be fully initialized when reading data from
device memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-14-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/audio/sb16: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:50 +0000 (13:36 +0100)] 
hw/audio/sb16: skip automatic zero-init of large array

The 'write_audio' method has a 4k byte array used for copying data
between the audio backend and device. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O hot
path.

The 'tmpbuf' array will be fully initialized when reading data from
device memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-13-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/audio/marvell_88w8618: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:49 +0000 (13:36 +0100)] 
hw/audio/marvell_88w8618: skip automatic zero-init of large array

The 'mv88w8618_audio_callback' method has a 4k byte array used for
copying data between the audio backend and device. Skip the automatic
zero-init of this array to eliminate the performance overhead in
the I/O hot path.

The 'buf' array will be fully initialized when reading data from
device memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-12-berrange@redhat.com
[Fixed hw/audio/gus in commit message --Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/audio/gus: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:48 +0000 (13:36 +0100)] 
hw/audio/gus: skip automatic zero-init of large array

The 'GUS_read_DMA' method has a 4k byte array used for copying
data between the audio backend and device. Skip the automatic
zero-init of this array to eliminate the performance overhead in
the I/O hot path.

The 'tmpbuf' array will be fully initialized when reading data
from device memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-11-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/audio/es1370: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:47 +0000 (13:36 +0100)] 
hw/audio/es1370: skip automatic zero-init of large array

The 'es1370_transfer_audio' method has a 4k byte array used for
copying data between the audio backend and device. Skip the automatic
zero-init of this array to eliminate the performance overhead in
the I/O hot path.

The 'tmpbuf' array will be fully initialized when reading data from
the audio backend and/or device memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-10-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/audio/cs4231a: skip automatic zero-init of large arrays
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:46 +0000 (13:36 +0100)] 
hw/audio/cs4231a: skip automatic zero-init of large arrays

The 'cs_write_audio' method has a pair of byte arrays, one 4k in size
and one 8k, which are used in converting audio samples. Skip the
automatic zero-init of these arrays to eliminate the performance
overhead in the I/O hot path.

The 'tmpbuf' array will be fully initialized when reading a block of
data from the guest. The 'linbuf' array will be fully initialized
when converting the audio samples.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-9-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/audio/ac97: skip automatic zero-init of large arrays
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:45 +0000 (13:36 +0100)] 
hw/audio/ac97: skip automatic zero-init of large arrays

The 'read_audio' & 'write_audio' methods have a 4k byte array used
for copying data between the audio backend and device. Skip the
automatic zero-init of these arrays to eliminate the performance
overhead in the I/O hot path.

The 'tmpbuf' array will be fully initialized when reading data from
the audio backend and/or device memory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-8-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agochardev/char-socket: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:44 +0000 (13:36 +0100)] 
chardev/char-socket: skip automatic zero-init of large array

The 'tcp_chr_read' method has a 4k byte array used for copying
data between the socket and device. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O
hot path.

The 'buf' array will be fully initialized when reading data off
the network socket.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-7-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agochardev/char-pty: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:43 +0000 (13:36 +0100)] 
chardev/char-pty: skip automatic zero-init of large array

The 'pty_chr_read' method has a 4k byte array used for copying
data between the PTY and device. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O
hot path.

The 'buf' array will be fully initialized when reading data off
the PTY.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-6-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agochardev/char-fd: skip automatic zero-init of large array
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:42 +0000 (13:36 +0100)] 
chardev/char-fd: skip automatic zero-init of large array

The 'fd_chr_read' method has a 4k byte array used for copying
data between the socket and device. Skip the automatic zero-init
of this array to eliminate the performance overhead in the I/O
hot path.

The 'buf' array will be fully initialized when reading data off
the network socket.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-5-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoblock: skip automatic zero-init of large array in ioq_submit
Daniel P. Berrangé [Tue, 10 Jun 2025 12:36:41 +0000 (13:36 +0100)] 
block: skip automatic zero-init of large array in ioq_submit

The 'ioq_submit' method has a struct array that is 8k in size.
Skip the automatic zero-init of this array to eliminate the
performance overhead in the I/O hot path.

The 'iocbs' array will selectively initialized when processing
the I/O data.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-4-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agohw/virtio/virtio: avoid cost of -ftrivial-auto-var-init in hot path
Stefan Hajnoczi [Tue, 10 Jun 2025 12:36:40 +0000 (13:36 +0100)] 
hw/virtio/virtio: avoid cost of -ftrivial-auto-var-init in hot path

Since commit 7ff9ff039380 ("meson: mitigate against use of uninitialize
stack for exploits") the -ftrivial-auto-var-init=zero compiler option is
used to zero local variables. While this reduces security risks
associated with uninitialized stack data, it introduced a measurable
bottleneck in the virtqueue_split_pop() and virtqueue_packed_pop()
functions.

These virtqueue functions are in the hot path. They are called for each
element (request) that is popped from a VIRTIO device's virtqueue. Using
__attribute__((uninitialized)) on large stack variables in these
functions improves fio randread bs=4k iodepth=64 performance from 304k
to 332k IOPS (+9%).

This issue was found using perf-top(1). virtqueue_split_pop() was one of
the top CPU consumers and the "annotate" feature showed that the memory
zeroing instructions at the beginning of the functions were hot.

Fixes: 7ff9ff039380 ("meson: mitigate against use of uninitialize stack for exploits")
Cc: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20250610123709.835102-3-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoinclude/qemu/compiler: add QEMU_UNINITIALIZED attribute macro
Stefan Hajnoczi [Tue, 10 Jun 2025 12:36:39 +0000 (13:36 +0100)] 
include/qemu/compiler: add QEMU_UNINITIALIZED attribute macro

The QEMU_UNINITIALIZED macro is to be used to skip the default compiler
variable initialization done by -ftrivial-auto-var-init=zero.

Use this in cases where there a method in the device I/O path (or other
important hot paths), that has large variables on the stack. A rule of
thumb is that "large" means a method with 4kb data in the local stack
frame. Any variables which are KB in size, should be annotated with this
attribute, to pre-emptively eliminate any potential overhead from the
compiler zero'ing memory.

Given that this turns off a security hardening feature, when using this
to flag variables, it is important that the code is double-checked to
ensure there is no possible use of uninitialized data in the method.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20250610123709.835102-2-berrange@redhat.com
[DB: split off patch & rewrite guidance on when to use the annotation]
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoMerge tag 'qga-pull-2025-06-12' of https://github.com/kostyanf14/qemu into staging
Stefan Hajnoczi [Thu, 12 Jun 2025 17:36:43 +0000 (13:36 -0400)] 
Merge tag 'qga-pull-2025-06-12' of https://github.com/kostyanf14/qemu into staging

qga-pull-2025-06-12

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEwsLBCepDxjwUI+uE711egWG6hOcFAmhK3hkACgkQ711egWG6
# hOdZ9g//aObON4+a2fSuTWToJwj5i2fcplXDD4OUnxH+pc3qt4bc50cpD4mbH3VZ
# 2W854DWfrvPOv1beVYlmOLKztCTFk445BwtV5im4TBBcRmPt9GXyGqqax+3msziF
# gA0r3KrJ4mv6OUvx61Jmgz4pFkHhWda6BbnTZbFPgPSz/poLN78Ib9TpAvOWBIEg
# 6bdux8Ivh4gWO22OtY7O8XDU/NwkVwQNJQ1iv3Y4EUJ+Qv4prePrDiyNVn0jf1S0
# KxIx4tPYf6B4mYbcc3/lURuI+R8H2KxCt7GmGxBl1esqjGOEUj/fjp54+OqOf/2n
# a/ZIWFu0cN1SK279eluBOm4Y7IGRouaFALaBJQLdEhYQgJmrCaEnSzHQCTR4cZQr
# V2KkmGFXV7IdLvlLl38safp/G8cxvq21ijEx/RkoZ7Iklx8wWx5A/Cy0D52IViXD
# +gsBpqGsMia+7Rus9o4P2QjWA5hCvaN7XH2rVGtELyoQwwhBfxCmhtn8qi5Vjybz
# 7f3tr0BwdRm70KL//OhSL6DZHOGyRdqyiV27IP/2K5TVqKjkZNP0eIL97Y6xoGe6
# vXLbx6y+wUW0LXJGXe2+OtR/nFTu+VJ8IapfwQfd9JIR8Z25cNsFLhvfmWlPQiMc
# EkNUEbEez21PSKuKz9cVHlfLl/L4VSgzychKF9uQWm7rhbK+Roc=
# =6AwB
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 12 Jun 2025 10:03:05 EDT
# gpg:                using RSA key C2C2C109EA43C63C1423EB84EF5D5E8161BA84E7
# gpg: Good signature from "Kostiantyn Kostiuk (Upstream PR sign) <kkostiuk@redhat.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: C2C2 C109 EA43 C63C 1423  EB84 EF5D 5E81 61BA 84E7

* tag 'qga-pull-2025-06-12' of https://github.com/kostyanf14/qemu:
  qga: Add tests for guest-get-load command
  qga-win: implement a 'guest-get-load' command

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoqga: Add tests for guest-get-load command
Konstantin Kostiuk [Mon, 24 Mar 2025 13:17:29 +0000 (15:17 +0200)] 
qga: Add tests for guest-get-load command

Tested-by: Dehan Meng <demeng@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
7 weeks agoqga-win: implement a 'guest-get-load' command
Konstantin Kostiuk [Mon, 24 Mar 2025 13:17:28 +0000 (15:17 +0200)] 
qga-win: implement a 'guest-get-load' command

Windows has no native equivalent API, but it would be possible to
simulate it as illustrated here (BSD-3-Clause):

  https://github.com/giampaolo/psutil/pull/1485

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Dehan Meng <demeng@redhat.com>
Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
Signed-off-by: Konstantin Kostiuk <kkostiuk@redhat.com>
7 weeks agoMerge tag 'pull-vfio-20250611' of https://github.com/legoater/qemu into staging
Stefan Hajnoczi [Wed, 11 Jun 2025 15:39:53 +0000 (11:39 -0400)] 
Merge tag 'pull-vfio-20250611' of https://github.com/legoater/qemu into staging

vfio queue:

* Fixed newly added potential issues in vfio-pci
* Added support to report vfio-ap configuration changes
* Added prerequisite support for vfio-user
* Added first part for VFIO live update support

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmhJm00ACgkQUaNDx8/7
# 7KHBehAAlbSt+QCPwdNJ/5QPGGPWIQ86acIHaI/sE/lpcJx9FideQhtKTtt0gTOE
# ZNGbzfeCnewCM+VLMgkrYZC9DWd9OpEO68tDy6ev577F6ijSR8wzXRtDl2j5Revm
# R9gBuOm/cQ6Mafiv8SNPNSGW2tQ0M9Bd4GJRa5K3VBf8kFwPpWEZC/yDWbvSVvwc
# 99TFXziIbWJEYGRzG4h7hoEEd/GapZOwTRIPRoRGHznbOPMsxShjIhExn8ZGTlU9
# woaNBPZXS5xjjy5tKyURexu+eyxbR6WsZFyeAA03+HzWEfRzhFc/rhAC6mBbpq7v
# 03a/4ewkKZ0fYUf9G2H5YpXTXl6io+qk+irKi99/4GT0oSBMrm+/NcY7u9Hv2MwA
# 50h3iXUhLQYzL2G2bSSoBTKOGxV84Xtto9j7dM7fy8e0nYv9rucvKl+V3Ox1Qwv4
# 8+bQsxP5tjmHlXE/n6ckfcrWtSHuWmb3JJ8yxdBttdo3Cz/+KxJ3UjtP9U81RXxY
# gepxCRXZmcTfnv1dV6FyjOE6QOhB3WIT5rHmgoQIvHGhtBsLpT2mDlSsMVEQIXvm
# ixQnRguwQv9fgEZeYB/ck/ezluOxewBlOv5Q3CPpHQBd2Ykh4N/8xsWpXlKI1KWr
# Tj7Nh/2ObqNXbKdmb9nNiuo6eQDkPOm4mr1cs2ncMr7/cRGeKeA=
# =KOf3
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 11 Jun 2025 11:05:49 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-vfio-20250611' of https://github.com/legoater/qemu: (27 commits)
  vfio: improve VFIODeviceIOOps docs
  vfio/pci: export MSI functions
  vfio/pci: vfio_notifier_cleanup
  vfio/pci: vfio_notifier_init cpr parameters
  vfio/pci: pass vector to virq functions
  vfio/pci: vfio_notifier_init
  vfio/pci: vfio_pci_vector_init
  vfio-pci: skip reset during cpr
  pci: skip reset during cpr
  pci: export msix_is_pending
  vfio/container: recover from unmap-all-vaddr failure
  vfio/container: mdev cpr blocker
  vfio/container: restore DMA vaddr
  vfio/container: discard old DMA vaddr
  vfio/container: preserve descriptors
  vfio/container: register container for cpr
  migration: lower handler priority
  migration: cpr helpers
  vfio: mark posted writes in region write callbacks
  vfio: add per-region fd support
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoMerge tag 'pull-request-2025-06-11' of https://gitlab.com/thuth/qemu into staging
Stefan Hajnoczi [Wed, 11 Jun 2025 15:39:30 +0000 (11:39 -0400)] 
Merge tag 'pull-request-2025-06-11' of https://gitlab.com/thuth/qemu into staging

* Remove aarch64 job from travis.yml
* Remove deprecated s390-ccw-virtio-4.1 machine
* Add memlock functional test
* Various other small updates and fixes

# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmhJfHgRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbX/8Q//VCvEW3EKp/r+jDK32rfeuVtGPQfjsJ7u
# iDI3OkzhWZOKpU229Nthj2rKGMPl19mBXFMRavRHceO1pW/xYlPNAErMgT9WrU9K
# Cy2pYvOGIVK6pZj+qtjcWwG7wHo8mUtgklXXOvH46pXKunRaVc5vJ3ooIvxn96aE
# aq6r+U4iW4WHt65OJj35Od6Fdl7eDuAHgFEzPIrb0+ip4NUNIlQBX7Ro/9Aaok5X
# u7hDNbaPMqsYQ2lvU6biJEiVRYz+urqjVUbnNPSm//0SEDc+tGYbwa+XVXaGG8ws
# URijEu4CTo26zm85ZVIr/b7HW2uzkSqM+phWXh1vDqOeyQq7a9k5MQ8K01reHBHp
# XvJbfg5hYrKbeJIn9QFTwJ+1UPh7fkR0MUj0LCfTEyO5U42OM6TA0R3JyebVx3eG
# YpjxUGUZWHLc/5OJFzthIqy0oG/PKuw1fcWTIgiojFQEAd4XIDsYyV66utONe/hJ
# on1Tn3eniw0L8k2pw6/9Hwnwufe2U+HG/ZGNyfFWq0nPk0Ccdb1MrMUOryLjG3TK
# OGHqGBEINUKkgX7C3ox0my+fYzUQGwi0O+jKqhDEzZP8Ci5Ozcx5mIb0XejqDBXM
# IvUqPirXvLFwh0djnisIXIIdDNWYH6TpjyyGLyUj8rPeE2FVyiNBQRT25rNMNdVn
# 0zYwfxH7pno=
# =Ky62
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 11 Jun 2025 08:54:16 EDT
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* tag 'pull-request-2025-06-11' of https://gitlab.com/thuth/qemu:
  scripts/meson-buildoptions: Sort coroutine_backend choices lexicographically
  MAINTAINERS: Update Akihiko Odaki's affiliation
  MAINTAINERS: Update the paths to the testing documentation files
  tests/vm/README: fix documentation path in tests/vm/README
  tests/functional: add memlock tests
  tests/functional: add skipLockedMemoryTest decorator
  tests/functional: Speed up the avr_mega2560 test
  tests/functional: Use the 'none' machine for the VNC test
  hw/s390x/s390-virtio-ccw: Remove the deprecated 4.1 machine type
  travis.yml: Remove the aarch64 job

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoMerge tag 'seabios-1.17.0-20250611-pull-request' of https://gitlab.com/kraxel/qemu...
Stefan Hajnoczi [Wed, 11 Jun 2025 15:38:34 +0000 (11:38 -0400)] 
Merge tag 'seabios-1.17.0-20250611-pull-request' of https://gitlab.com/kraxel/qemu into staging

seabios: update to 1.17.0 release

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmhJNR8ACgkQTLbY7tPo
# cTiJZBAAtIDoL4e/VOTJJX+Tz6s+z1PW0bvH0k1Uo1t9SJRy+po33BEYYw3mzgsF
# w0/kvHcWTuEs/iagcyVhrKKINBtK/IxuJwC7f7kvTVuK56aKheh+/w+d69vdtCak
# CWCkrf5VZ5Bd2dPI9naQ28BAza17FFgLVIFVxWXnWwbl6ThyKtxQwmunZZKgVNBm
# VQl66SyxgD8MzESePeDzqOfiPTM6zeCLB1RiuGFZ2IyH3Ku3Y/Dz82wFsLQ0bF7U
# VAWLokEmltFT8ZQcDurPgRdlk9GyVRRFUurjGUCf4vL+Ks1YSruT/+U4gxyyEl6y
# LbHr4SgMhh3nx1iqAUl4x2wWjdzXNxtGho5VPnSPE54iqJ0jeJe1ZYrUbDGWnhIx
# zzWII5pz8SZaE01YUKqY26o+7DAjVZdNGzjbluhDlWogRXj9zkW63SnTc1udTzoP
# jZLXpJDyk/M9NXP8d/byM0Y0t8HNFXjBXaAY4WjYev1n/FJQmD52JJXK8kLEWfDu
# FxUvgFs8zlNtdJxDuBhl/y7+olT+4VZkCIu09fhVCZt8melLrsN81PQJGZaWYheL
# vQKqv2+UaXzMMKmmCkTo6esCBPH++GeAeDsaMLtm5c6ejwBkBb3xRCFyL9IvJWn5
# o7akBbl8ELjCj5k/aQDU2ohoRBUIdTbBa/Gd5w9ARhcRFC6dxoo=
# =vDT+
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 11 Jun 2025 03:49:51 EDT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* tag 'seabios-1.17.0-20250611-pull-request' of https://gitlab.com/kraxel/qemu:
  seabios: update binaries to 1.17.0
  seabios: update submodule to 1.17.0

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoMerge tag 'hw-misc-20250610' of https://github.com/philmd/qemu into staging
Stefan Hajnoczi [Wed, 11 Jun 2025 15:37:59 +0000 (11:37 -0400)] 
Merge tag 'hw-misc-20250610' of https://github.com/philmd/qemu into staging

Misc HW patches

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmhILpoACgkQ4+MsLN6t
# wN4FxA//U3xm1ZJLQnlS+AQp31foxgptVTNej+ZGOfvhYaUSBtFgUhoiXMPJPN4v
# pKWBAFgWigaeM9f01T7H55M+Pj0Az2QLZw+Z6Bklu9RjzisZSuIdMZkPWiJXHBFC
# 6OMh6pIjyxuYwYltai8gFFP5ENuILETMpFHEfFQtMiAimXhvDKvcQ5Dmi08UcamQ
# hOFdia1djmVYIwJCi+V6Mwl/jwql/L1JpBrLyVOFmxGW8p5ZOjJTLL6pC7288dTP
# B8Nb9MhWZpbsHiU4GalTOEXQUuAEa/KX9ZhUqW6kLVhguiD5JoCeMhTur40sX+/J
# kKl8dSOhHJ0axEII5PxO4XviN1LWC4DATKfXxHjzvwNbJRH4gdBgaf8zqCeuy0TM
# 7pOLzyn6ARXoJZTftS9Ezm1MCdCT5eOQ3+YMrLId8M+KBatogJ8uFMRHa8j+khhB
# M08FOufxQGQYZsnz9eb+Dexh+Z3/EiUrCJt1X5icJEQ4uwvoo6lwxVnaV1RWYjRX
# EnQOvFr38rctDq3UIckBGzfuVmolEc3l/QgENsNb0AIsz0K2P11Xfg3SNnnPBST8
# duFsWD1/nR53wcKrRli0PMezcH/QuUkRqzBlOc2wllcVKJrp71+m2VDClCmH6bBF
# gk03V84b96rWkxwrxFB05mOVmdJKxAFAnwRRfIfYp69r9RgHx4A=
# =m3BF
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 10 Jun 2025 09:09:46 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-20250610' of https://github.com/philmd/qemu: (24 commits)
  hw/net/i82596: Factor configure function out
  hw/net/i82596: Update datasheet URL
  hw/misc/stm32_rcc: Fix stm32_rcc_write() arguments order
  hw/riscv/riscv-iommu: Remove definition of RISCVIOMMU[Pci|Sys]Class
  hw/gpio/aspeed: Fix definition of AspeedGPIOClass
  hw/virtio/virtio-pmem: Fix definition of VirtIOPMEMClass
  hw/virtio/virtio-mem: Fix definition of VirtIOMEMClass
  tests/unit/test-char: Avoid using g_alloca()
  backends/tpm: Avoid using g_alloca()
  hw/gpio/pca9552: Avoid using g_newa()
  hw/core/cpu: Move CacheType to general cpu.h
  accel/hvf: Fix TYPE_HVF_ACCEL instance size
  tests/functional: Add a test for the Arduino UNO machine
  MAINTAINERS: Update Akihiko Odaki's affiliation
  pc-bios: ensure installed ROMs don't have execute permissions
  hw/ppc/e500: Use SysBusDevice API to access TYPE_CCSR's internal resources
  hw/net/fsl_etsec: Set default MAC address
  hw/ppc/e500: Move clock and TB frequency to machine class
  hw/hyperv/balloon: Consolidate OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES
  hw/core/resetcontainer: Consolidate OBJECT_DECLARE_SIMPLE_TYPE
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agoMerge tag 'pull-loongarch-20250610' of https://github.com/gaosong715/qemu into staging
Stefan Hajnoczi [Wed, 11 Jun 2025 15:37:13 +0000 (11:37 -0400)] 
Merge tag 'pull-loongarch-20250610' of https://github.com/gaosong715/qemu into staging

pull-loongarch_20250610

# -----BEGIN PGP SIGNATURE-----
#
# iLMEAAEKAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCaEfZDQAKCRBAov/yOSY+
# 3z/XA/4vGGLAiCX6EN+t4E9sh7BWrt8fgbxBFSZapXVLGaeHDV3Y4IUHlLGy9RZT
# 3OtfE+5qvXPt1iz5l4IygmJh6wk7kN05Qw7XkV18hO5TqmYINdbmeuwvK0vmH6x+
# nTxSRke0CMmwYKg3bYDFVS1CRgfPX1zfRb1VKB1PnkKaZcHPNQ==
# =jC/2
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 10 Jun 2025 03:04:45 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-20250610' of https://github.com/gaosong715/qemu:
  hw/loongarch/virt: Remove global variables about memmap tables
  hw/loongarch/virt: Remove global variables about initrd
  target/loongarch: add check for fcond
  hw/loongarch/virt: inform guest of kvm
  hw/intc/loongarch_extioi: Fix typo issue about register EXTIOI_COREISR_END
  hw/intc/loongarch_pch: Convert to little endian with ID register
  hw/loongarch/virt: Fix big endian support with MCFG table

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
7 weeks agovfio: improve VFIODeviceIOOps docs
John Levon [Wed, 11 Jun 2025 10:47:53 +0000 (03:47 -0700)] 
vfio: improve VFIODeviceIOOps docs

Explicitly describe every parameter rather than summarizing.

Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250611104753.1199796-1-john.levon@nutanix.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/pci: export MSI functions
Steve Sistare [Tue, 10 Jun 2025 15:39:30 +0000 (08:39 -0700)] 
vfio/pci: export MSI functions

Export various MSI functions, renamed with a vfio_pci prefix, for use by
CPR in subsequent patches.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-18-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/pci: vfio_notifier_cleanup
Steve Sistare [Tue, 10 Jun 2025 15:39:29 +0000 (08:39 -0700)] 
vfio/pci: vfio_notifier_cleanup

Move event_notifier_cleanup calls to a helper vfio_notifier_cleanup.
This version is trivial, and does not yet use the vdev and nr parameters.
No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-17-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/pci: vfio_notifier_init cpr parameters
Steve Sistare [Tue, 10 Jun 2025 15:39:28 +0000 (08:39 -0700)] 
vfio/pci: vfio_notifier_init cpr parameters

Pass vdev and nr to vfio_notifier_init, for use by CPR in a subsequent
patch.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-16-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/pci: pass vector to virq functions
Steve Sistare [Tue, 10 Jun 2025 15:39:27 +0000 (08:39 -0700)] 
vfio/pci: pass vector to virq functions

Pass the vector number to vfio_connect_kvm_msi_virq and
vfio_remove_kvm_msi_virq, so it can be passed to their subroutines in
a subsequent patch.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-15-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/pci: vfio_notifier_init
Steve Sistare [Tue, 10 Jun 2025 15:39:26 +0000 (08:39 -0700)] 
vfio/pci: vfio_notifier_init

Move event_notifier_init calls to a helper vfio_notifier_init.
This version is trivial, but it will be expanded to support CPR
in subsequent patches.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-14-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/pci: vfio_pci_vector_init
Steve Sistare [Tue, 10 Jun 2025 15:39:25 +0000 (08:39 -0700)] 
vfio/pci: vfio_pci_vector_init

Extract a subroutine vfio_pci_vector_init.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-13-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio-pci: skip reset during cpr
Steve Sistare [Tue, 10 Jun 2025 15:39:24 +0000 (08:39 -0700)] 
vfio-pci: skip reset during cpr

Do not reset a vfio-pci device during CPR, and do not complain if the
kernel's PCI config space changes for non-emulated bits between the
vmstate save and load, which can happen due to ongoing interrupt activity.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-12-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agopci: skip reset during cpr
Steve Sistare [Tue, 10 Jun 2025 17:26:43 +0000 (10:26 -0700)] 
pci: skip reset during cpr

Do not reset a vfio-pci device during CPR.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749576403-25355-1-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agopci: export msix_is_pending
Steve Sistare [Tue, 10 Jun 2025 15:39:22 +0000 (08:39 -0700)] 
pci: export msix_is_pending

Export msix_is_pending for use by cpr.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-10-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/container: recover from unmap-all-vaddr failure
Steve Sistare [Tue, 10 Jun 2025 15:39:21 +0000 (08:39 -0700)] 
vfio/container: recover from unmap-all-vaddr failure

If there are multiple containers and unmap-all fails for some container, we
need to remap vaddr for the other containers for which unmap-all succeeded.
Recover by walking all address ranges of all containers to restore the vaddr
for each.  Do so by invoking the vfio listener callback, and passing a new
"remap" flag that tells it to restore a mapping without re-allocating new
userland data structures.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-9-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/container: mdev cpr blocker
Steve Sistare [Tue, 10 Jun 2025 15:39:20 +0000 (08:39 -0700)] 
vfio/container: mdev cpr blocker

During CPR, after VFIO_DMA_UNMAP_FLAG_VADDR, the vaddr is temporarily
invalid, so mediated devices cannot be supported.  Add a blocker for them.
This restriction will not apply to iommufd containers when CPR is added
for them in a future patch.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-8-git-send-email-steven.sistare@oracle.com
[ clg: Fixed context change in VFIODevice ]
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/container: restore DMA vaddr
Steve Sistare [Tue, 10 Jun 2025 15:39:19 +0000 (08:39 -0700)] 
vfio/container: restore DMA vaddr

In new QEMU, do not register the memory listener at device creation time.
Register it later, in the container post_load handler, after all vmstate
that may affect regions and mapping boundaries has been loaded.  The
post_load registration will cause the listener to invoke its callback on
each flat section, and the calls will match the mappings remembered by the
kernel.

The listener calls a special dma_map handler that passes the new VA of each
section to the kernel using VFIO_DMA_MAP_FLAG_VADDR.  Restore the normal
handler at the end.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-7-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/container: discard old DMA vaddr
Steve Sistare [Tue, 10 Jun 2025 15:39:18 +0000 (08:39 -0700)] 
vfio/container: discard old DMA vaddr

In the container pre_save handler, discard the virtual addresses in DMA
mappings with VFIO_DMA_UNMAP_FLAG_VADDR, because guest RAM will be
remapped at a different VA after in new QEMU.  DMA to already-mapped
pages continues.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-6-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/container: preserve descriptors
Steve Sistare [Tue, 10 Jun 2025 15:39:17 +0000 (08:39 -0700)] 
vfio/container: preserve descriptors

At vfio creation time, save the value of vfio container, group, and device
descriptors in CPR state.  On qemu restart, vfio_realize() finds and uses
the saved descriptors.

During reuse, device and iommu state is already configured, so operations
in vfio_realize that would modify the configuration, such as vfio ioctl's,
are skipped.  The result is that vfio_realize constructs qemu data
structures that reflect the current state of the device.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-5-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/container: register container for cpr
Steve Sistare [Tue, 10 Jun 2025 15:39:16 +0000 (08:39 -0700)] 
vfio/container: register container for cpr

Register a legacy container for cpr-transfer, replacing the generic CPR
register call with a more specific legacy container register call.  Add a
blocker if the kernel does not support VFIO_UPDATE_VADDR or VFIO_UNMAP_ALL.

This is mostly boiler plate.  The fields to to saved and restored are added
in subsequent patches.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-4-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agomigration: lower handler priority
Steve Sistare [Tue, 10 Jun 2025 15:39:15 +0000 (08:39 -0700)] 
migration: lower handler priority

Define a vmstate priority that is lower than the default, so its handlers
run after all default priority handlers.  Since 0 is no longer the default
priority, translate an uninitialized priority of 0 to MIG_PRI_DEFAULT.

CPR for vfio will use this to install handlers for containers that run
after handlers for the devices that they contain.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-3-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agomigration: cpr helpers
Steve Sistare [Tue, 10 Jun 2025 15:39:14 +0000 (08:39 -0700)] 
migration: cpr helpers

Add the cpr_incoming_needed, cpr_open_fd, and cpr_resave_fd helpers,
for use when adding cpr support for vfio and iommufd.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/1749569991-25171-2-git-send-email-steven.sistare@oracle.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio: mark posted writes in region write callbacks
John Levon [Sat, 7 Jun 2025 00:10:36 +0000 (17:10 -0700)] 
vfio: mark posted writes in region write callbacks

For vfio-user, the region write implementation needs to know if the
write is posted; add the necessary plumbing to support this.

Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250607001056.335310-5-john.levon@nutanix.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio: add per-region fd support
John Levon [Sat, 7 Jun 2025 00:10:35 +0000 (17:10 -0700)] 
vfio: add per-region fd support

For vfio-user, each region has its own fd rather than sharing
vbasedev's. Add the necessary plumbing to support this, and use the
correct fd in vfio_region_mmap().

Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250607001056.335310-4-john.levon@nutanix.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio: export PCI helpers needed for vfio-user
John Levon [Sat, 7 Jun 2025 00:10:33 +0000 (17:10 -0700)] 
vfio: export PCI helpers needed for vfio-user

The vfio-user code will need to re-use various parts of the vfio PCI
code. Export them in hw/vfio/pci.h, and rename them to the vfio_pci_*
namespace.

Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250607001056.335310-2-john.levon@nutanix.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agos390: implementing CHSC SEI for AP config change
Rorie Reyes [Mon, 9 Jun 2025 16:44:18 +0000 (12:44 -0400)] 
s390: implementing CHSC SEI for AP config change

Handle interception of the CHSC SEI instruction for requests
indicating the guest's AP configuration has changed.

If configuring --without-default-devices, hw/s390x/ap-stub.c
was created to handle such circumstance. Also added the
following to hw/s390x/meson.build if CONFIG_VFIO_AP is
false, it will use the stub file.

Signed-off-by: Rorie Reyes <rreyes@linux.ibm.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250609164418.17585-5-rreyes@linux.ibm.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agohw/vfio/ap: Storing event information for an AP configuration change event
Rorie Reyes [Mon, 9 Jun 2025 16:44:17 +0000 (12:44 -0400)] 
hw/vfio/ap: Storing event information for an AP configuration change event

These functions can be invoked by the function that handles interception
of the CHSC SEI instruction for requests indicating the accessibility of
one or more adjunct processors has changed.

Signed-off-by: Rorie Reyes <rreyes@linux.ibm.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20250609164418.17585-4-rreyes@linux.ibm.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agohw/vfio/ap: store object indicating AP config changed in a queue
Rorie Reyes [Mon, 9 Jun 2025 16:44:16 +0000 (12:44 -0400)] 
hw/vfio/ap: store object indicating AP config changed in a queue

Creates an object indicating that an AP configuration change event
has been received and stores it in a queue. These objects will later
be used to store event information for an AP configuration change
when the CHSC instruction is intercepted.

Signed-off-by: Rorie Reyes <rreyes@linux.ibm.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20250609164418.17585-3-rreyes@linux.ibm.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agohw/vfio/ap: notification handler for AP config changed event
Rorie Reyes [Mon, 9 Jun 2025 16:44:15 +0000 (12:44 -0400)] 
hw/vfio/ap: notification handler for AP config changed event

Register an event notifier handler to process AP configuration
change events by queuing the event and generating a CRW to let
the guest know its AP configuration has changed

Signed-off-by: Rorie Reyes <rreyes@linux.ibm.com>
Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20250609164418.17585-2-rreyes@linux.ibm.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/pci: Fix instance_size of VFIO_PCI_BASE
Zhenzhong Duan [Wed, 11 Jun 2025 02:42:28 +0000 (10:42 +0800)] 
vfio/pci: Fix instance_size of VFIO_PCI_BASE

Currently the final instance_size of VFIO_PCI_BASE is sizeof(PCIDevice).
It should be sizeof(VFIOPCIDevice), VFIO_PCI uses same structure as
base class VFIO_PCI_BASE, so no need to set its instance_size explicitly.

This isn't catastrophic only because VFIO_PCI_BASE is an abstract class.

Fixes: d4e392d0a99b ("vfio: add vfio-pci-base class")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Yi Liu <yi.l.liu@intel.com>
Link: https://lore.kernel.org/qemu-devel/20250611024228.423666-1-zhenzhong.duan@intel.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agovfio/container: Fix vfio_listener_commit()
Zhenzhong Duan [Mon, 9 Jun 2025 11:54:33 +0000 (19:54 +0800)] 
vfio/container: Fix vfio_listener_commit()

It's wrong to call into listener_begin callback in vfio_listener_commit().
Currently this impacts vfio-user.

Fixes: d9b7d8b6993b ("vfio/container: pass listener_begin/commit callbacks")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Link: https://lore.kernel.org/qemu-devel/20250609115433.401775-1-zhenzhong.duan@intel.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7 weeks agoscripts/meson-buildoptions: Sort coroutine_backend choices lexicographically
Bernhard Beschow [Tue, 10 Jun 2025 20:41:29 +0000 (22:41 +0200)] 
scripts/meson-buildoptions: Sort coroutine_backend choices lexicographically

When changing meson_options.txt, this script gets updated automatically
by QEMU tooling which sorts the choices lexicographically.

Fixes: ccc403ed5844 ("meson: Add wasm build in build scripts")
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-ID: <20250610204131.2862-4-shentey@gmail.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
7 weeks agoMAINTAINERS: Update Akihiko Odaki's affiliation
Akihiko Odaki [Sat, 31 May 2025 07:00:25 +0000 (16:00 +0900)] 
MAINTAINERS: Update Akihiko Odaki's affiliation

My contract with Daynix Computing Ltd. will expire by the end of May,
2025. As I may contribute to QEMU for my research, use my email address
at the lab.

As I'm the only maintainer of igb and no longer financially supported to
maintain it, change its status to Odd Fixes until someone steps up.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250531-rsg-v1-1-e0bae1e1d90e@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Thomas Huth <thuth@redhat.com>
7 weeks agoMAINTAINERS: Update the paths to the testing documentation files
Thomas Huth [Tue, 10 Jun 2025 05:37:34 +0000 (07:37 +0200)] 
MAINTAINERS: Update the paths to the testing documentation files

When the testing docs were moved to a separate subfolder, the entries
in the MAINTAINERS file were missed. Update them now.

Fixes: ff41da50308 ("docs/devel: Split testing docs from the build docs and move to separate folder")
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250610053734.10417-1-thuth@redhat.com>

7 weeks agotests/vm/README: fix documentation path in tests/vm/README
Haseung Bong [Sat, 7 Jun 2025 06:04:56 +0000 (15:04 +0900)] 
tests/vm/README: fix documentation path in tests/vm/README

The README file in tests/vm/ points to a non-existent file,
docs/devel/testing.rst. Update the README to point to
docs/devel/testing/main.rst, which now contains information
about VM testing.

Signed-off-by: Haseung Bong <hasueng@gmail.com>
Fixes: ff41da50308 ("docs/devel: Split testing docs from the build docs and move to separate folder")
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250607060456.28902-1-hasueng@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
7 weeks agotests/functional: add memlock tests
Alexandr Moshkov [Thu, 5 Jun 2025 06:59:11 +0000 (11:59 +0500)] 
tests/functional: add memlock tests

Add new tests to check the correctness of the `-overcommit memlock`
option (possible values: off, on, on-fault) by using
`/proc/{qemu_pid}/status` file to check in VmSize, VmRSS and VmLck
values:

* if `memlock=off`, then VmLck = 0;
* if `memlock=on`, then VmLck > 0 and almost all memory is resident;
* if `memlock=on-fault`, then VmLck > 0 and only few memory is resident.

Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
Message-ID: <20250605065908.299979-3-dtalexundeer@yandex-team.ru>
Signed-off-by: Thomas Huth <thuth@redhat.com>
7 weeks agotests/functional: add skipLockedMemoryTest decorator
Alexandr Moshkov [Thu, 5 Jun 2025 06:59:09 +0000 (11:59 +0500)] 
tests/functional: add skipLockedMemoryTest decorator

Used in future commit to skipping execution of a tests if the system's
locked memory limit is below the required threshold.

Signed-off-by: Alexandr Moshkov <dtalexundeer@yandex-team.ru>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250605065908.299979-2-dtalexundeer@yandex-team.ru>
Signed-off-by: Thomas Huth <thuth@redhat.com>
7 weeks agotests/functional: Speed up the avr_mega2560 test
Thomas Huth [Tue, 3 Jun 2025 18:47:10 +0000 (20:47 +0200)] 
tests/functional: Speed up the avr_mega2560 test

We can simply check for the expected pattern on the console,
no need to wait for two seconds here to search for the pattern
in the log at the end.

While we're at it, also remove the obsolete "timeout" variable
from this test.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250603184710.25651-1-thuth@redhat.com>

7 weeks agotests/functional: Use the 'none' machine for the VNC test
Thomas Huth [Tue, 3 Jun 2025 10:34:49 +0000 (12:34 +0200)] 
tests/functional: Use the 'none' machine for the VNC test

The VNC test currently fails if the default machine ("pc" for x86)
has not been compiled into the binary. Since we also can test VNC
when QEMU just shows the default monitor, let's avoid this problem
by simply using the "none" machine (which is always available)
here instead.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250603103449.32499-1-thuth@redhat.com>

7 weeks agohw/s390x/s390-virtio-ccw: Remove the deprecated 4.1 machine type
Thomas Huth [Mon, 19 May 2025 05:47:44 +0000 (07:47 +0200)] 
hw/s390x/s390-virtio-ccw: Remove the deprecated 4.1 machine type

With the upcoming release of QEMU 10.1, the s390-ccw-virtio-4.1 machine
will be older than 6 years, so according to our machine support policy,
it can be removed now. The V4_1 CPU feature group gets merged into the
minimum CPU feature group now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250519054744.36715-1-thuth@redhat.com>

7 weeks agotravis.yml: Remove the aarch64 job
Thomas Huth [Fri, 30 May 2025 11:54:54 +0000 (13:54 +0200)] 
travis.yml: Remove the aarch64 job

According to:

 https://docs.travis-ci.com/user/billing-overview/#partner-queue-solution

only s390x and ppc64le are still part of the free OSS tier in Travis.
aarch64 has been removed sometime during the last year. Thus remove
the aarch64 job from our .travis.yml file now to avoid that someone
burns non-OSS CI credits with this job by accident now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20250530115454.187727-1-thuth@redhat.com>

7 weeks agoseabios: update binaries to 1.17.0
Gerd Hoffmann [Wed, 11 Jun 2025 07:43:13 +0000 (09:43 +0200)] 
seabios: update binaries to 1.17.0

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 weeks agoseabios: update submodule to 1.17.0
Gerd Hoffmann [Wed, 11 Jun 2025 07:36:41 +0000 (09:36 +0200)] 
seabios: update submodule to 1.17.0

git shortlog rel-1.16.3..rel-1.17.0
-----------------------------------

Andrej Kruták (1):
      Add AHCI Power ON + ICC_ACTIVE into port setup code

Daniel Khodabakhsh (2):
      boot: Force display of the boot menu when boot-menu-wait is a negative number
      usb-hid: Support multiple USB HID devices by storing them in a linked list

Daniel Verkamp (3):
      vbe: Add VBE 2.0+ OemData field to struct vbe_info
      vgasrc: round up save/restore size
      vbe: implement function 09h (get/set palette data)

Daniil Tatianin (1):
      pciinit: don't misalign large BARs

Gerd Hoffmann (6):
      limit address space used for pci devices, part two
      drop obsolete acpi table code
      drop acpi tables and hex includes
      add romfile_loadbool()
      update pci_pad_mem64 handling
      ahci: add controller reset

Igor Mammedov (1):
      fix smbios blob length overflow

Jiaxun Yang (1):
      ahci: Fix hangs due to controller reset

Kevin O'Connor (14):
      vgasrc: Use curmode_g instead of vmode_g when mode is the current video mode
      vgasrc: Rename vgahw_get_linesize() to vgahw_minimum_linelength()
      stdvgamodes: No need to store pelmask in vga_modes[]
      stdvgamodes: Improve naming of dac palette tables
      stdvga: Rename CGA palette functions
      stdvga: Add comments to interface functions in stdvga.c
      stdvga: Rename stdvga_toggle_intensity() to stdvga_set_palette_blinking()
      stdvga: Rework stdvga palette index paging interface functions
      stdvga: Rename stdvga_set_text_block_specifier() to stdvga_set_font_location()
      stdvga: Rename stdvga_set_scan_lines() to stdvga_set_character_height()
      stdvga: Rename stdvga_get_vde() to stdvga_get_vertical_size()
      stdvga: Add stdvga_set_vertical_size() helper function
      stdvgaio: Only read/write one color palette entry at a time
      docs: Note v1.17.0 release

Mark Cave-Ayland (2):
      esp-scsi: terminate DMA transfer when ESP data transfer completes
      esp-scsi: indicate acceptance of MESSAGE IN phase data

Max Tottenham (1):
      Add LBA 64bit support for reads beyond 2TB.

Steven Price (1):
      vgabios: Fix generating modes list for static_functionality

nikolar via SeaBIOS (1):
      kconfig: fix the check-lxdialog.sh to work with gcc 14+

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
7 weeks agohw/net/i82596: Factor configure function out
Soumyajyotii Ssarkar [Sat, 7 Jun 2025 15:27:12 +0000 (20:57 +0530)] 
hw/net/i82596: Factor configure function out

Abstract the configure function.

Signed-off-by: Soumyajyotii Ssarkar <soumyajyotisarkar23@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20250607152711.108914-2-soumyajyotisarkar23@gmail.com>
[PMD: Split patch in 2]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>