]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
KVM: nested VMX: disable perf cpuid reporting
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 18 Sep 2014 21:24:57 +0000 (18:24 -0300)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 24 Sep 2014 12:07:50 +0000 (14:07 +0200)
Initilization of L2 guest with -cpu host, on L1 guest with -cpu host
triggers:

(qemu) KVM: entry failed, hardware error 0x7
...
nested_vmx_run: VMCS MSR_{LOAD,STORE} unsupported

Nested VMX MSR load/store support is not sufficient to
allow perf for L2 guest.

Until properly fixed, trap CPUID and disable function 0xA.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/cpuid.c
arch/x86/kvm/vmx.c

index e28d798f72777e7f17fd0b8e474b73b7d11d199d..976e3a57f9eaa0bc178e4a65b45531507f0416b4 100644 (file)
@@ -774,6 +774,12 @@ void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
        if (!best)
                best = check_cpuid_limit(vcpu, function, index);
 
+       /*
+        * Perfmon not yet supported for L2 guest.
+        */
+       if (is_guest_mode(vcpu) && function == 0xa)
+               best = NULL;
+
        if (best) {
                *eax = best->eax;
                *ebx = best->ebx;
index e8f08e91592d3cd94f5faab47729762225179735..2ab504791190910c5bc09317de1cf54b98f344a6 100644 (file)
@@ -6986,6 +6986,8 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
        case EXIT_REASON_TASK_SWITCH:
                return 1;
        case EXIT_REASON_CPUID:
+               if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa)
+                       return 0;
                return 1;
        case EXIT_REASON_HLT:
                return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING);