]> git.ipfire.org Git - thirdparty/qemu.git/log
thirdparty/qemu.git
6 weeks agoi386/tdx: Add CPUID_24_0_EBX_AVX10_VL_MASK as supported
Xiaoyao Li [Tue, 12 May 2026 08:21:08 +0000 (16:21 +0800)] 
i386/tdx: Add CPUID_24_0_EBX_AVX10_VL_MASK as supported

AVX10 depends on CPUID_24_0_EBX_AVX10_VL_MASK as defined in
feature_dependencies[]. Currently CPUID_24_0_EBX_AVX10_VL_MASK is always
not supported for TDX, so AVX10 cannot be exposed to TD guest.

The TDX virtualization type of these bits is "XFAM & CPUID_Enabled &
Native": their value is determined by XFAM[5:7], the AVX10 CPUID bit,
and the native hardware value.

For simplicity, add CPUID_24_0_EBX_AVX10_VL_MASK to tdx_xfam_deps[]
under the AVX512/XFAM dependency, without separately checking the AVX10
bit. It's safe because any invalid combination supplied by the user will
be caught by tdx_check_features().

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Tested-by: Chenyi Qiang <chenyi.qiang@intel.com>
Link: https://lore.kernel.org/r/20260512082108.621596-4-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoi386/tdx: Make AMX alias bits supported
Xiaoyao Li [Tue, 12 May 2026 08:21:07 +0000 (16:21 +0800)] 
i386/tdx: Make AMX alias bits supported

When booting a TD guest on a platform that supports AMX alias bits, QEMU
emits the warning such as:

  qemu-system-x86_64: warning: TDX forcibly sets the feature: CPUID[eax=1Eh,ecx=01h].EAX.amx-int8-alias [bit 0]
  ...

Bit[3:0] of CPUID(0x1e,1).EAX alias the AMX CPUID bits from leaf 7.
Their TDX virtualization type is "CPUID_Enabled & Native": the value is
determined by the leaf-7 AMX bit they are aliased to and the native
hardware value.

These bits must be added to the TDX supported bits list so that they can
be enabled without triggering the forced-set warning. For simplicity,
mark them as supported whenever the corresponding AMX XFAM bit is
supported, rather than checking each aliased leaf-7 bit individually.
This reduces code complexity. Any platform that supports the AMX XFAM bit
but not these alias bits will still be handled correctly, since the TDX
module provides the real value via tdx_check_features().

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Tested-by: Chenyi Qiang <chenyi.qiang@intel.com>
Link: https://lore.kernel.org/r/20260512082108.621596-3-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoi386/tdx: Use .has_gpa field to check if the gpa is valid
Xiaoyao Li [Tue, 12 May 2026 08:21:06 +0000 (16:21 +0800)] 
i386/tdx: Use .has_gpa field to check if the gpa is valid

When translating the QAPI type GuestPanicInformationTdx into its C
struct, the generated code provides a .has_gpa boolean field to indicate
whether the optional gpa field is present.

Replace the magic sentinel value -1ULL, previously used to signal "no
valid GPA", with the idiomatic .has_gpa field.  This removes the
implicit sentinel coupling and makes the validity check self-documenting.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Link: https://lore.kernel.org/r/20260512082108.621596-2-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agomachine: Deprecate memory-encryption
Xiaoyao Li [Tue, 12 May 2026 08:44:58 +0000 (16:44 +0800)] 
machine: Deprecate memory-encryption

We've had 'confidential-guest-support' for long enough that no one should
be using 'memory-encryption' anymore.

Deprecate 'memory-encryption' by adding notes in docs/about/deprecated.rst
and print a warning when 'memory-encryptio' is used.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/qemu-devel/aMPYkUsytGxLPIM7@redhat.com/
Link: https://lore.kernel.org/r/20260512084458.622465-6-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoqemu-options: Add description of tdx-guest object
Xiaoyao Li [Tue, 12 May 2026 08:44:57 +0000 (16:44 +0800)] 
qemu-options: Add description of tdx-guest object

Add description of tdx-guest object so that QEMU doc page can have the
description.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20260512084458.622465-5-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoqemu-options: Add confidential-guest-support to machine options
Xiaoyao Li [Tue, 12 May 2026 08:44:56 +0000 (16:44 +0800)] 
qemu-options: Add confidential-guest-support to machine options

"confidential-guest-support" is the recommended property to configure
machine with confidential computing technology instead of
"memory-encryption".

Add "confidential-guest-support" to machine options and call out
explicitly "memory-encryption" is the alias of it and not recommended.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20260512084458.622465-4-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoqemu-options: Change memory-encryption to confidential-guest-support in the example
Xiaoyao Li [Tue, 12 May 2026 08:44:55 +0000 (16:44 +0800)] 
qemu-options: Change memory-encryption to confidential-guest-support in the example

"confidential-guest-support" is the recommended property instead of
"memory-encryption". Switch to "confidential-guest-support" in the
example of sev-guest.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20260512084458.622465-3-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoi386/sev: Remove the example that references memory-encryption
Xiaoyao Li [Tue, 12 May 2026 08:44:54 +0000 (16:44 +0800)] 
i386/sev: Remove the example that references memory-encryption

"confidential-guest-support" is the recommended property to configure
sev for the machine, and amd-memory-encryption.rst has already switched
to use "confidential-guest-support" in the example.

Instead of changing "memory-encryption" to "confidential-guest-support"
in the comment of struct SevGuestState, just drop the example for
simplicity.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Link: https://lore.kernel.org/r/20260512084458.622465-2-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: use the register page to set registers
Doru Blânzeanu [Tue, 28 Apr 2026 13:50:53 +0000 (16:50 +0300)] 
target/i386/mshv: use the register page to set registers

Update mshv_store_regs to use the register page when it is mmapped and
valid to set registers.
Otherwise use the ioctls to set the registers.

Signed-off-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Reviewed-By: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260428135053.251200-7-dblanzeanu@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: use the register page to get registers
Doru Blânzeanu [Tue, 28 Apr 2026 13:50:52 +0000 (16:50 +0300)] 
target/i386/mshv: use the register page to get registers

Change the mshv_load_regs to use the register page when it is mmapped
and is valid.
Otherwise use the existing logic that uses ioctls to fetch registers.

When retrieving the special registers, there are some registers that are
not present in the register page: TR, LDTR, GDTR, IDTR, CR2, APIC_BASE.
For this ones we still need to use ioctls to correctly fetch.

Signed-off-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260428135053.251200-6-dblanzeanu@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: hv_vp_register_page setup for the vcpu
Doru Blânzeanu [Tue, 28 Apr 2026 13:50:51 +0000 (16:50 +0300)] 
target/i386/mshv: hv_vp_register_page setup for the vcpu

When the vcpu is created, call mmap to configure access to the register page.

Update CPUArchState to store a pointer to the mmapped hv_vp_register_page.

Signed-off-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260428135053.251200-5-dblanzeanu@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoinclude/hw/hyperv: add hv_vp_register_page struct definition
Doru Blânzeanu [Tue, 28 Apr 2026 13:50:50 +0000 (16:50 +0300)] 
include/hw/hyperv: add hv_vp_register_page struct definition

Define the `hv_vp_register_page` structure that the linux kernel uses
to allow access to vcpu registers.

This structure is going to be used in later patches to access vcpu
registers.

