revert android-tegra-2.6.36-honeycomb-mr1-9001adc to v2.6.36
[firefly-linux-kernel-4.4.55.git] / arch / x86 / kvm / svm.c
index e7c3f3bd08fc8730c3c22721b4c430f5c7ea4fbd..8a3f9f64f86f9e7fee5bc5112bf50a04fbe37b15 100644 (file)
@@ -88,14 +88,6 @@ struct nested_state {
        /* A VMEXIT is required but not yet emulated */
        bool exit_required;
 
-       /*
-        * If we vmexit during an instruction emulation we need this to restore
-        * the l1 guest rip after the emulation
-        */
-       unsigned long vmexit_rip;
-       unsigned long vmexit_rsp;
-       unsigned long vmexit_rax;
-
        /* cache for intercepts of the guest */
        u16 intercept_cr_read;
        u16 intercept_cr_write;
@@ -1214,12 +1206,8 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
                if (old == new) {
                        /* cr0 write with ts and mp unchanged */
                        svm->vmcb->control.exit_code = SVM_EXIT_CR0_SEL_WRITE;
-                       if (nested_svm_exit_handled(svm) == NESTED_EXIT_DONE) {
-                               svm->nested.vmexit_rip = kvm_rip_read(vcpu);
-                               svm->nested.vmexit_rsp = kvm_register_read(vcpu, VCPU_REGS_RSP);
-                               svm->nested.vmexit_rax = kvm_register_read(vcpu, VCPU_REGS_RAX);
+                       if (nested_svm_exit_handled(svm) == NESTED_EXIT_DONE)
                                return;
-                       }
                }
        }
 
@@ -2411,23 +2399,6 @@ static int emulate_on_interception(struct vcpu_svm *svm)
        return emulate_instruction(&svm->vcpu, 0, 0, 0) == EMULATE_DONE;
 }
 
-static int cr0_write_interception(struct vcpu_svm *svm)
-{
-       struct kvm_vcpu *vcpu = &svm->vcpu;
-       int r;
-
-       r = emulate_instruction(&svm->vcpu, 0, 0, 0);
-
-       if (svm->nested.vmexit_rip) {
-               kvm_register_write(vcpu, VCPU_REGS_RIP, svm->nested.vmexit_rip);
-               kvm_register_write(vcpu, VCPU_REGS_RSP, svm->nested.vmexit_rsp);
-               kvm_register_write(vcpu, VCPU_REGS_RAX, svm->nested.vmexit_rax);
-               svm->nested.vmexit_rip = 0;
-       }
-
-       return r == EMULATE_DONE;
-}
-
 static int cr8_write_interception(struct vcpu_svm *svm)
 {
        struct kvm_run *kvm_run = svm->vcpu.run;
@@ -2701,7 +2672,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = {
        [SVM_EXIT_READ_CR4]                     = emulate_on_interception,
        [SVM_EXIT_READ_CR8]                     = emulate_on_interception,
        [SVM_EXIT_CR0_SEL_WRITE]                = emulate_on_interception,
-       [SVM_EXIT_WRITE_CR0]                    = cr0_write_interception,
+       [SVM_EXIT_WRITE_CR0]                    = emulate_on_interception,
        [SVM_EXIT_WRITE_CR3]                    = emulate_on_interception,
        [SVM_EXIT_WRITE_CR4]                    = emulate_on_interception,
        [SVM_EXIT_WRITE_CR8]                    = cr8_write_interception,
@@ -3281,7 +3252,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
        vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip;
 
        load_host_msrs(vcpu);
-       kvm_load_ldt(ldt_selector);
        loadsegment(fs, fs_selector);
 #ifdef CONFIG_X86_64
        load_gs_index(gs_selector);
@@ -3289,6 +3259,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 #else
        loadsegment(gs, gs_selector);
 #endif
+       kvm_load_ldt(ldt_selector);
 
        reload_tss(vcpu);
 
@@ -3383,14 +3354,6 @@ static void svm_cpuid_update(struct kvm_vcpu *vcpu)
 static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
 {
        switch (func) {
-       case 0x00000001:
-               /* Mask out xsave bit as long as it is not supported by SVM */
-               entry->ecx &= ~(bit(X86_FEATURE_XSAVE));
-               break;
-       case 0x80000001:
-               if (nested)
-                       entry->ecx |= (1 << 2); /* Set SVM bit */
-               break;
        case 0x8000000A:
                entry->eax = 1; /* SVM revision 1 */
                entry->ebx = 8; /* Lets support 8 ASIDs in case we add proper