KVM: x86: Add comments to document various emulation types
Document the intended usage of each emulation type as each exists to handle an edge case of one kind or another and can be easily misinterpreted at first glance. Cc: Liran Alon <liran.alon@oracle.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
1957aa63be
commit
41577ab8bd
@ -1315,6 +1315,36 @@ extern u64 kvm_default_tsc_scaling_ratio;
|
||||
|
||||
extern u64 kvm_mce_cap_supported;
|
||||
|
||||
/*
|
||||
* EMULTYPE_NO_DECODE - Set when re-emulating an instruction (after completing
|
||||
* userspace I/O) to indicate that the emulation context
|
||||
* should be resued as is, i.e. skip initialization of
|
||||
* emulation context, instruction fetch and decode.
|
||||
*
|
||||
* EMULTYPE_TRAP_UD - Set when emulating an intercepted #UD from hardware.
|
||||
* Indicates that only select instructions (tagged with
|
||||
* EmulateOnUD) should be emulated (to minimize the emulator
|
||||
* attack surface). See also EMULTYPE_TRAP_UD_FORCED.
|
||||
*
|
||||
* EMULTYPE_SKIP - Set when emulating solely to skip an instruction, i.e. to
|
||||
* decode the instruction length. For use *only* by
|
||||
* kvm_x86_ops->skip_emulated_instruction() implementations.
|
||||
*
|
||||
* EMULTYPE_ALLOW_RETRY - Set when the emulator should resume the guest to
|
||||
* retry native execution under certain conditions.
|
||||
*
|
||||
* EMULTYPE_TRAP_UD_FORCED - Set when emulating an intercepted #UD that was
|
||||
* triggered by KVM's magic "force emulation" prefix,
|
||||
* which is opt in via module param (off by default).
|
||||
* Bypasses EmulateOnUD restriction despite emulating
|
||||
* due to an intercepted #UD (see EMULTYPE_TRAP_UD).
|
||||
* Used to test the full emulator from userspace.
|
||||
*
|
||||
* EMULTYPE_VMWARE_GP - Set when emulating an intercepted #GP for VMware
|
||||
* backdoor emulation, which is opt in via module param.
|
||||
* VMware backoor emulation handles select instructions
|
||||
* and reinjects the #GP for all other cases.
|
||||
*/
|
||||
#define EMULTYPE_NO_DECODE (1 << 0)
|
||||
#define EMULTYPE_TRAP_UD (1 << 1)
|
||||
#define EMULTYPE_SKIP (1 << 2)
|
||||
|
Loading…
Reference in New Issue
Block a user