Commit Graph

276 Commits

Author SHA1 Message Date
Stefan Hajnoczi
ac0cc20ad2 Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* hw/qdev: Consolidate qdev_get_printable_name() into qdev_get_human_name()
* target/i386: add new models for GMET, MMIO/GDS/RFDS mitigation and MBEC
* whpx improvements
* bump meson to 1.11.1
* tests: add test for json-streamer.c error recovery
* kconfig cleanups
* target/arm/hvf, target/i386/hvf: Pass MR-relative offset to memory_region_set_dirty()

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmnze1oUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroM1Bgf7BvK8Vvix46/LARl8sxhwSBdz3UfH
# KFq4N8ghUVVCyitghN4iMXvGHSBMJQo3BaV/a24gxGKjmGtYaX1PyR+v5t8HO50W
# 0iyQTjXMxBBEBvxLsGVuGTptcVstM3IbXko9wszOui42qtOqfymGgI628bc4lc5G
# yq8TjyhdEYgFLkafbSlKi8B9wtCcna8DU+Hv5Tfau3pKbtQJpxthdLKPFf0phJky
# Pgb/NdKSXoj97GHMI9IwA6dsqzNELx2Q/Pw0rW00xqYj0juKC0e+dQOeNndA3xFB
# vxCCogOqplP+dQazFxhjIL4FE0wB8QdwK3D544iYsBWCqd4C07OYGR7CWA==
# =v3J9
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 30 Apr 2026 11:55:06 EDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (58 commits)
  whpx: i386: documentation update
  whpx: i386: add SeparateSecurityDomain flag and make default
  whpx: i386: add feature to intercept #GP MSR accesses
  whpx: i386: update migration blocker message
  whpx: i386: set APIC ID only when APIC present
  whpx: xsave support
  target/i386: add de/compaction to xsave_helper
  target/i386: make xsave_buf present unconditionally
  target/i386: emulate: use exception_payload for fault address
  whpx: i386: Pause VM on fatal exception to be able to inspect state
  whpx: i386: set WHvX64RegisterInitialApicId
  whpx: i386: some x2APIC awareness
  whpx: i386: add HV_X64_MSR_GUEST_IDLE when !kernel-irqchip
  target: i386: HLT type that ignores EFLAGS.IF
  whpx: i386: ignore vpassist when kernel-irqchip=off
  whpx: i386: tighten APIC base validity check
  target/i386: emulate, hvf: rdmsr/wrmsr GPF handling
  whpx: i386: don't increment eip on MSR access raising GPF
  whpx: i386: unknown MSR configurability
  whpx: i386: enable GuestIdleReg enlightenment
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-05-01 14:41:49 -04:00
Mohamed Mediouni
a1a3692d15 whpx: i386: add SeparateSecurityDomain flag and make default
For workloads where isolation is less important, -accel whpx,ssd=off
will provide significantly higher MMIO performance.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-37-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:04 +02:00
Mohamed Mediouni
bb605df21e whpx: i386: add feature to intercept #GP MSR accesses
It turns out they're not that uncommon, so have
a feature around to log those.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-35-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:04 +02:00
Mohamed Mediouni
cfaa3b6c95 whpx: xsave support
Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-30-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:04 +02:00
Mohamed Mediouni
d9225244af whpx: i386: unknown MSR configurability
Add an option to inject back a GPF for unknown MSRs.

Keep it on by default for now as Linux expects accesses to some
AMD-specific MSRs to always succeed when on an AMD host.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-18-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:03 +02:00
Mohamed Mediouni
478e27cf87 whpx: i386: fix CPUID[1:EDX].APIC reporting
Hyper-V always has CPUID[1:EDX].APIC set, even when the APIC isn't enabled yet.

Work around this by also using the APICBASE trap for kernel-irqchip=on.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-16-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:03 +02:00
Mohamed Mediouni
77f90aef5b whpx: i386: kernel-irqchip=off fixes
This was really... quite broken. After fixing this,
Windows boots with kernel-irqchip=off.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-9-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:03 +02:00
Mohamed Mediouni
f741457c1a whpx: i386: reintroduce enlightenments for Windows 10
Was removed in 2c08624 but it's still useful for
Windows 10 so reintroduce it there.

And this time, actually make it work by reporting
the hypervisor bit in CPUID.

Pretend to be vmware to be able to use vmport's functionality.

If the vmware frequency leaf is disabled, pretend to be
KVM, with the only capability reported being X2APIC support.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-7-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:03 +02:00
Mohamed Mediouni
057143ba75 whpx: i386: wire up feature probing
Windows 10 doesn't have the API for this, so using this
only for Windows 11.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260422214225.2242-4-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-04-30 17:55:03 +02:00
Jaehoon Kim
9fea80ddf0 qapi/iothread: introduce poll-weight parameter for aio-poll
Introduce a configurable poll-weight parameter for adaptive polling
in IOThread. This parameter replaces the hardcoded POLL_WEIGHT_SHIFT
constant, allowing runtime control over how much the most recent
event interval affects the next polling duration calculation.

The poll-weight parameter uses a shift value where larger values
decrease the weight of the current interval, enabling more gradual
adjustments. When set to 0, a default value of 3 is used (meaning
the current interval contributes approximately 1/8 to the weighted
average).

This patch also removes the hardcoded default value checks from
adjust_polling_time(). Instead, poll-grow, poll-shrink, and
poll-weight now use default values initialized in iothread.c
during IOThread creation.

Signed-off-by: Jaehoon Kim <jhkim@linux.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20260423195918.661299-4-jhkim@linux.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2026-04-29 11:31:44 -04:00
Philippe Mathieu-Daudé
712e2b9aa8 system/memory: Constify various AddressSpace arguments (flatview)
Mark the AddressSpace structure const when it is only accessed
read-only.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260319191017.12636-2-philmd@linaro.org>
2026-04-24 21:20:44 +02:00
Philippe Mathieu-Daudé
3912e312ae hw/tpm: Simplify tpm_ppi_enabled()
TPM instances don't expose any "ppi" property anymore,
remove that dead code.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20260317120241.16320-6-philmd@linaro.org>
2026-04-24 21:20:44 +02:00
Philippe Mathieu-Daudé
6f4a959952 hw/tpm: Add TPMIfClass::ppi_enabled field
Each TPM derived device has a @ppi_enabled field, itself
exposed as a QOM property. External layers (like the ACPI
subsystem) wanting to know whether a device implements PPI
has to check for the QOM property available. This can be
simplified by declaring a single field in the TPM interface.

Here we add such field to TPMIfClass, before converting each
TPM devices to use it in the following commits.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20260317120241.16320-3-philmd@linaro.org>
2026-04-24 21:20:44 +02:00
Philippe Mathieu-Daudé
60ab4a0437 hw/tpm: Factor tpm_ppi_enabled() out
Factor out tpm_ppi_enabled() before modifying it in a unique place.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Message-Id: <20260317120241.16320-2-philmd@linaro.org>
2026-04-24 21:20:44 +02:00
Zhenzhong Duan
e2b7310276 iommufd: Rename all the idev and idevc variables to hiod and hiodc
We used idev and idevc naming for HostIOMMUDeviceIOMMUFD and corresponding
class variables which followed the iommufd_device naming in linux kernel.

This is mixed with the hiod naming for base type HostIOMMUDevice. Rename
HostIOMMUDeviceIOMMUFD* to hiodi* for consistency in QEMU.

No functional change intended.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20260401080354.1347212-1-zhenzhong.duan@intel.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
2026-04-21 18:28:42 +02:00
Luigi Leonardi
9b4edc3eca igvm: fix parent object type in IgvmCfg struct
IgvmCfg is defined as an Object but, currently, its first member is an
ObjectClass.

Replace ObjectClass with Object.

