diff options
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 7527cefc5a43..41dd0387cccb 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -1056,9 +1056,11 @@ static void svm_adjust_tsc_offset(struct kvm_vcpu *vcpu, s64 adjustment, bool ho | |||
1056 | { | 1056 | { |
1057 | struct vcpu_svm *svm = to_svm(vcpu); | 1057 | struct vcpu_svm *svm = to_svm(vcpu); |
1058 | 1058 | ||
1059 | WARN_ON(adjustment < 0); | 1059 | if (host) { |
1060 | if (host) | 1060 | if (svm->tsc_ratio != TSC_RATIO_DEFAULT) |
1061 | adjustment = svm_scale_tsc(vcpu, adjustment); | 1061 | WARN_ON(adjustment < 0); |
1062 | adjustment = svm_scale_tsc(vcpu, (u64)adjustment); | ||
1063 | } | ||
1062 | 1064 | ||
1063 | svm->vmcb->control.tsc_offset += adjustment; | 1065 | svm->vmcb->control.tsc_offset += adjustment; |
1064 | if (is_guest_mode(vcpu)) | 1066 | if (is_guest_mode(vcpu)) |
@@ -2999,7 +3001,6 @@ static int dr_interception(struct vcpu_svm *svm) | |||
2999 | { | 3001 | { |
3000 | int reg, dr; | 3002 | int reg, dr; |
3001 | unsigned long val; | 3003 | unsigned long val; |
3002 | int err; | ||
3003 | 3004 | ||
3004 | if (svm->vcpu.guest_debug == 0) { | 3005 | if (svm->vcpu.guest_debug == 0) { |
3005 | /* | 3006 | /* |
@@ -3019,12 +3020,15 @@ static int dr_interception(struct vcpu_svm *svm) | |||
3019 | dr = svm->vmcb->control.exit_code - SVM_EXIT_READ_DR0; | 3020 | dr = svm->vmcb->control.exit_code - SVM_EXIT_READ_DR0; |
3020 | 3021 | ||
3021 | if (dr >= 16) { /* mov to DRn */ | 3022 | if (dr >= 16) { /* mov to DRn */ |
3023 | if (!kvm_require_dr(&svm->vcpu, dr - 16)) | ||
3024 | return 1; | ||
3022 | val = kvm_register_read(&svm->vcpu, reg); | 3025 | val = kvm_register_read(&svm->vcpu, reg); |
3023 | kvm_set_dr(&svm->vcpu, dr - 16, val); | 3026 | kvm_set_dr(&svm->vcpu, dr - 16, val); |
3024 | } else { | 3027 | } else { |
3025 | err = kvm_get_dr(&svm->vcpu, dr, &val); | 3028 | if (!kvm_require_dr(&svm->vcpu, dr)) |
3026 | if (!err) | 3029 | return 1; |
3027 | kvm_register_write(&svm->vcpu, reg, val); | 3030 | kvm_get_dr(&svm->vcpu, dr, &val); |
3031 | kvm_register_write(&svm->vcpu, reg, val); | ||
3028 | } | 3032 | } |
3029 | 3033 | ||
3030 | skip_emulated_instruction(&svm->vcpu); | 3034 | skip_emulated_instruction(&svm->vcpu); |
@@ -4123,6 +4127,11 @@ static bool svm_mpx_supported(void) | |||
4123 | return false; | 4127 | return false; |
4124 | } | 4128 | } |
4125 | 4129 | ||
4130 | static bool svm_xsaves_supported(void) | ||
4131 | { | ||
4132 | return false; | ||
4133 | } | ||
4134 | |||
4126 | static bool svm_has_wbinvd_exit(void) | 4135 | static bool svm_has_wbinvd_exit(void) |
4127 | { | 4136 | { |
4128 | return true; | 4137 | return true; |
@@ -4410,6 +4419,7 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
4410 | .rdtscp_supported = svm_rdtscp_supported, | 4419 | .rdtscp_supported = svm_rdtscp_supported, |
4411 | .invpcid_supported = svm_invpcid_supported, | 4420 | .invpcid_supported = svm_invpcid_supported, |
4412 | .mpx_supported = svm_mpx_supported, | 4421 | .mpx_supported = svm_mpx_supported, |
4422 | .xsaves_supported = svm_xsaves_supported, | ||
4413 | 4423 | ||
4414 | .set_supported_cpuid = svm_set_supported_cpuid, | 4424 | .set_supported_cpuid = svm_set_supported_cpuid, |
4415 | 4425 | ||