Skip to content

whpx: i386: even more changes

Mohamed Mediouni qemu-devel 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 0 repliesNew
  2. v14 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8whpx: i386: move whpx_vcpu_kick_out_of_hlt() invocation to interrupt raise timetarget/i386/whpx/whpx-all.c+21 -280 replies
2/8whpx: i386: enable all supported host featurestarget/i386/whpx/whpx-all.c+40 -00 replies
3/8whpx: i386: enable synthetic processor featurestarget/i386/whpx/whpx-all.c+34 -00 replies
4/8whpx: i386: warn on unsupported MSR access instead of failing silentlytarget/i386/whpx/whpx-all.c+3 -00 replies
5/8target/i386: emulate: more 64-bit register handlingtarget/i386/emulate/x86_emu.c target/i386/emulate/x86_flags.c target/i386/emulate/x86_flags.h+84 -00 replies
6/8whpx: i386: enable PMUtarget/i386/whpx/whpx-all.c+22 -00 replies
7/8whpx: i386: expose HV_X64_MSR_APIC_FREQUENCY when kernel-irqchip=offtarget/i386/whpx/whpx-all.c+16 -20 replies
8/8target/i386: emulate: fix scastarget/i386/emulate/x86_emu.c+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/8] whpx: i386: even more changes

Hello,

I think that'll be it for QEMU 11.0. This one contains some additional set of patches on top of the v1 of "whpx: i386: even more changes".

This is to be applied on top of https://patchew.org/QEMU/[email protected]/
followed by https://patchew.org/QEMU/[email protected]/

I think the missing bits now for WHPX on x86 are mainly:

- incomplete and/or sometimes erroneous emulation in target/i386/emulate - it's nowhere near passing the kvm-unit-tests emulator test but hopefully will be good enough for this release. HVF relied on it for a long time after all :)

- and save/restore is the other big one. This one is missing from the Arm backend too. I won't have that ready in time for the 11.0 window closing unfortunately. On the x86 side, I'm tempted to wait until it's done for MSHV and then pick up the pieces from there.

And on that note, the layout returned by WHvGetVirtualProcessorState(WHvVirtualProcessorStateTypeInterruptControllerState2) is this:

typedef struct _HV_X64_INTERRUPT_CONTROLLER_STATE

{
    UINT32 ApicId;
    UINT32 ApicVersion;
    UINT32 ApicLdr;
    UINT32 ApicDfr;
    UINT32 ApicSpurious;
    UINT32 ApicIsr[8];
    UINT32 ApicTmr[8];
    UINT32 ApicIrr[8];
    UINT32 ApicEsr;
    UINT32 ApicIcrHigh;
    UINT32 ApicIcrLow;
    UINT32 ApicLvtTimer;
    UINT32 ApicLvtThermal;
    UINT32 ApicLvtPerfmon;
    UINT32 ApicLvtLint0;
    UINT32 ApicLvtLint1;
    UINT32 ApicLvtError;
    UINT32 ApicLvtCmci;
    UINT32 ApicErrorStatus;
    UINT32 ApicInitialCount;
    UINT32 ApicCounterValue;
    UINT32 ApicDivideConfiguration;
    UINT32 ApicRemoteRead;

} HV_X64_INTERRUPT_CONTROLLER_STATE, *PHV_X64_INTERRUPT_CONTROLLER_STATE;

which matches the hv_local_interrupt_controller_state structure in the hvgdk_mini.h present for MSHV.

Side note: probably want to add a KVM capability to skip the instruction emulator - and whatever plumbing might be needed to pass all the instruction fault info given by the hardware. And fallback execution too, which would allow stabilising the set of instructions supported by the in-KVM emulator going forward once target/x86/emulate is more complete.

Happy hacking :)

This series is pretty small:

- the first patch is a fixup for "whpx: x86: kick out of HLT manually when using the kernel-irqchip"

It can be squashed with it and fixes the "sti; hlt" KVM unit test case.

- enable all supported host features

This enables the nested virt capability too when marked as supported (although without nested virt enlightenments).

- enable synthetic processor features

QEMU assumes that those are a property of the CPU, but Hyper-V needs that info at partition init time, so just enable them unconditionally for now.

- warn on unsupported MSR accesses

This applies on top of the "whpx: x86 updates (2026-02)" and "whpx: i386: interrupt-related updates" series.

- target/i386/emulate: more 64-bit register handling

- whpx: i386: enable PMU

- whpx: i386: expose HV_X64_MSR_APIC_FREQUENCY for kernel-irqchip=off

Instead of having it be handled as zeroing...

- target/i386: emulate: fix scas

Based-on: <[email protected]>

Mohamed Mediouni (8):
whpx: i386: move whpx_vcpu_kick_out_of_hlt() invocation to interrupt
raise time
whpx: i386: enable all supported host features
whpx: i386: enable synthetic processor features
whpx: i386: warn on unsupported MSR access instead of failing silently target/i386: emulate: more 64-bit register handling
whpx: i386: enable PMU
whpx: i386: expose HV_X64_MSR_APIC_FREQUENCY when kernel-irqchip=off target/i386: emulate: fix scas

 target/i386/emulate/x86_emu.c   |  19 ++++
 target/i386/emulate/x86_flags.c |  47 +++++++++
 target/i386/emulate/x86_flags.h |  20 ++++
 target/i386/whpx/whpx-all.c     | 162 ++++++++++++++++++++++++++------
 4 files changed, 220 insertions(+), 28 deletions(-)
Signature · 1 line
2.50.1 (Apple Git-155)