Signed-off-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260428135053.251200-4-dblanzeanu@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel: remove unnecessary #ifdefs
Paolo Bonzini [Thu, 25 Jun 2026 17:35:18 +0000 (19:35 +0200)] 
accel: remove unnecessary #ifdefs

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: migrate CET/SS MSRs
Magnus Kulke [Fri, 17 Apr 2026 10:56:07 +0000 (12:56 +0200)] 
target/i386/mshv: migrate CET/SS MSRs

This change migrates the MSRs required for CET shadow stack and indirect
branch tracking. They are gated behind cet_ss_support || cet_ibt_support
mshv processor feature flags.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-24-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: migrate MTRR MSRs
Magnus Kulke [Fri, 17 Apr 2026 10:56:05 +0000 (12:56 +0200)] 
target/i386/mshv: migrate MTRR MSRs

This change roundtrips memory access/caching MSRs. The mapping scheme
is a bit more elaborate on these, so we have added a special handling
instead of individual entries in the MSR mapping table.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-22-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: migrate MSRs
Magnus Kulke [Fri, 17 Apr 2026 10:56:04 +0000 (12:56 +0200)] 
target/i386/mshv: migrate MSRs

In this change the we rewrite the existing MSR logic to make MSRs
migratable:

- we map them on existing QEMU fields in the CPU. A table and a macro
  MSHV_ENV_FIELD is used to associate a HV register name to the their msr
  index and their offset in the cpu state struct. The list is not
  exhaustive and will be extended in follow-up commits.
- mshv_set/get_msrs() fns are called in the arch_load/store_vcpu_state()
  fns. they use use generic registers ioctl's and map the input/output
  via load/store_to/from_env() from/to the hv register content to the
  cpu state representation.
- init_msrs() has been moved from mshv-vcpu to the msr source file
- we need to perform some filtering of MSR because before writing and
  reading, because the hvcalls will fail if the partition doesn't
  support a given MSRs.
- Some MSRs are partition-wide and so we will only write the to on the
  BSP.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-21-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: reconstruct hflags after load
Magnus Kulke [Fri, 17 Apr 2026 10:56:16 +0000 (12:56 +0200)] 
target/i386/mshv: reconstruct hflags after load

hflags is a cached bitmap derived from standard and special regs. We
want to reconstruct this state after regs and sregs have been read from
the hypervisor, similar to how it's one in other accelerators.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-33-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: migrate XSAVE state
Magnus Kulke [Fri, 17 Apr 2026 10:56:15 +0000 (12:56 +0200)] 
target/i386/mshv: migrate XSAVE state

We implement fn's that roundtrip XSAVE state in migration. We are using
the xsave_helper routines to move individual components from CPUX86State
to an xsave_buf and then we have to compact the buffer to XSAVEC format,
which is what the hypervisor expects.

And the same applies in the other direction for restoring state from the
hypervisor.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-32-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agogitlab: greatly expand captured info about CI runner environment
Daniel P. Berrangé [Wed, 24 Jun 2026 12:46:57 +0000 (13:46 +0100)] 
gitlab: greatly expand captured info about CI runner environment

To aid in debugging wierd CI failures we need greater information
about the CI runner environment. It is usually container based
and can have some unexpected characteristics that significantly
differ from a developer's local environment.

This captures the mount list, CPU model, memory information,
device node lists, kernel info, user identity and all environment
variables.

Since this information can get quite large it is not emitted
directly in the logs, rather it is exposed in job artifacts
under the "ci-runner-env" directory.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-7-berrange@redhat.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
6 weeks agogitlab: pull before_script logic into .base_meson_job_template
Daniel P. Berrangé [Wed, 24 Jun 2026 12:46:56 +0000 (13:46 +0100)] 
gitlab: pull before_script logic into .base_meson_job_template

This ensures that all jobs have the $JOBS env set and capture the
packages.txt content (where available) in their logs, and all use
the job section headers.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-6-berrange@redhat.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
6 weeks agogitlab: pull ccache setup into .base_meson_ccache_job_template
Daniel P. Berrangé [Wed, 24 Jun 2026 12:46:55 +0000 (13:46 +0100)] 
gitlab: pull ccache setup into .base_meson_ccache_job_template

This provides a consistent ccache setup across all build jobs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-5-berrange@redhat.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
6 weeks agogitlab: use .base_meson_job_template from crossbuild jobs
Daniel P. Berrangé [Wed, 24 Jun 2026 12:46:54 +0000 (13:46 +0100)] 
gitlab: use .base_meson_job_template from crossbuild jobs

This ensures that crossbuild jobs capture the build/meson-logs
content as artifacts to aid in debugging.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-4-berrange@redhat.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
6 weeks agogitlab: move .meson_job_template into base.yaml
Daniel P. Berrangé [Wed, 24 Jun 2026 12:46:53 +0000 (13:46 +0100)] 
gitlab: move .meson_job_template into base.yaml

Rename .meson_job_template to .base_meson_job_template and move
it into base.yml, in prep for wider reuse.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-3-berrange@redhat.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
6 weeks agogitlab: remove unused .cross_test_artifacts template
Daniel P. Berrangé [Wed, 24 Jun 2026 12:46:52 +0000 (13:46 +0100)] 
gitlab: remove unused .cross_test_artifacts template

This is unused since

  commit 0d1137550bbf3af7ebe34801a9bff5a4839cc34e
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   Thu Dec 18 09:58:33 2025 +1100

    gitlab: Remove 32-bit host testing

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260624124657.2725376-2-berrange@redhat.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
6 weeks agoMerge tag 'ui-pr-v1' of https://gitlab.com/marcandre.lureau/qemu into staging
Stefan Hajnoczi [Thu, 25 Jun 2026 20:58:35 +0000 (16:58 -0400)] 
Merge tag 'ui-pr-v1' of https://gitlab.com/marcandre.lureau/qemu into staging

UI patches

- ui: better console hotplug support
- vga: implement blinking

To: qemu-devel@nongnu.org
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEh6m9kz+HxgbSdvYt2ujhCXWWnOUFAmo7wlsACgkQ2ujhCXWW
# nOUAaA/+OWDMM1SdVCk9M9K/sWiSP2fsXAB+Zpdj9mUKz4B86ulVAc5Wv0ROMKyC
# hO9XT8ksCC5Xuehhfb1gxhazA46z9QWDiZ1Drnm945WUJF9U6zcqMS9w343HNL/p
# HE+wCxz+D2Izx0wrlPHVPnNp+54Ge/YK4vNjfGKSXdwFGgQPfqMX3D+chL57/quG
# xttjbDNixplqxKGqzmQRIZKgifyrMUs1knLv+bi7BHGnKIws1ww5EwOAF9zfY626
# ouo5knVNqRKMekCudIudWIYKNtVSV2WPQz/k2AdNq5L0NeI2Mj6tFswVSfLlZ1LZ
# Np0Ijeip2EOYLuPTZJKZmAWlsUK1E/VXqpehzmZdi07i37kHJBafppPOD2//P3Bs
# UB8pXVcjlXrHxEwkwEKRLHsAbivmD/bszLeNj+/E1V9M7P9pIc0jiEYPG+9WniYv
# CJZ9w9Q9S7C1IKjRIRtR/veLI4MxBu/gz5DG8qzD2GfRVpGUV8J5loSc2CidBvCR
# Vk7fetkBLh9vWgWqqbBBguHieiqoWqJZ3OL+F+tMRfiA7WIJgl2K6hRlmA5baQpW
# pD794a2bn6h6jK26natfdA6Ns4NfWc4R/3lZRNqX3cPjyAy98nxdmCQwDJBV61e9
# e9YKU2tJ6zruUs3Oa9/XW/W4kyEm+aBXdysg5KziXUKLx3pHTOY=
# =N7bZ
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 24 Jun 2026 07:41:15 EDT
# gpg:                using RSA key 87A9BD933F87C606D276F62DDAE8E10975969CE5
# gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" [full]
# gpg:                 aka "Marc-André Lureau <marcandre.lureau@gmail.com>" [full]
# Primary key fingerprint: 87A9 BD93 3F87 C606 D276  F62D DAE8 E109 7596 9CE5

