aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/vmx.h2
-rw-r--r--arch/x86/include/uapi/asm/vmx.h6
-rw-r--r--arch/x86/kvm/vmx.c21
3 files changed, 28 insertions, 1 deletions
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 08dc770bd340..45afaee9555c 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -160,6 +160,8 @@ enum vmcs_field {
160 EOI_EXIT_BITMAP3_HIGH = 0x00002023, 160 EOI_EXIT_BITMAP3_HIGH = 0x00002023,
161 VMREAD_BITMAP = 0x00002026, 161 VMREAD_BITMAP = 0x00002026,
162 VMWRITE_BITMAP = 0x00002028, 162 VMWRITE_BITMAP = 0x00002028,
163 XSS_EXIT_BITMAP = 0x0000202C,
164 XSS_EXIT_BITMAP_HIGH = 0x0000202D,
163 GUEST_PHYSICAL_ADDRESS = 0x00002400, 165 GUEST_PHYSICAL_ADDRESS = 0x00002400,
164 GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401, 166 GUEST_PHYSICAL_ADDRESS_HIGH = 0x00002401,
165 VMCS_LINK_POINTER = 0x00002800, 167 VMCS_LINK_POINTER = 0x00002800,
diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h
index 990a2fe1588d..b813bf9da1e2 100644
--- a/arch/x86/include/uapi/asm/vmx.h
+++ b/arch/x86/include/uapi/asm/vmx.h
@@ -72,6 +72,8 @@
72#define EXIT_REASON_XSETBV 55 72#define EXIT_REASON_XSETBV 55
73#define EXIT_REASON_APIC_WRITE 56 73#define EXIT_REASON_APIC_WRITE 56
74#define EXIT_REASON_INVPCID 58 74#define EXIT_REASON_INVPCID 58
75#define EXIT_REASON_XSAVES 63
76#define EXIT_REASON_XRSTORS 64
75 77
76#define VMX_EXIT_REASONS \ 78#define VMX_EXIT_REASONS \
77 { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \ 79 { EXIT_REASON_EXCEPTION_NMI, "EXCEPTION_NMI" }, \
@@ -116,6 +118,8 @@
116 { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \ 118 { EXIT_REASON_INVALID_STATE, "INVALID_STATE" }, \
117 { EXIT_REASON_INVD, "INVD" }, \ 119 { EXIT_REASON_INVD, "INVD" }, \
118 { EXIT_REASON_INVVPID, "INVVPID" }, \ 120 { EXIT_REASON_INVVPID, "INVVPID" }, \
119 { EXIT_REASON_INVPCID, "INVPCID" } 121 { EXIT_REASON_INVPCID, "INVPCID" }, \
122 { EXIT_REASON_XSAVES, "XSAVES" }, \
123 { EXIT_REASON_XRSTORS, "XRSTORS" }
120 124
121#endif /* _UAPIVMX_H */ 125#endif /* _UAPIVMX_H */
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index dd4fa461454a..88048c72b6b1 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -761,6 +761,7 @@ static u64 construct_eptp(unsigned long root_hpa);
761static void kvm_cpu_vmxon(u64 addr); 761static void kvm_cpu_vmxon(u64 addr);
762static void kvm_cpu_vmxoff(void); 762static void kvm_cpu_vmxoff(void);
763static bool vmx_mpx_supported(void); 763static bool vmx_mpx_supported(void);
764static bool vmx_xsaves_supported(void);
764static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr); 765static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr);
765static void vmx_set_segment(struct kvm_vcpu *vcpu, 766static void vmx_set_segment(struct kvm_vcpu *vcpu,
766 struct kvm_segment *var, int seg); 767 struct kvm_segment *var, int seg);
@@ -4337,6 +4338,7 @@ static void ept_set_mmio_spte_mask(void)
4337 kvm_mmu_set_mmio_spte_mask((0x3ull << 62) | 0x6ull); 4338 kvm_mmu_set_mmio_spte_mask((0x3ull << 62) | 0x6ull);
4338} 4339}
4339 4340
4341#define VMX_XSS_EXIT_BITMAP 0
4340/* 4342/*
4341 * Sets up the vmcs for emulated real mode. 4343 * Sets up the vmcs for emulated real mode.
4342 */ 4344 */
@@ -4446,6 +4448,9 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
4446 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL); 4448 vmcs_writel(CR0_GUEST_HOST_MASK, ~0UL);
4447 set_cr4_guest_host_mask(vmx); 4449 set_cr4_guest_host_mask(vmx);
4448 4450
4451 if (vmx_xsaves_supported())
4452 vmcs_write64(XSS_EXIT_BITMAP, VMX_XSS_EXIT_BITMAP);
4453
4449 return 0; 4454 return 0;
4450} 4455}
4451 4456
@@ -5334,6 +5339,20 @@ static int handle_xsetbv(struct kvm_vcpu *vcpu)
5334 return 1; 5339 return 1;
5335} 5340}
5336 5341
5342static int handle_xsaves(struct kvm_vcpu *vcpu)
5343{
5344 skip_emulated_instruction(vcpu);
5345 WARN(1, "this should never happen\n");
5346 return 1;
5347}
5348
5349static int handle_xrstors(struct kvm_vcpu *vcpu)
5350{
5351 skip_emulated_instruction(vcpu);
5352 WARN(1, "this should never happen\n");
5353 return 1;
5354}
5355
5337static int handle_apic_access(struct kvm_vcpu *vcpu) 5356static int handle_apic_access(struct kvm_vcpu *vcpu)
5338{ 5357{
5339 if (likely(fasteoi)) { 5358 if (likely(fasteoi)) {
@@ -6951,6 +6970,8 @@ static int (*const kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
6951 [EXIT_REASON_MONITOR_INSTRUCTION] = handle_monitor, 6970 [EXIT_REASON_MONITOR_INSTRUCTION] = handle_monitor,
6952 [EXIT_REASON_INVEPT] = handle_invept, 6971 [EXIT_REASON_INVEPT] = handle_invept,
6953 [EXIT_REASON_INVVPID] = handle_invvpid, 6972 [EXIT_REASON_INVVPID] = handle_invvpid,
6973 [EXIT_REASON_XSAVES] = handle_xsaves,
6974 [EXIT_REASON_XRSTORS] = handle_xrstors,
6954}; 6975};
6955 6976
6956static const int kvm_vmx_max_exit_handlers = 6977static const int kvm_vmx_max_exit_handlers =