aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2010-01-20 12:20:20 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2010-03-01 10:36:02 -0500
commitfd7373cce767a8803e79f51bd3fc5f531234657f (patch)
tree81ed1de614c16ab301a368948597659a3163b9c9 /arch
parent138ac8d88f91e2a6a278aa5cee9120c714c4ce2d (diff)
KVM: VMX: Clean up DR6 emulation
As we trap all debug register accesses, we do not need to switch real DR6 at all. Clean up update_exception_bitmap at this chance, too. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/vmx.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index c7b99e1f8aae..b7e812e9c299 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -579,17 +579,12 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
579{ 579{
580 u32 eb; 580 u32 eb;
581 581
582 eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) 582 eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) |
583 | (1u << NM_VECTOR); 583 (1u << NM_VECTOR) | (1u << DB_VECTOR);
584 /* 584 if ((vcpu->guest_debug &
585 * Unconditionally intercept #DB so we can maintain dr6 without 585 (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) ==
586 * reading it every exit. 586 (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP))
587 */ 587 eb |= 1u << BP_VECTOR;
588 eb |= 1u << DB_VECTOR;
589 if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
590 if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP)
591 eb |= 1u << BP_VECTOR;
592 }
593 if (to_vmx(vcpu)->rmode.vm86_active) 588 if (to_vmx(vcpu)->rmode.vm86_active)
594 eb = ~0; 589 eb = ~0;
595 if (enable_ept) 590 if (enable_ept)
@@ -3777,9 +3772,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
3777 */ 3772 */
3778 vmcs_writel(HOST_CR0, read_cr0()); 3773 vmcs_writel(HOST_CR0, read_cr0());
3779 3774
3780 if (vcpu->arch.switch_db_regs)
3781 set_debugreg(vcpu->arch.dr6, 6);
3782
3783 asm( 3775 asm(
3784 /* Store host registers */ 3776 /* Store host registers */
3785 "push %%"R"dx; push %%"R"bp;" 3777 "push %%"R"dx; push %%"R"bp;"
@@ -3880,9 +3872,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
3880 | (1 << VCPU_EXREG_PDPTR)); 3872 | (1 << VCPU_EXREG_PDPTR));
3881 vcpu->arch.regs_dirty = 0; 3873 vcpu->arch.regs_dirty = 0;
3882 3874
3883 if (vcpu->arch.switch_db_regs)
3884 get_debugreg(vcpu->arch.dr6, 6);
3885
3886 vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); 3875 vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
3887 if (vmx->rmode.irq.pending) 3876 if (vmx->rmode.irq.pending)
3888 fixup_rmode_irq(vmx); 3877 fixup_rmode_irq(vmx);