Skip to content

whpx: x86 updates (2026-02)

Mohamed Mediouni qemu-devel 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest28 patches 7 repliesIn review
  2. v527 patches 0 repliesSuperseded
  3. v416 patches 1 replySuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v314 patches4 repliesSuperseded
v210 patches7 repliesSuperseded
v17 patches5 repliesApplied

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/28target/i386/emulate/x86_decode: Fix compiler warningtarget/i386/emulate/x86_decode.c+1 -10 replies
2/28target/i386/hvf/x86_mmu: Fix compiler warningtarget/i386/hvf/x86_mmu.c+4 -20 replies
3/28target/i386/emulate/x86_decode: Actually use stream in decode_instruction_stream()target/i386/emulate/x86_decode.c+2 -20 replies
4/28target/i386/emulate: rework string_rep emulationtarget/i386/emulate/x86_emu.c+10 -30 replies
5/28target/i386: emulate, hvf: move x86_mmu to common codetarget/i386/emulate/meson.build target/i386/emulate/x86_mmu.c target/i386/emulate/x86_mmu.h +4 more+21 -90 replies
6/28whpx: i386: re-enable guest debug supportaccel/whpx/whpx-accel-ops.c include/system/whpx-all.h target/arm/whpx/whpx-all.c +1 more+22 -01 reply
7/28whpx: preparatory changes before switching over from winhvemulationtarget/i386/cpu.h target/i386/emulate/meson.build target/i386/mshv/meson.build+6 -10 replies
8/28whpx: refactor whpx_destroy_vcpu to arch-specific functionaccel/whpx/whpx-common.c include/system/whpx-all.h target/arm/whpx/whpx-all.c +1 more+13 -40 replies
9/28whpx: move whpx_get_reg/whpx_set_reg to generic codeaccel/whpx/whpx-common.c include/system/whpx-common.h target/arm/whpx/whpx-all.c+39 -360 replies
10/28whpx: i386: switch over from winhvemulation to target/i386/emulatetarget/i386/whpx/whpx-all.c+114 -1360 replies
11/28whpx: i386: flags conversion for target/i386/emulate internal statetarget/i386/whpx/whpx-all.c+2 -00 replies
12/28whpx: i386: remove remaining winhvemulation support codeaccel/whpx/whpx-common.c include/system/whpx-common.h include/system/whpx-internal.h +1 more+1 -430 replies
13/28whpx: i386: remove messagestarget/i386/whpx/whpx-all.c+0 -20 replies
14/28whpx: i386: remove CPUID trappingtarget/i386/whpx/whpx-all.c+0 -1040 replies
15/28whpx: common, i386, arm: rework state levelsaccel/whpx/whpx-common.c include/system/whpx-accel-ops.h include/system/whpx-all.h +2 more+30 -240 replies
16/28whpx: i386: saving/restoring less state for WHPX_LEVEL_FAST_RUNTIME_STATEtarget/i386/whpx/whpx-all.c+104 -980 replies
17/28target/i386: mshv, emulate: move the generic x86 helpers to target/i386/emulatetarget/i386/emulate/meson.build target/i386/emulate/x86_helpers.c target/i386/mshv/meson.build+7 -40 replies
18/28target/i386: emulate: 5-level paging for the page table walkertarget/i386/emulate/x86.h target/i386/emulate/x86_helpers.c target/i386/emulate/x86_mmu.c +1 more+17 -00 replies
19/28target/i386: emulate, hvf, mshv: rework MMU codetarget/i386/emulate/x86_decode.c target/i386/emulate/x86_emu.c target/i386/emulate/x86_emu.h +8 more+146 -1840 replies
20/28hvf: i386: save/restore CR0/2/3target/i386/hvf/hvf.c+15 -02 replies
21/28target/i386: emulate: get rid of write_val_to_mem() helpertarget/i386/emulate/x86_emu.c+2 -70 replies
22/28target/i386: emulate: raise an exception on translation faulttarget/i386/emulate/x86_mmu.c+30 -00 replies
23/28target/i386: emulate: remove fetch_instruction helper tootarget/i386/emulate/x86_decode.c target/i386/emulate/x86_emu.h+1 -70 replies
24/28target/i386: emulate: propagate memory errors on most reads/writestarget/i386/emulate/x86_emu.c+88 -310 replies
25/28whpx: i386: inject exceptionstarget/i386/whpx/whpx-all.c+22 -02 replies
26/28whpx: i386: bump to x2apictarget/i386/whpx/whpx-all.c+1 -10 replies
27/28whpx: i386: ignore send_msi to interrupt vector 0target/i386/whpx/whpx-apic.c+5 -00 replies
28/28target/i386: emulate: propagate errors all the way and stop earlytarget/i386/emulate/x86_emu.c target/i386/emulate/x86_emu.h+160 -850 replies

