Skip to content

VMX: Invalid guest state emulation

Mohammed Gamal kvm 1 version In review

Get series with b4
b4 am 20080817133615.GA8743@mohd-laptop

Versions newest first

  1. v1 Latest4 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4VMX: Add Guest State Validity Checksarch/x86/kvm/vmx.c+180 -00 replies
2/4VMX: Add module parameter and emulation flag.arch/x86/kvm/vmx.c+4 -00 replies
3/4VMX: Add invalid guest state handlerarch/x86/kvm/vmx.c+31 -01 reply
4/4VMX: Modify mode switching and vmentry functionsarch/x86/kvm/vmx.c+20 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/4] VMX: Invalid guest state emulation

The patch series adds invalid guest state emulation for VMX hosts, which is needed in order to properly support real mode guests. Usually, a guest would be in an VMX-invalid state during mode switches from real to protected mode or vice versa. We handle this invalid state by using the x86 emulator to emulate instructions until we arrive back to a VMX-friendly state. This is achieved by:
- Adding thorough guest state checking in order to catch and handle invalid states
- Adding a guest state handler which emulates instructions till guest state is valid
- Adding an "emulation required" flag, enabled on mode switches, to indicated that emulation is needed
- Checking for guest state on vcpu_run() and emulating instructions instead of entering VMX if the state is invalid.

The next step needed is to add more instructions to the x86 emulator, since we might run into instructions not supported yet. In order not to interfere with normal KVM operation, a module parameter 'emulate_invalid_guest_state' -which is disabled by default- that is used in order to drive emulation. Bear in mind that currently you can't use this patch alone to get real mode guests to work. There is still a lot of work needed on the x86 emulator in order not to run into failures running these guests.