diff options
-rw-r--r-- | arch/x86/include/asm/svm.h | 3 | ||||
-rw-r--r-- | arch/x86/kvm/svm.c | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 85574b7c1bc1..1fecb7e61130 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h | |||
@@ -57,7 +57,8 @@ struct __attribute__ ((__packed__)) vmcb_control_area { | |||
57 | u16 intercept_dr_write; | 57 | u16 intercept_dr_write; |
58 | u32 intercept_exceptions; | 58 | u32 intercept_exceptions; |
59 | u64 intercept; | 59 | u64 intercept; |
60 | u8 reserved_1[44]; | 60 | u8 reserved_1[42]; |
61 | u16 pause_filter_count; | ||
61 | u64 iopm_base_pa; | 62 | u64 iopm_base_pa; |
62 | u64 msrpm_base_pa; | 63 | u64 msrpm_base_pa; |
63 | u64 tsc_offset; | 64 | u64 tsc_offset; |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 69610c5d6dea..170b2d9c6909 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -46,6 +46,7 @@ MODULE_LICENSE("GPL"); | |||
46 | #define SVM_FEATURE_NPT (1 << 0) | 46 | #define SVM_FEATURE_NPT (1 << 0) |
47 | #define SVM_FEATURE_LBRV (1 << 1) | 47 | #define SVM_FEATURE_LBRV (1 << 1) |
48 | #define SVM_FEATURE_SVML (1 << 2) | 48 | #define SVM_FEATURE_SVML (1 << 2) |
49 | #define SVM_FEATURE_PAUSE_FILTER (1 << 10) | ||
49 | 50 | ||
50 | #define NESTED_EXIT_HOST 0 /* Exit handled on host level */ | 51 | #define NESTED_EXIT_HOST 0 /* Exit handled on host level */ |
51 | #define NESTED_EXIT_DONE 1 /* Exit caused nested vmexit */ | 52 | #define NESTED_EXIT_DONE 1 /* Exit caused nested vmexit */ |
@@ -654,6 +655,11 @@ static void init_vmcb(struct vcpu_svm *svm) | |||
654 | svm->nested.vmcb = 0; | 655 | svm->nested.vmcb = 0; |
655 | svm->vcpu.arch.hflags = 0; | 656 | svm->vcpu.arch.hflags = 0; |
656 | 657 | ||
658 | if (svm_has(SVM_FEATURE_PAUSE_FILTER)) { | ||
659 | control->pause_filter_count = 3000; | ||
660 | control->intercept |= (1ULL << INTERCEPT_PAUSE); | ||
661 | } | ||
662 | |||
657 | enable_gif(svm); | 663 | enable_gif(svm); |
658 | } | 664 | } |
659 | 665 | ||
@@ -2281,6 +2287,12 @@ static int interrupt_window_interception(struct vcpu_svm *svm) | |||
2281 | return 1; | 2287 | return 1; |
2282 | } | 2288 | } |
2283 | 2289 | ||
2290 | static int pause_interception(struct vcpu_svm *svm) | ||
2291 | { | ||
2292 | kvm_vcpu_on_spin(&(svm->vcpu)); | ||
2293 | return 1; | ||
2294 | } | ||
2295 | |||
2284 | static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = { | 2296 | static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = { |
2285 | [SVM_EXIT_READ_CR0] = emulate_on_interception, | 2297 | [SVM_EXIT_READ_CR0] = emulate_on_interception, |
2286 | [SVM_EXIT_READ_CR3] = emulate_on_interception, | 2298 | [SVM_EXIT_READ_CR3] = emulate_on_interception, |
@@ -2316,6 +2328,7 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = { | |||
2316 | [SVM_EXIT_CPUID] = cpuid_interception, | 2328 | [SVM_EXIT_CPUID] = cpuid_interception, |
2317 | [SVM_EXIT_IRET] = iret_interception, | 2329 | [SVM_EXIT_IRET] = iret_interception, |
2318 | [SVM_EXIT_INVD] = emulate_on_interception, | 2330 | [SVM_EXIT_INVD] = emulate_on_interception, |
2331 | [SVM_EXIT_PAUSE] = pause_interception, | ||
2319 | [SVM_EXIT_HLT] = halt_interception, | 2332 | [SVM_EXIT_HLT] = halt_interception, |
2320 | [SVM_EXIT_INVLPG] = invlpg_interception, | 2333 | [SVM_EXIT_INVLPG] = invlpg_interception, |
2321 | [SVM_EXIT_INVLPGA] = invlpga_interception, | 2334 | [SVM_EXIT_INVLPGA] = invlpga_interception, |