Reviews trailers per patch

10 of 28 patches have a Reviewed-by or Acked-by.

PatchMohamed MediouniWei Liu (Microsoft)Philippe Mathieu-DaudéBernhard BeschowMagnus Kulke
1/28R-b R-b
2/28R-b R-b R-b
3/28R-b R-b T-b
4/28
5/28R-b
6/28R-b
7/28
8/28R-b
9/28R-b
10/28
11/28
12/28
13/28R-b
14/28
15/28R-b
16/28R-b
17/28
18/28
19/28
20/28
21/28
22/28
23/28
24/28
25/28
26/28
27/28
28/28

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 5 reviewers.

Read the v6 thread

Cover letter [PATCH v6 00/28] whpx: x86 updates (2026-02)

It's a bit of a misnomer, but didn't rename this series to not cause more confusion... should probably have been named more like:

whpx, target/i386/emulate: fixes for target/i386/emulate and move WHPX x86 to it + WHPX misc fixes

Should have probably put a bit less faith in the state of target/i386/emulate from the get-go...

In guest OSes compatibility: Win9x works now (but is not too stable...). I probably recommend using -M kernel-irqchip=off for that case though as it apparently raises stability (a bit). Win9x didn't work with winhvemulate.

32-bit Haiku didn't work for me with or without this, with an invalid bit being there in the PTEs, but 64-bit Haiku works.

On the bright side, this series should fix a lot on x86 HVF too...

Some questions/notes for mshv:
- On the model of the "whpx: i386: inject exceptions" commit, also have injection of raised exceptions for the MSHV backend for this all to work as expected.
- I removed the reliance on the Hyper-V GVA translate call, which is a very slow one. If you want to add it back instead of using the QEMU target/i386/emulate page table walker, there probably ought to be a way to reduce the number of calls to that...
- but emul_ops has a new mmu_gva_to_gpa call to enable this case to be implemented
- la57 code is not exactly tested

And in missing things that are probably a better fit for a separate patch (series) instead of this continously-growing one:
- I don't handle privileges for the page walker in target/i386/emulate
- and SMAP/SMEP for it, with complexity they might add to the picture
- and the same applies to putting the reserved bit on error_code for erroneous PTEs

Git: https://github.com/mediouni-m/qemu (tag for this revision: whpx-x86-202502-v5, and yeah the 2025 is a typo...)

This series contains:

- target/i386/emulate fixes
- move HVF x86_mmu code to common code
- fixing debug support, which was broken since around: "gdbstub: move guest debug support check to ops" a48e7d9e52f8fe8b47f4c74f3e99d9d677b87fe5
- switch over from winhvemulation to common x86 VM exit emulation code
- remove some log lines
- Remove WHPX CPUID traps as they're currently quite broken
- Reworked implementation of the REP prefix for string instructions
- page table walker rework, error propagation for target/i386/emulate,
and injecting exceptions too
- bump the exposed interrupt controller to an X2APIC
- preemptively ignore interrupt requests to vector 0 instead of making the HV do it

Changes added since v5:
- Thorough propagation of memory error reads across target/i386/emulate
- target/i386/emulate: warn on read/write from/to unmapped MMIO
- for an unmapped GPA, continue and 0xff the register

Changes added since v4:
- MMU code rework
- page table walker rework, (some) error propagation for target/i386/emulate, and injecting exceptions too...
- all around cleanups around target/i386/emulate...
- bump the exposed interrupt controller to an X2APIC
- preemptively ignore interrupt requests to vector 0 instead of making the HV do it

Changes added since v3:
- Reworked implementation of the REP prefix for string instructions
- Pick up flags conversion for WHPX x86 (used by target/i386/emulate)
- get rid of the goto for the save/restore less state for WHPX patch

