• Vitaly Kuznetsov's avatar
    KVM: nSVM: Implement Enlightened MSR-Bitmap feature · 66c03a92
    Vitaly Kuznetsov authored
    Similar to nVMX commit 502d2bf5 ("KVM: nVMX: Implement Enlightened MSR
    Bitmap feature"), add support for the feature for nSVM (Hyper-V on KVM).
    
    Notable differences from nVMX implementation:
    - As the feature uses SW reserved fields in VMCB control, KVM needs to
    make sure it's dealing with a Hyper-V guest (kvm_hv_hypercall_enabled()).
    
    - 'msrpm_base_pa' needs to be always be overwritten in
    nested_svm_vmrun_msrpm(), even when the update is skipped. As an
    optimization, nested_vmcb02_prepare_control() copies it from VMCB01
    so when MSR-Bitmap feature for L2 is disabled nothing needs to be done.
    
    - 'struct vmcb_ctrl_area_cached' needs to be extended with clean
    fields/sw reserved data and __nested_copy_vmcb_control_to_cache() needs to
    copy it so nested_svm_vmrun_msrpm() can use it later.
    Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
    Message-Id: <20220202095100.129834-5-vkuznets@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    66c03a92
nested.c 43.5 KB