diff options
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 26ba61d6af8c..864a1b6d155a 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <asm/vmx.h> | 37 | #include <asm/vmx.h> |
38 | #include <asm/virtext.h> | 38 | #include <asm/virtext.h> |
39 | #include <asm/mce.h> | 39 | #include <asm/mce.h> |
40 | #include <asm/i387.h> | ||
41 | #include <asm/xcr.h> | ||
40 | 42 | ||
41 | #include "trace.h" | 43 | #include "trace.h" |
42 | 44 | ||
@@ -3390,6 +3392,16 @@ static int handle_wbinvd(struct kvm_vcpu *vcpu) | |||
3390 | return 1; | 3392 | return 1; |
3391 | } | 3393 | } |
3392 | 3394 | ||
3395 | static int handle_xsetbv(struct kvm_vcpu *vcpu) | ||
3396 | { | ||
3397 | u64 new_bv = kvm_read_edx_eax(vcpu); | ||
3398 | u32 index = kvm_register_read(vcpu, VCPU_REGS_RCX); | ||
3399 | |||
3400 | if (kvm_set_xcr(vcpu, index, new_bv) == 0) | ||
3401 | skip_emulated_instruction(vcpu); | ||
3402 | return 1; | ||
3403 | } | ||
3404 | |||
3393 | static int handle_apic_access(struct kvm_vcpu *vcpu) | 3405 | static int handle_apic_access(struct kvm_vcpu *vcpu) |
3394 | { | 3406 | { |
3395 | return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE; | 3407 | return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE; |
@@ -3668,6 +3680,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { | |||
3668 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, | 3680 | [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, |
3669 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, | 3681 | [EXIT_REASON_APIC_ACCESS] = handle_apic_access, |
3670 | [EXIT_REASON_WBINVD] = handle_wbinvd, | 3682 | [EXIT_REASON_WBINVD] = handle_wbinvd, |
3683 | [EXIT_REASON_XSETBV] = handle_xsetbv, | ||
3671 | [EXIT_REASON_TASK_SWITCH] = handle_task_switch, | 3684 | [EXIT_REASON_TASK_SWITCH] = handle_task_switch, |
3672 | [EXIT_REASON_MCE_DURING_VMENTRY] = handle_machine_check, | 3685 | [EXIT_REASON_MCE_DURING_VMENTRY] = handle_machine_check, |
3673 | [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation, | 3686 | [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation, |