aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-10-17 01:48:06 -0400
committerAvi Kivity <avi@redhat.com>2012-10-18 10:30:32 -0400
commitbf4ca23ef597a440ca46c695d8711ec0b387f12c (patch)
tree769e53e811f231d0bd4129a4b88377f4626922de /arch/x86/kvm
parentb9bf6882c1f9451ce1e80aaed32107673a735613 (diff)
KVM: VMX: report internal error for MMIO #PF due to delivery event
The #PF with PFEC.RSV = 1 indicates that the guest is accessing MMIO, we can not fix it if it is caused by delivery event. Reporting internal error for this case Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/vmx.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index b8a0841dfe7d..6599e45f73f6 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -4287,16 +4287,6 @@ static int handle_exception(struct kvm_vcpu *vcpu)
4287 if (is_machine_check(intr_info)) 4287 if (is_machine_check(intr_info))
4288 return handle_machine_check(vcpu); 4288 return handle_machine_check(vcpu);
4289 4289
4290 if ((vect_info & VECTORING_INFO_VALID_MASK) &&
4291 !is_page_fault(intr_info)) {
4292 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
4293 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;
4294 vcpu->run->internal.ndata = 2;
4295 vcpu->run->internal.data[0] = vect_info;
4296 vcpu->run->internal.data[1] = intr_info;
4297 return 0;
4298 }
4299
4300 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR) 4290 if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR)
4301 return 1; /* already handled by vmx_vcpu_run() */ 4291 return 1; /* already handled by vmx_vcpu_run() */
4302 4292
@@ -4315,6 +4305,22 @@ static int handle_exception(struct kvm_vcpu *vcpu)
4315 error_code = 0; 4305 error_code = 0;
4316 if (intr_info & INTR_INFO_DELIVER_CODE_MASK) 4306 if (intr_info & INTR_INFO_DELIVER_CODE_MASK)
4317 error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE); 4307 error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);
4308
4309 /*
4310 * The #PF with PFEC.RSVD = 1 indicates the guest is accessing
4311 * MMIO, it is better to report an internal error.
4312 * See the comments in vmx_handle_exit.
4313 */
4314 if ((vect_info & VECTORING_INFO_VALID_MASK) &&
4315 !(is_page_fault(intr_info) && !(error_code & PFERR_RSVD_MASK))) {
4316 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
4317 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_SIMUL_EX;
4318 vcpu->run->internal.ndata = 2;
4319 vcpu->run->internal.data[0] = vect_info;
4320 vcpu->run->internal.data[1] = intr_info;
4321 return 0;
4322 }
4323
4318 if (is_page_fault(intr_info)) { 4324 if (is_page_fault(intr_info)) {
4319 /* EPT won't cause page fault directly */ 4325 /* EPT won't cause page fault directly */
4320 BUG_ON(enable_ept); 4326 BUG_ON(enable_ept);