diff options
Diffstat (limited to 'arch/x86/kvm/svm.c')
-rw-r--r-- | arch/x86/kvm/svm.c | 13 |
1 files changed, 13 insertions, 0 deletions
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, |