Changes added since v2:
- Take target/i386/emulate patches from Bernhard Beschow
https://lore.kernel.org/qemu-devel/[email protected]/
- Rework state levels to an enum
- Skip some state loading on the registers save path too

Changes added since v1:
- move HVF x86_mmu code to common code
- Use x86_mmu in WHPX MMIO exits
- Remove WHPX CPUID traps as they're currently quite broken
- Optimise MMIO vmexits by not restoring the full state

Bernhard Beschow (3):
target/i386/emulate/x86_decode: Fix compiler warning target/i386/hvf/x86_mmu: Fix compiler warning target/i386/emulate/x86_decode: Actually use stream in
decode_instruction_stream()

Mohamed Mediouni (25):
target/i386/emulate: rework string_rep emulation target/i386: emulate, hvf: move x86_mmu to common code
whpx: i386: re-enable guest debug support
whpx: preparatory changes before switching over from winhvemulation
whpx: refactor whpx_destroy_vcpu to arch-specific function
whpx: move whpx_get_reg/whpx_set_reg to generic code
whpx: i386: switch over from winhvemulation to target/i386/emulate
whpx: i386: flags conversion for target/i386/emulate internal state
whpx: i386: remove remaining winhvemulation support code
whpx: i386: remove messages
whpx: i386: remove CPUID trapping
whpx: common, i386, arm: rework state levels
whpx: i386: saving/restoring less state for
WHPX_LEVEL_FAST_RUNTIME_STATE
target/i386: mshv, emulate: move the generic x86 helpers to

    target/i386/emulate

target/i386: emulate: 5-level paging for the page table walker target/i386: emulate, hvf, mshv: rework MMU code
hvf: i386: save/restore CR0/2/3
target/i386: emulate: get rid of write_val_to_mem() helper target/i386: emulate: raise an exception on translation fault target/i386: emulate: remove fetch_instruction helper too target/i386: emulate: propagate memory errors on most reads/writes
whpx: i386: inject exceptions
whpx: i386: bump to x2apic
whpx: i386: ignore send_msi to interrupt vector 0 target/i386: emulate: propagate errors all the way and stop early

 accel/whpx/whpx-accel-ops.c                   |   8 +
 accel/whpx/whpx-common.c                      |  68 +-
 include/system/whpx-accel-ops.h               |  16 +-
 include/system/whpx-all.h                     |  11 +-
 include/system/whpx-common.h                  |   6 +-
 include/system/whpx-internal.h                |  16 -
 meson.build                                   |   3 +-
 target/arm/whpx/whpx-all.c                    |  43 +-
 target/i386/cpu.h                             |   2 +-
 target/i386/emulate/meson.build               |   9 +
 target/i386/emulate/x86.h                     |   1 +
 target/i386/emulate/x86_decode.c              |  12 +-
 target/i386/emulate/x86_emu.c                 | 356 +++++++----
 target/i386/emulate/x86_emu.h                 |  24 +-
 .../{mshv/x86.c => emulate/x86_helpers.c}     |  13 +-
 target/i386/emulate/x86_mmu.c                 | 354 +++++++++++
 target/i386/{hvf => emulate}/x86_mmu.h        |  31 +-
 target/i386/hvf/hvf.c                         |  40 +-
 target/i386/hvf/meson.build                   |   1 -
 target/i386/hvf/x86.c                         |  13 +-
 target/i386/hvf/x86_mmu.c                     | 277 --------
 target/i386/hvf/x86_task.c                    |  10 +-
 target/i386/mshv/meson.build                  |   2 +-
 target/i386/mshv/mshv-cpu.c                   |  71 ---
 target/i386/whpx/whpx-all.c                   | 591 ++++++++----------
 target/i386/whpx/whpx-apic.c                  |   5 +
 26 files changed, 1031 insertions(+), 952 deletions(-)
 rename target/i386/{mshv/x86.c => emulate/x86_helpers.c} (95%)
 create mode 100644 target/i386/emulate/x86_mmu.c
 rename target/i386/{hvf => emulate}/x86_mmu.h (51%)
 delete mode 100644 target/i386/hvf/x86_mmu.c
Signature · 1 line
2.50.1 (Apple Git-155)