aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/svm.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-08-07 05:49:43 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 03:46:32 -0400
commit1f8da47805072e89454ccfdada553c2afc4dfb79 (patch)
tree916742666153e0279d3286b98447cd75cb9d7771 /arch/x86/kvm/svm.c
parentea8e064fe22a132da1473d82a57751208e6b8bfd (diff)
KVM: SVM: handle errors in vmrun emulation path appropriatly
If nested svm fails to load the msrpm the vmrun succeeds with the old msrpm which is not correct. This patch changes the logic to roll back to host mode in case the msrpm cannot be loaded. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r--arch/x86/kvm/svm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index d458297d54c8..53376f144d70 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1874,6 +1874,7 @@ static int vmsave_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1874static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run) 1874static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1875{ 1875{
1876 nsvm_printk("VMrun\n"); 1876 nsvm_printk("VMrun\n");
1877
1877 if (nested_svm_check_permissions(svm)) 1878 if (nested_svm_check_permissions(svm))
1878 return 1; 1879 return 1;
1879 1880
@@ -1884,7 +1885,18 @@ static int vmrun_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1884 return 1; 1885 return 1;
1885 1886
1886 if (!nested_svm_vmrun_msrpm(svm)) 1887 if (!nested_svm_vmrun_msrpm(svm))
1887 return 1; 1888 goto failed;
1889
1890 return 1;
1891
1892failed:
1893
1894 svm->vmcb->control.exit_code = SVM_EXIT_ERR;
1895 svm->vmcb->control.exit_code_hi = 0;
1896 svm->vmcb->control.exit_info_1 = 0;
1897 svm->vmcb->control.exit_info_2 = 0;
1898
1899 nested_svm_vmexit(svm);
1888 1900
1889 return 1; 1901 return 1;
1890} 1902}