KVM/nVMX: Set the CPU_BASED_USE_MSR_BITMAPS if we have a valid L02 MSR bitmap

"Linux Kernel Mailing List" <[email protected]> Thu, 15 Feb 2018 01:31:42 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/3712caeb14dcb33fb4d5114f14c0beef10aca101
Commit:     3712caeb14dcb33fb4d5114f14c0beef10aca101
Parent:     206587a9fb764d71f035dc7f6d3b6488f5d5b304
Refname:    refs/heads/master
Author:     KarimAllah Ahmed <[email protected]>
AuthorDate: Sat Feb 10 23:39:26 2018 +0000
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue Feb 13 09:00:17 2018 +0100

    KVM/nVMX: Set the CPU_BASED_USE_MSR_BITMAPS if we have a valid L02 MSR bitmap
    
    We either clear the CPU_BASED_USE_MSR_BITMAPS and end up intercepting all
    MSR accesses or create a valid L02 MSR bitmap and use that. This decision
    has to be made every time we evaluate whether we are going to generate the
    L02 MSR bitmap.
    
    Before commit:
    
      d28b387fb74d ("KVM/VMX: Allow direct access to MSR_IA32_SPEC_CTRL")
    
    ... this was probably OK since the decision was always identical.
    
    This is no longer the case now since the MSR bitmap might actually
    change once we decide to not intercept SPEC_CTRL and PRED_CMD.
    
    Signed-off-by: KarimAllah Ahmed <[email protected]>
    Signed-off-by: David Woodhouse <[email protected]>
    Acked-by: Paolo Bonzini <[email protected]>
    Cc: Andy Lutomirski <[email protected]>
    Cc: Arjan van de Ven <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Dan Williams <[email protected]>
    Cc: Dave Hansen <[email protected]>
    Cc: David Woodhouse <[email protected]>
    Cc: Greg Kroah-Hartman <[email protected]>
    Cc: Josh Poimboeuf <[email protected]>
    Cc: Linus Torvalds <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Radim Krčmář <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Cc: [email protected]
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
---
 arch/x86/kvm/vmx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 599179bfb87f..91e3539cba02 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -10130,7 +10130,8 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu,
 	if (cpu_has_vmx_msr_bitmap() &&
 	    nested_cpu_has(vmcs12, CPU_BASED_USE_MSR_BITMAPS) &&
 	    nested_vmx_merge_msr_bitmap(vcpu, vmcs12))
-		;
+		vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL,
+			      CPU_BASED_USE_MSR_BITMAPS);
 	else
 		vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL,
 				CPU_BASED_USE_MSR_BITMAPS);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html