* tag 'ui-pr-v1' of https://gitlab.com/marcandre.lureau/qemu: (35 commits)
  vga: implement text mode character blink
  tests/qtest: add D-Bus display hotplug test
  ui/dbus: handle console hotplug/unplug events
  ui/console: unregister console from QOM tree on close
  ui/console: register console in QOM tree dynamically
  ui/gtk: handle console hotplug/unplug events
  ui/gtk: centralize console menu and shortcut management
  ui/gtk: fix tab re-insertion order on window close
  ui/gtk: move global display settings out of per-console init
  ui/gtk: convert VirtualConsole storage from fixed array to GPtrArray
  ui/console-vc: fire ADDED/REMOVED notifications
  ui/console: fire console ADDED/REMOVED notifications
  ui/console: add console event notifier infrastructure
  ui/gtk: implement display cleanup
  ui/dbus: implement display cleanup
  ui/cocoa: implement display cleanup
  ui/egl: implement display and EGL cleanup
  ui/spice-app: implement display cleanup
  ui/sdl2: implement display cleanup
  ui/curses: implement display cleanup
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agotests/docker: bump emsdk-wasm64-cross zlib version to 1.3.2
Stefan Hajnoczi [Thu, 25 Jun 2026 19:33:20 +0000 (15:33 -0400)] 
tests/docker: bump emsdk-wasm64-cross zlib version to 1.3.2

Container image builds have started failing because zlib.net no longer
hosts the 1.3.1 tarball. Move to the 1.3.2 release from February 17,
2026.

  $ make docker-image-emsdk-wasm64-cross
  changing dir to build for make "docker-image-emsdk-wasm64-cross"...
  make[1]: Entering directory 'qemu/build'
    BUILD   emsdk-wasm64-cross
  ...
  xz: (stdin): File format not recognized
  tar: Child returned status 1
  tar: Error is not recoverable: exiting now
  Error: building at STEP "RUN curl -Ls https://zlib.net/zlib-$ZLIB_VERSION.tar.xz |     tar xJC /zlib --strip-components=1": while running runtime: exit status 2
  make[1]: *** [qemu/tests/docker/Makefile.include:43: docker-image-emsdk-wasm64-cross] Error 2
  make[1]: Leaving directory 'qemu/build'
  make: *** [GNUmakefile:6: build] Error 2

Cc: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Cc: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-id: 20260625193320.260312-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agoMerge tag 'pbouvier/pr/gitlab_ci-20260623' of https://gitlab.com/p-b-o/qemu into...
Stefan Hajnoczi [Thu, 25 Jun 2026 19:34:37 +0000 (15:34 -0400)] 
Merge tag 'pbouvier/pr/gitlab_ci-20260623' of https://gitlab.com/p-b-o/qemu into staging

Changes:
- [PATCH] gitlab: disable macOS jobs in forks (=?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>)
Link: https://lore.kernel.org/qemu-devel/20260610091700.2772973-1-berrange@redhat.com
# -----BEGIN PGP SIGNATURE-----
#
# iQGzBAABCgAdFiEEN8FWlNi6l2Sxlz/btEQ30ZwoYt8FAmo6vkMACgkQtEQ30Zwo
# Yt9/PgwAtOYo/+RM74Yp5+ewifpv6A9+F2kp5WlLKDdOqK34BQwNrw5O3eJFfjvh
# lwerFStOCdvxq25umsyjxi2SIX+9VRJtRtosSxk3SwzGecnVWjhvkpq/oLQUnQ2u
# eeAGqF6OHylFAcM4QoEjAva4IlerdEeY6X6T30Xj6suA7ym9EX9SoBIogOPrC9hL
# NdjG0sZ2Q3JRYq/ZUXQ9l49+BTNq4ue7w4AUT1OjnHcUX+0Sptj91b+lLf3XgUu/
# 0Fxw2cm/FN4eV0ik2hmWREMM2me2gj1pDwyL3cBEvm/DfF/43y/xESUdMiKtdPeT
# R2m42dAocJK7pzv5CYwno1f0hn4Gj3Qoy9CjVwGp0SOCFmA91608dZ2u889CRin1
# Xi7EQysA9x5EOCOg1l89QXFoz58On6K2KS10EbkNWr0ZHsgdSvYkFD/u0bEdzCkz
# +3rdLdlRMBaQyrC/F2IKB2u4RTYaaV9+RYYKrJXR2tQMu4g1i2zc5Jsi+5c79RcG
# on8rDKv7
# =nRsY
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 23 Jun 2026 13:11:31 EDT
# gpg:                using RSA key 37C15694D8BA9764B1973FDBB44437D19C2862DF
# gpg: Good signature from "Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.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: 37C1 5694 D8BA 9764 B197  3FDB B444 37D1 9C28 62DF

* tag 'pbouvier/pr/gitlab_ci-20260623' of https://gitlab.com/p-b-o/qemu:
  gitlab: disable macOS jobs in forks

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agoMerge tag 'next-pull-request' of https://gitlab.com/peterx/qemu into staging
Stefan Hajnoczi [Thu, 25 Jun 2026 19:34:25 +0000 (15:34 -0400)] 
Merge tag 'next-pull-request' of https://gitlab.com/peterx/qemu into staging

Migration and mem pull request

- Maciej's patch to fix rare crash in VFIO multifd thread pool mgmt
- Peter's cleanup of @cpr-exec-command doc in migration.json
- Akihiko's patch to fix a TSAN warning on ram_list operations
- Bibo's migration-test coverage for loongarch
- Peter's update on a-b-boot image
- Marc-André's virtio-mem fix for CoCo

# -----BEGIN PGP SIGNATURE-----
#
# iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCajqAMhIccGV0ZXJ4QHJl
# ZGhhdC5jb20ACgkQO1/MzfOr1wbvoQEAytdLWqLYwQz2ZLI+8jyqQhznHrzOXQYO
# JV0rQxv4AzMBAOSoNHlKc1T87B4IdUuu8DffxhaFbqfxxlZBma3PYewJ
# =hvNA
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue 23 Jun 2026 08:46:42 EDT
# gpg:                using EDDSA key B9184DC20CC457DACF7DD1A93B5FCCCDF3ABD706
# gpg:                issuer "peterx@redhat.com"
# gpg: Good signature from "Peter Xu <xzpeter@gmail.com>" [full]
# gpg:                 aka "Peter Xu <peterx@redhat.com>" [full]
# Primary key fingerprint: B918 4DC2 0CC4 57DA CF7D  D1A9 3B5F CCCD F3AB D706

* tag 'next-pull-request' of https://gitlab.com/peterx/qemu:
  system/physmem: make ram_block_discard_range() handle guest_memfd
  tests: add unit tests for RamDiscardManager multi-source aggregation
  system/memory: add RamDiscardManager reference counting and cleanup
  system/physmem: destroy ram block attributes before RCU-deferred reclaim
  system/memory: implement RamDiscardManager multi-source aggregation
  system/ram-discard-manager: drop replay from source interface
  virtio-mem: remove replay_populated/replay_discarded implementation
  system/ram-discard-manager: implement replay via is_populated iteration
  system/memory: constify section arguments
  system/memory: move RamDiscardManager to separate compilation unit
  system/memory: split RamDiscardManager into source and manager
  migration/tests: Update a-b-boot images for all archs
  tests/qtest/migration: Add migration test on loongarch
  migration: Use OBJECT_DECLARE_SIMPLE_TYPE
  system/memory: Remove MAX_PHYS_ADDR
  system/physmem: Synchronize ram_list accesses
  qapi/migration: Remove @cpr-exec-command doc in MigrationParameter
  thread-pool: Allow at least 1 thread in thread_pool_adjust_max_threads_to_work()

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
6 weeks agotarget/i386/mshv: migrate pending ints/excs
Magnus Kulke [Fri, 17 Apr 2026 10:56:13 +0000 (12:56 +0200)] 
target/i386/mshv: migrate pending ints/excs

We use PENDING_INTERRUPTION, INTERRUPT_STATE, PENDING_EVENT hv registers
to map and roundtrip from/to CPUX86State.

We ignore HV_REGISTER_PENDING_EVENT1 which represent events for nested
virt contexts, as we don't support nested virt with MSHV currently.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-30-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: move msr code to arch
Magnus Kulke [Fri, 17 Apr 2026 10:56:01 +0000 (12:56 +0200)] 
target/i386/mshv: move msr code to arch

The MSR code is x86 specific, hence it's better suited in the arch
tree.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-18-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: enable dirty page tracking
Magnus Kulke [Fri, 17 Apr 2026 10:56:18 +0000 (12:56 +0200)] 
accel/mshv: enable dirty page tracking

This change introduces the functions required to perform dirty page
tracking to speed up migrations. We are using the sync, global_start,
and global_stop hooks.

The sync is implemented in batches.

Before we can disable the dirty page tracking we have to set all dirty bits.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-35-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: expose mshv_get_generic_regs
Magnus Kulke [Fri, 17 Apr 2026 10:56:03 +0000 (12:56 +0200)] 
target/i386/mshv: expose mshv_get_generic_regs

We expose the fn, so we can call them from the other source files
(msr.c).

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-20-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: store partition proc features
Magnus Kulke [Fri, 17 Apr 2026 10:56:02 +0000 (12:56 +0200)] 
accel/mshv: store partition proc features

We retrieve and store processor features on the state, so we can query
them later when deciding which MSRs to migrate.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-19-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: remove redundant msi controller
Magnus Kulke [Fri, 17 Apr 2026 10:55:57 +0000 (12:55 +0200)] 
accel/mshv: remove redundant msi controller

The remaining MsiControl infrastructure can be removed now

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-14-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: reserve ioapic routes on s->irq_routes
Magnus Kulke [Fri, 17 Apr 2026 10:55:56 +0000 (12:55 +0200)] 
accel/mshv: reserve ioapic routes on s->irq_routes

We reserve 24 ioapic routes using the new functions that operate on the
mshv apic state.

commit/add_msi_routing() fn's can be removed now.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-13-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: use s->irq_routes in commit_routes
Magnus Kulke [Fri, 17 Apr 2026 10:55:55 +0000 (12:55 +0200)] 
accel/mshv: use s->irq_routes in commit_routes

In mshv_irqchip_commit_routes() the entries that have been accumulated
in s->irq_routes are committed directly to MSHV's irqchip.

The old commit_msi_routing_table() fn will be removed in a subsquent commit.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-12-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: update s->irq_routes in release_virq
Magnus Kulke [Fri, 17 Apr 2026 10:55:54 +0000 (12:55 +0200)] 
accel/mshv: update s->irq_routes in release_virq

The state's irq_routes field will be updated when an irqchip's gsi
is requested to be released.

The old remove_msi_routing() fn is redundant and can be removed.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-11-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: update s->irq_routes in update_msi_route
Magnus Kulke [Fri, 17 Apr 2026 10:55:53 +0000 (12:55 +0200)] 
accel/mshv: update s->irq_routes in update_msi_route

The state's irq_routes field will be updated when an irqchip's gsi
is requested to be updated with a new dest/vector.

The old set_msi_routing() fn is redundant and can be removed.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-10-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: update s->irq_routes in add_msi_route
Magnus Kulke [Fri, 17 Apr 2026 10:55:52 +0000 (12:55 +0200)] 
accel/mshv: update s->irq_routes in add_msi_route

The irq_routes field of the state is populated with native mshv irq
route entries. The allocation logic is modelled after the KVM
implementation: we will always allocate a minumum of 64 entries and use
a bitmask to find/set/clear GSIs.

The old implementation of add_msi_routes will be removed in a subsequent
commit.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-9-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: add irq_routes to state
Magnus Kulke [Fri, 17 Apr 2026 10:55:51 +0000 (12:55 +0200)] 
accel/mshv: add irq_routes to state

This change adds fields related to irq routing to the MSHV state, following
similar fields in the KVM implementation.

So far the fields are only initialized, they will be used in subsequent
commits for bookkeeping purposes and storing uncommitted interrupt routes.

The TYPE_MSHV_ACCEL defines have been moved to the header.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-8-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/accel-irq: add generic commit_route_changes
Magnus Kulke [Fri, 17 Apr 2026 10:55:50 +0000 (12:55 +0200)] 
accel/accel-irq: add generic commit_route_changes

A generic accel_irqchip_commit_route_changes() fn has been introduced for
usage in the MSHV accelerator. The respective kvm_ fn can be removed
since we handle the commit op in a generic way.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-7-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/accel-irq: add generic begin_route_changes
Magnus Kulke [Fri, 17 Apr 2026 10:55:49 +0000 (12:55 +0200)] 
accel/accel-irq: add generic begin_route_changes

A generic accel_irqchip_begin_route_change() fn has been introduced for
usage in the MSHV accelerator. It replaces the respective kvm_ fn.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-6-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/accel-irq: add AccelRouteChange abstraction
Magnus Kulke [Fri, 17 Apr 2026 10:55:48 +0000 (12:55 +0200)] 
accel/accel-irq: add AccelRouteChange abstraction

The accelerated irqchip routines use a record of changes to batch
changes when programming routes.

Currently this mechanism is coupled to the KVM accelerator, this change
introduces an abstraction that replaces KVMRouteChange and keeps a
pointer to an abstract AccelState instead of the concrete type,
converting the state where necessary.

This is done to further align the irqchip programming in the MSHV
accelerator with the existing KVM code in QEMU. Subsequent commits will
introduce AccelRouteChange to the MSHV accelerator code.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-5-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: impl init/load/store_vcpu_state
Magnus Kulke [Fri, 17 Apr 2026 10:55:47 +0000 (12:55 +0200)] 
target/i386/mshv: impl init/load/store_vcpu_state

In migration we will handle more than registers, so we rework the
routines that were used to load & store CPU registers from/to the
hypervisor into more explicit init/load/store_vcpu_state() functions
that can be called from the appropriate hooks.

load/store_regs() still exists for the purpose of MMIO emulation, but it
will only address standard and special x86 registers.

Functions to retrieve FPU and XCR0 state from the hypervsisor have been
introduced.

MSR and APIC state covered are covered only as part of init_vcpu(). They
are not yet part of the load/store routines.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-4-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: use generic FPU/xcr0 state
Magnus Kulke [Fri, 17 Apr 2026 10:55:46 +0000 (12:55 +0200)] 
target/i386/mshv: use generic FPU/xcr0 state

Instead of using an mshv-specific FPU state representation we switch to
the generic i386 representation of the registers.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-3-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: use arch_load/store_reg fns
Magnus Kulke [Fri, 17 Apr 2026 10:55:45 +0000 (12:55 +0200)] 
target/i386/mshv: use arch_load/store_reg fns

Improved consistency around the naming of load/store register fn's. this
is required since we want to roundtrip more registers in a migration
than what's currently required for MMIO emulation.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260417105618.3621-2-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: disable la57 (5lvl paging)
Magnus Kulke [Thu, 16 Apr 2026 12:11:16 +0000 (14:11 +0200)] 
accel/mshv: disable la57 (5lvl paging)

This change disable la57 paging on the mshv hypervisor on both the
mshv processor feature bitmap and mask the cpuid feature leaf to the
guest.

Since the removal of hypervisor-assisted gva=>gpa translation in
1c85a4a3d7 we have seen MMIO errors in guests on la57-enabled hw. We
will have to investigate and test this further.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Reviewed-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-10-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: use hv-provided [0xD,1+2].EBX
Magnus Kulke [Thu, 16 Apr 2026 12:11:15 +0000 (14:11 +0200)] 
target/i386/mshv: use hv-provided [0xD,1+2].EBX

We cannot statically set the responses for CPUID[0xD,{1,2}].EBX, b/c
those are dynamic, dependent on which features the guest enables.

Hence we mask EBX when registering answers for those subleaves at the
hypervisor, which will result in the hypervisor providing us answers,
considering XCR0 and XSS.

The reported size now reflects the field masks properly (without the
mask they were 576 and 10728, which is wrong):

$ cpuid -l 0xd -s 0
CPU 0:
   XSAVE features (0xd/0):
      XCR0 valid bit field mask               = 0x00000000000600e7
      ...
      bytes required by fields in XCR0        = 0x00002b00 (11008)
      bytes required by XSAVE/XRSTOR area     = 0x00002b00 (11008)

$ cpuid -l 0xd -s 1
CPU 0:
   XSAVE features (0xd/1):
      ...
      SAVE area size in bytes                     = 0x000029c0 (10688)
      IA32_XSS lower 32 bits valid bit field mask = 0x00001800
      IA32_XSS upper 32 bits valid bit field mask = 0x00000000

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-9-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: populate xsave area offsets
Magnus Kulke [Thu, 16 Apr 2026 12:11:14 +0000 (14:11 +0200)] 
target/i386/mshv: populate xsave area offsets

This function is copied verbatim from kvm_cpu_xsave_init(), for MSHV we
need to populate the offsets similarly.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-8-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386: query mshv accel for supported cpuids
Magnus Kulke [Thu, 16 Apr 2026 12:11:13 +0000 (14:11 +0200)] 
target/i386: query mshv accel for supported cpuids

We implement mshv_get_supported_cpuid() and invoke it in
x86_cpu_get_supported_feature_word() retrieve the cpu features that the
host is supporting. Initially we mask the virtualization capabilitities
potentially we might need to mask more in the future.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-7-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: set cpu model name on -cpu host
Magnus Kulke [Thu, 16 Apr 2026 12:11:12 +0000 (14:11 +0200)] 
target/i386/mshv: set cpu model name on -cpu host

By registering a cpu_accel_class for mshv, we can report an accurate
model name on -cpu host.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-6-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: change cpuid mask to UINT32_MAX
Magnus Kulke [Thu, 16 Apr 2026 12:11:11 +0000 (14:11 +0200)] 
target/i386/mshv: change cpuid mask to UINT32_MAX

The current implementation would only override the feature bits that are
enabled, however we also want to consider disabled features, hence all
bits are set on the masks in the hypercall argument.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-5-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: fix various cpuid traversal bugs
Magnus Kulke [Thu, 16 Apr 2026 12:11:10 +0000 (14:11 +0200)] 
target/i386/mshv: fix various cpuid traversal bugs

- Hardcoded max_leaf was not accurate. We query leaf 0x0 and 0x80000000 to
  get the actual max leaves

- On all 0 zeroes on leaf 0x0d, we register 0-63 subleaves with zeros
  indicating XSAVE is disabled

- Subleaf 0 was hardcoded, so the Hypervisor returned defaults for other
  subleaves

- Subleaf 0 was hardcoded, so we were passing 0 instead of actual subleaf
  when adding entries. We now pass the correct subleaf value to
  add_cpuid_entry()

- Leaves 0x04,0x07,0d,0f,10 weren't marked as subleaf-specific

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-4-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agotarget/i386/mshv: fix cpuid propagation bug
Magnus Kulke [Thu, 16 Apr 2026 12:11:09 +0000 (14:11 +0200)] 
target/i386/mshv: fix cpuid propagation bug

The list argument was missing a pointer and hence e.g. -cpu qemu64 and
-cpu EPYC would produce the same of cpuid leaves.

Fixes: 4fa04dd1621 ("target/i386: Register CPUID entries with MSHV")
Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-3-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agoaccel/mshv: use mshv_create_partition_v2 payload
Magnus Kulke [Thu, 16 Apr 2026 12:11:08 +0000 (14:11 +0200)] 
accel/mshv: use mshv_create_partition_v2 payload

When using the extended request format we can instruct the hypervisor to
provision enough space for requested XSAVE features. This is required
for supporting QEMU models provided via the -cpu flag properly.

Signed-off-by: Magnus Kulke <magnuskulke@linux.microsoft.com>
Acked-by: Wei Liu <wei.liu@kernel.org>
Reviewed-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com>
Reviewed-by: Doru Blânzeanu <dblanzeanu@linux.microsoft.com>
Link: https://lore.kernel.org/r/20260416121116.527927-2-magnuskulke@linux.microsoft.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
6 weeks agovga: implement text mode character blink
Marc-André Lureau [Mon, 25 May 2026 08:19:44 +0000 (12:19 +0400)] 
vga: implement text mode character blink

When bit 3 of the VGA Attribute Mode Control register is set, attribute
bit 7 switches from selecting bright background colors to enabling
character blink.

Implement this by tracking a separate blink phase timer that toggles
every 32 frames (matching real VGA hardware frame counter bit 5 @60hz),
and rendering blinking characters by replacing their foreground with
background during the off phase.

As with cursor, no VMState migration of the fields, as they are
transient display-side states.

Related to: https://gitlab.com/qemu-project/qemu/-/work_items/1585
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260525081944.1494798-1-marcandre.lureau@redhat.com>

6 weeks agotests/qtest: add D-Bus display hotplug test
Marc-André Lureau [Tue, 23 Jun 2026 07:44:49 +0000 (11:44 +0400)] 
tests/qtest: add D-Bus display hotplug test

Add a qtest that verifies display consoles are dynamically added and
removed over D-Bus when a bochs-display device is hotplugged and
unplugged on a q35 machine.

The test plugs device_add a bochs-display, waits for the DEVICE_ADDED
QMP event, and checks that the D-Bus VM interface reports a second
console. It then device_del it, forces a system reset
(q35 removal is ACPI-based and needs guest cooperation qtest cannot
provide), waits for DEVICE_DELETED, and checks the console count again.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-34-4656aec3398d@redhat.com>

6 weeks agoui/dbus: handle console hotplug/unplug events
Marc-André Lureau [Tue, 23 Jun 2026 07:44:48 +0000 (11:44 +0400)] 
ui/dbus: handle console hotplug/unplug events

Subscribe to QemuConsoleEvent notifications to dynamically add and
remove D-Bus display consoles. This mirrors the GTK backend's
handling added in the previous commits.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-33-4656aec3398d@redhat.com>

6 weeks agoui/console: unregister console from QOM tree on close
Marc-André Lureau [Tue, 23 Jun 2026 07:44:47 +0000 (11:44 +0400)] 
ui/console: unregister console from QOM tree on close

Call object_unparent() in graphic_console_close() to remove the
console from /backend/console[N]. This drops the QOM tree
reference, while the initial object_new() reference keeps the
console alive for potential reuse.

When graphic_console_init() reuses a closed console, re-register
it in the QOM tree.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-32-4656aec3398d@redhat.com>

6 weeks agoui/console: register console in QOM tree dynamically
Marc-André Lureau [Tue, 23 Jun 2026 07:44:46 +0000 (11:44 +0400)] 
ui/console: register console in QOM tree dynamically

Consoles created after init_displaystate() (e.g. hotplugged
display devices) were never added to the /backend/console[N]
QOM tree. Extract qemu_console_add_to_qom() and call it from
qemu_console_register() when the display is already initialized.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-31-4656aec3398d@redhat.com>

6 weeks agoui/gtk: handle console hotplug/unplug events
Marc-André Lureau [Tue, 23 Jun 2026 07:44:45 +0000 (11:44 +0400)] 
ui/gtk: handle console hotplug/unplug events

Register a console notifier so the GTK display dynamically creates and
destroys VirtualConsole tabs when graphic consoles are added or removed
at runtime (e.g. vfio-pci with display=on hotplug).

Add skips consoles that already have a VC binding, remove skips unknown
consoles.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-30-4656aec3398d@redhat.com>

6 weeks agoui/gtk: centralize console menu and shortcut management
Marc-André Lureau [Tue, 23 Jun 2026 07:44:44 +0000 (11:44 +0400)] 
ui/gtk: centralize console menu and shortcut management

Replace the per-console gd_vc_menu_init() with gd_rebuild_vc_menu()
that tears down and rebuilds all console radio menu items and
Ctrl+Alt+N accelerators at once. This is called from initialization
and whenever consoles are detached or reattached.

Shortcuts now skip detached (windowed) consoles, so they always map
to reachable tabs. Rename gd_vc_gfx_init() to add_gfx_console()
and simplify the init function signatures now that menu creation is
decoupled.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-29-4656aec3398d@redhat.com>

6 weeks agoui/gtk: fix tab re-insertion order on window close
Marc-André Lureau [Tue, 23 Jun 2026 07:44:43 +0000 (11:44 +0400)] 
ui/gtk: fix tab re-insertion order on window close

Add gd_vc_notebook_pos() which computes the correct notebook position
for a console by counting only non-detached (non-windowed) tabs before
it. Use it in gd_tab_window_close() so a re-attached tab is inserted
at its logical position rather than appended at the end.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-28-4656aec3398d@redhat.com>

6 weeks agoui/gtk: move global display settings out of per-console init
Marc-André Lureau [Tue, 23 Jun 2026 07:44:42 +0000 (11:44 +0400)] 
ui/gtk: move global display settings out of per-console init

Move zoom_to_fit, keep_aspect_ratio and touch_slots initialisation
from gd_vc_gfx_init() to gd_create_menu_view(). These are global
display settings that should be set once after all consoles are
created, not repeated on every per-console init (where the last
iteration's values silently win).

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-27-4656aec3398d@redhat.com>

6 weeks agoui/gtk: convert VirtualConsole storage from fixed array to GPtrArray
Marc-André Lureau [Tue, 23 Jun 2026 07:44:41 +0000 (11:44 +0400)] 
ui/gtk: convert VirtualConsole storage from fixed array to GPtrArray

Replace the fixed-size vc[MAX_VCS] with GPtrArray.

This is a preparatory refactoring for console hotplug support, which
needs to add/remove VCs dynamically.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-26-4656aec3398d@redhat.com>

6 weeks agoui/console-vc: fire ADDED/REMOVED notifications
Marc-André Lureau [Tue, 23 Jun 2026 07:44:40 +0000 (11:44 +0400)] 
ui/console-vc: fire ADDED/REMOVED notifications

Fire CONSOLE_ADDED when the chardev is opened.

Fire CONSOLE_REMOVED in char_vc_finalize() before dropping the console
reference, so the console is still in a valid state when listeners
handle the event. Also fixes a console object leak by adding the
missing object_unref().

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-25-4656aec3398d@redhat.com>

6 weeks agoui/console: fire console ADDED/REMOVED notifications
Marc-André Lureau [Tue, 23 Jun 2026 07:44:39 +0000 (11:44 +0400)] 
ui/console: fire console ADDED/REMOVED notifications

Fire CONSOLE_ADDED at the end of graphic_console_init() and
CONSOLE_REMOVED at the start of graphic_console_close(), so display
backends can react to console hotplug/unplug events.

REMOVED fires before the device link is cleared and before the
placeholder surface swap, so handlers can unregister their DCL while
the console is still in a known state.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-24-4656aec3398d@redhat.com>

6 weeks agoui/console: add console event notifier infrastructure
Marc-André Lureau [Tue, 23 Jun 2026 07:44:38 +0000 (11:44 +0400)] 
ui/console: add console event notifier infrastructure

Add a NotifierList to DisplayState so display backends can be notified
when consoles are added or removed at runtime.

No events are fired yet, that follows in the next commits.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-23-4656aec3398d@redhat.com>

6 weeks agoui/gtk: implement display cleanup
Marc-André Lureau [Tue, 23 Jun 2026 07:44:37 +0000 (11:44 +0400)] 
ui/gtk: implement display cleanup

Add gtk_display_cleanup() to properly tear down GTK display state:
remove console and mouse notifiers, unregister clipboard peer,
destroy the main window and virtual consoles.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-22-4656aec3398d@redhat.com>

6 weeks agoui/dbus: implement display cleanup
Marc-André Lureau [Tue, 23 Jun 2026 07:44:36 +0000 (11:44 +0400)] 
ui/dbus: implement display cleanup

Add dbus_cleanup() to unparent the D-Bus display object, ensuring
proper teardown before user_creatable_cleanup() runs.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-21-4656aec3398d@redhat.com>

6 weeks agoui/cocoa: implement display cleanup
Marc-André Lureau [Tue, 23 Jun 2026 07:44:35 +0000 (11:44 +0400)] 
ui/cocoa: implement display cleanup

Move cbowner release from QemuCocoaAppController -dealloc to
cocoa_display_cleanup(), since cbowner is allocated in
cocoa_display_init() and cleanup is the symmetric teardown path.

Tested-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-20-4656aec3398d@redhat.com>

6 weeks agoui/egl: implement display and EGL cleanup
Marc-André Lureau [Tue, 23 Jun 2026 07:44:34 +0000 (11:44 +0400)] 
ui/egl: implement display and EGL cleanup

Add egl_cleanup() to tear down the EGL render node context, GBM device,
and EGL display. Add egl_headless_cleanup() to unregister listeners,
destroy framebuffers, and free per-console state tracked via a new
GPtrArray.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-19-4656aec3398d@redhat.com>

6 weeks agoui/spice-app: implement display cleanup
Marc-André Lureau [Tue, 23 Jun 2026 07:44:33 +0000 (11:44 +0400)] 
ui/spice-app: implement display cleanup

Replace the atexit() handler with the display cleanup callback,
reusing the existing spice_app_atexit() function.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-18-4656aec3398d@redhat.com>

6 weeks agoui/sdl2: implement display cleanup
Marc-André Lureau [Tue, 23 Jun 2026 07:44:32 +0000 (11:44 +0400)] 
ui/sdl2: implement display cleanup

Replace the atexit() handler with a proper cleanup callback. Extend
sdl_cleanup() to unregister display listeners, free keyboard state,
destroy windows, and clean up all cursor resources.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-17-4656aec3398d@redhat.com>

6 weeks agoui/curses: implement display cleanup
Marc-André Lureau [Tue, 23 Jun 2026 07:44:31 +0000 (11:44 +0400)] 
ui/curses: implement display cleanup

Replace the atexit() handler with a proper cleanup callback. The new
curses_cleanup() unregisters the display listener, destroy & free the
allocated resources.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-16-4656aec3398d@redhat.com>

6 weeks agoui: add display cleanup infrastructure
Marc-André Lureau [Tue, 23 Jun 2026 07:44:30 +0000 (11:44 +0400)] 
ui: add display cleanup infrastructure

Add a cleanup callback to QemuDisplay and a qemu_display_cleanup()
function that iterates all registered display types and calls their
cleanup handler. Wire it into qemu_cleanup() in runstate.c, replacing
the ad-hoc vnc_cleanup() call.

This provides a structured alternative to atexit() handlers, giving
deterministic teardown ordering and making resource leaks visible to
sanitizers.

The cleanup should happen before user_creatable_cleanup(), since some
display have weak user-creatable references to cleanup before.

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-15-4656aec3398d@redhat.com>

6 weeks agoui/spice: add cleanup on shutdown
Marc-André Lureau [Tue, 23 Jun 2026 07:44:29 +0000 (11:44 +0400)] 
ui/spice: add cleanup on shutdown

SPICE resources were never freed on shutdown. Add per-subsystem
cleanup (display, input, core) and call it from qemu_cleanup().

Move spice-module.c into libui so the qemu_spice ops table links
with the rest of the UI code. Add an LSan suppression for a known
spice-server leak.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-14-4656aec3398d@redhat.com>

6 weeks agoui/spice: remove dead spice_displays
Marc-André Lureau [Tue, 23 Jun 2026 07:44:28 +0000 (11:44 +0400)] 
ui/spice: remove dead spice_displays

This is left-over from commit 9fa032866da ("spice: fix multihead support")

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-13-4656aec3398d@redhat.com>

6 weeks agoui/console: init gl_unblock_timer in qemu_console_init
Marc-André Lureau [Tue, 23 Jun 2026 07:44:27 +0000 (11:44 +0400)] 
ui/console: init gl_unblock_timer in qemu_console_init

Move gl_unblock_timer allocation from graphic_console_init() to
qemu_console_init(), similar to what was done in commit cfde05d15b
("ui/console: allocate ui_timer in QemuConsole").

This fixes leaking timers on console recycling.

Fixes: a9b1e471e17 ("ui: add a gl-unblock warning timer")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-12-4656aec3398d@redhat.com>

6 weeks agoui: stop ui timer when closing
Marc-André Lureau [Tue, 23 Jun 2026 07:44:26 +0000 (11:44 +0400)] 
ui: stop ui timer when closing

hwops is reset, so if the UI timer is pending it will crash.

Fixes: 9588d67e72 ("console: minimal hotplug suport")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-11-4656aec3398d@redhat.com>

6 weeks agoui/qmp: keep a reference of console across yield
Marc-André Lureau [Tue, 23 Jun 2026 07:44:25 +0000 (11:44 +0400)] 
ui/qmp: keep a reference of console across yield

While the coroutine is waiting, the console could be finalized. Keep a
reference to prevent this.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-10-4656aec3398d@redhat.com>

6 weeks agoui/dbus: remove mouse handler on dispose
Marc-André Lureau [Tue, 23 Jun 2026 07:44:24 +0000 (11:44 +0400)] 
ui/dbus: remove mouse handler on dispose

Fixes: 142ca628a7 ("ui: add a D-Bus display backend")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-9-4656aec3398d@redhat.com>

6 weeks agoutil: make notifer_remove() safer
Marc-André Lureau [Tue, 23 Jun 2026 07:44:23 +0000 (11:44 +0400)] 
util: make notifer_remove() safer

Allow to call multiple time notifier_remove() safely.
This shoudn't impact performance in any measurable way...

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-8-4656aec3398d@redhat.com>

6 weeks agoglib-compat: add fallback for g_clear_fd/g_autofd
Marc-André Lureau [Tue, 23 Jun 2026 07:44:22 +0000 (11:44 +0400)] 
glib-compat: add fallback for g_clear_fd/g_autofd

Those helpers were added in glib 2.76.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-7-4656aec3398d@redhat.com>

6 weeks agodocs: add mdpy mdev vfio display testing guide
Marc-André Lureau [Tue, 23 Jun 2026 07:44:21 +0000 (11:44 +0400)] 
docs: add mdpy mdev vfio display testing guide

Document how to test VFIO display hotplug using the kernel mdpy mdev
sample.

Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-6-4656aec3398d@redhat.com>

6 weeks agovfio/pci: close display console during unrealize, not finalize
Marc-André Lureau [Tue, 23 Jun 2026 07:44:20 +0000 (11:44 +0400)] 
vfio/pci: close display console during unrealize, not finalize

The QemuGraphicConsole holds a strong QOM link back to the device via
its "device" property (OBJ_PROP_LINK_STRONG). When graphic_console_close()
is only called from vfio_display_finalize() during object finalize, this
creates a ref-cycle deadlock: the device can't reach refcount 0 because
the console holds a strong ref, but the console's ref is only dropped by
graphic_console_close() which runs inside finalize.

Split the display teardown into two phases:
- vfio_display_exit(): called during unrealize (vfio_exitfn), closes
  the graphic console to break the ref cycle, and removes display
  region subregions while the parent memory regions are still alive.
- vfio_display_finalize(): remains in finalize (vfio_pci_put_device),
  frees display region memory, dmabuf, and edid resources. The region
  memory contains QOM child objects (MemoryRegions) that must stay
  alive until QOM finalization has processed them.

Acked-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-5-4656aec3398d@redhat.com>

6 weeks agoscripts/lsan_suppressions: suppress fontconfig leaks
Marc-André Lureau [Tue, 23 Jun 2026 07:44:19 +0000 (11:44 +0400)] 
scripts/lsan_suppressions: suppress fontconfig leaks

Those are annoying reports for gtk/sdl etc.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-4-4656aec3398d@redhat.com>

6 weeks agoirq: add per-IRQ observer to fix qemu_irq_intercept_in leak
Marc-André Lureau [Tue, 23 Jun 2026 07:44:18 +0000 (11:44 +0400)] 
irq: add per-IRQ observer to fix qemu_irq_intercept_in leak

qemu_irq_intercept_in() saves original IRQ handlers by allocating
new QOM objects, which are never freed. On a PC machine, this leaks
IRQ objects (one per IOAPIC pin) on every qtest run.

Rather than tracking allocations to free later, avoid them: add an
"observer" field to IRQState, called by qemu_set_irq() after the
real handler. Interception sets the observer instead of rewriting
handlers, so there's nothing to save and nothing to leak.

Fix qemu_notirq() to route through qemu_set_irq() so inverted IRQs
trigger observers too. Drop the LSan suppression.

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-3-4656aec3398d@redhat.com>

6 weeks agobuild-sys: build with -fno-omit-frame-pointer with ASAN
Marc-André Lureau [Tue, 23 Jun 2026 07:44:17 +0000 (11:44 +0400)] 
build-sys: build with -fno-omit-frame-pointer with ASAN

On fc44, LSan fails to suppress leak:qemu_irq_intercept_in, because
the backtrace isn't deep enough.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-2-4656aec3398d@redhat.com>

6 weeks agoui/gtk: fix bad widget realize on non-GFX VC
Marc-André Lureau [Tue, 23 Jun 2026 07:44:16 +0000 (11:44 +0400)] 
ui/gtk: fix bad widget realize on non-GFX VC

The GTK VirtualConsole is a union, it may be .gfx or .vte depending on
the type.

Fixes: 565f85a9c2 ("ui/gtk: force realization of drawing area")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20260623-b4-ui-v4-1-4656aec3398d@redhat.com>

6 weeks agogitlab: disable macOS jobs in forks
Daniel P. Berrangé [Wed, 10 Jun 2026 09:17:00 +0000 (10:17 +0100)] 
gitlab: disable macOS jobs in forks

The GitLab macOS runners are only available in Premium and Ultimate
tier projects. This permits their use in QEMU upstream via the OSS
Program membership perk, but this does not extend to forks of QEMU.
The macOS jobs thus need to be disabled in forks, otherwise all
pipelines will immediately report a failure due to inability to
access a runner.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Link: https://lore.kernel.org/qemu-devel/20260610091700.2772973-1-berrange@redhat.com
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
6 weeks agogitlab: update bug template for sec issues & tool assistance
Daniel P. Berrangé [Fri, 19 Jun 2026 15:56:56 +0000 (16:56 +0100)] 
gitlab: update bug template for sec issues & tool assistance

Warn that a security issue must have the "confidential" flag
set and that any findings from automated tools must be validated
before submission.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260619123632.1276476-1-berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260619155657.944220-8-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
6 weeks agogitlab: remove build target hacks
Alex Bennée [Fri, 19 Jun 2026 15:56:55 +0000 (16:56 +0100)] 
gitlab: remove build target hacks

Since eef29e060dc (meson: build macOS signed binary as part of the
default target) we should be able to do a plain build and everything
just work.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260619155657.944220-7-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
6 weeks agogitlab: ensure "check-XXX' jobs capture functional test logs
Daniel P. Berrangé [Fri, 19 Jun 2026 15:56:54 +0000 (16:56 +0100)] 
gitlab: ensure "check-XXX' jobs capture functional test logs

A small subset of functional tests are run by default with
'make check', and so run in the context of 'check-XXX' CI
jobs, rather than 'functional-XXX' CI jobs.  Thus we need
to capture the functional test logs unconditionally for all
test jobs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20260610121254.2870259-1-berrange@redhat.com>
Message-ID: <20260619155657.944220-6-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
6 weeks agotests/functional: tell pylint not to check c-modules
Alex Bennée [Fri, 19 Jun 2026 15:56:53 +0000 (16:56 +0100)] 
tests/functional: tell pylint not to check c-modules

To fix:

  qemu-test.test_pylint "/home/alex/lsrc/qemu.git/tests/functional/arm/test_integratorcp.py:83: I1101: Module 'cv2' has no 'imread' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)"

Manually running python3 showed I could indeed import cv2 and call
those functions. Rather than allowing pylint to introspect lets just
tell it to skip c modules.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260619155657.944220-5-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
6 weeks agopython/qemu: dump a developer friendly version of cmdline to logs
Alex Bennée [Fri, 19 Jun 2026 15:56:52 +0000 (16:56 +0100)] 
python/qemu: dump a developer friendly version of cmdline to logs

Now we have the arguments nicely split up we can make _console_args a
function call and present a slightly different version to the logs to
save developers manually hacking the command line up.

Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20260619155657.944220-4-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
6 weeks agosystem/physmem: make ram_block_discard_range() handle guest_memfd
Marc-André Lureau [Thu, 4 Jun 2026 13:43:57 +0000 (17:43 +0400)] 
system/physmem: make ram_block_discard_range() handle guest_memfd

Most callers of ram_block_discard_range() want to discard both the
shared and guest_memfd backing. Only kvm_convert_memory() intentionally
discards a single plane during private/shared conversions.

Rename the current implementation to ram_block_discard_shared_range()
and make ram_block_discard_range() a composite that also discards
guest_memfd when present (rb->guest_memfd >= 0). This ensures callers
like virtio-mem, virtio-balloon, hv-balloon, migration.. reclaim
private pages on discard.

Update kvm_convert_memory() to use the plane-specific
ram_block_discard_shared_range() since it only needs to discard
the shared backing when converting to private.

Likewise, after TDVF image copy, use ram_block_discard_shared_range().

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20260604-rdm5-v5-11-5768e6a0943d@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
6 weeks agotests: add unit tests for RamDiscardManager multi-source aggregation
Marc-André Lureau [Thu, 4 Jun 2026 13:43:56 +0000 (17:43 +0400)] 
tests: add unit tests for RamDiscardManager multi-source aggregation

Add various unit tests for the RamDiscardManager multi-source
aggregation functionality.

The test uses a TestRamDiscardSource QOM object that tracks populated
state via a bitmap, similar to RamBlockAttributes implementation.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20260604-rdm5-v5-10-5768e6a0943d@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
6 weeks agosystem/memory: add RamDiscardManager reference counting and cleanup
Marc-André Lureau [Thu, 4 Jun 2026 13:43:55 +0000 (17:43 +0400)] 
system/memory: add RamDiscardManager reference counting and cleanup

Listeners now hold a reference to the RamDiscardManager, ensuring it
stays alive while listeners are registered. The RDM is eagerly freed
when the last source and listener are removed, and also unreffed during
MemoryRegion finalization as a safety net.

This completes the TODO left in the previous commit and prevents both
use-after-free and memory leaks of the RamDiscardManager.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20260604-rdm5-v5-9-5768e6a0943d@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
6 weeks agosystem/physmem: destroy ram block attributes before RCU-deferred reclaim
Marc-André Lureau [Thu, 4 Jun 2026 13:43:54 +0000 (17:43 +0400)] 
system/physmem: destroy ram block attributes before RCU-deferred reclaim

ram_block_attributes_destroy() was called from reclaim_ramblock(), which
runs as an RCU callback deferred by call_rcu().

However,when the RamDiscardManager is finalized, it will assert that its
source_list is empty in the next commit. Since the RCU callback hasn't
run yet, the source added by ram_block_attributes_create() is still
attached.

Move ram_block_attributes_destroy() into qemu_ram_free() so the source
is removed synchronously. This is safe because qemu_ram_free() during
shutdown runs after pause_all_vcpus(), so no vCPU thread can
concurrently access the attributes via kvm_convert_memory().

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Link: https://lore.kernel.org/r/20260604-rdm5-v5-8-5768e6a0943d@redhat.com
[peterx: rebase on top of qemu_ram_free() change]
Signed-off-by: Peter Xu <peterx@redhat.com>