diff options
-rw-r--r-- | arch/x86/kvm/x86.c | 20 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 1 |
2 files changed, 16 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index dbcff38dfcc3..491eda308289 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -155,11 +155,16 @@ void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long addr, | |||
155 | u32 error_code) | 155 | u32 error_code) |
156 | { | 156 | { |
157 | ++vcpu->stat.pf_guest; | 157 | ++vcpu->stat.pf_guest; |
158 | if (vcpu->arch.exception.pending && vcpu->arch.exception.nr == PF_VECTOR) { | 158 | if (vcpu->arch.exception.pending) { |
159 | printk(KERN_DEBUG "kvm: inject_page_fault:" | 159 | if (vcpu->arch.exception.nr == PF_VECTOR) { |
160 | " double fault 0x%lx\n", addr); | 160 | printk(KERN_DEBUG "kvm: inject_page_fault:" |
161 | vcpu->arch.exception.nr = DF_VECTOR; | 161 | " double fault 0x%lx\n", addr); |
162 | vcpu->arch.exception.error_code = 0; | 162 | vcpu->arch.exception.nr = DF_VECTOR; |
163 | vcpu->arch.exception.error_code = 0; | ||
164 | } else if (vcpu->arch.exception.nr == DF_VECTOR) { | ||
165 | /* triple fault -> shutdown */ | ||
166 | set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); | ||
167 | } | ||
163 | return; | 168 | return; |
164 | } | 169 | } |
165 | vcpu->arch.cr2 = addr; | 170 | vcpu->arch.cr2 = addr; |
@@ -2676,6 +2681,11 @@ again: | |||
2676 | r = 0; | 2681 | r = 0; |
2677 | goto out; | 2682 | goto out; |
2678 | } | 2683 | } |
2684 | if (test_and_clear_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests)) { | ||
2685 | kvm_run->exit_reason = KVM_EXIT_SHUTDOWN; | ||
2686 | r = 0; | ||
2687 | goto out; | ||
2688 | } | ||
2679 | } | 2689 | } |
2680 | 2690 | ||
2681 | kvm_inject_pending_timer_irqs(vcpu); | 2691 | kvm_inject_pending_timer_irqs(vcpu); |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 9750bb3c5a75..958e00371516 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -38,6 +38,7 @@ | |||
38 | #define KVM_REQ_MIGRATE_TIMER 1 | 38 | #define KVM_REQ_MIGRATE_TIMER 1 |
39 | #define KVM_REQ_REPORT_TPR_ACCESS 2 | 39 | #define KVM_REQ_REPORT_TPR_ACCESS 2 |
40 | #define KVM_REQ_MMU_RELOAD 3 | 40 | #define KVM_REQ_MMU_RELOAD 3 |
41 | #define KVM_REQ_TRIPLE_FAULT 4 | ||
41 | 42 | ||
42 | struct kvm_vcpu; | 43 | struct kvm_vcpu; |
43 | extern struct kmem_cache *kvm_vcpu_cache; | 44 | extern struct kmem_cache *kvm_vcpu_cache; |