Fixes: c1d466d267 ("backends/igvm: Add IGVM loader and configuration")
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Message-ID: <20260330-igvm_fixes-v1-3-03587a5a808b@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-03-31 08:53:47 +02:00
Paolo Bonzini
c725a896c6 typedefs: move QIgvm out of typedefs.h
Typedefs.h should only be used for really core types; QIgvm is
just an opaque struct that is defined in system/igvm-internal.h,
and the typedef itself can be placed simply in system/igvm.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-12 12:02:55 +01:00
Peter Maydell
ae56950eac Merge tag 'firmware-20260310-pull-request' of https://gitlab.com/kraxel/qemu into staging
- firmware.json spec update for svsm.
- igvm bugfixes.

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEoDKM/7k6F6eZAf59TLbY7tPocTgFAmmwGuAACgkQTLbY7tPo
# cTiOBQ//cln4/XTERNZqSiKGcjeX857L0KSw1JN2hHgXwvTMBTdCJHz0ZQw8mk5t
# ixcguZjmF2F9Xblljjwf8mQATtbZfnVtkkDXIGeezO3DRP38KK7OcHHPtHIJ2bdc
# cR1WOAPVn3465AFa6RqOhjK17U2aU9NQG7ecW2LbB6MuPCTwMdDQeZ4UEsVuBFf6
# b7vIUmDAQmOhMQEnaVdQUUFY7NyTv8i7KCXdf7c7Iz32VC7XJHJwQKrK7ixtuzVP
# /YWlcg//Qld/fhAWSb6N/mPxbrlpVbzeP93uoS0NF8RnF+5UpbNmNs2GSnI0Hu2+
# P1nvxOBDUGY6jZoha9mOQqMwj9C/rIC9mn72Wj0s8rukQV+bMZX/HjSF4HN1gbeV
# 2vqT3+I7khQxg89tlsGPCMMM+AtLCZA5dMKZ2EnAUdmZMbGEfjoR31spfIbUMsiI
# edDWLTetPHMHy+0Cyqbsg40RRmV9/QuysmFbMV5St2J+6oXxZBdF23m3VtDrYZRY
# e8qliIH8fdtnQWScELuAU33SY300ZXolurwHKsE86eWWDk2x6+u3funLWV3wcp3g
# ME0x3CycRooCEYV3ixy335YYMcE1pH6XjFLjMU6S5ABY3d/34P+0sF44ztvQ5Apj
# R+mEYe1gwyRzyTOUzBRz9+xJJvzOjpPTXvukKKofcF8eZNO+pTA=
# =taqn
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Mar 10 13:21:36 2026 GMT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* tag 'firmware-20260310-pull-request' of https://gitlab.com/kraxel/qemu:
  i386/sev/igvm: do not reset guest policy if IGVM does not set it
  igvm: fix build when igvm is not installed in a well known path
  docs/interop: Add AMD SEV-SNP SVSM interface to firmware.json

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-10 13:32:30 +00:00
Peter Maydell
89851dbcce Merge tag 'accel-tcg-20260310' of https://github.com/philmd/qemu into staging
Accelerators and TCG patches queue

- Improve TCG extract and deposit
- Build accelerator stub files once

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmmv9goACgkQ4+MsLN6t
# wN4NVQ//UsLGikzMHhQ52JqSePy3hJ00uBzeZ+6exKcgWfCHCEKLimTewCSuhdjM
# qic6DGSShUrl36EVT1qRdz261jntgvfn12TQfs0LdSvgZKBjdWFcZ+AiIp54jYTS
# Wi0Qsdqi0+oXg4ictiefmGlgqo65qJU8U8mnclzOa5GmLMZC4QbGhV3qvEcE0BNc
# 1tzLSSschLWOqAG+vaHUCyyhr28UgJGO7pqVSuVnw2fA1jXVyRH671ZIyhBf85o9
# eWlChqtuvwrauKojD2eIK4qMw3esDqlwRXckvLu6/Nq1McXYbdc5Mm61c6JW5Wza
# LXMms6bix2iS0CoR5qmkEFgttVe5aZtJwXkYW2FE/+p6wscZHOyhrs0YdxkYqjgp
# 9WYkyqK9oeLLDBHQ2XAa4f+zE/4nPaWzKElu/kqA+XrrxvnkQisD2uijxioXCi6X
# CUa+pJrXxiKZOrWRXRGwuPpdJT4CrX082ydhQnsnH0Pi7gedpXZj9eYIRjxSvndZ
# 06ONtE/4Ja++gKNF6sbu8HLY7eCrfIVCQGOex4h6BrQsyZKU/EYbw0LhcVfUooMw
# QsF3rMD2AyWpzPzcJ3Y0E7t7e5iKNJoKLlN3ziR9qz34HCjdoNmbIwvbR5oUkJpd
# dhvtPikIIgcRnQvVmuLdkiTg6he9z70lsCtSBCkkLQN8nb8j9cE=
# =ak2F
# -----END PGP SIGNATURE-----
# gpg: Signature made Tue Mar 10 10:44:26 2026 GMT
# 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 'accel-tcg-20260310' of https://github.com/philmd/qemu:
  accel/qtest: Build once as common object
  accel/xen: Build without target-specific knowledge
  accel/hvf: Build without target-specific knowledge
  accel/mshv: Build without target-specific knowledge
  accel/mshv: Forward-declare mshv_root_hvcall structure
  accel/stubs: Build stubs once
  accel/kvm: Make kvm_irqchip*notifier() declaration non target-specific
  accel/kvm: Include missing 'exec/cpu-common.h' header
  target/hppa: Expand tcg_global_mem_new() -> tcg_global_mem_new_i64()
  tcg/optimize: possibly expand deposit into zero with shifts
  tcg: target-dependent lowering of extract to shr/and
  tcg: Add tcg_op_imm_match
  tcg: Expand missing rotri with extract2
  tcg/optimize: Lower unsupported extract2 during optimize
  tcg/optimize: Lower unsupported deposit during optimize
  tcg: Drop extract+shl expansions in tcg_gen_deposit_z_*

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-10 13:32:04 +00:00
Peter Maydell
56fe2ca5b6 Merge tag 'staging-pull-request' of https://gitlab.com/peterx/qemu into staging
Memory pull for 11.0 softfreeze

- BALATON's memory cleanups on _nomigrate MRs and else
- Phil's small constify series and else
- Marc-André's initial cleanup patches around ram discard manager

# -----BEGIN PGP SIGNATURE-----
#
# iIgEABYKADAWIQS5GE3CDMRX2s990ak7X8zN86vXBgUCaa8v2xIccGV0ZXJ4QHJl
# ZGhhdC5jb20ACgkQO1/MzfOr1wbiNgD/ZLS5BtRGva5eUQNXKkE3oOiXfDBkLyQ1
# BowQ12zjPZMBAOxrVvyGbpgsI5SOcSjsvFSsWLs1GFfHjVUAyCNusl4D
# =+4wZ
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar  9 20:38:51 2026 GMT
# gpg:                using EDDSA key B9184DC20CC457DACF7DD1A93B5FCCCDF3ABD706
# gpg:                issuer "peterx@redhat.com"
# gpg: Good signature from "Peter Xu <xzpeter@gmail.com>" [marginal]
# gpg:                 aka "Peter Xu <peterx@redhat.com>" [marginal]
# gpg: WARNING: The key's User ID is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: B918 4DC2 0CC4 57DA CF7D  D1A9 3B5F CCCD F3AB D706

* tag 'staging-pull-request' of https://gitlab.com/peterx/qemu:
  system/memory: Have memory_region_type() correctly describe containers
  system/xen: Constify various MemoryRegion arguments
  system/memory: Constify various MemoryRegion arguments
  system/ramblock: Constify various RAMBlock arguments
  kvm: replace RamDicardManager by the RamBlockAttribute
  system/memory: minor doc fix
  virtio-mem: use warn_report_err_once()
  memory: drop RamDiscardListener::double_discard_supported
  system/rba: use DIV_ROUND_UP
  memory: Factor out common ram ptr initialization
  memory: Factor out common ram region initialization
  memory: Add internal memory_region_register_ram function
  memory: Shorten memory_region_init_ram_device_ptr and memory_region_init_rom_device
  memory: Remove memory_region_init_ram_nomigrate()
  hw/xtensa/xtfpga: Do not use memory_region_init_ram_nomigrate()
  sun4m,sun4u,tcx: Do not use memory_region_init_ram_nomigrate()
  memory: Remove memory_region_init_rom_nomigrate()
  hw/display/{cg3.tcx}: Do not use memory_region_init_rom_nomigrate()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-10 11:38:58 +00:00
Philippe Mathieu-Daudé
591357b68f accel/mshv: Forward-declare mshv_root_hvcall structure
Forward-declare the target-specific mshv_root_hvcall structure
in order to keep 'system/mshv_int.h' target-agnostic.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20260225051303.91614-3-philmd@linaro.org>
2026-03-10 11:36:21 +01:00
Philippe Mathieu-Daudé
23e79ed4bf accel/kvm: Make kvm_irqchip*notifier() declaration non target-specific
Commit 3607715a30 ("kvm: Introduce KVM irqchip change notifier")
restricted the kvm_irqchip*notifier() declarations to target-specific
files, guarding them under the NEED_CPU_H (later renamed as
COMPILING_PER_TARGET) #ifdef check.

This however prohibit building the kvm-stub.c file once:

  ../accel/stubs/kvm-stub.c:70:6: error: no previous prototype for function 'kvm_irqchip_add_change_notifier' [-Werror,-Wmissing-prototypes]
     70 | void kvm_irqchip_add_change_notifier(Notifier *n)
        |      ^
  ../accel/stubs/kvm-stub.c:74:6: error: no previous prototype for function 'kvm_irqchip_remove_change_notifier' [-Werror,-Wmissing-prototypes]
     74 | void kvm_irqchip_remove_change_notifier(Notifier *n)
        |      ^
  ../accel/stubs/kvm-stub.c:78:6: error: no previous prototype for function 'kvm_irqchip_change_notify' [-Werror,-Wmissing-prototypes]
     78 | void kvm_irqchip_change_notify(void)
        |      ^

Since nothing in these prototype declarations is target specific,
move them around to be generically available, allowing to build
kvm-stub.c once for all targets in the next commit.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20260309174941.67624-2-philmd@linaro.org>
2026-03-10 11:36:21 +01:00
Peter Maydell
be7f1c297c Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
* hvf/x86: compilation fixes
* whpx: fixes
* xen-block: fix possible NULL pointer dereference
* coroutine-lock: fix thinko

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCgAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmmugQwUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroOOpQf/euE88TGF71S3kW4ckqCN4hLlvpl8
# 7wHjj83ggzufJikx5UI1lw31UuqyZYDX5ICQnvNeVEvBqCpi8oo9SJMBIwXJxn45
# 3oolIy+TJ7/k+QjZ1kMLPubnbH7p5h/iix+IkU01gFS0F0S12LgiJcLpBsSkKZHK
# 5AK53dKBAEikPP+IIT8Y4RrzNOZrydZzaXAtU4eCi3YVxf7/Ld1w9nRGvfG07Zd6
# Y0TptxjfMzbhxLuKetaHrAEI8EYYsmLAE3uJaDMSZ6heCXtfwQjkOaFjaqE/OYOK
# NhtIFArkq+tneI3sqDEoIdMngkL6SEowi1uDAOc5vKmtb2JcWzNo9PsXJw==
# =3X24
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon Mar  9 08:13:00 2026 GMT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
  whpx: i386: remove SIPI trapping
  whpx: arm64: enable enlightenments if asked for
  whpx: make Hyper-V enlightenments configurable
  whpx: i386: enable some more enlightenments
  target/i386: emulate: LA57 fix
  whpx: i386: do not enable nested virt when kernel-irqchip=off
  hvf: arm: unbreak the x86 build
  target/i386/hvf/hvf.c: fix compilation
  qemu-coroutine-lock: fix has_waiters()
  xen-block: remove NULL pointer dereference

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-10 09:32:17 +00:00
Luigi Leonardi
5c45204e34 igvm: fix build when igvm is not installed in a well known path
`stubs/igvm.c` includes `igvm-internal.h`, that in turn includes the igvm library.
This is required just for the QIgvm declaration and creates an
unnecessary dependency on the library.

Since igvm is not listed as a dependency of stubs, this results in build
failing when the library is not installed in a "well known" path of the
system.

Add a forward declaration for QIgvm and move the definition of
`qigvm_directive_madt` to `igvm.h` so that we can drop `igvm-internal.h` from
`stubs/igvm.c`.

Fixes: dea1f68a5c ("igvm: Fill MADT IGVM parameter field on x86_64")
Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
Message-ID: <20260309-master-v2-1-7e02f07a1096@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-03-10 08:57:05 +01:00
Philippe Mathieu-Daudé
5eedbf49b9 system/xen: Constify various MemoryRegion arguments
Mark the MemoryRegion structure const when is only accessed read-only.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Link: https://lore.kernel.org/r/20260309183536.88976-4-philmd@linaro.org
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-03-09 15:27:26 -04:00
Philippe Mathieu-Daudé
5a525dcb4d system/memory: Constify various MemoryRegion arguments
Mark the MemoryRegion structure const when is only accessed read-only.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20260309183536.88976-3-philmd@linaro.org
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-03-09 15:27:26 -04:00
Philippe Mathieu-Daudé
f016021ff5 system/ramblock: Constify various RAMBlock arguments
Mark the RAMBlock structure const when is only accessed read-only.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/20260309183536.88976-2-philmd@linaro.org
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-03-09 15:27:25 -04:00
Marc-André Lureau
4264005cd4 system/memory: minor doc fix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
Link: https://lore.kernel.org/r/20260226140001.3622334-5-marcandre.lureau@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-03-09 14:06:30 -04:00
Marc-André Lureau
d3008f2e52 memory: drop RamDiscardListener::double_discard_supported
This was never turned off, effectively some dead code.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Link: https://lore.kernel.org/r/20260226140001.3622334-3-marcandre.lureau@redhat.com
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-03-09 14:06:30 -04:00
BALATON Zoltan
787495878f memory: Remove memory_region_init_ram_nomigrate()
Convert the last remaining use outside of memory.c in vga to use
memory_region_init_ram_flags_nomigrate() instead and inline and remove
the memory_region_init_ram_nomigrate() variant. This leaves
memory_region_init_ram_flags_nomigrate() as the only nomigrate variant
that is still needed at a few places.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Link: https://lore.kernel.org/r/d913d0694b792bc3aed3fbb432e63d00c556de39.1772924151.git.balaton@eik.bme.hu
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-03-09 14:05:55 -04:00
BALATON Zoltan
0f32940510 memory: Remove memory_region_init_rom_nomigrate()
All users were converted so no longer needed.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/r/2665c92b578f5f6a602b34c7dde73451773e6148.1772924151.git.balaton@eik.bme.hu
Signed-off-by: Peter Xu <peterx@redhat.com>
2026-03-09 14:05:55 -04:00
Mohamed Mediouni
ae9dcd6f26 whpx: make Hyper-V enlightenments configurable
Have them be a machine option instead of a CPU one, to have something available, even if not ideal...

