* [PATCH] KVM: x86: fix DR6 delivery for emulated hardware breakpoint
@ 2020-05-05 11:34 Paolo Bonzini
2020-05-05 14:15 ` Peter Xu
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2020-05-05 11:34 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: jmattson, peterx
Go through kvm_queue_exception_p so that the payload is correctly delivered
through the exit qualification, and add a kvm_update_dr6 call to
kvm_deliver_exception_payload that is needed on AMD.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch/x86/kvm/x86.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index c5835f9cb9ad..8f61cb15f147 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -473,6 +473,7 @@ void kvm_deliver_exception_payload(struct kvm_vcpu *vcpu)
* breakpoint), it is reserved and must be zero in DR6.
*/
vcpu->arch.dr6 &= ~BIT(12);
+ kvm_update_dr6(vcpu);
break;
case PF_VECTOR:
vcpu->arch.cr2 = payload;
@@ -6731,9 +6732,7 @@ static bool kvm_vcpu_check_breakpoint(struct kvm_vcpu *vcpu, int *r)
vcpu->arch.db);
if (dr6 != 0) {
- vcpu->arch.dr6 &= ~DR_TRAP_BITS;
- vcpu->arch.dr6 |= dr6 | DR6_RTM;
- kvm_queue_exception(vcpu, DB_VECTOR);
+ kvm_queue_exception_p(vcpu, DB_VECTOR, dr6);
*r = 1;
return true;
}
--
2.18.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: x86: fix DR6 delivery for emulated hardware breakpoint
2020-05-05 11:34 [PATCH] KVM: x86: fix DR6 delivery for emulated hardware breakpoint Paolo Bonzini
@ 2020-05-05 14:15 ` Peter Xu
0 siblings, 0 replies; 2+ messages in thread
From: Peter Xu @ 2020-05-05 14:15 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: linux-kernel, kvm, jmattson
On Tue, May 05, 2020 at 07:34:49AM -0400, Paolo Bonzini wrote:
> Go through kvm_queue_exception_p so that the payload is correctly delivered
> through the exit qualification, and add a kvm_update_dr6 call to
> kvm_deliver_exception_payload that is needed on AMD.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
I still think we could also change this in handle_exception_nmi() and
handle_dr() as mentioned in the other thread, but no strong opinion:
Reviewed-by: Peter Xu <peterx@redhat.com>
Thanks,
--
Peter Xu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-05 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-05 11:34 [PATCH] KVM: x86: fix DR6 delivery for emulated hardware breakpoint Paolo Bonzini
2020-05-05 14:15 ` Peter Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox