• Vitaly Kuznetsov's avatar
    KVM: nVMX: implement enlightened VMPTRLD and VMCLEAR · b8bbab92
    Vitaly Kuznetsov authored
    Per Hyper-V TLFS 5.0b:
    
    "The L1 hypervisor may choose to use enlightened VMCSs by writing 1 to
    the corresponding field in the VP assist page (see section 7.8.7).
    Another field in the VP assist page controls the currently active
    enlightened VMCS. Each enlightened VMCS is exactly one page (4 KB) in
    size and must be initially zeroed. No VMPTRLD instruction must be
    executed to make an enlightened VMCS active or current.
    
    After the L1 hypervisor performs a VM entry with an enlightened VMCS,
    the VMCS is considered active on the processor. An enlightened VMCS
    can only be active on a single processor at the same time. The L1
    hypervisor can execute a VMCLEAR instruction to transition an
    enlightened VMCS from the active to the non-active state. Any VMREAD
    or VMWRITE instructions while an enlightened VMCS is active is
    unsupported and can result in unexpected behavior."
    
    Keep Enlightened VMCS structure for the current L2 guest permanently mapped
    from struct nested_vmx instead of mapping it every time.
    Suggested-by: default avatarLadi Prosek <lprosek@redhat.com>
    Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    b8bbab92
vmx.c 433 KB