The existing Hyper-V enlightenments configuration mechanism is part of per-CPU configuration, which happens too late for this.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260307181856.2209-8-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-03-09 09:11:37 +01:00
Edgar E. Iglesias
ded5f9a909 xen: mapcache: Add function to check if the mapcache is enabled
Add function to check if the mapcache is enabled.
No functional change.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
2026-03-09 03:24:02 +01:00
Nicolin Chen
0885cd5504 backends/iommufd: Introduce iommufd_backend_alloc_veventq
Add a new helper for IOMMU_VEVENTQ_ALLOC ioctl to allocate a virtual event
queue (vEVENTQ) for a vIOMMU object.

Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Tested-by: Nicolin Chen <nicolinc@nvidia.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Nicolin Chen <nicolinc@nvidia.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
Message-id: 20260226084456.112142-2-skolothumtho@nvidia.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2026-03-06 09:43:18 +00:00
myrslint
5dacb3b8fa KVM: i386: Default disable ignore guest PAT quirk
Add a new accelerator option that allows the guest to adjust the PAT.
This is already the case for TDX guests and allows using virtio-gpu
Venus with RADV or NVIDIA drivers.

The quirk is disabled by default.  Since this caused problems with
Linux's Bochs video device driver, add a knob to leave it enabled,
and for now do ont enable it by default.

