• Wanpeng Li's avatar
    KVM: VMX: Fix VPID capability detection · 61f1dd90
    Wanpeng Li authored
    In my setup, EPT is not exposed to L1, the VPID capability is exposed and
    can be observed by vmxcap tool in L1:
    INVVPID supported                        yes
    Individual-address INVVPID               yes
    Single-context INVVPID                   yes
    All-context INVVPID                      yes
    Single-context-retaining-globals INVVPID yes
    
    However, the module parameter of VPID observed in L1 is always N, the
    cpu_has_vmx_invvpid() check in L1 KVM fails since vmx_capability.vpid
    is 0 and it is not read from MSR due to EPT is not exposed.
    
    The VPID can be used to tag linear mappings when EPT is not enabled. However,
    current logic just detects VPID capability if EPT is enabled, this patch
    fixes it.
    
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Radim Krčmář <rkrcmar@redhat.com>
    Cc: Jim Mattson <jmattson@google.com>
    Signed-off-by: default avatarWanpeng Li <wanpeng.li@hotmail.com>
    Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
    61f1dd90
vmx.c 344 KB