Signed-off-by: Myrsky Lintu <qemu.haziness801@passinbox.com>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2943
Link: https://lore.kernel.org/r/175527721636.15451.4393515241478547957-1@git.sr.ht
[Add property; for now leave it off by default. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 14:48:04 +01:00
Ani Sinha
956200b180 kvm/vcpu: add notifiers to inform vcpu file descriptor change
When new vcpu file descriptors are created and bound to the new kvm file
descriptor as a part of the confidential guest reset mechanism, various
subsystems needs to know about it. This change adds notifiers so that various
subsystems can take appropriate actions when vcpu fds change by registering
their handlers to this notifier.
Subsequent changes will register specific handlers to this notifier.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260225035000.385950-31-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 14:48:04 +01:00
Ani Sinha
0f53f021ad accel/kvm: notify when KVM VM file fd is about to be changed
Various subsystems might need to take some steps before the KVM file descriptor
for a virtual machine is changed. So a new boolean attribute is added to the
vmfd_notifier structure which is passed to the notifier callbacks.
vmfd_notifer.pre is true for pre-notification of vmfd change and false for
post notification. Notifier callback implementations can simply check
the boolean value for (vmfd_notifer*)->pre and can take actions for pre or
post vmfd change based on the value.

Subsequent patches will add callback implementations for specific components
that need this pre-notification.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260225035000.385950-9-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 14:22:08 +01:00
Ani Sinha
4dd184cb41 accel/kvm: add a notifier to indicate KVM VM file descriptor has changed
A notifier callback can be used by various subsystems to perform actions when
KVM file descriptor for a virtual machine changes as a part of confidential
guest reset process. This change adds this notifier mechanism. Subsequent
patches will add specific implementations for various notifier callbacks
corresponding to various subsystems that need to take action when KVM VM file
descriptor changed.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260225035000.385950-8-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 14:22:08 +01:00
Ani Sinha
98884e0cc1 accel/kvm: add changes required to support KVM VM file descriptor change
This change adds common kvm specific support to handle KVM VM file descriptor
change. KVM VM file descriptor can change as a part of confidential guest reset
mechanism. A new function api kvm_arch_on_vmfd_change() per
architecture platform is added in order to implement architecture specific
changes required to support it. A subsequent patch will add x86 specific
implementation for kvm_arch_on_vmfd_change() as currently only x86 supports
confidential guest reset.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260225035000.385950-6-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 14:22:08 +01:00
Ani Sinha
df8df3cb6b system/physmem: add helper to reattach existing memory after KVM VM fd change
After the guest KVM file descriptor has changed as a part of the process of
confidential guest reset mechanism, existing memory needs to be reattached to
the new file descriptor. This change adds a helper function ram_block_rebind()
for this purpose. The next patch will make use of this function.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260225035000.385950-5-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 14:22:07 +01:00
Ani Sinha
2391125f13 accel/kvm: add confidential class member to indicate guest rebuild capability
As a part of the confidential guest reset process, the existing encrypted guest
state must be made mutable since it would be discarded after reset. A new
encrypted and locked guest state must be established after the reset. To this
end, a new boolean member per confidential guest support class
(eg, tdx or sev-snp) is added that will indicate whether its possible to
rebuild guest state:

bool can_rebuild_guest_state;

This is true if rebuilding guest state is possible, false otherwise.
A KVM based confidential guest reset is only possible when
the existing state is locked but its possible to rebuild guest state.
Otherwise, the guest is not resettable.

Signed-off-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20260225035000.385950-3-anisinha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 14:22:07 +01:00
Alexander Graf
8155bca60d accel: Add Nitro Enclaves accelerator
Nitro Enclaves are a confidential compute technology which
allows a parent instance to carve out resources from itself
and spawn a confidential sibling VM next to itself. Similar
to other confidential compute solutions, this sibling is
controlled by an underlying vmm, but still has a higher level
vmm (QEMU) to implement some of its I/O functionality and
lifecycle.

Add an accelerator to drive this interface. In combination with
follow-on patches to enhance the Nitro Enclaves machine model, this
will allow users to run a Nitro Enclave using QEMU.

Signed-off-by: Alexander Graf <graf@amazon.com>

Link: https://lore.kernel.org/r/20260225220807.33092-5-graf@amazon.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-27 08:18:31 +01:00
Mohamed Mediouni
49f31a9671 whpx: common, i386, arm: rework state levels
Change state levels from a set of ifdefs to an enum.
Make register state loads use state levels too.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-16-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-26 18:58:39 +01:00
Mohamed Mediouni
9bd8a24a17 whpx: i386: remove remaining winhvemulation support code
After moving away to target/i386/emulate, this is no longer necessary.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Link: https://lore.kernel.org/r/20260223233950.96076-13-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-26 18:58:39 +01:00
Mohamed Mediouni
9fdece1224 whpx: move whpx_get_reg/whpx_set_reg to generic code
These will be used in the next commit on the x86_64 backend too.
Also move flush_cpu_state as it's used by get_reg/set_reg and the arm64 code.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Link: https://lore.kernel.org/r/20260223233950.96076-10-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-26 18:58:39 +01:00
Mohamed Mediouni
02dff8f72d whpx: refactor whpx_destroy_vcpu to arch-specific function
Avoid a TARGET_X86_64 define by moving platform-specific code
away from generic WHPX support.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-9-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-26 18:58:39 +01:00
Mohamed Mediouni
19b48084f7 whpx: i386: re-enable guest debug support
Fix what got broken several years ago by adding ops->supports_guest_debug
support as an architecture-specific function.

arm64 WHP doesn't currently provide support needed for this.

Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20260223233950.96076-7-mohamed@unpredictable.fr
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2026-02-26 18:58:39 +01:00
Philippe Mathieu-Daudé
747b494f12 system: Reduce 'arch_init.h' scope
Better to restrict qemu_arch_available() scope so it is only
used by generic system/ code to parse command line options.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-6-philmd@linaro.org>
2026-02-26 00:02:14 +01:00
Philippe Mathieu-Daudé
1bfbe1fc5a system: Make qemu_arch_available() common code
Remove the need of per-target QEMU_ARCH. Define the
QEMU_ARCH_* constants based on SYS_EMU_TARGET_* ones,
themselves already exposed via target_arch(), allowing
to check the current target is included in @arch_bitmask.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-5-philmd@linaro.org>
2026-02-26 00:02:14 +01:00
Philippe Mathieu-Daudé
4b75d19e36 qemu: Document qemu_arch_available() method
qemu_arch_available() is used to check if a broadly available
feature should be exposed to a particular set of target
architectures.

Since its argument is a mask of bits, rename it as @arch_bitmask.

We have less than 32 target architectures so far, so restrict it
to the uint32_t type.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20260213175032.32121-2-philmd@linaro.org>
2026-02-26 00:02:14 +01:00